Skip to content

Commit 8bdc2a6

Browse files
authored
Merge pull request #727 from devtron-labs/feat/retain-env-context
feat: use tab group in trigger output
2 parents ca32621 + 839580d commit 8bdc2a6

File tree

5 files changed

+84
-65
lines changed

5 files changed

+84
-65
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.13.0-pre-2",
3+
"version": "1.13.0-pre-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export const URLS = {
6565
CREATE_JOB: 'create-job',
6666
GETTING_STARTED: 'getting-started',
6767
STACK_MANAGER_ABOUT: '/stack-manager/about',
68-
APP_LIST_HELM: 'h',
6968
APP_CI_DETAILS: 'ci-details',
7069
LOGS: 'Logs',
7170
CREATE: '/create',

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import React, { useEffect, useMemo } from 'react'
18-
import { NavLink, Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom'
18+
import { Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom'
1919

2020
import { sanitizeTargetPlatforms } from '@Shared/Helpers'
2121

@@ -31,6 +31,7 @@ import {
3131
useInterval,
3232
} from '../../../Common'
3333
import { DEPLOYMENT_STAGE_TO_NODE_MAP, EMPTY_STATE_STATUS } from '../../constants'
34+
import { TabGroup, TabGroupProps } from '../TabGroup'
3435
import Artifacts from './Artifacts'
3536
import DeploymentDetailSteps from './DeploymentDetailSteps'
3637
import { DeploymentHistoryConfigDiff } from './DeploymentHistoryConfigDiff'
@@ -47,6 +48,7 @@ import {
4748
terminalStatus,
4849
TriggerOutputProps,
4950
} from './types'
51+
import { getTriggerOutputTabs } from './utils'
5052

5153
import './cicdHistory.scss'
5254

@@ -316,6 +318,11 @@ const TriggerOutput = ({
316318
(!!triggerDetailsResult?.result?.artifactId || !!triggerDetails?.artifactId),
317319
)
318320

321+
const tabs: TabGroupProps['tabs'] = useMemo(
322+
() => getTriggerOutputTabs(triggerDetails, deploymentAppType),
323+
[triggerDetails, deploymentAppType],
324+
)
325+
319326
useEffect(() => {
320327
if (triggerDetailsLoading) {
321328
return
@@ -409,66 +416,9 @@ const TriggerOutput = ({
409416
workflowExecutionStages={triggerDetails.workflowExecutionStages}
410417
namespace={triggerDetails.namespace}
411418
/>
412-
<ul className="pl-50 pr-20 pt-8 tab-list tab-list--nodes dc__border-bottom dc__position-sticky dc__top-0 bg__primary dc__zi-3">
413-
{triggerDetails.stage === 'DEPLOY' && deploymentAppType !== DeploymentAppTypes.HELM && (
414-
<li className="tab-list__tab" data-testid="deployment-history-steps-link">
415-
<NavLink
416-
replace
417-
className="tab-list__tab-link fs-13-imp pb-8 pt-0-imp"
418-
activeClassName="active"
419-
to="deployment-steps"
420-
>
421-
Steps
422-
</NavLink>
423-
</li>
424-
)}
425-
{!(triggerDetails.stage === 'DEPLOY' || triggerDetails.IsVirtualEnvironment) && (
426-
<li className="tab-list__tab" data-testid="deployment-history-logs-link">
427-
<NavLink
428-
replace
429-
className="tab-list__tab-link fs-13-imp pb-8 pt-0-imp"
430-
activeClassName="active"
431-
to="logs"
432-
>
433-
Logs
434-
</NavLink>
435-
</li>
436-
)}
437-
<li className="tab-list__tab" data-testid="deployment-history-source-code-link">
438-
<NavLink
439-
replace
440-
className="tab-list__tab-link fs-13-imp pb-8 pt-0-imp"
441-
activeClassName="active"
442-
to="source-code"
443-
>
444-
Source
445-
</NavLink>
446-
</li>
447-
{triggerDetails.stage === 'DEPLOY' && (
448-
<li className="tab-list__tab" data-testid="deployment-history-configuration-link">
449-
<NavLink
450-
replace
451-
className="tab-list__tab-link fs-13-imp pb-8 pt-0-imp"
452-
activeClassName="active"
453-
to="configuration"
454-
>
455-
Configuration
456-
</NavLink>
457-
</li>
458-
)}
459-
{(triggerDetails.stage !== 'DEPLOY' || triggerDetails.IsVirtualEnvironment) && (
460-
<li className="tab-list__tab" data-testid="deployment-history-artifacts-link">
461-
<NavLink
462-
replace
463-
className="tab-list__tab-link fs-13-imp pb-8 pt-0-imp"
464-
activeClassName="active"
465-
to="artifacts"
466-
>
467-
Artifacts
468-
</NavLink>
469-
</li>
470-
)}
471-
</ul>
419+
<div className="pl-50 pr-20 pt-8 dc__border-bottom dc__position-sticky dc__top-0 bg__primary dc__zi-3">
420+
<TabGroup tabs={tabs} />
421+
</div>
472422
</>
473423
)}
474424
<HistoryLogs

src/Shared/Components/CICDHistory/utils.tsx

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ import { ReactComponent as ICInProgress } from '@Icons/ic-in-progress.svg'
2626
import { ReactComponent as TimeOut } from '@Icons/ic-timeout-red.svg'
2727
import { ReactComponent as Timer } from '@Icons/ic-timer.svg'
2828
import { DATE_TIME_FORMATS } from '@Common/Constants'
29+
import { DeploymentAppTypes } from '@Common/Types'
2930
import { ALL_RESOURCE_KIND_FILTER } from '@Shared/constants'
3031
import { isTimeStringAvailable } from '@Shared/Helpers'
3132

3233
import { Node, ResourceKindType, WorkflowStatusEnum } from '../../types'
3334
import { Icon } from '../Icon'
3435
import { AppStatus, DeploymentStatus, StatusType } from '../StatusComponent'
36+
import { TabGroupProps } from '../TabGroup'
3537
import {
3638
DEFAULT_CLUSTER_ID,
3739
DEFAULT_NAMESPACE,
@@ -42,6 +44,7 @@ import {
4244
DeploymentHistory,
4345
DeploymentHistoryResultObject,
4446
ExecutionInfoType,
47+
History,
4548
NodeFilters,
4649
NodeStatus,
4750
PodExecutionStageDTO,
@@ -375,3 +378,70 @@ export const getTriggerStatusIcon = (status: string) => {
375378
return status
376379
}
377380
}
381+
382+
export const getTriggerOutputTabs = (
383+
triggerDetails: History,
384+
deploymentAppType: DeploymentAppTypes,
385+
): TabGroupProps['tabs'] => [
386+
...(triggerDetails.stage === 'DEPLOY' && deploymentAppType !== DeploymentAppTypes.HELM
387+
? [
388+
{
389+
id: 'deployment-history-steps-link',
390+
label: 'Steps',
391+
tabType: 'navLink' as const,
392+
props: {
393+
to: 'deployment-steps',
394+
'data-testid': 'deployment-history-steps-link',
395+
},
396+
},
397+
]
398+
: []),
399+
...(!(triggerDetails.stage === 'DEPLOY' || triggerDetails.IsVirtualEnvironment)
400+
? [
401+
{
402+
id: 'deployment-history-logs-link',
403+
label: 'Logs',
404+
tabType: 'navLink' as const,
405+
props: {
406+
to: 'logs',
407+
'data-testid': 'deployment-history-logs-link',
408+
},
409+
},
410+
]
411+
: []),
412+
{
413+
id: 'deployment-history-source-code-link',
414+
label: 'Source',
415+
tabType: 'navLink',
416+
props: {
417+
to: 'source-code',
418+
'data-testid': 'deployment-history-source-code-link',
419+
},
420+
},
421+
...(triggerDetails.stage === 'DEPLOY'
422+
? [
423+
{
424+
id: 'deployment-history-configuration-link',
425+
label: 'Configuration',
426+
tabType: 'navLink' as const,
427+
props: {
428+
to: 'configuration',
429+
'data-testid': 'deployment-history-configuration-link',
430+
},
431+
},
432+
]
433+
: []),
434+
...(triggerDetails.stage !== 'DEPLOY' || triggerDetails.IsVirtualEnvironment
435+
? [
436+
{
437+
id: 'deployment-history-artifacts-link',
438+
label: 'Artifacts',
439+
tabType: 'navLink' as const,
440+
props: {
441+
to: 'artifacts',
442+
'data-testid': 'deployment-history-artifacts-link',
443+
},
444+
},
445+
]
446+
: []),
447+
]

0 commit comments

Comments
 (0)