new changes
This commit is contained in:
@@ -55,7 +55,10 @@ export async function getSite(siteId: number) {
|
||||
)
|
||||
}
|
||||
|
||||
export async function updateSite(siteId: number, data: { path?: string; domains?: string[]; ps?: string }) {
|
||||
export async function updateSite(
|
||||
siteId: number,
|
||||
data: { path?: string; domains?: string[]; ps?: string; php_version?: string; force_https?: boolean }
|
||||
) {
|
||||
return apiRequest<{ status: boolean; msg: string }>(`/site/${siteId}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
|
||||
@@ -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