From 69bb0dafa6743e001491ba793cc9d0a94f163d9a Mon Sep 17 00:00:00 2001 From: karthik Date: Fri, 10 Nov 2023 20:17:41 +0530 Subject: [PATCH] move pipelinerun results to output tab --- .../pipelines-plugin/console-extensions.json | 43 +++++++++++++++++++ .../locales/en/pipelines-plugin.json | 2 + .../packages/pipelines-plugin/package.json | 3 +- .../detail-page-tabs/PipelineRunDetails.tsx | 24 ++--------- .../components/shared/results/OutputTab.tsx | 28 ++++++++++++ .../src/components/shared/results/index.ts | 1 + 6 files changed, 79 insertions(+), 22 deletions(-) create mode 100644 frontend/packages/pipelines-plugin/src/components/shared/results/OutputTab.tsx create mode 100644 frontend/packages/pipelines-plugin/src/components/shared/results/index.ts diff --git a/frontend/packages/pipelines-plugin/console-extensions.json b/frontend/packages/pipelines-plugin/console-extensions.json index 6243684593d..8dacb68436b 100644 --- a/frontend/packages/pipelines-plugin/console-extensions.json +++ b/frontend/packages/pipelines-plugin/console-extensions.json @@ -1115,5 +1115,48 @@ "flags": { "disallowed": ["HIDE_STATIC_PIPELINE_PLUGIN_PIPELINE_DETAIL_METRICS_TAB"] } + }, + { + "type": "console.tab/horizontalNav", + "properties": { + "id": "Output", + "name": "Output", + "model": { + "group": "tekton.dev", + "version": "v1", + "kind": "PipelineRun" + }, + "page": { + "name": "%pipelines-plugin~Output%", + "href": "output" + }, + "component": { "$codeRef": "ResultsComponent.OutputTab" } + } , + "flags": { + "required": ["OPENSHIFT_PIPELINE"], + "disallowed": ["CONSOLE_PIPELINE_PLUGIN"] + } + }, + { + "type": "console.tab/horizontalNav", + "properties": { + "id": "Output", + "name": "Output", + + "model": { + "group": "tekton.dev", + "version": "v1beta1", + "kind": "PipelineRun" + }, + "page": { + "name": "%pipelines-plugin~Output%", + "href": "output" + }, + "component": { "$codeRef": "ResultsComponent.OutputTab" } + } , + "flags": { + "required": ["OPENSHIFT_PIPELINE"], + "disallowed": ["CONSOLE_PIPELINE_PLUGIN"] + } } ] diff --git a/frontend/packages/pipelines-plugin/locales/en/pipelines-plugin.json b/frontend/packages/pipelines-plugin/locales/en/pipelines-plugin.json index 337f6eb2014..ef9a14b0361 100644 --- a/frontend/packages/pipelines-plugin/locales/en/pipelines-plugin.json +++ b/frontend/packages/pipelines-plugin/locales/en/pipelines-plugin.json @@ -30,6 +30,7 @@ "Community": "Community", "Browse tekton hub tasks.": "Browse tekton hub tasks.", "Metrics": "Metrics", + "Output": "Output", "Add": "Add", "{{clusterTaskLabel}} details": "{{clusterTaskLabel}} details", "Once your Pipeline Repository is configured, in order to update your {{translatedResourceName}} <4>{{name}} automatically, update the following in your <6>.tekton PipelineRun:": "Once your Pipeline Repository is configured, in order to update your {{translatedResourceName}} <4>{{name}} automatically, update the following in your <6>.tekton PipelineRun:", @@ -408,6 +409,7 @@ "Events triggering the webhook: ": "Events triggering the webhook: ", "Read more about setting up webhook": "Read more about setting up webhook", "No options matching your criteria": "No options matching your criteria", + "No Output found": "No Output found", "{{resourceName}} results": "{{resourceName}} results", "No {{resourceName}} results available due to failure": "No {{resourceName}} results available due to failure", "Empty Directories": "Empty Directories", diff --git a/frontend/packages/pipelines-plugin/package.json b/frontend/packages/pipelines-plugin/package.json index 887d68fcebf..7ea4b781d18 100644 --- a/frontend/packages/pipelines-plugin/package.json +++ b/frontend/packages/pipelines-plugin/package.json @@ -23,7 +23,8 @@ "pipelinesComponent": "src/components/pipelines-index.ts", "tasksComponent": "src/components/tasks-index.ts", "triggersComponent": "src/components/triggers-index.ts", - "pacComponent": "src/components/pac/index.ts" + "pacComponent": "src/components/pac/index.ts", + "ResultsComponent": "src/components/shared/results" } } } diff --git a/frontend/packages/pipelines-plugin/src/components/pipelineruns/detail-page-tabs/PipelineRunDetails.tsx b/frontend/packages/pipelines-plugin/src/components/pipelineruns/detail-page-tabs/PipelineRunDetails.tsx index c241e6a879f..7373e59bf47 100644 --- a/frontend/packages/pipelines-plugin/src/components/pipelineruns/detail-page-tabs/PipelineRunDetails.tsx +++ b/frontend/packages/pipelines-plugin/src/components/pipelineruns/detail-page-tabs/PipelineRunDetails.tsx @@ -1,9 +1,5 @@ import * as React from 'react'; -import { useTranslation } from 'react-i18next'; -import { PipelineRunModel } from '../../../models'; import { PipelineRunKind } from '../../../types'; -import { pipelineRunFilterReducer } from '../../../utils/pipeline-filter-reducer'; -import ResultsList from '../../shared/results/ResultsList'; import PipelineRunDetailsSection from './PipelineRunDetailsSection'; import './TriggeredBySection.scss'; @@ -12,23 +8,9 @@ export interface PipelineRunDetailsProps { } export const PipelineRunDetails: React.FC = ({ obj: pipelineRun }) => { - const { t } = useTranslation(); return ( - <> -
- -
- - {pipelineRun.status?.pipelineResults || - (pipelineRun.status?.results && ( -
- -
- ))} - +
+ +
); }; diff --git a/frontend/packages/pipelines-plugin/src/components/shared/results/OutputTab.tsx b/frontend/packages/pipelines-plugin/src/components/shared/results/OutputTab.tsx new file mode 100644 index 00000000000..1d1e7942fd5 --- /dev/null +++ b/frontend/packages/pipelines-plugin/src/components/shared/results/OutputTab.tsx @@ -0,0 +1,28 @@ +import * as React from 'react'; +import { EmptyState, EmptyStateBody, EmptyStateVariant } from '@patternfly/react-core'; +import { useTranslation } from 'react-i18next'; +import { PipelineRunModel } from '../../../models'; +import { PipelineRunKind } from '../../../types'; +import { pipelineRunFilterReducer } from '../../../utils/pipeline-filter-reducer'; +import ResultsList from './ResultsList'; + +const OutputTab: React.FC<{ obj: PipelineRunKind }> = ({ obj: pipelineRun }) => { + const { t } = useTranslation(); + + return pipelineRun.status?.pipelineResults || pipelineRun.status?.results ? ( +
+ +
+ ) : ( + + +

{t('pipelines-plugin~No Output found')}

+
+
+ ); +}; +export default OutputTab; diff --git a/frontend/packages/pipelines-plugin/src/components/shared/results/index.ts b/frontend/packages/pipelines-plugin/src/components/shared/results/index.ts new file mode 100644 index 00000000000..7f2aae50e07 --- /dev/null +++ b/frontend/packages/pipelines-plugin/src/components/shared/results/index.ts @@ -0,0 +1 @@ +export { default as OutputTab } from './OutputTab';