diff --git a/package-lock.json b/package-lock.json index b09819c3e..2f8afd806 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0-pre-2", + "version": "1.13.0-pre-3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0-pre-2", + "version": "1.13.0-pre-3", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index b58d4c174..47fbe8eeb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0-pre-2", + "version": "1.13.0-pre-3", "description": "Supporting common component library", "type": "module", "main": "dist/index.js", diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index 86964dd9d..49ce89f06 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -65,7 +65,6 @@ export const URLS = { CREATE_JOB: 'create-job', GETTING_STARTED: 'getting-started', STACK_MANAGER_ABOUT: '/stack-manager/about', - APP_LIST_HELM: 'h', APP_CI_DETAILS: 'ci-details', LOGS: 'Logs', CREATE: '/create', diff --git a/src/Shared/Components/CICDHistory/TriggerOutput.tsx b/src/Shared/Components/CICDHistory/TriggerOutput.tsx index 08e59dde1..fd614c38e 100644 --- a/src/Shared/Components/CICDHistory/TriggerOutput.tsx +++ b/src/Shared/Components/CICDHistory/TriggerOutput.tsx @@ -15,7 +15,7 @@ */ import React, { useEffect, useMemo } from 'react' -import { NavLink, Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom' +import { Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom' import { sanitizeTargetPlatforms } from '@Shared/Helpers' @@ -31,6 +31,7 @@ import { useInterval, } from '../../../Common' import { DEPLOYMENT_STAGE_TO_NODE_MAP, EMPTY_STATE_STATUS } from '../../constants' +import { TabGroup, TabGroupProps } from '../TabGroup' import Artifacts from './Artifacts' import DeploymentDetailSteps from './DeploymentDetailSteps' import { DeploymentHistoryConfigDiff } from './DeploymentHistoryConfigDiff' @@ -47,6 +48,7 @@ import { terminalStatus, TriggerOutputProps, } from './types' +import { getTriggerOutputTabs } from './utils' import './cicdHistory.scss' @@ -316,6 +318,11 @@ const TriggerOutput = ({ (!!triggerDetailsResult?.result?.artifactId || !!triggerDetails?.artifactId), ) + const tabs: TabGroupProps['tabs'] = useMemo( + () => getTriggerOutputTabs(triggerDetails, deploymentAppType), + [triggerDetails, deploymentAppType], + ) + useEffect(() => { if (triggerDetailsLoading) { return @@ -409,66 +416,9 @@ const TriggerOutput = ({ workflowExecutionStages={triggerDetails.workflowExecutionStages} namespace={triggerDetails.namespace} /> - +
+ +
)} { return status } } + +export const getTriggerOutputTabs = ( + triggerDetails: History, + deploymentAppType: DeploymentAppTypes, +): TabGroupProps['tabs'] => [ + ...(triggerDetails.stage === 'DEPLOY' && deploymentAppType !== DeploymentAppTypes.HELM + ? [ + { + id: 'deployment-history-steps-link', + label: 'Steps', + tabType: 'navLink' as const, + props: { + to: 'deployment-steps', + 'data-testid': 'deployment-history-steps-link', + }, + }, + ] + : []), + ...(!(triggerDetails.stage === 'DEPLOY' || triggerDetails.IsVirtualEnvironment) + ? [ + { + id: 'deployment-history-logs-link', + label: 'Logs', + tabType: 'navLink' as const, + props: { + to: 'logs', + 'data-testid': 'deployment-history-logs-link', + }, + }, + ] + : []), + { + id: 'deployment-history-source-code-link', + label: 'Source', + tabType: 'navLink', + props: { + to: 'source-code', + 'data-testid': 'deployment-history-source-code-link', + }, + }, + ...(triggerDetails.stage === 'DEPLOY' + ? [ + { + id: 'deployment-history-configuration-link', + label: 'Configuration', + tabType: 'navLink' as const, + props: { + to: 'configuration', + 'data-testid': 'deployment-history-configuration-link', + }, + }, + ] + : []), + ...(triggerDetails.stage !== 'DEPLOY' || triggerDetails.IsVirtualEnvironment + ? [ + { + id: 'deployment-history-artifacts-link', + label: 'Artifacts', + tabType: 'navLink' as const, + props: { + to: 'artifacts', + 'data-testid': 'deployment-history-artifacts-link', + }, + }, + ] + : []), +]