new changes
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
siteGitClone,
|
||||
siteGitPull,
|
||||
} from '../api/client'
|
||||
import { Plus, Trash2, Download, Archive, RotateCcw, Pencil, Play, Square, Redirect, GitBranch } from 'lucide-react'
|
||||
import { Plus, Trash2, Download, Archive, RotateCcw, Pencil, Play, Square, ArrowRightLeft, GitBranch } from 'lucide-react'
|
||||
|
||||
interface Site {
|
||||
id: number
|
||||
@@ -209,6 +209,33 @@ export function SitePage() {
|
||||
.catch((err) => setError(err.message))
|
||||
}
|
||||
|
||||
const handleGitClone = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault()
|
||||
if (!gitSiteId || !gitUrl.trim()) return
|
||||
setGitLoading(true)
|
||||
siteGitClone(gitSiteId, gitUrl.trim(), gitBranch.trim() || 'main')
|
||||
.then(() => {
|
||||
setGitSiteId(null)
|
||||
setGitAction(null)
|
||||
loadSites()
|
||||
})
|
||||
.catch((err) => setError(err.message))
|
||||
.finally(() => setGitLoading(false))
|
||||
}
|
||||
|
||||
const handleGitPull = () => {
|
||||
if (!gitSiteId) return
|
||||
setGitLoading(true)
|
||||
siteGitPull(gitSiteId)
|
||||
.then(() => {
|
||||
setGitSiteId(null)
|
||||
setGitAction(null)
|
||||
loadSites()
|
||||
})
|
||||
.catch((err) => setError(err.message))
|
||||
.finally(() => setGitLoading(false))
|
||||
}
|
||||
|
||||
const formatSize = (bytes: number) => {
|
||||
if (bytes < 1024) return bytes + ' B'
|
||||
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB'
|
||||
@@ -386,7 +413,7 @@ export function SitePage() {
|
||||
className="p-2 text-purple-600 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded"
|
||||
title="Redirects"
|
||||
>
|
||||
<Redirect className="w-4 h-4" />
|
||||
<ArrowRightLeft className="w-4 h-4" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => openEditModal(s.id)}
|
||||
|
||||
Reference in New Issue
Block a user