Skip to content

Commit

Permalink
Merge pull request #134 from lokanandaprabhu/feature/adding-k8s-overv…
Browse files Browse the repository at this point in the history
…iew-page

ODC-7629: Add pipelines overview page for cluster/live data
  • Loading branch information
openshift-merge-bot[bot] authored Aug 7, 2024
2 parents 24c8b12 + 5309cd7 commit dbe40ff
Show file tree
Hide file tree
Showing 34 changed files with 3,090 additions and 26 deletions.
55 changes: 54 additions & 1 deletion console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,23 @@
"required": ["PIPELINE_TEKTON_RESULT_INSTALLED"]
}
},
{
"type": "console.page/route",
"properties": {
"exact": true,
"path": [
"/pipelines-overview/ns/:ns",
"/pipelines-overview/all-namespaces"
],
"component": {
"$codeRef": "pipelinesComponent.PipelinesOverviewPageK8s"
}
},
"flags": {
"required": ["OPENSHIFT_PIPELINE"],
"disallowed": ["PIPELINE_TEKTON_RESULT_INSTALLED"]
}
},
{
"type": "console.navigation/href",
"properties": {
Expand All @@ -168,7 +185,7 @@
"namespaced": true
},
"flags": {
"required": ["OPENSHIFT_PIPELINE", "PIPELINE_TEKTON_RESULT_INSTALLED"]
"required": ["OPENSHIFT_PIPELINE"]
}
},
{
Expand All @@ -189,6 +206,42 @@
"required": ["PIPELINE_TEKTON_RESULT_INSTALLED"]
}
},
{
"type": "console.tab/horizontalNav",
"properties": {
"model": {
"group": "tekton.dev",
"version": "v1beta1",
"kind": "Pipeline"
},
"page": {
"name": "%plugin__pipelines-console-plugin~Metrics%",
"href": "metrics"
},
"component": { "$codeRef": "metricsComponent.PipelinesMetricsPageK8s" }
},
"flags": {
"disallowed": ["PIPELINE_TEKTON_RESULT_INSTALLED"]
}
},
{
"type": "console.tab/horizontalNav",
"properties": {
"model": {
"group": "tekton.dev",
"version": "v1",
"kind": "Pipeline"
},
"page": {
"name": "%plugin__pipelines-console-plugin~Metrics%",
"href": "metrics"
},
"component": { "$codeRef": "metricsComponent.PipelinesMetricsPageK8s" }
},
"flags": {
"disallowed": ["PIPELINE_TEKTON_RESULT_INSTALLED"]
}
},
{
"type": "console.tab/horizontalNav",
"properties": {
Expand Down
6 changes: 6 additions & 0 deletions locales/en/plugin__pipelines-console-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"Custom Task": "Custom Task",
"CustomRun": "CustomRun",
"CustomRuns": "CustomRuns",
"Data is incomplete. To see the full view, please enable ": "Data is incomplete. To see the full view, please enable ",
"Data source": "Data source",
"Decrement": "Decrement",
"Default value": "Default value",
Expand Down Expand Up @@ -172,6 +173,7 @@
"Image Registry": "Image Registry",
"Image Registry Credentials": "Image Registry Credentials",
"Increment": "Increment",
"Info": "Info",
"Init containers": "Init containers",
"Install Cosign": "Install Cosign",
"Installing": "Installing",
Expand Down Expand Up @@ -247,6 +249,7 @@
"Output": "Output",
"Overview": "Overview",
"Owner": "Owner",
"Page Not Found (404)": "Page Not Found (404)",
"Parameters": "Parameters",
"Partially approved": "Partially approved",
"Password": "Password",
Expand All @@ -272,6 +275,7 @@
"PipelineRun not started yet": "PipelineRun not started yet",
"PipelineRun status": "PipelineRun status",
"PipelineRun Status shows the % of PipelineRuns for various status like \"Succeeded\", \"Failed\", \"Running\", \"Cancelled\" and \"Others\". Here, Others includes statuses like \"Started\", \"CreateRunFailed\", \"PipelineRunTimeout\"": "PipelineRun Status shows the % of PipelineRuns for various status like \"Succeeded\", \"Failed\", \"Running\", \"Cancelled\" and \"Others\". Here, Others includes statuses like \"Started\", \"CreateRunFailed\", \"PipelineRunTimeout\"",
"PipelineRun status shows the % of PipelineRuns for various statuses like \"Succeeded\", \"Failed\" and \"Cancelled\".": "PipelineRun status shows the % of PipelineRuns for various statuses like \"Succeeded\", \"Failed\" and \"Cancelled\".",
"PipelineRuns": "PipelineRuns",
"Pipelines": "Pipelines",
"Please <2>try again</2>.": "Please <2>try again</2>.",
Expand Down Expand Up @@ -301,6 +305,7 @@
"Rerun": "Rerun",
"Reset": "Reset",
"Resource is being fetched from Tekton Results.": "Resource is being fetched from Tekton Results.",
"Resource is deleted.": "Resource is deleted.",
"Route": "Route",
"Routes": "Routes",
"run{{plural}} in other namespaces.": "run{{plural}} in other namespaces.",
Expand Down Expand Up @@ -371,6 +376,7 @@
"TaskRun name": "TaskRun name",
"TaskRuns": "TaskRuns",
"Tasks": "Tasks",
"Tekton results": "Tekton results",
"TektonResult": "TektonResult",
"TektonResults": "TektonResults",
"The base server url (e.g. https://github.com)": "The base server url (e.g. https://github.com)",
Expand Down
25 changes: 25 additions & 0 deletions src/components/common/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as React from 'react';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import {
EmptyState,
EmptyStateHeader,
EmptyStateVariant,
} from '@patternfly/react-core';

export const ErrorPage404: React.FC = () => {
const { t } = useTranslation('plugin__pipelines-console-plugin');
return (
<div>
<Helmet>
<title>{t('Page Not Found (404)')}</title>
</Helmet>
<EmptyState variant={EmptyStateVariant.lg}>
<EmptyStateHeader
titleText={t('Page Not Found (404)')}
headingLevel="h4"
/>
</EmptyState>
</div>
);
};
8 changes: 4 additions & 4 deletions src/components/hooks/flagHookProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const useFlagHookProvider = (setFeatureFlag: SetFeatureFlag) => {
FLAG_HIDE_STATIC_PIPELINE_PLUGIN_PIPELINERUN_DETAIL_APPROVALS_TAB,
true,
);
setFeatureFlag(
FLAG_HIDE_STATIC_PIPELINE_PLUGIN_PIPELINE_DETAIL_METRICS_TAB,
true,
);
};

export const useTektonResultInstallProvider = (
Expand All @@ -106,8 +110,4 @@ export const useTektonResultInstallProvider = (
fetch();
}, []);
setFeatureFlag(FLAG_PIPELINE_TEKTON_RESULT_INSTALLED, data ? true : false);
setFeatureFlag(
FLAG_HIDE_STATIC_PIPELINE_PLUGIN_PIPELINE_DETAIL_METRICS_TAB,
data ? true : false,
);
};
5 changes: 3 additions & 2 deletions src/components/pipelines-details/PipelineDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ import { triggerPipeline } from '../pipelines-list/PipelineKebab';
import { StartedByAnnotation } from '../../consts';
import { usePipelineTriggerTemplateNames } from '../utils/triggers';
import { resourcePathFromModel } from '../utils/utils';
import { ErrorPage404 } from '../common/error';

const PipelineDetailsPage = () => {
const { t } = useTranslation('plugin__pipelines-console-plugin');
const params = useParams();
const history = useHistory();
const navigate = useNavigate();
const { name, ns: namespace } = params;
const [pipeline, loaded] = useK8sWatchResource<PipelineKind>({
const [pipeline, loaded, loadError] = useK8sWatchResource<PipelineKind>({
groupVersionKind: getGroupVersionKindForModel(PipelineModel),
namespace,
name,
Expand Down Expand Up @@ -125,7 +126,7 @@ const PipelineDetailsPage = () => {
};

if (!loaded) {
return <LoadingBox />;
return loadError ? <ErrorPage404 /> : <LoadingBox />;
}
return (
<DetailsPage
Expand Down
Loading

0 comments on commit dbe40ff

Please sign in to comment.