diff --git a/client/src/assets/base.css b/client/src/assets/base.css index e093ac4..8e24aa2 100644 --- a/client/src/assets/base.css +++ b/client/src/assets/base.css @@ -49,6 +49,9 @@ --ct-red-950-rgb: 69, 10, 10; --color-primary: #005bac; + --color-primary-rgb: 0, 91, 172; + --color-primary-hover: #004a9a; + --color-primary-hover-rgb: 0, 74, 154; --color-primary-background: var(--ct-slate-200); } diff --git a/client/src/components/BenchmarkStatusChip.vue b/client/src/components/BenchmarkStatusChip.vue index 397d089..09f803d 100644 --- a/client/src/components/BenchmarkStatusChip.vue +++ b/client/src/components/BenchmarkStatusChip.vue @@ -21,7 +21,6 @@ const labels: Record = { line-height: 2; border-radius: 2px; width: 72px; - color: white; font-weight: 600; font-size: 0.7rem; text-align: center; diff --git a/client/src/components/CopyToClipboardButton.vue b/client/src/components/CopyToClipboardButton.vue new file mode 100644 index 0000000..95f6959 --- /dev/null +++ b/client/src/components/CopyToClipboardButton.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/client/src/components/InstanceCardList.vue b/client/src/components/InstanceCardList.vue new file mode 100644 index 0000000..86d933c --- /dev/null +++ b/client/src/components/InstanceCardList.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/client/src/components/InstanceStatusChip.vue b/client/src/components/InstanceStatusChip.vue new file mode 100644 index 0000000..caf5e15 --- /dev/null +++ b/client/src/components/InstanceStatusChip.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/client/src/lib/useServerData.ts b/client/src/lib/useServerData.ts index fcdd934..9ffdadb 100644 --- a/client/src/lib/useServerData.ts +++ b/client/src/lib/useServerData.ts @@ -1,5 +1,5 @@ import { api } from '@/api' -import { useQuery } from '@tanstack/vue-query' +import { useQuery, useMutation, QueryClient } from '@tanstack/vue-query' export const useUsers = () => useQuery({ @@ -43,3 +43,53 @@ export const useTeam = (teamId: string) => queryKey: ['team', teamId], queryFn: () => api.GET('/teams/{teamId}', { params: { path: { teamId } } }).then((r) => r.data), }) + +export const useCreateTeamInstance = (client: QueryClient) => + useMutation({ + mutationFn: (params: { teamId: string }) => + api.POST('/teams/{teamId}/instances', { + params: { path: params }, + }), + onSuccess: (_, params) => { + client.invalidateQueries({ queryKey: ['team-instances', params.teamId] }) + client.invalidateQueries({ queryKey: ['instances'] }) + }, + }) + +export const useStartTeamInstance = (client: QueryClient) => + useMutation({ + mutationFn: (params: { teamId: string; instanceId: string }) => + api.PATCH('/teams/{teamId}/instances/{instanceId}', { + params: { path: params }, + body: { operation: 'start' }, + }), + onSuccess: (_, params) => { + client.invalidateQueries({ queryKey: ['team-instances', params.teamId] }) + client.invalidateQueries({ queryKey: ['instances'] }) + }, + }) + +export const useStopTeamInstance = (client: QueryClient) => + useMutation({ + mutationFn: (params: { teamId: string; instanceId: string }) => + api.PATCH('/teams/{teamId}/instances/{instanceId}', { + params: { path: params }, + body: { operation: 'stop' }, + }), + onSuccess: (_, params) => { + client.invalidateQueries({ queryKey: ['team-instances', params.teamId] }) + client.invalidateQueries({ queryKey: ['instances'] }) + }, + }) + +export const useDeleteTeamInstance = (client: QueryClient) => + useMutation({ + mutationFn: (params: { teamId: string; instanceId: string }) => + api.DELETE('/teams/{teamId}/instances/{instanceId}', { + params: { path: params }, + }), + onSuccess: (_, params) => { + client.invalidateQueries({ queryKey: ['team-instances', params.teamId] }) + client.invalidateQueries({ queryKey: ['instances'] }) + }, + }) diff --git a/client/src/views/InstancesView.vue b/client/src/views/InstancesView.vue index 1685c66..d7aa571 100644 --- a/client/src/views/InstancesView.vue +++ b/client/src/views/InstancesView.vue @@ -1,7 +1,28 @@ - + + +