-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): adding cluster ops runtime classes view (#68)
## Description Adding Runtime Classes view ## Related Issue - #50 --------- Co-authored-by: Jeff McCoy <code@jeffm.us>
- Loading branch information
1 parent
1d0b68a
commit 084fc83
Showing
8 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ vite.config.ts.timestamp-* | |
/ui/test-results | ||
|
||
# Dev | ||
/zarf-sbom | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
ui/src/lib/features/k8s/cluster-ops/runtime-classes/component.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- SPDX-License-Identifier: Apache-2.0 --> | ||
<!-- SPDX-FileCopyrightText: 2024-Present The UDS Authors --> | ||
|
||
<script lang="ts"> | ||
import { DataTable } from '$components' | ||
import { createStore, type Columns } from './store' | ||
export let columns: Columns = [['name', 'emphasize'], ['handler'], ['age']] | ||
</script> | ||
|
||
<DataTable {columns} {createStore} /> |
21 changes: 21 additions & 0 deletions
21
ui/src/lib/features/k8s/cluster-ops/runtime-classes/component.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2024-Present The UDS Authors | ||
|
||
import '@testing-library/jest-dom' | ||
|
||
import { testK8sTableWithCustomColumns, testK8sTableWithDefaults } from '$features/k8s/test-helper' | ||
import Component from './component.svelte' | ||
import { createStore } from './store' | ||
|
||
suite('RuntimeClassesTable Component', () => { | ||
beforeEach(() => { | ||
vi.clearAllMocks() | ||
}) | ||
|
||
testK8sTableWithDefaults(Component, { | ||
createStore, | ||
columns: [['name', 'emphasize'], ['handler'], ['age']], | ||
}) | ||
|
||
testK8sTableWithCustomColumns(Component, { createStore }) | ||
}) |
29 changes: 29 additions & 0 deletions
29
ui/src/lib/features/k8s/cluster-ops/runtime-classes/store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2024-Present The UDS Authors | ||
|
||
import type { V1RuntimeClass as Resource } from '@kubernetes/client-node' | ||
|
||
import { ResourceStore, transformResource } from '$features/k8s/store' | ||
import { type ColumnWrapper, type CommonRow, type ResourceStoreInterface } from '$features/k8s/types' | ||
|
||
interface Row extends CommonRow { | ||
handler: string | ||
} | ||
|
||
export type Columns = ColumnWrapper<Row> | ||
|
||
export function createStore(): ResourceStoreInterface<Resource, Row> { | ||
const url = `/api/v1/resources/cluster-ops/runtime-classes` | ||
|
||
const transform = transformResource<Resource, Row>((r) => ({ | ||
handler: r.handler ?? '', | ||
})) | ||
|
||
const store = new ResourceStore<Resource, Row>('name') | ||
|
||
return { | ||
...store, | ||
start: () => store.start(url, transform), | ||
sortByKey: store.sortByKey.bind(store), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2024-Present The UDS Authors | ||
|
||
// Core Resources | ||
export { default as EventTable } from './events/component.svelte' | ||
export { default as NamespaceTable } from './namespaces/component.svelte' | ||
export { default as NodeTable } from './nodes/component.svelte' | ||
|
||
// Workload resources | ||
export { default as CronJobTable } from './workloads/cronjobs/component.svelte' | ||
export { default as DaemonSetsTable } from './workloads/daemonsets/component.svelte' | ||
export { default as DeploymentTable } from './workloads/deployments/component.svelte' | ||
export { default as JobTable } from './workloads/jobs/component.svelte' | ||
export { default as PodTable } from './workloads/pods/component.svelte' | ||
export { default as StatefulsetTable } from './workloads/statefulsets/component.svelte' | ||
|
||
// Config resources | ||
export { default as UDSExemptionTable } from './configs/uds-exemptions/component.svelte' | ||
export { default as UDSPackageTable } from './configs/uds-packages/component.svelte' | ||
|
||
// Cluster ops resources | ||
export { default as PriorityClassesTable } from './cluster-ops/priority-classes/component.svelte' | ||
export { default as RuntimeClassesTable } from './cluster-ops/runtime-classes/component.svelte' | ||
|
||
// Network resources | ||
export { default as ServiceTable } from './networks/services/component.svelte' |
6 changes: 5 additions & 1 deletion
6
ui/src/routes/(resources)/cluster-ops/runtime-classes/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<!-- SPDX-License-Identifier: Apache-2.0 --> | ||
<!-- SPDX-FileCopyrightText: 2024-Present The UDS Authors --> | ||
|
||
<h1 class="text-white text-5xl">Runtime Classes</h1> | ||
<script> | ||
import { RuntimeClassesTable } from '$features/k8s' | ||
</script> | ||
|
||
<RuntimeClassesTable /> |