mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 02:14:32 +00:00
fix(ui): add install button to copilot page sidebar
- show Install copilot-api button when not installed - display version in status when installed
This commit is contained in:
1 parent
f813ad06f6
commit
3865747154
1 file changed
+31
-1
@@ -19,6 +19,8 @@ import {
|
|||||||
Key,
|
Key,
|
||||||
Server,
|
Server,
|
||||||
Cpu,
|
Cpu,
|
||||||
|
Download,
|
||||||
|
Loader2,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useCopilot } from '@/hooks/use-copilot';
|
import { useCopilot } from '@/hooks/use-copilot';
|
||||||
import { CopilotConfigForm } from '@/components/copilot/copilot-config-form';
|
import { CopilotConfigForm } from '@/components/copilot/copilot-config-form';
|
||||||
@@ -108,6 +110,8 @@ export function CopilotPage() {
|
|||||||
isStartingDaemon,
|
isStartingDaemon,
|
||||||
stopDaemon,
|
stopDaemon,
|
||||||
isStoppingDaemon,
|
isStoppingDaemon,
|
||||||
|
install,
|
||||||
|
isInstalling,
|
||||||
} = useCopilot();
|
} = useCopilot();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -160,8 +164,34 @@ export function CopilotPage() {
|
|||||||
icon={Server}
|
icon={Server}
|
||||||
label="copilot-api"
|
label="copilot-api"
|
||||||
status={status?.installed ?? false}
|
status={status?.installed ?? false}
|
||||||
statusText={status?.installed ? 'Installed' : 'Missing'}
|
statusText={
|
||||||
|
status?.installed
|
||||||
|
? status.version
|
||||||
|
? `v${status.version}`
|
||||||
|
: 'Installed'
|
||||||
|
: 'Missing'
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
{!status?.installed && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
className="w-full mt-2"
|
||||||
|
onClick={() => install(undefined)}
|
||||||
|
disabled={isInstalling}
|
||||||
|
>
|
||||||
|
{isInstalling ? (
|
||||||
|
<>
|
||||||
|
<Loader2 className="w-3.5 h-3.5 mr-1.5 animate-spin" />
|
||||||
|
Installing...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Download className="w-3.5 h-3.5 mr-1.5" />
|
||||||
|
Install copilot-api
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</StatusSection>
|
</StatusSection>
|
||||||
|
|
||||||
{/* Authentication */}
|
{/* Authentication */}
|
||||||
|
|||||||
Reference in new issue
Block a user