From de8276dedaf6f1701c8a0907d9445948509664d6 Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Tue, 2 Jul 2024 23:17:03 +0100 Subject: [PATCH] Add support for displaying StepActions --- base/200-clusterrole-tenant.yaml | 3 +- .../read-write/clusterrole-tenant-patch.yaml | 3 +- packages/e2e/cypress/fixtures/kinds.json | 1 + packages/utils/src/utils/router.js | 11 +++++ packages/utils/src/utils/router.test.js | 26 ++++++++++++ src/containers/SideNav/SideNav.jsx | 5 +++ src/routes/pipelines.jsx | 41 ++++++++++++++++++- 7 files changed, 87 insertions(+), 3 deletions(-) diff --git a/base/200-clusterrole-tenant.yaml b/base/200-clusterrole-tenant.yaml index 66d338130..98d2609b9 100644 --- a/base/200-clusterrole-tenant.yaml +++ b/base/200-clusterrole-tenant.yaml @@ -1,4 +1,4 @@ -# Copyright 2019-2023 The Tekton Authors +# Copyright 2019-2024 The Tekton Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ rules: - apiGroups: - tekton.dev resources: + - stepactions - tasks - taskruns - pipelines diff --git a/overlays/patches/read-write/clusterrole-tenant-patch.yaml b/overlays/patches/read-write/clusterrole-tenant-patch.yaml index 9cc35435c..5707dbef3 100644 --- a/overlays/patches/read-write/clusterrole-tenant-patch.yaml +++ b/overlays/patches/read-write/clusterrole-tenant-patch.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 The Tekton Authors +# Copyright 2020-2024 The Tekton Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ apiGroups: - tekton.dev resources: + - stepactions - tasks - taskruns - pipelines diff --git a/packages/e2e/cypress/fixtures/kinds.json b/packages/e2e/cypress/fixtures/kinds.json index d4207a1aa..bac2e1f4a 100644 --- a/packages/e2e/cypress/fixtures/kinds.json +++ b/packages/e2e/cypress/fixtures/kinds.json @@ -1,6 +1,7 @@ [ { "label": "Pipelines", "path": "/pipelines" }, { "label": "PipelineRuns", "path": "/pipelineruns" }, + { "label": "StepActions", "path": "/stepactions" }, { "label": "Tasks", "path": "/tasks" }, { "label": "ClusterTasks", "path": "/clustertasks" }, { "label": "TaskRuns", "path": "/taskruns" }, diff --git a/packages/utils/src/utils/router.js b/packages/utils/src/utils/router.js index cc48febc8..6d1236d1c 100644 --- a/packages/utils/src/utils/router.js +++ b/packages/utils/src/utils/router.js @@ -129,6 +129,17 @@ export const paths = { settings() { return '/settings'; }, + stepActions: { + all() { + return '/stepactions'; + }, + byName() { + return byNamespace({ path: '/stepactions/:name' }); + }, + byNamespace() { + return byNamespace({ path: '/stepactions' }); + } + }, taskRuns: { all() { return '/taskruns'; diff --git a/packages/utils/src/utils/router.test.js b/packages/utils/src/utils/router.test.js index 8bced391f..0326cfdf4 100644 --- a/packages/utils/src/utils/router.test.js +++ b/packages/utils/src/utils/router.test.js @@ -21,6 +21,7 @@ const namespace = 'fake_namespace'; const pipelineName = 'fake_pipelineName'; const pipelineRunName = 'fake_pipelineRunName'; const runName = 'fake_runName'; +const stepActionName = 'fake_stepActionName'; const taskName = 'fake_taskName'; const taskRunName = 'fake_taskRunName'; const triggerName = 'fake_triggerName'; @@ -252,6 +253,31 @@ it('settings', () => { expect(urls.settings()).toEqual(generatePath(paths.settings())); }); +describe('stepActions', () => { + it('all', () => { + expect(urls.stepActions.all()).toEqual( + generatePath(paths.stepActions.all()) + ); + }); + + it('byName', () => { + expect( + urls.stepActions.byName({ name: stepActionName, namespace }) + ).toEqual( + generatePath(paths.stepActions.byName(), { + name: stepActionName, + namespace + }) + ); + }); + + it('byNamespace', () => { + expect(urls.stepActions.byNamespace({ namespace })).toEqual( + generatePath(paths.stepActions.byNamespace(), { namespace }) + ); + }); +}); + describe('taskRuns', () => { it('all', () => { expect(urls.taskRuns.all()).toEqual(generatePath(paths.taskRuns.all())); diff --git a/src/containers/SideNav/SideNav.jsx b/src/containers/SideNav/SideNav.jsx index 5fc2b8d41..1dcb189b8 100644 --- a/src/containers/SideNav/SideNav.jsx +++ b/src/containers/SideNav/SideNav.jsx @@ -106,6 +106,11 @@ function SideNav({ expanded, showKubernetesResources = false }) { > PipelineRuns + + StepActions + Tasks diff --git a/src/routes/pipelines.jsx b/src/routes/pipelines.jsx index 59e969e71..bd8e4e643 100644 --- a/src/routes/pipelines.jsx +++ b/src/routes/pipelines.jsx @@ -11,7 +11,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { paths } from '@tektoncd/dashboard-utils'; +import { paths, urls } from '@tektoncd/dashboard-utils'; import { ClusterTasks, @@ -25,6 +25,7 @@ import { PipelineRuns, Pipelines, ReadWriteRoute, + ResourceList, TaskRun, TaskRuns, Tasks @@ -141,6 +142,44 @@ export default [ ) }, + { + path: paths.stepActions.all(), + element: , + handle: { + group: tektonAPIGroup, + isNamespaced: true, + kind: 'stepactions', + path: paths.stepActions.all(), + resourceURL: urls.stepActions.byName, + title: 'StepActions', + version: 'v1beta1' + } + }, + { + path: paths.stepActions.byName(), + element: , + handle: { + group: tektonAPIGroup, + isNamespaced: true, + isResourceDetails: true, + kind: 'stepactions', + path: paths.stepActions.byName(), + version: 'v1beta1' + } + }, + { + path: paths.stepActions.byNamespace(), + element: , + handle: { + group: tektonAPIGroup, + isNamespaced: true, + kind: 'stepactions', + path: paths.stepActions.byNamespace(), + resourceURL: urls.stepActions.byName, + title: 'StepActions', + version: 'v1beta1' + } + }, { path: paths.tasks.all(), element: ,