From e8aee8ed86c0eaf3f8a3a79a6d02bc531ce22589 Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Fri, 13 Dec 2024 19:13:00 +0300 Subject: [PATCH] feat: implement the machine categories UI It is now possible to filter the machine by the following categories in the UI: - Manually joined machines. - Machines provisioned by the infra providers. - Machines PXE booted through the metal provider. - Machines discovered by the metal provider, but not yet accepted by the system. Machine acceptance UI also has two new modal windows for accepting and rejecting the machines. Also update controllers to add labels to the not accepted infra machines. Fixes: https://github.com/siderolabs/omni/issues/773 Fixes: https://github.com/siderolabs/omni/issues/766 Signed-off-by: Artem Chernyshev --- client/pkg/omni/resources/omni/labels.go | 6 ++ frontend/src/api/resources.ts | 3 + .../src/components/SideBar/TSideBarList.vue | 5 +- frontend/src/components/common/Icon/TIcon.vue | 3 + .../components/common/MenuItem/TMenuItem.vue | 49 +++++++--- .../components/icons/IconServerNetwork.vue | 34 +++++++ frontend/src/methods/machine.ts | 50 +++++++++- frontend/src/router/index.ts | 42 ++++++++- .../ClusterMachines/ClusterMachine.vue | 12 ++- .../src/views/omni/ItemLabels/ItemLabels.vue | 1 + .../src/views/omni/Machines/MachineTabs.vue | 51 ++++++++++ frontend/src/views/omni/Machines/Machines.vue | 35 ++++++- .../views/omni/Machines/MachinesPending.vue | 92 +++++++++++++++++++ .../src/views/omni/Modals/MachineAccept.vue | 68 ++++++++++++++ .../src/views/omni/Modals/MachineReject.vue | 69 ++++++++++++++ .../omni/cluster_machine_status.go | 13 ++- .../omni/controllers/omni/infra_machine.go | 22 ++++- internal/version/data/tag | 2 +- 18 files changed, 522 insertions(+), 35 deletions(-) create mode 100644 frontend/src/components/icons/IconServerNetwork.vue create mode 100644 frontend/src/views/omni/Machines/MachineTabs.vue create mode 100644 frontend/src/views/omni/Machines/MachinesPending.vue create mode 100644 frontend/src/views/omni/Modals/MachineAccept.vue create mode 100644 frontend/src/views/omni/Modals/MachineReject.vue diff --git a/client/pkg/omni/resources/omni/labels.go b/client/pkg/omni/resources/omni/labels.go index e7393076..39de47d3 100644 --- a/client/pkg/omni/resources/omni/labels.go +++ b/client/pkg/omni/resources/omni/labels.go @@ -55,6 +55,7 @@ const ( LabelExposedServiceAlias = SystemLabelPrefix + "exposed-service-alias" // LabelInfraProviderID is the infra provider ID for the resources managed by infra providers, e.g., infra.MachineRequest, infra.MachineRequestStatus. + // tsgen:LabelInfraProviderID LabelInfraProviderID = SystemLabelPrefix + "infra-provider-id" // LabelIsStaticInfraProvider is set on the infra.ProviderStatus resources to mark them as static providers - they do not work with MachineRequests to @@ -82,7 +83,12 @@ const ( LabelNoManualAllocation = SystemLabelPrefix + "no-manual-allocation" // LabelIsManagedByStaticInfraProvider is set on the machines managed by static infra providers. + // tsgen:LabelIsManagedByStaticInfraProvider LabelIsManagedByStaticInfraProvider = SystemLabelPrefix + "is-managed-by-static-infra-provider" + + // LabelMachinePendingAccept is added to the InfraMachine and is used to filter out the machines which are pending acceptance. + // tsgen:LabelMachinePendingAccept + LabelMachinePendingAccept = SystemLabelPrefix + "accept-pending" ) const ( diff --git a/frontend/src/api/resources.ts b/frontend/src/api/resources.ts index 8df3a8d3..994a4bf2 100644 --- a/frontend/src/api/resources.ts +++ b/frontend/src/api/resources.ts @@ -125,9 +125,12 @@ export const LabelClusterMachine = "omni.sidero.dev/cluster-machine"; export const LabelMachine = "omni.sidero.dev/machine"; export const LabelSystemPatch = "omni.sidero.dev/system-patch"; export const LabelExposedServiceAlias = "omni.sidero.dev/exposed-service-alias"; +export const LabelInfraProviderID = "omni.sidero.dev/infra-provider-id"; export const LabelMachineRequest = "omni.sidero.dev/machine-request"; export const LabelMachineRequestSet = "omni.sidero.dev/machine-request-set"; export const LabelNoManualAllocation = "omni.sidero.dev/no-manual-allocation"; +export const LabelIsManagedByStaticInfraProvider = "omni.sidero.dev/is-managed-by-static-infra-provider"; +export const LabelMachinePendingAccept = "omni.sidero.dev/accept-pending"; export const MachineStatusLabelConnected = "omni.sidero.dev/connected"; export const MachineStatusLabelDisconnected = "omni.sidero.dev/disconnected"; export const MachineStatusLabelInvalidState = "omni.sidero.dev/invalid-state"; diff --git a/frontend/src/components/SideBar/TSideBarList.vue b/frontend/src/components/SideBar/TSideBarList.vue index 95fc1091..56cb142a 100644 --- a/frontend/src/components/SideBar/TSideBarList.vue +++ b/frontend/src/components/SideBar/TSideBarList.vue @@ -15,7 +15,8 @@ included in the LICENSE file. :icon="item.icon" :label="item.label" :label-color="item.labelColor" - /> + > + @@ -30,7 +31,7 @@ export type SideBarItem = { route: string | RouteLocationRaw, icon?: IconType, label?: string | number, - labelColor?: string + labelColor?: string, } type Props = { diff --git a/frontend/src/components/common/Icon/TIcon.vue b/frontend/src/components/common/Icon/TIcon.vue index 6bcdaec5..5d921b9d 100644 --- a/frontend/src/components/common/Icon/TIcon.vue +++ b/frontend/src/components/common/Icon/TIcon.vue @@ -31,6 +31,7 @@ import { ServerIcon, ServerStackIcon, CalendarIcon, + CpuChipIcon, } from "@heroicons/vue/24/outline"; import { @@ -114,6 +115,7 @@ const icons = { "rollback": defineAsyncComponent(() => import("../../icons/IconRollback.vue")), "extensions": defineAsyncComponent(() => import("../../icons/IconExtensions.vue")), "extensions-toggle": defineAsyncComponent(() => import("../../icons/IconExtensionsToggle.vue")), + "server-network": defineAsyncComponent(() => import("../../icons/IconServerNetwork.vue")), "document": DocumentIcon, "power": PowerIcon, "users": UsersIcon, @@ -135,6 +137,7 @@ const icons = { "server-stack": ServerStackIcon, "lifebuoy": LifebuoyIcon, "calendar": CalendarIcon, + "cpu-chip": CpuChipIcon, }; const getComponent = (icon: string): Component | undefined => { diff --git a/frontend/src/components/common/MenuItem/TMenuItem.vue b/frontend/src/components/common/MenuItem/TMenuItem.vue index 57d602fa..704749fc 100644 --- a/frontend/src/components/common/MenuItem/TMenuItem.vue +++ b/frontend/src/components/common/MenuItem/TMenuItem.vue @@ -6,11 +6,22 @@ included in the LICENSE file. --> diff --git a/frontend/src/views/omni/Machines/Machines.vue b/frontend/src/views/omni/Machines/Machines.vue index 990e20f1..21c746fd 100644 --- a/frontend/src/views/omni/Machines/Machines.vue +++ b/frontend/src/views/omni/Machines/Machines.vue @@ -15,7 +15,7 @@ included in the LICENSE file. > + + + +