Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for displaying StepActions #3490

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/200-clusterrole-tenant.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -44,6 +44,7 @@ rules:
- apiGroups:
- tekton.dev
resources:
- stepactions
- tasks
- taskruns
- pipelines
Expand Down
3 changes: 2 additions & 1 deletion overlays/patches/read-write/clusterrole-tenant-patch.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -19,6 +19,7 @@
apiGroups:
- tekton.dev
resources:
- stepactions
- tasks
- taskruns
- pipelines
Expand Down
1 change: 1 addition & 0 deletions packages/e2e/cypress/fixtures/kinds.json
Original file line number Diff line number Diff line change
@@ -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" },
Expand Down
11 changes: 11 additions & 0 deletions packages/utils/src/utils/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
26 changes: 26 additions & 0 deletions packages/utils/src/utils/router.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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()));
Expand Down
5 changes: 5 additions & 0 deletions src/containers/SideNav/SideNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ function SideNav({ expanded, showKubernetesResources = false }) {
>
PipelineRuns
</SideNavMenuItem>
<SideNavMenuItem
{...getMenuItemProps(getPath(urls.stepActions.all()))}
>
StepActions
</SideNavMenuItem>
<SideNavMenuItem {...getMenuItemProps(getPath(urls.tasks.all()))}>
Tasks
</SideNavMenuItem>
Expand Down
41 changes: 40 additions & 1 deletion src/routes/pipelines.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,6 +25,7 @@ import {
PipelineRuns,
Pipelines,
ReadWriteRoute,
ResourceList,
TaskRun,
TaskRuns,
Tasks
Expand Down Expand Up @@ -141,6 +142,44 @@ export default [
</ReadWriteRoute>
)
},
{
path: paths.stepActions.all(),
element: <ResourceList />,
handle: {
group: tektonAPIGroup,
isNamespaced: true,
kind: 'stepactions',
path: paths.stepActions.all(),
resourceURL: urls.stepActions.byName,
title: 'StepActions',
version: 'v1beta1'
}
},
{
path: paths.stepActions.byName(),
element: <CustomResourceDefinition />,
handle: {
group: tektonAPIGroup,
isNamespaced: true,
isResourceDetails: true,
kind: 'stepactions',
path: paths.stepActions.byName(),
version: 'v1beta1'
}
},
{
path: paths.stepActions.byNamespace(),
element: <ResourceList />,
handle: {
group: tektonAPIGroup,
isNamespaced: true,
kind: 'stepactions',
path: paths.stepActions.byNamespace(),
resourceURL: urls.stepActions.byName,
title: 'StepActions',
version: 'v1beta1'
}
},
{
path: paths.tasks.all(),
element: <Tasks />,
Expand Down
Loading