From 09ef68e25cd8923f667e7aff72f3096b9f7ef9b4 Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Tue, 10 Jan 2023 17:03:24 +0000 Subject: [PATCH] Remove PipelineResources Remove support for PipelineResources from the Dashboard. They have been deprecated since Tekton Pipelines v0.30.0 in November 2021. This also involves updating the Import Resources functionality to use a Task instead of PipelineResources (git). The Task uses the git-init image also used by the git-clone Task in the catalog. --- .storybook/main.js | 7 +- base/200-clusterrole-tenant.yaml | 3 +- .../__mocks__/resourceMock.js | 9 +- docs/dev/localization/Japanese/term.tsv | 4 - jest.config.js | 3 +- .../read-write/clusterrole-tenant-patch.yaml | 3 +- package-lock.json | 57 +++- package.json | 3 +- .../PipelineResources/PipelineResources.js | 118 ------- .../PipelineResources.test.js | 77 ----- .../PipelineRun/PipelineRun.stories.js | 9 +- .../PipelineRun/PipelineRun.test.js | 10 +- .../PipelineRuns/PipelineRuns.stories.js | 32 +- .../components/ResourceTable/ResourceTable.js | 76 ----- .../ResourceTable/ResourceTable.scss | 22 -- .../ResourceTable/ResourceTable.stories.js | 39 --- .../ResourceTable/ResourceTable.test.js | 36 -- .../src/components/ResourceTable/index.js | 15 - .../StepDefinition/StepDefinition.test.js | 4 +- .../TaskRunDetails/TaskRunDetails.js | 111 +------ .../TaskRunDetails/TaskRunDetails.stories.js | 17 +- .../TaskRunDetails/TaskRunDetails.test.js | 55 +--- packages/components/src/components/index.js | 4 +- packages/e2e/cypress/fixtures/kinds.json | 1 - .../src/components/examples/pipelineRun.json | 20 -- packages/utils/src/utils/index.js | 31 +- packages/utils/src/utils/index.test.js | 26 +- packages/utils/src/utils/router.js | 16 +- packages/utils/src/utils/router.test.js | 34 +- src/api/index.js | 159 ++------- src/api/index.test.js | 283 ++-------------- src/api/pipelineResources.js | 92 ------ src/api/pipelineResources.test.js | 110 ------- src/api/pipelineRuns.js | 11 - src/api/pipelineRuns.test.js | 14 +- .../import-resources-pipelinerun.yaml | 143 ++++++++ src/api/taskRuns.js | 21 -- src/api/taskRuns.test.js | 27 +- src/containers/App/App.js | 34 +- .../CreatePipelineResource.js | 308 ------------------ .../CreatePipelineResource.test.js | 283 ---------------- ...ePipelineResourceErrorNotification.test.js | 53 --- .../GitResourceFields.js | 48 --- .../CreatePipelineResource/UniversalFields.js | 115 ------- .../CreatePipelineResource/index.js | 15 - .../CreatePipelineRun/CreatePipelineRun.js | 74 +---- .../CreatePipelineRun.test.js | 22 +- src/containers/CreateTaskRun/CreateTaskRun.js | 123 +------ .../CreateTaskRun/CreateTaskRun.test.js | 30 +- .../PipelineResource/PipelineResource.js | 204 ------------ src/containers/PipelineResource/index.js | 15 - .../PipelineResources/PipelineResources.js | 185 ----------- src/containers/PipelineResources/index.js | 15 - .../PipelineResourcesDropdown.js | 96 ------ .../PipelineResourcesDropdown.test.js | 285 ---------------- .../PipelineResourcesDropdown/index.js | 15 - .../PipelineRuns/PipelineRuns.test.js | 3 +- src/containers/SideNav/SideNav.js | 7 +- .../TriggerTemplate/TriggerTemplate.test.js | 69 +--- src/containers/index.js | 6 +- src/nls/messages_de.json | 26 -- src/nls/messages_en.json | 26 -- src/nls/messages_es.json | 26 -- src/nls/messages_fr.json | 26 -- src/nls/messages_it.json | 26 -- src/nls/messages_ja.json | 26 -- src/nls/messages_ko.json | 26 -- src/nls/messages_pt.json | 26 -- src/nls/messages_zh-Hans.json | 26 -- src/nls/messages_zh-Hant.json | 26 -- src/scss/App.scss | 3 +- test/e2e-common.sh | 4 +- webpack.common.js | 7 +- 73 files changed, 329 insertions(+), 3652 deletions(-) rename packages/components/src/components/PipelineResources/index.js => config_frontend/__mocks__/resourceMock.js (83%) delete mode 100644 packages/components/src/components/PipelineResources/PipelineResources.js delete mode 100644 packages/components/src/components/PipelineResources/PipelineResources.test.js delete mode 100644 packages/components/src/components/ResourceTable/ResourceTable.js delete mode 100644 packages/components/src/components/ResourceTable/ResourceTable.scss delete mode 100644 packages/components/src/components/ResourceTable/ResourceTable.stories.js delete mode 100644 packages/components/src/components/ResourceTable/ResourceTable.test.js delete mode 100644 packages/components/src/components/ResourceTable/index.js delete mode 100644 src/api/pipelineResources.js delete mode 100644 src/api/pipelineResources.test.js create mode 100644 src/api/resources/import-resources-pipelinerun.yaml delete mode 100644 src/containers/CreatePipelineResource/CreatePipelineResource.js delete mode 100644 src/containers/CreatePipelineResource/CreatePipelineResource.test.js delete mode 100644 src/containers/CreatePipelineResource/CreatePipelineResourceErrorNotification.test.js delete mode 100644 src/containers/CreatePipelineResource/GitResourceFields.js delete mode 100644 src/containers/CreatePipelineResource/UniversalFields.js delete mode 100644 src/containers/CreatePipelineResource/index.js delete mode 100644 src/containers/PipelineResource/PipelineResource.js delete mode 100644 src/containers/PipelineResource/index.js delete mode 100644 src/containers/PipelineResources/PipelineResources.js delete mode 100644 src/containers/PipelineResources/index.js delete mode 100644 src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.js delete mode 100644 src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.test.js delete mode 100644 src/containers/PipelineResourcesDropdown/index.js diff --git a/.storybook/main.js b/.storybook/main.js index efae9d69b..3eb28c2e7 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,5 +1,5 @@ /* -Copyright 2020-2022 The Tekton Authors +Copyright 2020-2023 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. You may obtain a copy of the License at @@ -56,6 +56,11 @@ module.exports = { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'], include: path.resolve(__dirname, '../'), + }, { + test: /\.yaml$/, + type: 'json', + loader: 'yaml-loader', + options: { asJSON: true } }); return config; diff --git a/base/200-clusterrole-tenant.yaml b/base/200-clusterrole-tenant.yaml index 27f91a3a4..fb209bf74 100644 --- a/base/200-clusterrole-tenant.yaml +++ b/base/200-clusterrole-tenant.yaml @@ -1,4 +1,4 @@ -# Copyright 2019-2022 The Tekton Authors +# Copyright 2019-2023 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. @@ -48,7 +48,6 @@ rules: - taskruns - pipelines - pipelineruns - - pipelineresources - runs verbs: - get diff --git a/packages/components/src/components/PipelineResources/index.js b/config_frontend/__mocks__/resourceMock.js similarity index 83% rename from packages/components/src/components/PipelineResources/index.js rename to config_frontend/__mocks__/resourceMock.js index 7823de9b8..c06b1f9eb 100644 --- a/packages/components/src/components/PipelineResources/index.js +++ b/config_frontend/__mocks__/resourceMock.js @@ -1,5 +1,5 @@ /* -Copyright 2019 The Tekton Authors +Copyright 2023 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. You may obtain a copy of the License at @@ -10,5 +10,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -/* istanbul ignore file */ -export default from './PipelineResources'; + +module.exports = { + metadata: {}, + spec: {} +}; diff --git a/docs/dev/localization/Japanese/term.tsv b/docs/dev/localization/Japanese/term.tsv index 726105c06..e61b746cd 100644 --- a/docs/dev/localization/Japanese/term.tsv +++ b/docs/dev/localization/Japanese/term.tsv @@ -97,8 +97,6 @@ completed 完了 fail 失敗 location 場所 available 利用可能 -output Resources 出力リソース -input Resources 入力リソース input 入力 Pending 保留 accepted 使用可能 @@ -153,8 +151,6 @@ Taskruns Taskrun ClusterTask ClusterTask ClusterTasks ClusterTask ClusterTriggerBinding ClusterTriggerBinding -PipelineResource PipelineResource -PipelineResources PipelineResource Secret Secret Secrets Secret URL URL diff --git a/jest.config.js b/jest.config.js index 17294222f..3da0fe9fe 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -35,6 +35,7 @@ module.exports = { '/config_frontend/__mocks__/svgMock.js', '\\.(png|svg|woff|woff2)$': '/config_frontend/__mocks__/fileMock.js', + '\\.yaml$': '/config_frontend/__mocks__/resourceMock.js', '\\.(css|scss)$': '/config_frontend/__mocks__/styleMock.js' }, restoreMocks: true, diff --git a/overlays/patches/read-write/clusterrole-tenant-patch.yaml b/overlays/patches/read-write/clusterrole-tenant-patch.yaml index fce0d96ef..69e9aee87 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-2022 The Tekton Authors +# Copyright 2020-2023 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. @@ -23,7 +23,6 @@ - taskruns - pipelines - pipelineruns - - pipelineresources - runs verbs: - create diff --git a/package-lock.json b/package-lock.json index f4f0e4e2e..b3d66ca34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,7 +96,8 @@ "webpack": "^5.75.0", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", - "webpack-merge": "^5.8.0" + "webpack-merge": "^5.8.0", + "yaml-loader": "^0.8.0" }, "engines": { "node": "^16.18.1", @@ -22646,6 +22647,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/javascript-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.1.0.tgz", + "integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==", + "dev": true + }, "node_modules/jest": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/jest/-/jest-29.3.1.tgz", @@ -34821,6 +34828,29 @@ "node": ">= 6" } }, + "node_modules/yaml-loader": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/yaml-loader/-/yaml-loader-0.8.0.tgz", + "integrity": "sha512-LjeKnTzVBKWiQBeE2L9ssl6WprqaUIxCSNs5tle8PaDydgu3wVFXTbMfsvF2MSErpy9TDVa092n4q6adYwJaWg==", + "dev": true, + "dependencies": { + "javascript-stringify": "^2.0.1", + "loader-utils": "^2.0.0", + "yaml": "^2.0.0" + }, + "engines": { + "node": ">= 12.13" + } + }, + "node_modules/yaml-loader/node_modules/yaml": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", + "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -52064,6 +52094,12 @@ "iterate-iterator": "^1.0.1" } }, + "javascript-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.1.0.tgz", + "integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==", + "dev": true + }, "jest": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/jest/-/jest-29.3.1.tgz", @@ -61552,6 +61588,25 @@ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true }, + "yaml-loader": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/yaml-loader/-/yaml-loader-0.8.0.tgz", + "integrity": "sha512-LjeKnTzVBKWiQBeE2L9ssl6WprqaUIxCSNs5tle8PaDydgu3wVFXTbMfsvF2MSErpy9TDVa092n4q6adYwJaWg==", + "dev": true, + "requires": { + "javascript-stringify": "^2.0.1", + "loader-utils": "^2.0.0", + "yaml": "^2.0.0" + }, + "dependencies": { + "yaml": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", + "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", + "dev": true + } + } + }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", diff --git a/package.json b/package.json index 7f9c348e0..0fc26a802 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,8 @@ "webpack": "^5.75.0", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", - "webpack-merge": "^5.8.0" + "webpack-merge": "^5.8.0", + "yaml-loader": "^0.8.0" }, "engines": { "node": "^16.18.1", diff --git a/packages/components/src/components/PipelineResources/PipelineResources.js b/packages/components/src/components/PipelineResources/PipelineResources.js deleted file mode 100644 index 0d77f2904..000000000 --- a/packages/components/src/components/PipelineResources/PipelineResources.js +++ /dev/null @@ -1,118 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { useIntl } from 'react-intl'; -import { Link } from 'react-router-dom'; -import { urls } from '@tektoncd/dashboard-utils'; -import { Link as CustomLink } from '@tektoncd/dashboard-components'; - -import { FormattedDate, Table } from '..'; - -const PipelineResources = ({ - batchActionButtons, - createPipelineResourcesURL = urls.pipelineResources.byName, - createPipelineResourceDisplayName = ({ pipelineResourceMetadata }) => - pipelineResourceMetadata.name, - loading, - pipelineResources, - selectedNamespace, - toolbarButtons -}) => { - const intl = useIntl(); - const headers = [ - { - key: 'name', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.name', - defaultMessage: 'Name' - }) - }, - { - key: 'namespace', - header: 'Namespace' - }, - { - key: 'type', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.type', - defaultMessage: 'Type' - }) - }, - { - key: 'createdTime', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.createdTime', - defaultMessage: 'Created' - }) - } - ]; - - const pipelineResourcesFormatted = pipelineResources.map(pipelineResource => { - const { namespace } = pipelineResource.metadata; - const pipelineResourceName = createPipelineResourceDisplayName({ - pipelineResourceMetadata: pipelineResource.metadata - }); - const url = createPipelineResourcesURL({ - namespace, - pipelineResourceName - }); - - return { - id: pipelineResource.metadata.uid, - name: url ? ( - - {pipelineResourceName} - - ) : ( - pipelineResourceName - ), - namespace, - type: pipelineResource.spec.type, - createdTime: ( - - ) - }; - }); - - return ( - - ); -}; - -export default PipelineResources; diff --git a/packages/components/src/components/PipelineResources/PipelineResources.test.js b/packages/components/src/components/PipelineResources/PipelineResources.test.js deleted file mode 100644 index f31960105..000000000 --- a/packages/components/src/components/PipelineResources/PipelineResources.test.js +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { fireEvent, waitFor } from '@testing-library/react'; -import { TrashCan32 as Delete } from '@carbon/icons-react'; -import { render, renderWithRouter } from '../../utils/test'; -import PipelineResources from './PipelineResources'; - -it('PipelineResources renders empty state', () => { - const { queryByText } = render(); - expect(queryByText(/no matching pipelineresources/i)).toBeTruthy(); - expect(queryByText('Namespace')).toBeTruthy(); -}); - -it('PipelineResources renders headers state', () => { - const { queryByText } = render(); - expect(queryByText(/pipelineresources/i)).toBeTruthy(); - expect(queryByText('Namespace')).toBeTruthy(); - expect(queryByText(/type/i)).toBeTruthy(); - expect(document.getElementsByClassName('bx--overflow-menu')).toBeTruthy(); -}); - -it('PipelineResources renders correct data', async () => { - const pipelineResourceName = 'pipeline-resource-20190816124708'; - const batchDeleteSpy = jest.fn(); - const { queryByText, getByLabelText, getByText } = renderWithRouter( - - ); - expect(queryByText(pipelineResourceName)).toBeTruthy(); - expect(queryByText(/default-namespace/i)).toBeTruthy(); - expect(queryByText(/git/i)).toBeTruthy(); - fireEvent.click(await waitFor(() => getByLabelText(/select row/i))); - await waitFor(() => getByText(/Delete/i)); - expect(getByText(/1 item selected/i)).toBeTruthy(); -}); diff --git a/packages/components/src/components/PipelineRun/PipelineRun.stories.js b/packages/components/src/components/PipelineRun/PipelineRun.stories.js index fafb73eb3..1c68e3430 100644 --- a/packages/components/src/components/PipelineRun/PipelineRun.stories.js +++ b/packages/components/src/components/PipelineRun/PipelineRun.stories.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -29,8 +29,7 @@ const task = { args: ['-c', 'echo storybook;'], command: ['/bin/bash'], image: 'ubuntu', - name: 'build', - resources: {} + name: 'build' } ] } @@ -41,10 +40,6 @@ function getTaskRun({ exitCode = 0, name }) { metadata: { labels: {}, name, namespace: 'default', uid: name }, spec: { params: {}, - resources: { - inputs: {}, - outputs: {} - }, serviceAccountName: 'default', taskRef: { kind: 'Task', name: 'task1' }, timeout: '24h0m0s' diff --git a/packages/components/src/components/PipelineRun/PipelineRun.test.js b/packages/components/src/components/PipelineRun/PipelineRun.test.js index bfad110ed..f0c313584 100644 --- a/packages/components/src/components/PipelineRun/PipelineRun.test.js +++ b/packages/components/src/components/PipelineRun/PipelineRun.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -39,10 +39,6 @@ it('PipelineRunContainer handles init step failures', async () => { }, spec: { params: {}, - resources: { - inputs: {}, - outputs: {} - }, taskSpec: {} }, status: { @@ -88,10 +84,6 @@ it('PipelineRunContainer handles init step failures for retry', async () => { }, spec: { params: {}, - resources: { - inputs: {}, - outputs: {} - }, taskSpec: {} }, status: { diff --git a/packages/components/src/components/PipelineRuns/PipelineRuns.stories.js b/packages/components/src/components/PipelineRuns/PipelineRuns.stories.js index 9c90ce05c..0415a17be 100644 --- a/packages/components/src/components/PipelineRuns/PipelineRuns.stories.js +++ b/packages/components/src/components/PipelineRuns/PipelineRuns.stories.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -133,15 +133,7 @@ export const Base = () => ( pipelineRef: { name: 'output-pipeline' }, - serviceAccountName: 'default', - resources: [ - { - name: 'source-repo', - resourceRef: { - name: 'skaffold-git' - } - } - ] + serviceAccountName: 'default' } } ]} @@ -209,15 +201,7 @@ export const NoPipelineLink = () => ( uid: '905c1ab0-203d-49ce-ad8d-4553e5d06bf0' }, spec: { - serviceAccountName: 'default', - resources: [ - { - name: 'source-repo', - resourceRef: { - name: 'skaffold-git' - } - } - ] + serviceAccountName: 'default' } } ]} @@ -267,15 +251,7 @@ export const BatchActions = () => ( uid: '77e0f4a3-40e5-46f1-84cc-ab7aa93c382c' }, spec: { - serviceAccountName: 'default', - resources: [ - { - name: 'source-repo', - resourceRef: { - name: 'skaffold-git' - } - } - ] + serviceAccountName: 'default' } } ]} diff --git a/packages/components/src/components/ResourceTable/ResourceTable.js b/packages/components/src/components/ResourceTable/ResourceTable.js deleted file mode 100644 index 672837fe8..000000000 --- a/packages/components/src/components/ResourceTable/ResourceTable.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { DataTable } from 'carbon-components-react'; - -const { - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableHeader, - TableRow -} = DataTable; - -const ResourceTable = props => { - const { title, rows: rowParams, headers: headerParams } = props; - return ( - ( - -
- - - {headers.map(header => ( - - {header.header} - - ))} - - - - {rows.map(row => ( - - {row.cells.map(cell => ( - {cell.value} - ))} - - ))} - -
- - )} - /> - ); -}; - -ResourceTable.defaultProps = { - rows: [], - headers: [] -}; - -export default ResourceTable; diff --git a/packages/components/src/components/ResourceTable/ResourceTable.scss b/packages/components/src/components/ResourceTable/ResourceTable.scss deleted file mode 100644 index e148042ba..000000000 --- a/packages/components/src/components/ResourceTable/ResourceTable.scss +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -.tkn--resource-table { - &.tkn--table { - margin-top: 0; - } - - .bx--data-table-header { - padding-top: 0; - } -} diff --git a/packages/components/src/components/ResourceTable/ResourceTable.stories.js b/packages/components/src/components/ResourceTable/ResourceTable.stories.js deleted file mode 100644 index 1cf87d410..000000000 --- a/packages/components/src/components/ResourceTable/ResourceTable.stories.js +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2019-2020 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; - -import ResourceTable from '.'; - -const title = 'title'; -const id = 'id'; -const headerValue = 'header'; -const rowValue = 'row'; -const rows = [ - { - id, - name: rowValue - } -]; -const headers = [{ key: 'name', header: headerValue }]; - -export default { - component: ResourceTable, - title: 'Components/ResourceTable' -}; - -export const Base = () => ; - -export const WithContent = () => ( - -); diff --git a/packages/components/src/components/ResourceTable/ResourceTable.test.js b/packages/components/src/components/ResourceTable/ResourceTable.test.js deleted file mode 100644 index 8ab2c5b5e..000000000 --- a/packages/components/src/components/ResourceTable/ResourceTable.test.js +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2019 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { render } from '@testing-library/react'; -import ResourceTable from './ResourceTable'; - -it('ResourceTable renders with one row', () => { - const title = 'testTitle'; - const id = 'id'; - const headerValue = 'header'; - const rowValue = 'row'; - const rows = [ - { - id, - name: rowValue - } - ]; - const headers = [{ key: 'name', header: headerValue }]; - - const { queryByText } = render( - - ); - expect(queryByText(headerValue)).toBeTruthy(); - expect(queryByText(rowValue)).toBeTruthy(); -}); diff --git a/packages/components/src/components/ResourceTable/index.js b/packages/components/src/components/ResourceTable/index.js deleted file mode 100644 index 415743888..000000000 --- a/packages/components/src/components/ResourceTable/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/* istanbul ignore file */ - -export { default } from './ResourceTable'; diff --git a/packages/components/src/components/StepDefinition/StepDefinition.test.js b/packages/components/src/components/StepDefinition/StepDefinition.test.js index 3fd9afb64..7e2030e4b 100644 --- a/packages/components/src/components/StepDefinition/StepDefinition.test.js +++ b/packages/components/src/components/StepDefinition/StepDefinition.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2021 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -32,6 +32,4 @@ it('StepDefinition renders the provided content', () => { expect(queryByText(/--someArg/)).toBeTruthy(); expect(queryByText('test-name')).toBeTruthy(); - expect(queryByText('Input resources')).toBeNull(); - expect(queryByText('Output resources')).toBeNull(); }); diff --git a/packages/components/src/components/TaskRunDetails/TaskRunDetails.js b/packages/components/src/components/TaskRunDetails/TaskRunDetails.js index e6e6088aa..522f8f64b 100644 --- a/packages/components/src/components/TaskRunDetails/TaskRunDetails.js +++ b/packages/components/src/components/TaskRunDetails/TaskRunDetails.js @@ -1,5 +1,5 @@ /* -Copyright 2020-2022 The Tekton Authors +Copyright 2020-2023 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. You may obtain a copy of the License at @@ -12,27 +12,12 @@ limitations under the License. */ import React, { useEffect, useState } from 'react'; -import { Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import { useIntl } from 'react-intl'; -import { - getParams, - getResources, - taskRunHasWarning, - urls -} from '@tektoncd/dashboard-utils'; +import { getParams, taskRunHasWarning } from '@tektoncd/dashboard-utils'; import { ContentSwitcher, Switch } from 'carbon-components-react'; -import { - Link as CustomLink, - DetailsHeader, - Param, - ResourceTable, - Tab, - Table, - Tabs, - ViewYAML -} from '..'; +import { DetailsHeader, Param, Tab, Table, Tabs, ViewYAML } from '..'; function getDescriptions(array) { if (!array) { @@ -45,49 +30,7 @@ function getDescriptions(array) { }, {}); } -function resourceTable(title, namespace, resources, intl) { - return ( - ({ - id: name, - name, - value: - resourceRef && resourceRef.name ? ( - - {resourceRef.name} - - ) : ( - - ) - }))} - headers={[ - { - key: 'name', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.name', - defaultMessage: 'Name' - }) - }, - { - key: 'value', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.value', - defaultMessage: 'Value' - }) - } - ]} - /> - ); -} - -const TaskRunDetails = ({ onViewChange, pod, task, taskRun, view, showIO }) => { +const TaskRunDetails = ({ onViewChange, pod, task, taskRun, view }) => { const intl = useIntl(); const displayName = taskRun.metadata.name; const taskSpec = task?.spec || taskRun.spec.taskSpec; @@ -158,34 +101,6 @@ const TaskRunDetails = ({ onViewChange, pod, task, taskRun, view, showIO }) => { /> ) : null; - const { namespace } = taskRun.metadata; - const { inputResources, outputResources } = getResources(taskRun.spec); - - const resources = showIO && (inputResources || outputResources) && ( - <> - {inputResources && - resourceTable( - intl.formatMessage({ - id: 'dashboard.stepDefinition.inputResources', - defaultMessage: 'Input resources' - }), - namespace, - inputResources, - intl - )} - {outputResources && - resourceTable( - intl.formatMessage({ - id: 'dashboard.stepDefinition.outputResources', - defaultMessage: 'Output resources' - }), - namespace, - outputResources, - intl - )} - - ); - const results = taskRun.status?.taskResults; const resultsTable = results?.length ? ( { const tabs = [ paramsTable && 'params', resultsTable && 'results', - resources && 'resources', 'status', pod && 'pod' ].filter(Boolean); @@ -252,17 +166,6 @@ const TaskRunDetails = ({ onViewChange, pod, task, taskRun, view, showIO }) => {
{resultsTable}
)} - {resources && ( - -
{resources}
-
- )} { TaskRunDetails.propTypes = { onViewChange: PropTypes.func, task: PropTypes.shape({}), - taskRun: PropTypes.shape({}), - showIO: PropTypes.bool + taskRun: PropTypes.shape({}) }; TaskRunDetails.defaultProps = { onViewChange: /* istanbul ignore next */ () => {}, task: {}, - taskRun: {}, - showIO: false + taskRun: {} }; export default TaskRunDetails; diff --git a/packages/components/src/components/TaskRunDetails/TaskRunDetails.stories.js b/packages/components/src/components/TaskRunDetails/TaskRunDetails.stories.js index 05c792f57..8023bed31 100644 --- a/packages/components/src/components/TaskRunDetails/TaskRunDetails.stories.js +++ b/packages/components/src/components/TaskRunDetails/TaskRunDetails.stories.js @@ -1,5 +1,5 @@ /* -Copyright 2020-2022 The Tekton Authors +Copyright 2020-2023 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. You may obtain a copy of the License at @@ -24,15 +24,6 @@ const params = [ } ]; -const resources = { - inputs: [ - { name: 'input-resource', resourceRef: { name: 'input-resource-ref' } } - ], - outputs: [ - { name: 'output-resource', resourceRef: { name: 'output-resource-ref' } } - ] -}; - export default { component: TaskRunDetails, parameters: { @@ -48,8 +39,7 @@ export const Base = () => ( taskRun={{ metadata: { name: 'my-task', namespace: 'my-namespace' }, spec: { - params, - resources + params }, status: { completionTime: '2021-03-03T15:25:34Z', @@ -67,8 +57,7 @@ export const WithWarning = () => ( taskRun={{ metadata: { name: 'my-task', namespace: 'my-namespace' }, spec: { - params, - resources + params }, status: { completionTime: '2021-03-03T15:25:34Z', diff --git a/packages/components/src/components/TaskRunDetails/TaskRunDetails.test.js b/packages/components/src/components/TaskRunDetails/TaskRunDetails.test.js index a844bd09f..5e95658e8 100644 --- a/packages/components/src/components/TaskRunDetails/TaskRunDetails.test.js +++ b/packages/components/src/components/TaskRunDetails/TaskRunDetails.test.js @@ -1,5 +1,5 @@ /* -Copyright 2020-2022 The Tekton Authors +Copyright 2020-2023 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. You may obtain a copy of the License at @@ -14,7 +14,7 @@ limitations under the License. import React from 'react'; import { fireEvent } from '@testing-library/react'; -import { render, renderWithRouter } from '../../utils/test'; +import { render } from '../../utils/test'; import TaskRunDetails from './TaskRunDetails'; describe('TaskRunDetails', () => { @@ -88,7 +88,6 @@ describe('TaskRunDetails', () => { const { queryByText } = render(); expect(queryByText(/parameters/i)).toBeFalsy(); expect(queryByText(/results/i)).toBeFalsy(); - expect(queryByText(/resources/i)).toBeFalsy(); expect(queryByText(/pod/i)).toBeFalsy(); expect(queryByText(/status/i)).toBeTruthy(); }); @@ -239,54 +238,4 @@ describe('TaskRunDetails', () => { expect(queryByText('Resource')).toBeFalsy(); expect(queryByText(waitingMessage)).toBeTruthy(); }); - - it('renders both input and output resources', () => { - const inputResourceName = 'input-resource'; - const outputResourceName = 'output-resource'; - const inputs = [ - { name: inputResourceName, resourceRef: { name: 'input-resource-ref' } } - ]; - const outputs = [{ name: outputResourceName, resourceSpec: '' }]; - - const taskRun = { - metadata: { name: 'task-run-name', namespace: 'namespace-name' }, - spec: { - resources: { - inputs, - outputs - } - } - }; - - const { queryByText } = renderWithRouter( - - ); - - expect(queryByText(/input resources/i)).toBeTruthy(); - expect(queryByText(inputResourceName)).toBeTruthy(); - expect(queryByText(/output resources/i)).toBeTruthy(); - expect(queryByText(outputResourceName)).toBeTruthy(); - }); - - it('renders output resources', () => { - const outputResourceName = 'output-resource'; - const outputs = [{ name: outputResourceName, resourceSpec: '' }]; - - const taskRun = { - metadata: { name: 'task-run-name', namespace: 'namespace-name' }, - spec: { - resources: { - outputs - } - } - }; - - const { queryByText } = renderWithRouter( - - ); - - expect(queryByText(/input resources/i)).toBeFalsy(); - expect(queryByText(/output resources/i)).toBeTruthy(); - expect(queryByText(outputResourceName)).toBeTruthy(); - }); }); diff --git a/packages/components/src/components/index.js b/packages/components/src/components/index.js index 25380acf1..92daca555 100644 --- a/packages/components/src/components/index.js +++ b/packages/components/src/components/index.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -32,12 +32,10 @@ export { default as LogsToolbar } from './LogsToolbar'; export { default as Modal } from './Modal'; export { default as PageErrorBoundary } from './PageErrorBoundary'; export { default as Param } from './Param'; -export { default as PipelineResources } from './PipelineResources'; export { default as PipelineRun } from './PipelineRun'; export { default as PipelineRuns } from './PipelineRuns'; export { default as Portal } from './Portal'; export { default as ResourceDetails } from './ResourceDetails'; -export { default as ResourceTable } from './ResourceTable'; export { default as RunHeader } from './RunHeader'; export { default as Spinner } from './Spinner'; export { default as StatusFilterDropdown } from './StatusFilterDropdown'; diff --git a/packages/e2e/cypress/fixtures/kinds.json b/packages/e2e/cypress/fixtures/kinds.json index 26f490491..763576a68 100644 --- a/packages/e2e/cypress/fixtures/kinds.json +++ b/packages/e2e/cypress/fixtures/kinds.json @@ -1,7 +1,6 @@ [ { "label": "Pipelines", "path": "/pipelines" }, { "label": "PipelineRuns", "path": "/pipelineruns" }, - { "label": "PipelineResources", "path": "/pipelineresources" }, { "label": "Tasks", "path": "/tasks" }, { "label": "ClusterTasks", "path": "/clustertasks" }, { "label": "TaskRuns", "path": "/taskruns" }, diff --git a/packages/graph/src/components/examples/pipelineRun.json b/packages/graph/src/components/examples/pipelineRun.json index b5031bff8..1ee5cbdc3 100644 --- a/packages/graph/src/components/examples/pipelineRun.json +++ b/packages/graph/src/components/examples/pipelineRun.json @@ -21,26 +21,6 @@ "name": "demo-pipeline" }, "podTemplate": {}, - "resources": [ - { - "name": "source-repo", - "resourceRef": { - "name": "skaffold-git" - } - }, - { - "name": "web-image", - "resourceRef": { - "name": "skaffold-image-leeroy-web" - } - }, - { - "name": "app-image", - "resourceRef": { - "name": "skaffold-image-leeroy-app" - } - } - ], "serviceAccountName": "default", "timeout": "1h0m0s" }, diff --git a/packages/utils/src/utils/index.js b/packages/utils/src/utils/index.js index 267ef60e1..dc40740d4 100644 --- a/packages/utils/src/utils/index.js +++ b/packages/utils/src/utils/index.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -357,26 +357,17 @@ export function getGenerateNamePrefixForRerun(name) { } /* - getParams and getResources below required to support 3rd-party consumers - of certain dashboard components (e.g. PipelineRun) while they migrate to - the Tekton beta. + getParams required to support 3rd-party consumers of certain dashboard + components (e.g. PipelineRun) while they migrate to the Tekton beta Support both the Pipelines beta (0.11+) structure { - params: ..., - resources: { - inputs: ..., - outputs: ... - } + params: ... } and the older alpha (<0.11) structure { inputs: { params: ..., - resources: ... - }, - outputs: { - resources: ... } } */ @@ -384,20 +375,6 @@ export function getParams({ params, inputs }) { return params || (inputs && inputs.params); } -export function getResources({ resources, inputs, outputs }) { - if (resources) { - return { - inputResources: resources.inputs, - outputResources: resources.outputs - }; - } - - return { - inputResources: inputs && inputs.resources, - outputResources: outputs && outputs.resources - }; -} - /* istanbul ignore next */ export function getTranslateWithId(intl) { return function translateWithId(id) { diff --git a/packages/utils/src/utils/index.test.js b/packages/utils/src/utils/index.test.js index 207a71f1f..589f5e6ea 100644 --- a/packages/utils/src/utils/index.test.js +++ b/packages/utils/src/utils/index.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -25,7 +25,6 @@ import { getGenerateNamePrefixForRerun, getParams, getPlaceholderTaskRun, - getResources, getStatus, getStatusFilter, getStatusFilterHandler, @@ -288,29 +287,6 @@ describe('getParams', () => { }); }); -describe('getResources', () => { - it('supports v1alpha1 structure', () => { - const fakeInputResources = { fake: 'inputResources' }; - const fakeOutputResources = { fake: 'outputResources' }; - const { inputResources, outputResources } = getResources({ - inputs: { resources: fakeInputResources }, - outputs: { resources: fakeOutputResources } - }); - expect(inputResources).toEqual(fakeInputResources); - expect(outputResources).toEqual(fakeOutputResources); - }); - - it('supports v1beta1 structure', () => { - const fakeInputResources = { fake: 'inputResources' }; - const fakeOutputResources = { fake: 'outputResources' }; - const { inputResources, outputResources } = getResources({ - resources: { inputs: fakeInputResources, outputs: fakeOutputResources } - }); - expect(inputResources).toEqual(fakeInputResources); - expect(outputResources).toEqual(fakeOutputResources); - }); -}); - it('applyStepTemplate', () => { const stepTemplate = { args: ['some_args'], diff --git a/packages/utils/src/utils/router.js b/packages/utils/src/utils/router.js index 25e9b4461..5b1bc1093 100644 --- a/packages/utils/src/utils/router.js +++ b/packages/utils/src/utils/router.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -89,20 +89,6 @@ export const paths = { return '/:group/:version/:type/:name'; } }, - pipelineResources: { - all() { - return '/pipelineresources'; - }, - byName() { - return byNamespace({ path: '/pipelineresources/:pipelineResourceName' }); - }, - byNamespace() { - return byNamespace({ path: '/pipelineresources' }); - }, - create() { - return '/pipelineresources/create'; - } - }, pipelineRuns: { all() { return '/pipelineruns'; diff --git a/packages/utils/src/utils/router.test.js b/packages/utils/src/utils/router.test.js index 5d2a943e6..443899ea9 100644 --- a/packages/utils/src/utils/router.test.js +++ b/packages/utils/src/utils/router.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -18,7 +18,6 @@ const clusterTriggerBindingName = 'fake_clusterTriggerBindingName'; const eventListenerName = 'fake_eventListenerName'; const namespace = 'fake_namespace'; const pipelineName = 'fake_pipelineName'; -const pipelineResourceName = 'fake_pipelineResourceName'; const pipelineRunName = 'fake_pipelineRunName'; const runName = 'fake_runName'; const taskName = 'fake_taskName'; @@ -181,37 +180,6 @@ describe('kubernetesResources', () => { }); }); -describe('pipelineResources', () => { - it('all', () => { - expect(urls.pipelineResources.all()).toEqual( - generatePath(paths.pipelineResources.all()) - ); - }); - - it('byName', () => { - expect( - urls.pipelineResources.byName({ namespace, pipelineResourceName }) - ).toEqual( - generatePath(paths.pipelineResources.byName(), { - namespace, - pipelineResourceName - }) - ); - }); - - it('byNamespace', () => { - expect(urls.pipelineResources.byNamespace({ namespace })).toEqual( - generatePath(paths.pipelineResources.byNamespace(), { namespace }) - ); - }); - - it('create', () => { - expect(urls.pipelineResources.create()).toEqual( - generatePath(paths.pipelineResources.create()) - ); - }); -}); - describe('pipelineRuns', () => { it('all', () => { expect(urls.pipelineRuns.all()).toEqual( diff --git a/src/api/index.js b/src/api/index.js index 44660dfca..b9c22b028 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -13,6 +13,7 @@ limitations under the License. import { useQuery } from '@tanstack/react-query'; import { labels as labelConstants } from '@tektoncd/dashboard-utils'; +import deepClone from 'lodash.clonedeep'; import { useClusterTask } from './clusterTasks'; import { useTask } from './tasks'; @@ -23,11 +24,14 @@ import { getQueryParams, getResourcesAPI, getTektonAPI, + getTektonPipelinesAPIVersion, isLogTimestampsEnabled, useCollection, useResource } from './utils'; +import importResourcesPipelineRunTemplate from './resources/import-resources-pipelinerun.yaml'; + export { NamespaceContext, useSelectedNamespace } from './utils'; export * from './clusterInterceptors'; export * from './clusterTasks'; @@ -35,7 +39,6 @@ export * from './clusterTriggerBindings'; export * from './eventListeners'; export * from './extensions'; export * from './interceptors'; -export * from './pipelineResources'; export * from './pipelineRuns'; export * from './pipelines'; export * from './runs'; @@ -217,153 +220,31 @@ export function importResources({ revision, serviceAccount }) { - const taskSpec = { - resources: { - inputs: [ - { - name: 'git-source', - type: 'git' - } - ] - }, - params: [ - { - name: 'path', - description: 'The path from which resources are to be imported', - default: '.', - type: 'string' - }, - { - name: 'target-namespace', - description: - 'The namespace in which to create the resources being imported', - default: 'tekton-pipelines', - type: 'string' - } - ], - steps: [ - { - name: 'import', - image: 'lachlanevenson/k8s-kubectl:latest', - command: ['kubectl'], - args: [ - method, - '-f', - '$(resources.inputs.git-source.path)/$(params.path)', - '-n', - '$(params.target-namespace)' - ] - } - ] - }; - - const pipelineSpec = { - resources: [ - { - name: 'git-source', - type: 'git' - } - ], - params: [ - { - name: 'path', - description: 'The path from which resources are to be imported', - default: '.', - type: 'string' - }, - { - name: 'target-namespace', - description: - 'The namespace in which to create the resources being imported', - default: 'tekton-pipelines', - type: 'string' - } - ], - tasks: [ - { - name: 'import-resources', - taskSpec, - params: [ - { - name: 'path', - value: '$(params.path)' - }, - { - name: 'target-namespace', - value: '$(params.target-namespace)' - } - ], - resources: { - inputs: [ - { - name: 'git-source', - resource: 'git-source' - } - ] - } - } - ] - }; - - const resourceSpec = { - type: 'git', - params: [ - { - name: 'url', - value: repositoryURL - }, - revision - ? { - name: 'revision', - value: revision - } - : null - ].filter(Boolean) - }; - - const pipelineRunSpec = { - pipelineSpec, - resources: [ - { - name: 'git-source', - resourceSpec - } - ], - params: [ - { - name: 'path', - value: path - }, - { - name: 'target-namespace', - value: namespace - } - ] - }; + const pipelineRun = deepClone(importResourcesPipelineRunTemplate); - const payload = { - apiVersion: 'tekton.dev/v1beta1', - kind: 'PipelineRun', - metadata: { - name: `import-resources-${Date.now()}`, - labels: { - ...labels, - app: 'tekton-app', - [labelConstants.DASHBOARD_IMPORT]: 'true' - } - }, - spec: pipelineRunSpec + pipelineRun.apiVersion = `tekton.dev/${getTektonPipelinesAPIVersion()}`; + pipelineRun.metadata.name = `import-resources-${Date.now()}`; + pipelineRun.metadata.labels = { + ...labels, + [labelConstants.DASHBOARD_IMPORT]: 'true' }; + pipelineRun.spec.params = [ + { name: 'method', value: method }, + { name: 'path', value: path }, + { name: 'repositoryURL', value: repositoryURL }, + { name: 'revision', value: revision }, + { name: 'target-namespace', value: namespace } + ]; if (serviceAccount) { - payload.spec.serviceAccountName = serviceAccount; + pipelineRun.spec.serviceAccountName = serviceAccount; } const uri = getTektonAPI('pipelineruns', { namespace: importerNamespace, - version: 'v1beta1' + version: getTektonPipelinesAPIVersion() }); - return post(uri, payload).then(({ body }) => body); + return post(uri, pipelineRun).then(({ body }) => body); } export function getAPIResource({ group, version, type }) { diff --git a/src/api/index.test.js b/src/api/index.test.js index fe98ffe47..75490d1f2 100644 --- a/src/api/index.test.js +++ b/src/api/index.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -279,130 +279,6 @@ it('importResources', () => { repositoryURL, serviceAccount }; - const data = { - apiVersion: 'tekton.dev/v1beta1', - kind: 'PipelineRun', - metadata: { - name: `import-resources-${Date.now()}`, - labels: { - app: 'tekton-app', - [labels.DASHBOARD_IMPORT]: 'true' - } - }, - spec: { - params: [ - { - name: 'path', - value: 'fake-directory' - }, - { - name: 'target-namespace', - value: 'fake-namespace' - } - ], - pipelineSpec: { - params: [ - { - default: '.', - description: 'The path from which resources are to be imported', - name: 'path', - type: 'string' - }, - { - default: 'tekton-pipelines', - description: - 'The namespace in which to create the resources being imported', - name: 'target-namespace', - type: 'string' - } - ], - resources: [ - { - name: 'git-source', - type: 'git' - } - ], - tasks: [ - { - name: 'import-resources', - params: [ - { - name: 'path', - value: '$(params.path)' - }, - { - name: 'target-namespace', - value: '$(params.target-namespace)' - } - ], - resources: { - inputs: [ - { - name: 'git-source', - resource: 'git-source' - } - ] - }, - taskSpec: { - params: [ - { - default: '.', - description: - 'The path from which resources are to be imported', - name: 'path', - type: 'string' - }, - { - default: 'tekton-pipelines', - description: - 'The namespace in which to create the resources being imported', - name: 'target-namespace', - type: 'string' - } - ], - resources: { - inputs: [ - { - name: 'git-source', - type: 'git' - } - ] - }, - steps: [ - { - args: [ - method, - '-f', - '$(resources.inputs.git-source.path)/$(params.path)', - '-n', - '$(params.target-namespace)' - ], - command: ['kubectl'], - image: 'lachlanevenson/k8s-kubectl:latest', - name: 'import' - } - ] - } - } - ] - }, - resources: [ - { - name: 'git-source', - resourceSpec: { - params: [ - { - name: 'url', - value: 'https://github.com/test/testing' - } - ], - type: 'git' - } - } - ], - serviceAccountName: serviceAccount - } - }; server.use( rest.post(/\/pipelineruns\//, async (req, res, ctx) => @@ -410,7 +286,20 @@ it('importResources', () => { ) ); return API.importResources(payload).then(response => { - expect(response).toEqual(data); + expect(response.metadata.name).toEqual(`import-resources-fake-timestamp`); + expect(response.metadata.labels).toEqual({ + [labels.DASHBOARD_IMPORT]: 'true' + }); + expect(response.spec.params).toEqual( + expect.arrayContaining([ + { name: 'method', value: method }, + { name: 'path', value: path }, + { name: 'repositoryURL', value: repositoryURL }, + { name: 'revision' }, + { name: 'target-namespace', value: namespace } + ]) + ); + expect(response.spec.serviceAccountName).toEqual(serviceAccount); mockDateNow.mockRestore(); }); }); @@ -434,133 +323,6 @@ it('importResources with revision and no serviceAccount', () => { repositoryURL, revision }; - const data = { - apiVersion: 'tekton.dev/v1beta1', - kind: 'PipelineRun', - metadata: { - name: `import-resources-${Date.now()}`, - labels: { - app: 'tekton-app', - [labels.DASHBOARD_IMPORT]: 'true' - } - }, - spec: { - params: [ - { - name: 'path', - value: 'fake-directory' - }, - { - name: 'target-namespace', - value: 'fake-namespace' - } - ], - pipelineSpec: { - params: [ - { - default: '.', - description: 'The path from which resources are to be imported', - name: 'path', - type: 'string' - }, - { - default: 'tekton-pipelines', - description: - 'The namespace in which to create the resources being imported', - name: 'target-namespace', - type: 'string' - } - ], - resources: [ - { - name: 'git-source', - type: 'git' - } - ], - tasks: [ - { - name: 'import-resources', - params: [ - { - name: 'path', - value: '$(params.path)' - }, - { - name: 'target-namespace', - value: '$(params.target-namespace)' - } - ], - resources: { - inputs: [ - { - name: 'git-source', - resource: 'git-source' - } - ] - }, - taskSpec: { - params: [ - { - default: '.', - description: - 'The path from which resources are to be imported', - name: 'path', - type: 'string' - }, - { - default: 'tekton-pipelines', - description: - 'The namespace in which to create the resources being imported', - name: 'target-namespace', - type: 'string' - } - ], - resources: { - inputs: [ - { - name: 'git-source', - type: 'git' - } - ] - }, - steps: [ - { - args: [ - method, - '-f', - '$(resources.inputs.git-source.path)/$(params.path)', - '-n', - '$(params.target-namespace)' - ], - command: ['kubectl'], - image: 'lachlanevenson/k8s-kubectl:latest', - name: 'import' - } - ] - } - } - ] - }, - resources: [ - { - name: 'git-source', - resourceSpec: { - params: [ - { - name: 'url', - value: 'https://github.com/test/testing' - }, - { - name: 'revision', - value: revision - } - ], - type: 'git' - } - } - ] - } - }; server.use( rest.post(/\/pipelineruns\//, async (req, res, ctx) => @@ -568,7 +330,20 @@ it('importResources with revision and no serviceAccount', () => { ) ); return API.importResources(payload).then(response => { - expect(response).toEqual(data); + expect(response.metadata.name).toEqual(`import-resources-fake-timestamp`); + expect(response.metadata.labels).toEqual({ + [labels.DASHBOARD_IMPORT]: 'true' + }); + expect(response.spec.params).toEqual( + expect.arrayContaining([ + { name: 'method', value: method }, + { name: 'path', value: path }, + { name: 'repositoryURL', value: repositoryURL }, + { name: 'revision', value: revision }, + { name: 'target-namespace', value: namespace } + ]) + ); + expect(response.spec.serviceAccountName).toBeUndefined(); mockDateNow.mockRestore(); }); }); diff --git a/src/api/pipelineResources.js b/src/api/pipelineResources.js deleted file mode 100644 index 44edf92aa..000000000 --- a/src/api/pipelineResources.js +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import { deleteRequest, get, post } from './comms'; -import { - getQueryParams, - getTektonAPI, - useCollection, - useResource -} from './utils'; - -export function createPipelineResource({ namespace, resource } = {}) { - const uri = getTektonAPI('pipelineresources', { - namespace, - version: 'v1alpha1' - }); - return post(uri, resource); -} - -export function deletePipelineResource({ name, namespace } = {}) { - const uri = getTektonAPI('pipelineresources', { - name, - namespace, - version: 'v1alpha1' - }); - return deleteRequest(uri); -} - -function getPipelineResourcesAPI({ filters, isWebSocket, name, namespace }) { - return getTektonAPI( - 'pipelineresources', - { isWebSocket, namespace, version: 'v1alpha1' }, - getQueryParams({ filters, name }) - ); -} - -export function getPipelineResources({ filters = [], namespace } = {}) { - const uri = getPipelineResourcesAPI({ - filters, - namespace - }); - return get(uri); -} - -export function getPipelineResource({ name, namespace }) { - const uri = getTektonAPI( - 'pipelineresources', - { - name, - namespace, - version: 'v1alpha1' - }, - undefined - ); - return get(uri); -} - -export function usePipelineResources(params) { - const webSocketURL = getPipelineResourcesAPI({ - ...params, - isWebSocket: true - }); - return useCollection({ - api: getPipelineResources, - kind: 'PipelineResource', - params, - webSocketURL - }); -} - -export function usePipelineResource(params) { - const webSocketURL = getPipelineResourcesAPI({ - ...params, - isWebSocket: true - }); - return useResource({ - api: getPipelineResource, - kind: 'PipelineResource', - params, - webSocketURL - }); -} diff --git a/src/api/pipelineResources.test.js b/src/api/pipelineResources.test.js deleted file mode 100644 index 067b834ce..000000000 --- a/src/api/pipelineResources.test.js +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import * as API from './pipelineResources'; -import * as utils from './utils'; -import { rest, server } from '../../config_frontend/msw'; - -it('createPipelineResource', () => { - const namespace = 'namespace1'; - const payload = { - apiVersion: 'tekton.dev/v1alpha1', - kind: 'PipelineResource', - metadata: { - generateName: 'git-source', - namespace - }, - spec: { - type: 'git', - params: [ - { - name: 'url', - value: 'http://someUrl.com' - }, - { - name: 'revision', - value: 'master' - } - ] - } - }; - const data = { fake: 'data' }; - server.use( - rest.post(/\/pipelineresources\//, (req, res, ctx) => res(ctx.json(data))) - ); - return API.createPipelineResource({ namespace, payload }).then(response => { - expect(response).toEqual(data); - }); -}); - -it('deletePipelineResource', () => { - const name = 'foo'; - const data = { fake: 'pipelineResource' }; - server.use( - rest.delete(new RegExp(`/${name}$`), (req, res, ctx) => res(ctx.json(data))) - ); - return API.deletePipelineResource({ name }).then(pipelineResource => { - expect(pipelineResource).toEqual(data); - }); -}); - -it('getPipelineResources', () => { - const data = { - items: 'pipelineResources' - }; - server.use( - rest.get(/\/pipelineresources\//, (req, res, ctx) => res(ctx.json(data))) - ); - return API.getPipelineResources().then(pipelineResources => { - expect(pipelineResources).toEqual(data); - }); -}); - -it('getPipelineResource', () => { - const name = 'foo'; - const data = { fake: 'pipelineResource' }; - server.use( - rest.get(new RegExp(`/${name}$`), (req, res, ctx) => res(ctx.json(data))) - ); - return API.getPipelineResource({ name }).then(pipelineResource => { - expect(pipelineResource).toEqual(data); - }); -}); - -it('usePipelineResources', () => { - const query = { fake: 'query' }; - const params = { fake: 'params' }; - jest.spyOn(utils, 'useCollection').mockImplementation(() => query); - expect(API.usePipelineResources(params)).toEqual(query); - expect(utils.useCollection).toHaveBeenCalledWith( - expect.objectContaining({ - api: API.getPipelineResources, - kind: 'PipelineResource', - params - }) - ); -}); - -it('usePipelineResource', () => { - const query = { fake: 'query' }; - const params = { fake: 'params' }; - jest.spyOn(utils, 'useResource').mockImplementation(() => query); - expect(API.usePipelineResource(params)).toEqual(query); - expect(utils.useResource).toHaveBeenCalledWith( - expect.objectContaining({ - api: API.getPipelineResource, - kind: 'PipelineResource', - params - }) - ); -}); diff --git a/src/api/pipelineRuns.js b/src/api/pipelineRuns.js index a458c8d11..bf7d0db77 100644 --- a/src/api/pipelineRuns.js +++ b/src/api/pipelineRuns.js @@ -81,7 +81,6 @@ export function createPipelineRunRaw({ namespace, payload }) { export function getPipelineRunPayload({ params: inputParams, - resources: inputResources, labels, namespace, nodeSelector, @@ -122,14 +121,6 @@ export function getPipelineRunPayload({ payload.spec.params = params; } - const resources = Object.keys(inputResources).map(name => ({ - name, - resourceRef: { name: inputResources[name] } - })); - if (resources.length) { - payload.spec.resources = resources; - } - if (nodeSelector) { payload.spec.podTemplate = { nodeSelector @@ -157,7 +148,6 @@ export function createPipelineRun({ pipelineName, pipelinePendingStatus, pipelineRunName, - resources, serviceAccount, timeoutsFinally, timeoutsPipeline, @@ -171,7 +161,6 @@ export function createPipelineRun({ pipelineName, pipelinePendingStatus, pipelineRunName, - resources, serviceAccount, timeoutsFinally, timeoutsPipeline, diff --git a/src/api/pipelineRuns.test.js b/src/api/pipelineRuns.test.js index 280846eda..1be357ea6 100644 --- a/src/api/pipelineRuns.test.js +++ b/src/api/pipelineRuns.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -55,13 +55,11 @@ it('createPipelineRun', () => { .spyOn(Date, 'now') .mockImplementation(() => 'fake-timestamp'); const pipelineName = 'fake-pipelineName'; - const resources = { 'fake-resource-name': 'fake-resource-value' }; const params = { 'fake-param-name': 'fake-param-value' }; const serviceAccount = 'fake-serviceAccount'; const timeout = 'fake-timeout'; const payload = { pipelineName, - resources, params, serviceAccount, timeoutsPipeline: timeout @@ -76,10 +74,6 @@ it('createPipelineRun', () => { pipelineRef: { name: pipelineName }, - resources: Object.keys(resources).map(name => ({ - name, - resourceRef: { name: resources[name] } - })), params: Object.keys(params).map(name => ({ name, value: params[name] @@ -108,13 +102,11 @@ it('createPipelineRun with nodeSelector', () => { .spyOn(Date, 'now') .mockImplementation(() => 'fake-timestamp'); const pipelineName = 'fake-pipelineName'; - const resources = { 'fake-resource-name': 'fake-resource-value' }; const params = { 'fake-param-name': 'fake-param-value' }; const serviceAccount = 'fake-serviceAccount'; const timeout = 'fake-timeout'; const payload = { pipelineName, - resources, params, serviceAccount, timeoutsPipeline: timeout, @@ -132,10 +124,6 @@ it('createPipelineRun with nodeSelector', () => { pipelineRef: { name: pipelineName }, - resources: Object.keys(resources).map(name => ({ - name, - resourceRef: { name: resources[name] } - })), params: Object.keys(params).map(name => ({ name, value: params[name] diff --git a/src/api/resources/import-resources-pipelinerun.yaml b/src/api/resources/import-resources-pipelinerun.yaml new file mode 100644 index 000000000..0203f0627 --- /dev/null +++ b/src/api/resources/import-resources-pipelinerun.yaml @@ -0,0 +1,143 @@ +# Copyright 2023 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# version may be replaced in the API layer if the user has opted in to v1 resources +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + # name will be replaced in the API layer + name: import-resources + labels: + # additional labels will be added in the API layer + dashboard.tekton.dev/import: 'true' +spec: + pipelineSpec: + params: + - name: method + description: Which kubectl command to use to import the resources (apply / create) + default: 'apply' + type: string + - name: path + description: The path from which resources are to be imported + default: '.' + type: string + - name: repositoryURL + description: The URL of the git repository from which resources are to be imported + type: string + - name: revision + description: The git revision from which resources are to be imported + default: '' + type: string + - name: target-namespace + description: The namespace in which to create the resources being imported + default: tekton-pipelines + type: string + tasks: + - name: fetch-repo + taskSpec: + params: + - name: repositoryURL + description: The URL of the git repository from which resources are to be imported + type: string + - name: revision + description: The git revision to clone + type: string + workspaces: + - name: repo + steps: + - name: clone + image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.41.0 + env: + - name: PARAM_URL + value: $(params.repositoryURL) + - name: PARAM_REVISION + value: $(params.revision) + - name: WORKSPACE_PATH + value: $(workspaces.repo.path) + securityContext: + runAsNonRoot: true + runAsUser: 65532 + script: | + #!/usr/bin/env sh + set -eu + git config --global --add safe.directory "${WORKSPACE_PATH}" + /ko-app/git-init \ + -url="${PARAM_URL}" \ + -revision="${PARAM_REVISION}" \ + -path=${WORKSPACE_PATH} + params: + - name: repositoryURL + value: $(params.repositoryURL) + - name: revision + value: $(params.revision) + workspaces: + - name: repo + workspace: repo + - name: import-resources + runAfter: [fetch-repo] + taskSpec: + params: + - name: path + description: The path from which resources are to be imported + type: string + - name: target-namespace + description: The namespace in which to create the resources being imported + type: string + - name: method + description: Which kubectl command to use to import the resources (apply / create) + type: string + workspaces: + - name: repo + steps: + - name: import + image: lachlanevenson/k8s-kubectl:latest + command: ['kubectl'] + args: [ + '$(params.method)', + '-f', + '$(workspaces.repo.path)/$(params.path)', + '-n', + '$(params.target-namespace)' + ] + params: + - name: path + value: '$(params.path)' + - name: target-namespace + value: $(params.target-namespace) + - name: method + value: $(params.method) + workspaces: + - name: repo + workspace: repo + params: + # Values will be replaced in the API layer + - name: method + value: '' + - name: path + value: '' + - name: repositoryURL + value: '' + - name: revision + value: '' + - name: target-namespace + value: '' + workspaces: + - name: repo + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/src/api/taskRuns.js b/src/api/taskRuns.js index ef104ad24..9016b045d 100644 --- a/src/api/taskRuns.js +++ b/src/api/taskRuns.js @@ -82,7 +82,6 @@ export function createTaskRun({ namespace, nodeSelector, params, - resources, serviceAccount, taskName, taskRunName = `${taskName}-run-${Date.now()}`, @@ -98,10 +97,6 @@ export function createTaskRun({ }, spec: { params: [], - resources: { - inputs: [], - outputs: [] - }, taskRef: { name: taskName, kind: kind || 'Task' @@ -117,22 +112,6 @@ export function createTaskRun({ value: params[name] })); } - if (resources && resources.inputs) { - payload.spec.resources.inputs = Object.keys(resources.inputs).map( - inputName => ({ - name: inputName, - resourceRef: { name: resources.inputs[inputName] } - }) - ); - } - if (resources && resources.outputs) { - payload.spec.resources.outputs = Object.keys(resources.outputs).map( - outputName => ({ - name: outputName, - resourceRef: { name: resources.outputs[outputName] } - }) - ); - } if (serviceAccount) { payload.spec.serviceAccountName = serviceAccount; } diff --git a/src/api/taskRuns.test.js b/src/api/taskRuns.test.js index cfca6f2f3..c02e0ebc8 100644 --- a/src/api/taskRuns.test.js +++ b/src/api/taskRuns.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -114,31 +114,6 @@ it('createTaskRun handles parameters', () => { return API.createTaskRun({ taskName, params }); }); -it('createTaskRun handles resources', () => { - const taskName = 'fake-task'; - const resources = { - inputs: { 'fake-task-input': 'fake-input-resource' }, - outputs: { 'fake-task-output': 'fake-output-resource' } - }; - server.use( - rest.post(/\/taskruns\//, async (req, res, ctx) => { - const { - spec: { resources: sentResources } - } = await req.json(); - expect(sentResources.inputs).toContainEqual({ - name: 'fake-task-input', - resourceRef: { name: 'fake-input-resource' } - }); - expect(sentResources.outputs).toContainEqual({ - name: 'fake-task-output', - resourceRef: { name: 'fake-output-resource' } - }); - return res(ctx.status(201), ctx.json({})); - }) - ); - return API.createTaskRun({ taskName, resources }); -}); - it('createTaskRun handles serviceAccount', () => { const taskName = 'fake-task'; const serviceAccount = 'fake-service-account'; diff --git a/src/containers/App/App.js b/src/containers/App/App.js index e0fe1d3a7..ec48769f1 100644 --- a/src/containers/App/App.js +++ b/src/containers/App/App.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -44,7 +44,6 @@ import { ClusterTasks, ClusterTriggerBinding, ClusterTriggerBindings, - CreatePipelineResource, CreatePipelineRun, CreateTaskRun, CustomResourceDefinition, @@ -57,8 +56,6 @@ import { Interceptors, NamespacedRoute, NotFound, - PipelineResource, - PipelineResources, PipelineRun, PipelineRuns, Pipelines, @@ -296,35 +293,6 @@ export function App({ lang }) { - - - - - - - - - - - - - - - - - - - - diff --git a/src/containers/CreatePipelineResource/CreatePipelineResource.js b/src/containers/CreatePipelineResource/CreatePipelineResource.js deleted file mode 100644 index b72561189..000000000 --- a/src/containers/CreatePipelineResource/CreatePipelineResource.js +++ /dev/null @@ -1,308 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React, { useState } from 'react'; -import { useNavigate } from 'react-router-dom-v5-compat'; -import { useIntl } from 'react-intl'; -import { Button, InlineNotification } from 'carbon-components-react'; -import { - ALL_NAMESPACES, - getErrorMessage, - resourceNameRegex, - urls, - useTitleSync -} from '@tektoncd/dashboard-utils'; - -import GitResourceFields from './GitResourceFields'; -import UniversalFields from './UniversalFields'; -import { createPipelineResource, useSelectedNamespace } from '../../api'; - -/* istanbul ignore next */ -function validateInputs(value, id) { - const trimmed = value.trim(); - - if (trimmed === '') { - return false; - } - if (id === 'name') { - if (trimmed.length >= 64) { - return false; - } - - if (!resourceNameRegex.test(trimmed)) { - return false; - } - - if (trimmed.startsWith('-', 0) || trimmed.endsWith('-')) { - return false; - } - } - - return true; -} - -export /* istanbul ignore next */ function CreatePipelineResource() { - const intl = useIntl(); - const navigate = useNavigate(); - const { selectedNamespace: defaultNamespace } = useSelectedNamespace(); - const [creating, setCreating] = useState(false); - const [gitSource, setGitSource] = useState(true); - const [invalidFields, setInvalidFields] = useState({}); - const [name, setName] = useState(''); - const [namespace, setNamespace] = useState( - defaultNamespace === ALL_NAMESPACES ? '' : defaultNamespace - ); - const [revision, setRevision] = useState(''); - const [submitError, setSubmitError] = useState(''); - const [type, setType] = useState('Git'); - const [url, setURL] = useState(''); - - useTitleSync({ - page: intl.formatMessage({ - id: 'dashboard.createPipelineResource.title', - defaultMessage: 'Create PipelineResource' - }) - }); - - function handleClose() { - navigate(urls.pipelineResources.all()); - } - - function resetError() { - setSubmitError(''); - } - - function handleSubmit() { - const newInvalidFields = {}; - let resource; - - setCreating(true); - - if (type === 'Git') { - resource = { - apiVersion: 'tekton.dev/v1alpha1', - kind: 'PipelineResource', - metadata: { - name: '', - namespace - }, - spec: { - type: '', - params: [ - { - name: 'url', - value: '' - }, - { - name: 'revision', - value: '' - } - ] - } - }; - } else { - resource = { - apiVersion: 'tekton.dev/v1alpha1', - kind: 'PipelineResource', - metadata: { - name: '', - namespace - }, - spec: { - type: '', - params: [ - { - name: 'url', - value: '' - } - ] - } - }; - } - - if (!validateInputs(namespace, 'namespace')) { - newInvalidFields.namespace = true; - } else { - resource.metadata.namespace = namespace; - } - - if (validateInputs(name, 'name')) { - resource.metadata.name = name.trim(); - } else { - newInvalidFields.name = true; - } - - if (validateInputs(url, 'url')) { - resource.spec.params[0].value = url.trim(); - } else { - newInvalidFields.url = true; - } - - resource.spec.type = type.toLowerCase(); - - if (type === 'Git') { - if (validateInputs(revision, 'revision')) { - resource.spec.params[1].value = revision; - } else { - newInvalidFields.revision = true; - } - } - - if (Object.keys(newInvalidFields).length) { - setCreating(false); - setInvalidFields(newInvalidFields); - return; - } - - createPipelineResource({ namespace, resource }) - .then(() => { - navigate(urls.pipelineResources.byNamespace({ namespace })); - }) - .catch(error => { - error.response.text().then(text => { - const statusCode = error.response.status; - let errorMessage = `error code ${statusCode}`; - if (text) { - errorMessage = `${text} (error code ${statusCode})`; - } - setCreating(false); - setSubmitError(errorMessage); - }); - }); - } - - function handleChangeTextInput(e) { - const updaters = { - name: setName, - revision: setRevision, - url: setURL - }; - - const stateVar = e.target.id; - const stateValue = e.target.value; - const newInvalidFields = { ...invalidFields }; - if (validateInputs(stateValue, stateVar)) { - delete newInvalidFields[stateVar]; - } else { - newInvalidFields[stateVar] = true; - } - updaters[stateVar](stateValue); - setInvalidFields(newInvalidFields); - } - - function handleChangeNamespace({ selectedItem }) { - const stateVar = 'namespace'; - const { text: stateValue = '' } = selectedItem || {}; - const newInvalidFields = { ...invalidFields }; - if (validateInputs(stateValue, stateVar)) { - delete newInvalidFields[stateVar]; - } else { - newInvalidFields[stateVar] = true; - } - setNamespace(stateValue); - setInvalidFields(newInvalidFields); - } - - function handleChangeType(e) { - const stateVar = 'type'; - const stateValue = e.selectedItem.text; - const newInvalidFields = { ...invalidFields }; - if (validateInputs(stateValue, stateVar)) { - delete newInvalidFields[stateVar]; - } else { - newInvalidFields[stateVar] = true; - } - setType(stateValue); - setInvalidFields(newInvalidFields); - setGitSource(stateValue === 'Git'); - } - - return ( -
-
-

- {intl.formatMessage({ - id: 'dashboard.createPipelineResource.title', - defaultMessage: 'Create PipelineResource' - })} -

-
- -
- {submitError && ( - - )} - - {gitSource && ( - - )} - - - - -
- ); -} - -export default CreatePipelineResource; diff --git a/src/containers/CreatePipelineResource/CreatePipelineResource.test.js b/src/containers/CreatePipelineResource/CreatePipelineResource.test.js deleted file mode 100644 index c74981cee..000000000 --- a/src/containers/CreatePipelineResource/CreatePipelineResource.test.js +++ /dev/null @@ -1,283 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { fireEvent } from '@testing-library/react'; -import { ALL_NAMESPACES, paths, urls } from '@tektoncd/dashboard-utils'; - -import { renderWithRouter } from '../../utils/test'; -import CreatePipelineResource from '.'; -import * as API from '../../api'; -import * as APIUtils from '../../api/utils'; - -describe('CreatePipelineResource', () => { - beforeEach(() => { - jest.spyOn(API, 'useNamespaces').mockImplementation(() => ({ - data: [{ metadata: { name: 'default' } }] - })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: ALL_NAMESPACES })); - }); - - it('renders blank', () => { - const { queryByText } = renderWithRouter(); - expect(queryByText('Create PipelineResource')).toBeTruthy(); - expect(queryByText('Cancel')).toBeTruthy(); - expect(queryByText('Create')).toBeTruthy(); - }); - - it('redirects to PipelineResources on cancel', () => { - jest.spyOn(API, 'getNamespaces').mockImplementation(() => []); - jest.spyOn(window.history, 'pushState'); - - const { queryByText } = renderWithRouter(, { - path: paths.pipelineResources.create(), - route: urls.pipelineResources.create() - }); - fireEvent.click(queryByText(/cancel/i)); - expect(window.history.pushState).toHaveBeenCalledWith( - expect.anything(), - null, - urls.pipelineResources.all() - ); - }); - - const nameValidationErrorMsgRegExp = - /Must consist of lower case alphanumeric characters, '-' or '.', start and end with an alphanumeric character, and be at most 63 characters/i; - const namespaceValidationErrorRegExp = /Namespace required/i; - const urlValidationErrorRegExp = /URL required/i; - const revisionValidationErrorRegExp = /Revision required/i; - - it('validates all empty inputs', () => { - const { queryByText } = renderWithRouter(); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('errors when name starts with a "-"', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: '-meow' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('errors when name ends with a "-"', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'meow-' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('errors when name ends with a "."', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'meow.' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('errors when name contains spaces', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the cat goes meow' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('errors when name contains capital letters', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'MEOW' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('doesn\'t error when contains "-" or "." in the middle of the name', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the-cat.goes-meow' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it("doesn't error when name contains number", () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the-cat-likes-0' } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it('errors when name contains 64 characters', () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { - value: - '1111111111111111111111111111111111111111111111111111111111111111' - } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeTruthy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it("doesn't error when name contains 63 characters", () => { - const { queryByText, getByPlaceholderText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { - value: '111111111111111111111111111111111111111111111111111111111111111' - } - }); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it("doesn't error when contains a valid namespace", () => { - const { queryByText, getByPlaceholderText, getByText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the-cat-goes-meow' } - }); - fireEvent.click(getByPlaceholderText(/select namespace/i)); - fireEvent.click(getByText(/default/i)); - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeFalsy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it("doesn't error when a url is entered", () => { - const { queryByText, getByPlaceholderText, getByText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the-cat-goes-meow' } - }); - fireEvent.click(getByPlaceholderText(/select namespace/i)); - fireEvent.click(getByText(/default/i)); - - fireEvent.change(getByPlaceholderText(/pipeline-resource-url/i), { - target: { value: 'the-cat-goes-meow' } - }); - - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeFalsy(); - expect(queryByText(urlValidationErrorRegExp)).toBeFalsy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeTruthy(); - }); - - it("doesn't error when a revision is entered", () => { - const { queryByText, getByPlaceholderText, getByText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the-cat-goes-meow' } - }); - fireEvent.click(getByPlaceholderText(/select namespace/i)); - fireEvent.click(getByText(/default/i)); - - fireEvent.change(getByPlaceholderText(/pipeline-resource-revision/i), { - target: { value: 'the-cat-goes-meow' } - }); - - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeFalsy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeFalsy(); - }); - - it('handles type change', () => { - const { queryByText, getByPlaceholderText, getByText } = renderWithRouter( - - ); - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'the-cat-goes-meow' } - }); - fireEvent.click(getByPlaceholderText(/select namespace/i)); - fireEvent.click(getByText(/default/i)); - - fireEvent.change(getByPlaceholderText(/pipeline-resource-revision/i), { - target: { value: 'the-cat-goes-meow' } - }); - - fireEvent.click(getByText(/git/i)); - fireEvent.click(getByText(/image/i)); - - fireEvent.click(queryByText('Create')); - expect(queryByText(nameValidationErrorMsgRegExp)).toBeFalsy(); - expect(queryByText(namespaceValidationErrorRegExp)).toBeFalsy(); - expect(queryByText(urlValidationErrorRegExp)).toBeTruthy(); - expect(queryByText(revisionValidationErrorRegExp)).toBeFalsy(); - }); -}); diff --git a/src/containers/CreatePipelineResource/CreatePipelineResourceErrorNotification.test.js b/src/containers/CreatePipelineResource/CreatePipelineResourceErrorNotification.test.js deleted file mode 100644 index 95791cd8a..000000000 --- a/src/containers/CreatePipelineResource/CreatePipelineResourceErrorNotification.test.js +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2020-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import React from 'react'; -import { fireEvent, waitFor } from '@testing-library/react'; -import { renderWithRouter } from '../../utils/test'; - -import CreatePipelineResource from '.'; -import * as API from '../../api'; -import * as PipelineResourcesAPI from '../../api/pipelineResources'; - -it('CreatePipelineResource error notification appears', async () => { - const errorResponseMock = { - response: { status: 404, text: () => Promise.resolve('') } - }; - jest - .spyOn(API, 'useNamespaces') - .mockImplementation(() => ({ data: [{ metadata: { name: 'default' } }] })); - jest - .spyOn(PipelineResourcesAPI, 'createPipelineResource') - .mockImplementation(() => Promise.reject(errorResponseMock)); - - const { getByPlaceholderText, getByText, queryByText } = renderWithRouter( - - ); - - fireEvent.change(getByPlaceholderText(/pipeline-resource-name/i), { - target: { value: 'test-pipeline-resource' } - }); - fireEvent.click(getByPlaceholderText(/select namespace/i)); - await waitFor(() => getByText(/default/i)); - fireEvent.click(getByText(/default/i)); - - fireEvent.change(getByPlaceholderText(/pipeline-resource-url/i), { - target: { value: 'test-url' } - }); - fireEvent.change(getByPlaceholderText(/pipeline-resource-revision/i), { - target: { value: 'test-revision' } - }); - fireEvent.click(queryByText('Create')); - - await waitFor(() => getByText('Error:')); - expect(getByText('error code 404')); -}); diff --git a/src/containers/CreatePipelineResource/GitResourceFields.js b/src/containers/CreatePipelineResource/GitResourceFields.js deleted file mode 100644 index fb0ee422e..000000000 --- a/src/containers/CreatePipelineResource/GitResourceFields.js +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { TextInput } from 'carbon-components-react'; -import { useIntl } from 'react-intl'; - -const GitResourceFields = ({ - revision, - handleChangeTextInput, - invalidFields -}) => { - const intl = useIntl(); - - return ( - - ); -}; - -export default GitResourceFields; diff --git a/src/containers/CreatePipelineResource/UniversalFields.js b/src/containers/CreatePipelineResource/UniversalFields.js deleted file mode 100644 index 8bcf88628..000000000 --- a/src/containers/CreatePipelineResource/UniversalFields.js +++ /dev/null @@ -1,115 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { Dropdown, TextInput } from 'carbon-components-react'; -import { useIntl } from 'react-intl'; -import { getTranslateWithId } from '@tektoncd/dashboard-utils'; - -import NamespacesDropdown from '../NamespacesDropdown'; - -const itemToString = ({ text }) => text; - -const UniversalFields = ({ - name, - handleChangeTextInput, - handleChangeNamespace, - selectedNamespace, - type, - handleChangeType, - url, - invalidFields -}) => { - const intl = useIntl(); - - return ( - <> - - - - - - ); -}; - -export default UniversalFields; diff --git a/src/containers/CreatePipelineResource/index.js b/src/containers/CreatePipelineResource/index.js deleted file mode 100644 index e5e25e22b..000000000 --- a/src/containers/CreatePipelineResource/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/* istanbul ignore file */ - -export { default } from './CreatePipelineResource'; diff --git a/src/containers/CreatePipelineRun/CreatePipelineRun.js b/src/containers/CreatePipelineRun/CreatePipelineRun.js index 3139d456e..3ca70e9fe 100644 --- a/src/containers/CreatePipelineRun/CreatePipelineRun.js +++ b/src/containers/CreatePipelineRun/CreatePipelineRun.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -35,7 +35,6 @@ import { KeyValueList } from '@tektoncd/dashboard-components'; import { useIntl } from 'react-intl'; import { NamespacesDropdown, - PipelineResourcesDropdown, PipelinesDropdown, ServiceAccountsDropdown } from '..'; @@ -61,8 +60,6 @@ const initialState = { pipelineError: false, pipelineRef: '', pipelineRunName: '', - resources: {}, - resourceSpecs: [], serviceAccount: '', submitError: '', timeoutsFinally: '', @@ -83,17 +80,6 @@ const initialParamsState = paramSpecs => { return paramSpecs.reduce(paramsReducer, {}); }; -const initialResourcesState = resourceSpecs => { - if (!resourceSpecs) { - return {}; - } - const resourcesReducer = (acc, resource) => ({ - ...acc, - [resource.name]: '' - }); - return resourceSpecs.reduce(resourcesReducer, {}); -}; - function CreatePipelineRun() { const intl = useIntl(); const location = useLocation(); @@ -130,7 +116,6 @@ function CreatePipelineRun() { pipelinePendingStatus, pipelineRef, pipelineRunName, - resources, serviceAccount, submitError, timeoutsFinally, @@ -144,8 +129,7 @@ function CreatePipelineRun() { ...initialState, namespace: getNamespace(), pipelineRef: getPipelineName(), - params: initialParamsState(null), - resources: initialResourcesState(null) + params: initialParamsState(null) }); const { data: pipeline, error: pipelineError } = usePipeline( @@ -154,9 +138,8 @@ function CreatePipelineRun() { ); let paramSpecs; - let resourceSpecs; if (pipeline?.spec) { - ({ resources: resourceSpecs, params: paramSpecs } = pipeline.spec); + ({ params: paramSpecs } = pipeline.spec); } useTitleSync({ @@ -181,15 +164,9 @@ function CreatePipelineRun() { } function checkFormValidation() { - // Namespace, PipelineRef, Resources, and Params must all have values + // Namespace, PipelineRef, and Params must all have values const validNamespace = !!namespace; const validPipelineRef = !!pipelineRef; - const validResources = - !resources || - Object.keys(resources).reduce( - (acc, name) => acc && !!resources[name], - true - ); const paramSpecMap = keyBy(paramSpecs, 'name'); const validParams = !params || @@ -247,7 +224,6 @@ function CreatePipelineRun() { return ( validNamespace && validPipelineRef && - validResources && validParams && validLabels && validNodeSelector && @@ -381,13 +357,12 @@ function CreatePipelineRun() { return { ...state, pipelineRef: text, - resources: initialResourcesState(resourceSpecs), params: initialParamsState(paramSpecs) }; }); return; } - // Reset pipelineresources and params when no Pipeline is selected + // Reset params when no Pipeline is selected setState(state => ({ ...state, ...initialState, @@ -395,16 +370,6 @@ function CreatePipelineRun() { })); } - function handleResourceChange(key, value) { - setState(state => ({ - ...state, - resources: { - ...state.resources, - [key]: value - } - })); - } - function handleSubmit(event) { event.preventDefault(); @@ -424,7 +389,6 @@ function CreatePipelineRun() { namespace, pipelineName: pipelineRef, pipelineRunName: pipelineRunName || undefined, - resources, params, pipelinePendingStatus, serviceAccount, @@ -478,7 +442,6 @@ function CreatePipelineRun() { pipelineRunName: pipelineRunName || undefined, params, pipelinePendingStatus, - resources, serviceAccount, timeoutsFinally, timeoutsPipeline, @@ -647,33 +610,6 @@ function CreatePipelineRun() { onAdd={() => handleAddLabel('nodeSelector')} /> - {resourceSpecs && resourceSpecs.length !== 0 && ( - - {resourceSpecs.map(resourceSpec => ( - { - const value = resources[resourceSpec.name]; - return value ? { id: value, text: value } : ''; - })()} - onChange={({ selectedItem }) => { - const { text } = selectedItem || {}; - handleResourceChange(resourceSpec.name, text); - }} - /> - ))} - - )} {paramSpecs && paramSpecs.length !== 0 && ( {paramSpecs.map(paramSpec => ( diff --git a/src/containers/CreatePipelineRun/CreatePipelineRun.test.js b/src/containers/CreatePipelineRun/CreatePipelineRun.test.js index 2b019bb4c..272da4a9a 100644 --- a/src/containers/CreatePipelineRun/CreatePipelineRun.test.js +++ b/src/containers/CreatePipelineRun/CreatePipelineRun.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2021 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -19,7 +19,6 @@ import { renderWithRouter } from '../../utils/test'; import CreatePipelineRun from './CreatePipelineRun'; import * as API from '../../api'; import * as APIUtils from '../../api/utils'; -import * as PipelineResourcesAPI from '../../api/pipelineResources'; import * as PipelineRunsAPI from '../../api/pipelineRuns'; import * as PipelinesAPI from '../../api/pipelines'; import * as ServiceAccountsAPI from '../../api/serviceAccounts'; @@ -32,10 +31,6 @@ const pipelines = [ uid: 'id-pipeline-1' }, spec: { - resources: [ - { name: 'resource-1', type: 'type-1' }, - { name: 'resource-2', type: 'type-2' } - ], params: [ { name: 'param-1', @@ -72,16 +67,6 @@ const serviceAccount = { } }; -const pipelineResource1 = { - metadata: { name: 'pipeline-resource-1' }, - spec: { type: 'type-1' } -}; - -const pipelineResource2 = { - metadata: { name: 'pipeline-resource-2' }, - spec: { type: 'type-2' } -}; - describe('CreatePipelineRun', () => { beforeEach(() => { jest @@ -90,11 +75,6 @@ describe('CreatePipelineRun', () => { jest .spyOn(PipelinesAPI, 'usePipelines') .mockImplementation(() => ({ data: pipelines })); - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ - data: [pipelineResource1, pipelineResource2] - })); jest .spyOn(PipelineRunsAPI, 'usePipelineRuns') .mockImplementation(() => ({ data: [] })); diff --git a/src/containers/CreateTaskRun/CreateTaskRun.js b/src/containers/CreateTaskRun/CreateTaskRun.js index 675d2bd12..f3b5719e8 100644 --- a/src/containers/CreateTaskRun/CreateTaskRun.js +++ b/src/containers/CreateTaskRun/CreateTaskRun.js @@ -1,5 +1,5 @@ /* -Copyright 2020-2022 The Tekton Authors +Copyright 2020-2023 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. You may obtain a copy of the License at @@ -36,7 +36,6 @@ import { useIntl } from 'react-intl'; import { ClusterTasksDropdown, NamespacesDropdown, - PipelineResourcesDropdown, ServiceAccountsDropdown, TasksDropdown } from '..'; @@ -56,8 +55,6 @@ const initialState = { nodeSelector: [], params: {}, paramSpecs: [], - resources: { inputs: {}, outputs: {} }, - resourceSpecs: [], serviceAccount: '', submitError: '', taskRef: '', @@ -77,29 +74,6 @@ const initialParamsState = paramSpecs => { ); }; -const initialResourcesState = resourceSpecs => { - const resources = { - inputs: {}, - outputs: {} - }; - if (!resourceSpecs) { - return resources; - } - if (resourceSpecs.inputs) { - resources.inputs = resourceSpecs.inputs.reduce( - (acc, res) => ({ ...acc, [res.name]: '' }), - {} - ); - } - if (resourceSpecs.outputs) { - resources.outputs = resourceSpecs.outputs.reduce( - (acc, res) => ({ ...acc, [res.name]: '' }), - {} - ); - } - return resources; -}; - const itemToString = ({ text }) => text; function CreateTaskRun() { @@ -136,7 +110,6 @@ function CreateTaskRun() { namespace, nodeSelector, params, - resources, serviceAccount, submitError, taskRef, @@ -151,8 +124,7 @@ function CreateTaskRun() { kind: initialTaskKind || 'Task', namespace: getNamespace(), taskRef: taskRefFromDetails, - params: initialParamsState(null), - resources: initialResourcesState(null) + params: initialParamsState(null) }); const { data: task, error: taskError } = useTaskByKind( @@ -161,7 +133,6 @@ function CreateTaskRun() { ); const paramSpecs = task?.spec?.params; - const resourceSpecs = task?.spec?.resources; useTitleSync({ page: intl.formatMessage({ @@ -171,23 +142,9 @@ function CreateTaskRun() { }); function checkFormValidation() { - // Namespace, PipelineRef, Resources, and Params must all have values + // Namespace, PipelineRef, and Params must all have values const validNamespace = !!namespace; const validTaskRef = !!taskRef; - const validInputResources = - !resources || - !resources.inputs || - Object.keys(resources.inputs).reduce( - (acc, name) => acc && !!resources.inputs[name], - true - ); - const validOutputResources = - !resources || - !resources.outputs || - Object.keys(resources.outputs).reduce( - (acc, name) => acc && !!resources.outputs[name], - true - ); const paramSpecMap = keyBy(paramSpecs, 'name'); const validParams = @@ -243,8 +200,6 @@ function CreateTaskRun() { return ( validNamespace && validTaskRef && - validInputResources && - validOutputResources && validParams && validLabels && validNodeSelector && @@ -387,13 +342,12 @@ function CreateTaskRun() { return { ...state, taskRef: text, - resources: initialResourcesState(resourceSpecs), params: initialParamsState(paramSpecs) }; }); return; } - // Reset pipelineresources and params when no Task is selected + // Reset params when no Task is selected setState(state => ({ ...state, ...initialState, @@ -401,14 +355,6 @@ function CreateTaskRun() { })); } - function handleResourceChange(resourceKind, key, value) { - setState(state => { - const next = { ...state }; - next.resources[resourceKind][key] = value; - return next; - }); - } - function handleSubmit(event) { event.preventDefault(); @@ -435,7 +381,6 @@ function CreateTaskRun() { }, {}) : null, params, - resources, serviceAccount, taskName: taskRef, taskRunName: taskRunName || undefined, @@ -634,66 +579,6 @@ function CreateTaskRun() { onAdd={() => handleAddLabel('nodeSelector')} /> - {resourceSpecs?.inputs?.length > 0 && ( - - {resourceSpecs.inputs.map(spec => ( - { - let value = ''; - if (resources.inputs !== undefined) { - value = resources.inputs[spec.name]; - } - return value ? { id: value, text: value } : ''; - })()} - onChange={({ selectedItem }) => { - const { text } = selectedItem || {}; - handleResourceChange('inputs', spec.name, text); - }} - /> - ))} - - )} - {resourceSpecs?.outputs?.length > 0 && ( - - {resourceSpecs.outputs.map(spec => ( - { - let value = ''; - if (resources.outputs !== undefined) { - value = resources.outputs[spec.name]; - } - return value ? { id: value, text: value } : ''; - })()} - onChange={({ selectedItem }) => { - const { text } = selectedItem || {}; - handleResourceChange('outputs', spec.name, text); - }} - /> - ))} - - )} {paramSpecs && paramSpecs.length !== 0 && ( {paramSpecs.map(paramSpec => ( diff --git a/src/containers/CreateTaskRun/CreateTaskRun.test.js b/src/containers/CreateTaskRun/CreateTaskRun.test.js index 3cbf0606f..fdf12fe6c 100644 --- a/src/containers/CreateTaskRun/CreateTaskRun.test.js +++ b/src/containers/CreateTaskRun/CreateTaskRun.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -20,7 +20,6 @@ import { renderWithRouter } from '../../utils/test'; import CreateTaskRun from './CreateTaskRun'; import * as API from '../../api'; import * as APIUtils from '../../api/utils'; -import * as PipelineResourcesAPI from '../../api/pipelineResources'; import * as ServiceAccountsAPI from '../../api/serviceAccounts'; import * as TaskRunsAPI from '../../api/taskRuns'; import * as ClusterTasksAPI from '../../api/clusterTasks'; @@ -34,13 +33,6 @@ const tasks = [ uid: 'id-task-1' }, spec: { - resources: { - inputs: [ - { name: 'resource-1', type: 'type-1' }, - { name: 'resource-2', type: 'type-2' } - ], - outputs: [{ name: 'resource-3', type: 'type-3' }] - }, params: [ { name: 'param-1', @@ -93,21 +85,6 @@ const serviceAccount = { } }; -const pipelineResource1 = { - metadata: { name: 'pipeline-resource-1' }, - spec: { type: 'type-1' } -}; - -const pipelineResource2 = { - metadata: { name: 'pipeline-resource-2' }, - spec: { type: 'type-2' } -}; - -const pipelineResource3 = { - metadata: { name: 'pipeline-resource-3' }, - spec: { type: 'type-3' } -}; - const taskRuns = { isFetching: false, byId: {}, @@ -127,11 +104,6 @@ describe('CreateTaskRun', () => { jest .spyOn(ClusterTasksAPI, 'useClusterTasks') .mockImplementation(() => ({ data: clusterTasks })); - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ - data: [pipelineResource1, pipelineResource2, pipelineResource3] - })); jest .spyOn(TaskRunsAPI, 'getTaskRuns') .mockImplementation(() => taskRuns.byId); diff --git a/src/containers/PipelineResource/PipelineResource.js b/src/containers/PipelineResource/PipelineResource.js deleted file mode 100644 index d11426dbf..000000000 --- a/src/containers/PipelineResource/PipelineResource.js +++ /dev/null @@ -1,204 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { - useLocation, - useNavigate, - useParams -} from 'react-router-dom-v5-compat'; -import { useIntl } from 'react-intl'; -import { DataTable } from 'carbon-components-react'; -import { ResourceDetails } from '@tektoncd/dashboard-components'; -import { useTitleSync } from '@tektoncd/dashboard-utils'; - -import { usePipelineResource } from '../../api'; -import { getViewChangeHandler } from '../../utils'; - -const { - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableHeader, - TableRow -} = DataTable; - -/* istanbul ignore next */ -function PipelineResource() { - const intl = useIntl(); - const location = useLocation(); - const navigate = useNavigate(); - const { namespace, pipelineResourceName: resourceName } = useParams(); - - const queryParams = new URLSearchParams(location.search); - const view = queryParams.get('view'); - - useTitleSync({ - page: 'PipelineResource', - resourceName - }); - - const { - data: pipelineResource, - error, - isFetching - } = usePipelineResource({ - name: resourceName, - namespace - }); - - const { params = [], secrets, type } = pipelineResource?.spec || {}; - - return ( - - - {intl.formatMessage({ - id: 'dashboard.pipelineResource.type', - defaultMessage: 'Type:' - })} - - {type} -

- } - error={error} - loading={isFetching} - onViewChange={getViewChangeHandler({ location, navigate })} - resource={pipelineResource} - view={view} - > - ({ - id: name, - name, - value - }))} - headers={[ - { - key: 'name', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.name', - defaultMessage: 'Name' - }) - }, - { - key: 'value', - header: intl.formatMessage({ - id: 'dashboard.tableHeader.value', - defaultMessage: 'Value' - }) - } - ]} - render={({ - rows, - headers, - getHeaderProps, - getRowProps, - getTableProps - }) => ( - -
- - - {headers.map(header => ( - - {header.header} - - ))} - - - - {rows.map(row => ( - - {row.cells.map(cell => ( - {cell.value} - ))} - - ))} - -
- - )} - /> - - {secrets && ( - ({ - id: fieldName, - fieldName, - secretKey, - secretName - }))} - headers={[ - { - key: 'fieldName', - header: intl.formatMessage({ - id: 'dashboard.pipelineResource.fieldName', - defaultMessage: 'Field name' - }) - }, - { - key: 'secretKey', - header: intl.formatMessage({ - id: 'dashboard.pipelineResource.secretKey', - defaultMessage: 'Secret key' - }) - }, - { - key: 'secretName', - header: intl.formatMessage({ - id: 'dashboard.pipelineResource.secretName', - defaultMessage: 'Secret name' - }) - } - ]} - render={({ - rows, - headers, - getHeaderProps, - getRowProps, - getTableProps - }) => ( - - - - - {headers.map(header => ( - - {header.header} - - ))} - - - - {rows.map(row => ( - - {row.cells.map(cell => ( - {cell.value} - ))} - - ))} - -
-
- )} - /> - )} - - ); -} - -export default PipelineResource; diff --git a/src/containers/PipelineResource/index.js b/src/containers/PipelineResource/index.js deleted file mode 100644 index ffa269568..000000000 --- a/src/containers/PipelineResource/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/* istanbul ignore file */ - -export { default } from './PipelineResource'; diff --git a/src/containers/PipelineResources/PipelineResources.js b/src/containers/PipelineResources/PipelineResources.js deleted file mode 100644 index bf86e4f81..000000000 --- a/src/containers/PipelineResources/PipelineResources.js +++ /dev/null @@ -1,185 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/* istanbul ignore file */ - -import React, { useState } from 'react'; -import { - useLocation, - useNavigate, - useParams -} from 'react-router-dom-v5-compat'; -import { useIntl } from 'react-intl'; -import keyBy from 'lodash.keyby'; -import { - ALL_NAMESPACES, - getFilters, - urls, - useTitleSync -} from '@tektoncd/dashboard-utils'; -import { - DeleteModal, - PipelineResources as PipelineResourcesList -} from '@tektoncd/dashboard-components'; -import { Add16 as Add, TrashCan32 as Delete } from '@carbon/icons-react'; - -import { ListPageLayout } from '..'; -import { - deletePipelineResource, - useIsReadOnly, - usePipelineResources, - useSelectedNamespace -} from '../../api'; - -export function PipelineResources() { - const intl = useIntl(); - const location = useLocation(); - const navigate = useNavigate(); - const params = useParams(); - const filters = getFilters(location); - - const { selectedNamespace } = useSelectedNamespace(); - const { namespace = selectedNamespace } = params; - - const [cancelSelection, setCancelSelection] = useState(null); - const [deleteError, setDeleteError] = useState(null); - const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); - const [toBeDeleted, setToBeDeleted] = useState([]); - - const isReadOnly = useIsReadOnly(); - - useTitleSync({ page: 'PipelineResources' }); - - const { - data: pipelineResources = [], - error, - isLoading - } = usePipelineResources({ filters, namespace }); - - function getError() { - if (error) { - return { - error, - title: intl.formatMessage({ - id: 'dashboard.pipelineResources.error', - defaultMessage: 'Error loading PipelineResources' - }) - }; - } - - if (deleteError) { - return { - clear: () => setDeleteError(null), - error: deleteError - }; - } - - return null; - } - - function openDeleteModal(selectedRows, handleCancel) { - const pipelineResourcesById = keyBy(pipelineResources, 'metadata.uid'); - const resourcesToBeDeleted = selectedRows.map( - ({ id }) => pipelineResourcesById[id] - ); - - setIsDeleteModalOpen(true); - setToBeDeleted(resourcesToBeDeleted); - setCancelSelection(() => handleCancel); - } - - function closeDeleteModal() { - setIsDeleteModalOpen(false); - setToBeDeleted([]); - } - - function deleteResource(pipelineResource) { - const { name, namespace: resourceNamespace } = pipelineResource.metadata; - return deletePipelineResource({ name, namespace: resourceNamespace }).catch( - err => { - err.response.text().then(text => { - const statusCode = err.response.status; - let errorMessage = `error code ${statusCode}`; - if (text) { - errorMessage = `${text} (error code ${statusCode})`; - } - setDeleteError(errorMessage); - }); - } - ); - } - - async function handleDelete() { - const deletions = toBeDeleted.map(resource => deleteResource(resource)); - closeDeleteModal(); - await Promise.all(deletions); - cancelSelection(); - } - - const toolbarButtons = isReadOnly - ? [] - : [ - { - onClick: () => navigate(urls.pipelineResources.create()), - text: intl.formatMessage({ - id: 'dashboard.actions.createButton', - defaultMessage: 'Create' - }), - icon: Add - } - ]; - - const batchActionButtons = isReadOnly - ? [] - : [ - { - onClick: openDeleteModal, - text: intl.formatMessage({ - id: 'dashboard.actions.deleteButton', - defaultMessage: 'Delete' - }), - icon: Delete - } - ]; - - return ( - - {({ resources }) => ( - <> - - {isDeleteModalOpen ? ( - - ) : null} - - )} - - ); -} - -export default PipelineResources; diff --git a/src/containers/PipelineResources/index.js b/src/containers/PipelineResources/index.js deleted file mode 100644 index 0c1d7758e..000000000 --- a/src/containers/PipelineResources/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/* istanbul ignore file */ - -export { default } from './PipelineResources'; diff --git a/src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.js b/src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.js deleted file mode 100644 index a54b8a92d..000000000 --- a/src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.js +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { useIntl } from 'react-intl'; -import { ALL_NAMESPACES } from '@tektoncd/dashboard-utils'; -import { TooltipDropdown } from '@tektoncd/dashboard-components'; - -import { usePipelineResources, useSelectedNamespace } from '../../api'; - -function PipelineResourcesDropdown({ - label, - namespace: namespaceProp, - type, - ...rest -}) { - const intl = useIntl(); - const { selectedNamespace } = useSelectedNamespace(); - const namespace = namespaceProp || selectedNamespace; - - const { data: pipelineResources = [], isFetching } = usePipelineResources({ - namespace - }); - - const items = pipelineResources - .filter(pipelineResource => !type || type === pipelineResource.spec.type) - .map(pipelineResource => pipelineResource.metadata.name); - - let emptyText = intl.formatMessage({ - id: 'dashboard.pipelineResourcesDropdown.empty.allNamespaces', - defaultMessage: 'No PipelineResources found' - }); - if (type && namespace !== ALL_NAMESPACES) { - emptyText = intl.formatMessage( - { - id: 'dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type', - defaultMessage: - "No PipelineResources found of type ''{type}'' in the ''{namespace}'' namespace" - }, - { - namespace, - type - } - ); - } else if (type) { - emptyText = intl.formatMessage( - { - id: 'dashboard.pipelineResourcesDropdown.empty.allNamespaces.type', - defaultMessage: "No PipelineResources found of type ''{type}''" - }, - { type } - ); - } else if (namespace !== ALL_NAMESPACES) { - emptyText = intl.formatMessage( - { - id: 'dashboard.pipelineResourcesDropdown.empty.selectedNamespace', - defaultMessage: - "No PipelineResources found in the ''{namespace}'' namespace" - }, - { namespace } - ); - } - - const labelString = - label || - intl.formatMessage({ - id: 'dashboard.pipelineResourcesDropdown.label', - defaultMessage: 'Select PipelineResource' - }); - - return ( - - ); -} - -PipelineResourcesDropdown.defaultProps = { - titleText: 'PipelineResource' -}; - -export default PipelineResourcesDropdown; diff --git a/src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.test.js b/src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.test.js deleted file mode 100644 index ba51cf7a3..000000000 --- a/src/containers/PipelineResourcesDropdown/PipelineResourcesDropdown.test.js +++ /dev/null @@ -1,285 +0,0 @@ -/* -Copyright 2019-2022 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { fireEvent, getNodeText } from '@testing-library/react'; -import { ALL_NAMESPACES } from '@tektoncd/dashboard-utils'; - -import { render } from '../../utils/test'; -import PipelineResourcesDropdown from './PipelineResourcesDropdown'; -import * as API from '../../api'; -import * as APIUtils from '../../api/utils'; -import * as PipelineResourcesAPI from '../../api/pipelineResources'; - -const props = { - id: 'pipeline-resources-dropdown', - onChange: () => {} -}; - -const pipelineResourcesByNamespace = { - blue: { - 'pipeline-resource-1': 'id-pipeline-resource-1', - 'pipeline-resource-2': 'id-pipeline-resource-2' - }, - green: { - 'pipeline-resource-3': 'id-pipeline-resource-3' - } -}; - -const pipelineResource1 = { - metadata: { - name: 'pipeline-resource-1', - namespace: 'blue', - uid: 'id-pipeline-resource-1' - }, - spec: { type: 'type-1' } -}; - -const pipelineResource2 = { - metadata: { - name: 'pipeline-resource-2', - namespace: 'blue', - uid: 'id-pipeline-resource-2' - }, - spec: { type: 'type-2' } -}; - -const pipelineResource3 = { - metadata: { - name: 'pipeline-resource-3', - namespace: 'green', - uid: 'id-pipeline-resource-3' - }, - spec: { type: 'type-1' } -}; - -const initialTextRegExp = /select pipelineresource/i; - -const checkDropdownItems = ({ - queryByText, - getAllByText, - testDict, - itemPrefixRegExp = /pipeline-resource-/i -}) => { - Object.keys(testDict).forEach(item => { - expect(queryByText(new RegExp(item, 'i'))).toBeTruthy(); - }); - getAllByText(itemPrefixRegExp).forEach(node => { - expect(getNodeText(node) in testDict).toBeTruthy(); - }); -}; - -describe('PipelineResourcesDropdown', () => { - beforeEach(() => { - jest.spyOn(API, 'useNamespaces').mockImplementation(() => ({ - data: [{ metadata: { name: 'blue' } }, { metadata: { name: 'green' } }] - })); - }); - - it('renders items', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ - data: [pipelineResource1, pipelineResource2] - })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - const { getByPlaceholderText, getAllByText, queryByText } = render( - - ); - // View items - fireEvent.click(getByPlaceholderText(initialTextRegExp)); - checkDropdownItems({ - getAllByText, - queryByText, - testDict: pipelineResourcesByNamespace.blue - }); - }); - - it('renders items based on type', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ - data: [pipelineResource1, pipelineResource2] - })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - const { getByPlaceholderText, queryByText, rerender } = render( - - ); - // View items - fireEvent.click(getByPlaceholderText(initialTextRegExp)); - expect(queryByText(/pipeline-resource-1/i)).toBeTruthy(); - expect(queryByText(/pipeline-resource-2/i)).toBeFalsy(); - fireEvent.click(getByPlaceholderText(initialTextRegExp)); - render(, { - rerender - }); - // View items - fireEvent.click(getByPlaceholderText(initialTextRegExp)); - expect(queryByText(/pipeline-resource-1/i)).toBeFalsy(); - expect(queryByText(/pipeline-resource-2/i)).toBeTruthy(); - }); - - it('renders controlled selection', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ - data: [pipelineResource1, pipelineResource2] - })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - - // Select item 'pipeline-resource-1' - const { queryByPlaceholderText, queryByDisplayValue, rerender } = render( - - ); - expect(queryByDisplayValue(/pipeline-resource-1/i)).toBeTruthy(); - // Select item 'pipeline-resource-2' - render( - , - { rerender } - ); - expect(queryByDisplayValue(/pipeline-resource-2/i)).toBeTruthy(); - // No selected item (select item '') - render(, { - rerender - }); - expect(queryByPlaceholderText(initialTextRegExp)).toBeTruthy(); - }); - - it('renders controlled namespace', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ data: [pipelineResource3] })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - // Select namespace 'green' - const { queryByText, getByPlaceholderText, getAllByText } = render( - - ); - fireEvent.click(getByPlaceholderText(initialTextRegExp)); - checkDropdownItems({ - getAllByText, - queryByText, - testDict: pipelineResourcesByNamespace.green - }); - }); - - it('renders empty', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ data: [] })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - const { queryByPlaceholderText } = render( - - ); - expect( - queryByPlaceholderText( - /no pipelineresources found in the 'blue' namespace/i - ) - ).toBeTruthy(); - expect(queryByPlaceholderText(initialTextRegExp)).toBeFalsy(); - }); - - it('renders empty all namespaces', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ data: [] })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: ALL_NAMESPACES })); - const { queryByPlaceholderText } = render( - - ); - expect(queryByPlaceholderText(/no pipelineresources found/i)).toBeTruthy(); - expect(queryByPlaceholderText(initialTextRegExp)).toBeFalsy(); - }); - - it('renders empty with type', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ data: [] })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - const { queryByPlaceholderText } = render( - - ); - expect( - queryByPlaceholderText( - /no pipelineresources found of type 'bogus' in the 'blue' namespace/i - ) - ).toBeTruthy(); - expect(queryByPlaceholderText(initialTextRegExp)).toBeFalsy(); - }); - - it('renders empty with type and all namespaces', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ data: [] })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: ALL_NAMESPACES })); - const { queryByPlaceholderText } = render( - - ); - expect( - queryByPlaceholderText(/no pipelineresources found of type 'bogus'/i) - ).toBeTruthy(); - expect(queryByPlaceholderText(initialTextRegExp)).toBeFalsy(); - }); - - it('renders loading state', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ isFetching: true })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - const { queryByPlaceholderText } = render( - - ); - expect(queryByPlaceholderText(initialTextRegExp)).toBeFalsy(); - }); - - it('handles onChange event', () => { - jest - .spyOn(PipelineResourcesAPI, 'usePipelineResources') - .mockImplementation(() => ({ - data: [pipelineResource1] - })); - jest - .spyOn(APIUtils, 'useSelectedNamespace') - .mockImplementation(() => ({ selectedNamespace: 'blue' })); - const onChange = jest.fn(); - const { getByPlaceholderText, getByText } = render( - - ); - fireEvent.click(getByPlaceholderText(initialTextRegExp)); - fireEvent.click(getByText(/pipeline-resource-1/i)); - expect(onChange).toHaveBeenCalledTimes(1); - }); -}); diff --git a/src/containers/PipelineResourcesDropdown/index.js b/src/containers/PipelineResourcesDropdown/index.js deleted file mode 100644 index d4cb1bcb5..000000000 --- a/src/containers/PipelineResourcesDropdown/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2019-2021 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. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/* istanbul ignore file */ - -export { default } from './PipelineResourcesDropdown'; diff --git a/src/containers/PipelineRuns/PipelineRuns.test.js b/src/containers/PipelineRuns/PipelineRuns.test.js index 3398f2827..6b7aa8485 100644 --- a/src/containers/PipelineRuns/PipelineRuns.test.js +++ b/src/containers/PipelineRuns/PipelineRuns.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -29,7 +29,6 @@ const pipelines = [ uid: 'id-pipeline-1' }, spec: { - resources: [{ name: 'resource-1', type: 'type-1' }], params: [ { name: 'param-1', diff --git a/src/containers/SideNav/SideNav.js b/src/containers/SideNav/SideNav.js index e5de10bf3..8de298055 100644 --- a/src/containers/SideNav/SideNav.js +++ b/src/containers/SideNav/SideNav.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -110,11 +110,6 @@ function SideNav({ expanded, showKubernetesResources }) { > PipelineRuns - - PipelineResources - Tasks diff --git a/src/containers/TriggerTemplate/TriggerTemplate.test.js b/src/containers/TriggerTemplate/TriggerTemplate.test.js index 42a43c814..8719995db 100644 --- a/src/containers/TriggerTemplate/TriggerTemplate.test.js +++ b/src/containers/TriggerTemplate/TriggerTemplate.test.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -25,38 +25,22 @@ const intl = createIntl({ defaultLocale: 'en' }); -const resourceTemplate1NameInfo = 'git-source'; +const resourceTemplate1NameInfo = 'git-clone'; const resourceTemplate2NameInfo = 'simple-pipeline-run'; const namespace = 'tekton-pipelines'; const triggerTemplateName = 'pipeline-template'; const resourceTemplate1Details = { - apiVersion: 'tekton.dev/v1alpha1', - kind: 'PipelineResource', + apiVersion: 'tekton.dev/v1', + kind: 'Task', metadata: { - name: 'git-source' + name: 'git-clone' }, - spec: { - params: [ - { - name: 'revision', - value: '$(params.gitrevision)' - }, - { - name: 'url', - value: '$(params.gitrepositoryurl)' - } - ], - type: 'git' - } + spec: {} }; const fakeTriggerTemplate = { apiVersion: 'triggers.tekton.dev/v1alpha1', kind: 'TriggerTemplate', metadata: { - annotations: { - 'kubectl.kubernetes.io/last-applied-configuration': - '{"apiVersion":"tekton.dev/v1alpha1","kind":"TriggerTemplate","metadata":{"annotations":{},"name":"pipeline-template","namespace":"tekton-pipelines"},"spec":{"params":[{"default":"master","description":"The git revision","name":"gitrevision"},{"description":"The git repository url","name":"gitrepositoryurl"},{"default":"This is the default message","description":"The message to print","name":"message"},{"description":"The Content-Type of the event","name":"contenttype"}],"resourcetemplates":[{"apiVersion":"tekton.dev/v1alpha1","kind":"PipelineResource","metadata":{"name":"git-source"},"spec":{"params":[{"name":"revision","value":"$(params.gitrevision)"},{"name":"url","value":"$(params.gitrepositoryurl)"}],"type":"git"}},{"apiVersion":"tekton.dev/v1alpha1","kind":"PipelineRun","metadata":{"generateName":"simple-pipeline-run"},"spec":{"params":[{"name":"message","value":"$(params.message)"},{"name":"contenttype","value":"$(params.contenttype)"}],"pipelineRef":{"name":"simple-pipeline"},"resources":[{"name":"git-source","resourceRef":{"name":"git-source"}}]}}]}}\n' - }, creationTimestamp: '2019-11-21T15:19:18Z', generation: 1, name: triggerTemplateName, @@ -82,18 +66,7 @@ const fakeTriggerTemplate = { { description: 'The Content-Type of the event', name: 'contenttype' } ], resourcetemplates: [ - { - apiVersion: 'tekton.dev/v1alpha1', - kind: 'PipelineResource', - metadata: { name: 'git-source' }, - spec: { - params: [ - { name: 'revision', value: '$(params.gitrevision)' }, - { name: 'url', value: '$(params.gitrepositoryurl)' } - ], - type: 'git' - } - }, + resourceTemplate1Details, { apiVersion: 'tekton.dev/v1alpha1', kind: 'PipelineRun', @@ -103,10 +76,7 @@ const fakeTriggerTemplate = { { name: 'message', value: '$(params.message)' }, { name: 'contenttype', value: '$(params.contenttype)' } ], - pipelineRef: { name: 'simple-pipeline' }, - resources: [ - { name: 'git-source', resourceRef: { name: 'git-source' } } - ] + pipelineRef: { name: 'simple-pipeline' } } } ] @@ -117,10 +87,6 @@ const fakeTriggerTemplateWithLabels = { apiVersion: 'triggers.tekton.dev/v1alpha1', kind: 'TriggerTemplate', metadata: { - annotations: { - 'kubectl.kubernetes.io/last-applied-configuration': - '{"apiVersion":"tekton.dev/v1alpha1","kind":"TriggerTemplate","metadata":{"annotations":{},"name":"pipeline-template","namespace":"tekton-pipelines"},"spec":{"params":[{"default":"master","description":"The git revision","name":"gitrevision"},{"description":"The git repository url","name":"gitrepositoryurl"},{"default":"This is the default message","description":"The message to print","name":"message"},{"description":"The Content-Type of the event","name":"contenttype"}],"resourcetemplates":[{"apiVersion":"tekton.dev/v1alpha1","kind":"PipelineResource","metadata":{"name":"git-source"},"spec":{"params":[{"name":"revision","value":"$(params.gitrevision)"},{"name":"url","value":"$(params.gitrepositoryurl)"}],"type":"git"}},{"apiVersion":"tekton.dev/v1alpha1","kind":"PipelineRun","metadata":{"generateName":"simple-pipeline-run"},"spec":{"params":[{"name":"message","value":"$(params.message)"},{"name":"contenttype","value":"$(params.contenttype)"}],"pipelineRef":{"name":"simple-pipeline"},"resources":[{"name":"git-source","resourceRef":{"name":"git-source"}}]}}]}}\n' - }, labels: { mylabel: 'foo', myotherlabel: 'bar' @@ -150,18 +116,7 @@ const fakeTriggerTemplateWithLabels = { { description: 'The Content-Type of the event', name: 'contenttype' } ], resourcetemplates: [ - { - apiVersion: 'tekton.dev/v1alpha1', - kind: 'PipelineResource', - metadata: { name: 'git-source' }, - spec: { - params: [ - { name: 'revision', value: '$(params.gitrevision)' }, - { name: 'url', value: '$(params.gitrepositoryurl)' } - ], - type: 'git' - } - }, + resourceTemplate1Details, { apiVersion: 'tekton.dev/v1alpha1', kind: 'PipelineRun', @@ -171,10 +126,7 @@ const fakeTriggerTemplateWithLabels = { { name: 'message', value: '$(params.message)' }, { name: 'contenttype', value: '$(params.contenttype)' } ], - pipelineRef: { name: 'simple-pipeline' }, - resources: [ - { name: 'git-source', resourceRef: { name: 'git-source' } } - ] + pipelineRef: { name: 'simple-pipeline' } } } ] @@ -255,7 +207,6 @@ it('TriggerTemplateContainer contains YAML tab with accurate information', async await waitFor(() => getByText('creationTimestamp:')); await waitFor(() => getByText('selfLink:')); await waitFor(() => getByText('pipelineRef:')); - await waitFor(() => getByText('resourceRef:')); await waitFor(() => getByText('generation:')); await waitFor(() => getByText('resourceVersion:')); }); diff --git a/src/containers/index.js b/src/containers/index.js index 0a012ce6d..145711b09 100644 --- a/src/containers/index.js +++ b/src/containers/index.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -18,7 +18,6 @@ export { default as ClusterTasksDropdown } from './ClusterTasksDropdown'; export { default as ClusterTriggerBinding } from './ClusterTriggerBinding'; export { default as ClusterTriggerBindings } from './ClusterTriggerBindings'; export { default as CustomResourceDefinition } from './CustomResourceDefinition'; -export { default as CreatePipelineResource } from './CreatePipelineResource'; export { default as CreatePipelineRun } from './CreatePipelineRun'; export { default as CreateTaskRun } from './CreateTaskRun'; export { default as EventListener } from './EventListener'; @@ -33,9 +32,6 @@ export { default as ListPageLayout } from './ListPageLayout'; export { default as NamespacedRoute } from './NamespacedRoute'; export { default as NamespacesDropdown } from './NamespacesDropdown'; export { default as NotFound } from './NotFound'; -export { default as PipelineResource } from './PipelineResource'; -export { default as PipelineResources } from './PipelineResources'; -export { default as PipelineResourcesDropdown } from './PipelineResourcesDropdown'; export { default as PipelineRun } from './PipelineRun'; export { default as PipelineRuns } from './PipelineRuns'; export { default as Pipelines } from './Pipelines'; diff --git a/src/nls/messages_de.json b/src/nls/messages_de.json index 825386dde..848946c3f 100644 --- a/src/nls/messages_de.json +++ b/src/nls/messages_de.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "Fehler beim Laden von PipelineRun", "dashboard.pipelineRun.failed": "PipelineRun kann nicht geladen werden", "dashboard.pipelineRun.failedMessage": "Details der PipelineRun können nicht geladen werden: {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "Beschreibung: Die Schrittdefinition ist nicht verfügbar", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "Erstellt", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Pipeline", "dashboard.tableHeader.status": "Status", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "Protokolle", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "Status", "dashboard.taskRun.status.cancelled": "Abgebrochen", diff --git a/src/nls/messages_en.json b/src/nls/messages_en.json index 56092a48d..d547b09c3 100644 --- a/src/nls/messages_en.json +++ b/src/nls/messages_en.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "No ClusterTasks found", "dashboard.clusterTasksDropdown.label": "Select ClusterTask", "dashboard.clusterTriggerBinding.noParams": "No parameters found for this ClusterTriggerBinding.", - "dashboard.createPipelineResource.name": "pipeline-resource-name", - "dashboard.createPipelineResource.nameLabel": "Name", - "dashboard.createPipelineResource.namespaceError": "Namespace required", - "dashboard.createPipelineResource.revision": "pipeline-resource-revision", - "dashboard.createPipelineResource.revisionError": "Revision required", - "dashboard.createPipelineResource.revisionLabel": "Revision", - "dashboard.createPipelineResource.title": "Create PipelineResource", - "dashboard.createPipelineResource.type": "Type", - "dashboard.createPipelineResource.url": "pipeline-resource-url", - "dashboard.createPipelineResource.urlError": "URL required", - "dashboard.createPipelineResource.urlLabel": "URL", "dashboard.createPipelineRun.createError": "Error creating PipelineRun", "dashboard.createPipelineRun.disabled": "Disabled", "dashboard.createPipelineRun.empty": "PipelineRun cannot be empty", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "Must consist of lower case alphanumeric characters, '-' or '.', start and end with an alphanumeric character, and be at most 63 characters", "dashboard.createRun.invalidNamespace": "Namespace cannot be empty", "dashboard.createRun.invalidParams": "Params cannot be empty", - "dashboard.createRun.invalidPipelineResources": "PipelineResources cannot be empty", "dashboard.createRun.label.invalidText": "Labels must follow the {0}kubernetes labels syntax{1}.", "dashboard.createRun.labels.legendText": "Labels", "dashboard.createRun.nodeSelector.legendText": "Node selector", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "Items per page:", "dashboard.pagination.previousPage": "Previous page", "dashboard.parameters.title": "Parameters", - "dashboard.pipelineResource.fieldName": "Field name", - "dashboard.pipelineResource.secretKey": "Secret key", - "dashboard.pipelineResource.secretName": "Secret name", - "dashboard.pipelineResource.type": "Type:", - "dashboard.pipelineResources.error": "Error loading PipelineResources", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "No PipelineResources found", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "No PipelineResources found of type ''{type}''", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "No PipelineResources found in the ''{namespace}'' namespace", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "No PipelineResources found of type ''{type}'' in the ''{namespace}'' namespace", - "dashboard.pipelineResourcesDropdown.label": "Select PipelineResource", "dashboard.pipelineRun.error": "Error loading PipelineRun", "dashboard.pipelineRun.failed": "Cannot load PipelineRun", "dashboard.pipelineRun.failedMessage": "Unable to load PipelineRun: {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "Skip to main content", "dashboard.startPipelineRun.actionText": "Start", "dashboard.step.definitionNotAvailable": "Step definition not available", - "dashboard.stepDefinition.inputResources": "Input resources", - "dashboard.stepDefinition.outputResources": "Output resources", "dashboard.tableHeader.createdTime": "Created", "dashboard.tableHeader.default": "Default", "dashboard.tableHeader.expression": "Expression", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Pipeline", "dashboard.tableHeader.status": "Status", "dashboard.tableHeader.task": "Task", - "dashboard.tableHeader.type": "Type", "dashboard.tableHeader.value": "Value", "dashboard.taskRun.logs": "Logs", "dashboard.taskRun.params": "Parameters", - "dashboard.taskRun.resources": "Resources", "dashboard.taskRun.results": "Results", "dashboard.taskRun.status": "Status", "dashboard.taskRun.status.cancelled": "Cancelled", diff --git a/src/nls/messages_es.json b/src/nls/messages_es.json index 825e75986..d8cb6406f 100644 --- a/src/nls/messages_es.json +++ b/src/nls/messages_es.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "Error al cargar PipelineRun", "dashboard.pipelineRun.failed": "No se puede cargar PipelineRun", "dashboard.pipelineRun.failedMessage": "No se han podido cargar los detalles de PipelineRun: {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "descripción: la definición del paso no está disponible", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "Creado", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Conducto", "dashboard.tableHeader.status": "Estado", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "Anotaciones", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "Estado", "dashboard.taskRun.status.cancelled": "Cancelado", diff --git a/src/nls/messages_fr.json b/src/nls/messages_fr.json index 16b91c087..04521b590 100644 --- a/src/nls/messages_fr.json +++ b/src/nls/messages_fr.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "Une erreur s'est produite lors du chargement de PipelineRun", "dashboard.pipelineRun.failed": "Impossible de charger PipelineRun", "dashboard.pipelineRun.failedMessage": "Impossible de charger les détails de PipelineRun : {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "description : définition d'étape non disponible", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "Création", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Pipeline", "dashboard.tableHeader.status": "Statut", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "Journaux", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "Statut", "dashboard.taskRun.status.cancelled": "Annulé", diff --git a/src/nls/messages_it.json b/src/nls/messages_it.json index 09a173d5c..e371cf158 100644 --- a/src/nls/messages_it.json +++ b/src/nls/messages_it.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "Errore nel caricamento dell'esecuzione pipeline", "dashboard.pipelineRun.failed": "Impossibile caricare l'esecuzione pipeline", "dashboard.pipelineRun.failedMessage": "Impossibile caricare i dettagli dell'esecuzione pipeline: {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "descrizione: definizione passo non disponibile", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "Creato", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Pipeline", "dashboard.tableHeader.status": "Stato", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "Log", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "Stato", "dashboard.taskRun.status.cancelled": "Annullato", diff --git a/src/nls/messages_ja.json b/src/nls/messages_ja.json index a0d5e4b87..15d3cc2ad 100644 --- a/src/nls/messages_ja.json +++ b/src/nls/messages_ja.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "ClusterTaskが見つかりません", "dashboard.clusterTasksDropdown.label": "ClusterTaskを選択", "dashboard.clusterTriggerBinding.noParams": "このClusterTriggerBindingのパラメータが見つかりません", - "dashboard.createPipelineResource.name": "パイプラインリソース名を入力", - "dashboard.createPipelineResource.nameLabel": "名前", - "dashboard.createPipelineResource.namespaceError": "Namespaceが必要です", - "dashboard.createPipelineResource.revision": "パイプラインリソースのリビジョンを入力", - "dashboard.createPipelineResource.revisionError": "リビジョンが必要です", - "dashboard.createPipelineResource.revisionLabel": "リビジョン", - "dashboard.createPipelineResource.title": "PipelineResourceを作成", - "dashboard.createPipelineResource.type": "種類", - "dashboard.createPipelineResource.url": "パイプラインリソースのURLを入力", - "dashboard.createPipelineResource.urlError": "URLが必要です", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "PipelineRunの作成中にエラーが発生しました", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "小文字英数字およびハイフン(64文字未満)", "dashboard.createRun.invalidNamespace": "Namespaceは必須です", "dashboard.createRun.invalidParams": "パラメータは必須です", - "dashboard.createRun.invalidPipelineResources": "PipelineResourceは必須です", "dashboard.createRun.label.invalidText": "ラベルは{0}kubernetesラベル構文{1}に従う必要があります", "dashboard.createRun.labels.legendText": "ラベル", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "パラメータ", - "dashboard.pipelineResource.fieldName": "フィールド名", - "dashboard.pipelineResource.secretKey": "Secretキー", - "dashboard.pipelineResource.secretName": "Secret名", - "dashboard.pipelineResource.type": "種類:", - "dashboard.pipelineResources.error": "PipelineResourceのロード中にエラーが発生しました", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "PipelineResourceが見つかりません", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "''{type}''のPipelineResourceが見つかりません", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "''{namespace}'' NamespaceにPipelineResourceが見つかりません", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "''{namespace}'' Namespaceに''{type}''のPipelineResourceが見つかりません", - "dashboard.pipelineResourcesDropdown.label": "PipelineResourceを選択", "dashboard.pipelineRun.error": "PipelineRunのロード中にエラーが発生しました", "dashboard.pipelineRun.failed": "PipelineRunをロードできません", "dashboard.pipelineRun.failedMessage": "PipelineRunをロードできません:{reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "メインコンテンツへ", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "利用可能な定義がありません", - "dashboard.stepDefinition.inputResources": "入力リソース", - "dashboard.stepDefinition.outputResources": "出力リソース", "dashboard.tableHeader.createdTime": "作成日", "dashboard.tableHeader.default": "デフォルト値", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "", "dashboard.tableHeader.status": "ステータス", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "種類", "dashboard.tableHeader.value": "値", "dashboard.taskRun.logs": "ログ", "dashboard.taskRun.params": "パラメータ", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "結果", "dashboard.taskRun.status": "ステータス", "dashboard.taskRun.status.cancelled": "キャンセル済み", diff --git a/src/nls/messages_ko.json b/src/nls/messages_ko.json index c3d396e85..2fe6ec6ea 100644 --- a/src/nls/messages_ko.json +++ b/src/nls/messages_ko.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "PipelineRun 로드 중 오류 발생", "dashboard.pipelineRun.failed": "PipelineRun을 로드할 수 없음", "dashboard.pipelineRun.failedMessage": "PipelineRun 세부사항을 로드할 수 없습니다. {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "설명: 단계 정의를 사용할 수 없음", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "작성일", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "파이프라인", "dashboard.tableHeader.status": "상태", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "로그", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "상태", "dashboard.taskRun.status.cancelled": "취소됨", diff --git a/src/nls/messages_pt.json b/src/nls/messages_pt.json index 4a8c8b399..f0b30fe35 100644 --- a/src/nls/messages_pt.json +++ b/src/nls/messages_pt.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "Erro ao carregar o PipelineRun", "dashboard.pipelineRun.failed": "Não é possível carregar PipelineRun", "dashboard.pipelineRun.failedMessage": "Não é possível carregar detalhes de PipelineRun: {reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "Descrição: definição de etapa não disponível", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "Criado", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Pipeline", "dashboard.tableHeader.status": "Status", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "Logs", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "Status", "dashboard.taskRun.status.cancelled": "Cancelado", diff --git a/src/nls/messages_zh-Hans.json b/src/nls/messages_zh-Hans.json index 471b781bb..7cd473375 100644 --- a/src/nls/messages_zh-Hans.json +++ b/src/nls/messages_zh-Hans.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "未找到 ClusterTask", "dashboard.clusterTasksDropdown.label": "选择 ClusterTask", "dashboard.clusterTriggerBinding.noParams": "未找到该 ClusterTriggerBinding 的参数。", - "dashboard.createPipelineResource.name": "pipeline-resource-name", - "dashboard.createPipelineResource.nameLabel": "名称", - "dashboard.createPipelineResource.namespaceError": "NameSpace 是必须的", - "dashboard.createPipelineResource.revision": "pipeline-resource-revision", - "dashboard.createPipelineResource.revisionError": "修改历史是必须的", - "dashboard.createPipelineResource.revisionLabel": "修改历史", - "dashboard.createPipelineResource.title": "创建 PipelineResource", - "dashboard.createPipelineResource.type": "类型", - "dashboard.createPipelineResource.url": "pipeline-resource-url", - "dashboard.createPipelineResource.urlError": "URL 是必须的", - "dashboard.createPipelineResource.urlLabel": "URL", "dashboard.createPipelineRun.createError": "创建 PipelineRun 时失败", "dashboard.createPipelineRun.disabled": "禁用", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "必须少于 64 个字符,且只包含小写字母、数字或 -", "dashboard.createRun.invalidNamespace": "Namespace 不能为空", "dashboard.createRun.invalidParams": "Params 不能为空", - "dashboard.createRun.invalidPipelineResources": "PipelineResources 不能为空", "dashboard.createRun.label.invalidText": "Label 必须遵循 {0} Kubernetes 标签语法 {1}", "dashboard.createRun.labels.legendText": "标签", "dashboard.createRun.nodeSelector.legendText": "节点选择器", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "参数", - "dashboard.pipelineResource.fieldName": "字段名称", - "dashboard.pipelineResource.secretKey": "Secret 密钥", - "dashboard.pipelineResource.secretName": "Secret 名称", - "dashboard.pipelineResource.type": "类型:", - "dashboard.pipelineResources.error": "加载 PipelineResources 时发生错误", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "未找到 PipelineResources", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "未找到类型为 ''{type}'' 的 PipelineResources", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "在Namespace ''{namespace}'' 中未找到 PipelineResources", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "在 Namespace ''{namespace}'' 中未找到类型为 ''{type}'' 的 PipelineResources", - "dashboard.pipelineResourcesDropdown.label": "选择 PipelineResource", "dashboard.pipelineRun.error": "加载 PipelineRun 时出错", "dashboard.pipelineRun.failed": "无法加载 PipelineRun", "dashboard.pipelineRun.failedMessage": "无法加载 PipelineRun 详细信息:{reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "跳转到主要内容", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "步骤定义不可用", - "dashboard.stepDefinition.inputResources": "Input Resources", - "dashboard.stepDefinition.outputResources": "Output Resources", "dashboard.tableHeader.createdTime": "创建日期", "dashboard.tableHeader.default": "默认", "dashboard.tableHeader.expression": "表达式", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "Pipeline", "dashboard.tableHeader.status": "状态", "dashboard.tableHeader.task": "Task", - "dashboard.tableHeader.type": "种类", "dashboard.tableHeader.value": "值", "dashboard.taskRun.logs": "日志", "dashboard.taskRun.params": "参数", - "dashboard.taskRun.resources": "资源", "dashboard.taskRun.results": "结果", "dashboard.taskRun.status": "状态", "dashboard.taskRun.status.cancelled": "已取消", diff --git a/src/nls/messages_zh-Hant.json b/src/nls/messages_zh-Hant.json index 0a20868e5..971e30109 100644 --- a/src/nls/messages_zh-Hant.json +++ b/src/nls/messages_zh-Hant.json @@ -49,17 +49,6 @@ "dashboard.clusterTasksDropdown.empty": "", "dashboard.clusterTasksDropdown.label": "", "dashboard.clusterTriggerBinding.noParams": "", - "dashboard.createPipelineResource.name": "", - "dashboard.createPipelineResource.nameLabel": "", - "dashboard.createPipelineResource.namespaceError": "", - "dashboard.createPipelineResource.revision": "", - "dashboard.createPipelineResource.revisionError": "", - "dashboard.createPipelineResource.revisionLabel": "", - "dashboard.createPipelineResource.title": "", - "dashboard.createPipelineResource.type": "", - "dashboard.createPipelineResource.url": "", - "dashboard.createPipelineResource.urlError": "", - "dashboard.createPipelineResource.urlLabel": "", "dashboard.createPipelineRun.createError": "", "dashboard.createPipelineRun.disabled": "", "dashboard.createPipelineRun.empty": "", @@ -73,7 +62,6 @@ "dashboard.createResource.nameError": "", "dashboard.createRun.invalidNamespace": "", "dashboard.createRun.invalidParams": "", - "dashboard.createRun.invalidPipelineResources": "", "dashboard.createRun.label.invalidText": "", "dashboard.createRun.labels.legendText": "", "dashboard.createRun.nodeSelector.legendText": "", @@ -178,16 +166,6 @@ "dashboard.pagination.pageSize": "", "dashboard.pagination.previousPage": "", "dashboard.parameters.title": "", - "dashboard.pipelineResource.fieldName": "", - "dashboard.pipelineResource.secretKey": "", - "dashboard.pipelineResource.secretName": "", - "dashboard.pipelineResource.type": "", - "dashboard.pipelineResources.error": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces": "", - "dashboard.pipelineResourcesDropdown.empty.allNamespaces.type": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace": "", - "dashboard.pipelineResourcesDropdown.empty.selectedNamespace.type": "", - "dashboard.pipelineResourcesDropdown.label": "", "dashboard.pipelineRun.error": "載入 PipelineRun 時發生錯誤", "dashboard.pipelineRun.failed": "無法載入 PipelineRun", "dashboard.pipelineRun.failedMessage": "無法載入 PipelineRun 詳細資料:{reason}", @@ -235,8 +213,6 @@ "dashboard.skipToContent": "", "dashboard.startPipelineRun.actionText": "", "dashboard.step.definitionNotAvailable": "說明:步驟定義無法使用", - "dashboard.stepDefinition.inputResources": "", - "dashboard.stepDefinition.outputResources": "", "dashboard.tableHeader.createdTime": "已建立", "dashboard.tableHeader.default": "", "dashboard.tableHeader.expression": "", @@ -245,11 +221,9 @@ "dashboard.tableHeader.pipeline": "管線", "dashboard.tableHeader.status": "狀態", "dashboard.tableHeader.task": "", - "dashboard.tableHeader.type": "", "dashboard.tableHeader.value": "", "dashboard.taskRun.logs": "日誌", "dashboard.taskRun.params": "", - "dashboard.taskRun.resources": "", "dashboard.taskRun.results": "", "dashboard.taskRun.status": "狀態", "dashboard.taskRun.status.cancelled": "已取消", diff --git a/src/scss/App.scss b/src/scss/App.scss index 689527eba..edaa7c647 100644 --- a/src/scss/App.scss +++ b/src/scss/App.scss @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -39,7 +39,6 @@ limitations under the License. @import '@tektoncd/dashboard-components/src/components/LogoutButton/LogoutButton.scss'; @import '@tektoncd/dashboard-components/src/components/Param/Param.scss'; @import '@tektoncd/dashboard-components/src/components/PipelineRuns/PipelineRuns.scss'; -@import '@tektoncd/dashboard-components/src/components/ResourceTable/ResourceTable.scss'; @import '@tektoncd/dashboard-components/src/components/RunHeader/RunHeader.scss'; @import '@tektoncd/dashboard-components/src/components/Spinner/Spinner.scss'; @import '@tektoncd/dashboard-components/src/components/StatusIcon/StatusIcon.scss'; diff --git a/test/e2e-common.sh b/test/e2e-common.sh index 089713100..f8d185c92 100644 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2018-2022 The Tekton Authors +# Copyright 2018-2023 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. @@ -46,7 +46,7 @@ function install_pipelines() { kubectl apply --filename "https://github.com/tektoncd/pipeline/releases/download/$version/release.yaml" || fail_test "Tekton Pipelines installation failed" # Make sure that everything is cleaned up in the current namespace. - for res in pipelineresources tasks pipelines taskruns pipelineruns; do + for res in tasks pipelines taskruns pipelineruns; do kubectl delete --ignore-not-found=true ${res}.tekton.dev --all done diff --git a/webpack.common.js b/webpack.common.js index 01e22a71d..e89a602dc 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,5 +1,5 @@ /* -Copyright 2019-2022 The Tekton Authors +Copyright 2019-2023 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. You may obtain a copy of the License at @@ -45,6 +45,11 @@ module.exports = ({ mode }) => ({ { test: /\.(woff|woff2)$/, loader: 'file-loader' + }, + { + test: /\.yaml$/, + type: 'json', + use: [{ loader: 'yaml-loader', options: { asJSON: true } }] } ] },