Skip to content

Commit 6cdc762

Browse files
committed
feat: DeploymentConfigDiff
- DeploymentConfigDiffNavigation - add support for tabs - DeploymentConfigDiff.utils - add manifest data utils - DeploymentConfigDiffMain - add support for error screen
1 parent 82defbf commit 6cdc762

9 files changed

+261
-90
lines changed

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DeploymentConfigDiffNavigation } from './DeploymentConfigDiffNavigation'
22
import { DeploymentConfigDiffMain } from './DeploymentConfigDiffMain'
3-
import { DeploymentConfigDiffProps } from './types'
3+
import { DeploymentConfigDiffProps } from './DeploymentConfigDiff.types'
44
import './DeploymentConfigDiff.scss'
55

66
export const DeploymentConfigDiff = ({
@@ -11,6 +11,7 @@ export const DeploymentConfigDiff = ({
1111
goBackURL,
1212
navHeading,
1313
navHelpText,
14+
tabConfig,
1415
...resProps
1516
}: DeploymentConfigDiffProps) => (
1617
<div className="deployment-config-diff">
@@ -21,6 +22,7 @@ export const DeploymentConfigDiff = ({
2122
goBackURL={goBackURL}
2223
navHeading={navHeading}
2324
navHelpText={navHelpText}
25+
tabConfig={tabConfig}
2426
/>
2527
<DeploymentConfigDiffMain isLoading={isLoading} configList={configList} {...resProps} />
2628
</div>

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
height: calc(100vh - 122px);
2222
overflow: auto;
2323

24+
&__heading {
25+
display: grid;
26+
// -15px to accommodate the right side bar of the code-editor
27+
grid-template-columns: calc(50% - 15px) calc(50% - 15px);
28+
grid-template-rows: auto;
29+
}
30+
2431
&__comparison {
2532
margin: 16px 0 0;
2633
}
@@ -29,4 +36,18 @@
2936
& .react-monaco-editor-container {
3037
min-height: 100px;
3138
}
39+
40+
&__tab-list {
41+
list-style: none;
42+
}
43+
44+
&__tab {
45+
&, &:hover {
46+
color: var(--N700);
47+
}
48+
49+
&--active, &--active:hover {
50+
color: var(--N900);
51+
}
52+
}
3253
}

src/Shared/Components/DeploymentConfigDiff/types.ts renamed to src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.types.ts

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { SortingOrder } from '@Common/Constants'
22

3-
import { ConfigMapSecretDataConfigDatumDTO, DeploymentTemplateDTO } from '@Shared/Services'
3+
import {
4+
AppEnvDeploymentConfigDTO,
5+
ConfigMapSecretDataConfigDatumDTO,
6+
DeploymentTemplateDTO,
7+
EnvResourceType,
8+
ManifestTemplateDTO,
9+
} from '@Shared/Services'
10+
411
import { DeploymentHistoryDetail } from '../CICDHistory'
512
import { CollapsibleListConfig, CollapsibleListItem } from '../CollapsibleList'
613
import { SelectPickerProps } from '../SelectPicker'
@@ -45,6 +52,11 @@ export interface DeploymentConfigDiffNavigationCollapsibleItem
4552

4653
export interface DeploymentConfigDiffProps {
4754
isLoading?: boolean
55+
errorConfig?: {
56+
error: boolean
57+
code: number
58+
reload: () => void
59+
}
4860
configList: DeploymentConfigListItem[]
4961
headerText?: string
5062
scrollIntoViewId?: string
@@ -62,18 +74,31 @@ export interface DeploymentConfigDiffProps {
6274
goBackURL?: string
6375
navHeading: string
6476
navHelpText?: string
77+
tabConfig?: {
78+
tabs: {
79+
value: string
80+
href: string
81+
}[]
82+
onClick: (tab: string) => void
83+
}
6584
}
6685

6786
export interface DeploymentConfigDiffNavigationProps
6887
extends Pick<
6988
DeploymentConfigDiffProps,
70-
'isLoading' | 'navList' | 'collapsibleNavList' | 'goBackURL' | 'navHeading' | 'navHelpText'
89+
'isLoading' | 'navList' | 'collapsibleNavList' | 'goBackURL' | 'navHeading' | 'navHelpText' | 'tabConfig'
7190
> {}
7291

7392
export interface DeploymentConfigDiffMainProps
7493
extends Pick<
7594
DeploymentConfigDiffProps,
76-
'isLoading' | 'headerText' | 'configList' | 'scrollIntoViewId' | 'selectorsConfig' | 'sortingConfig'
95+
| 'isLoading'
96+
| 'errorConfig'
97+
| 'headerText'
98+
| 'configList'
99+
| 'scrollIntoViewId'
100+
| 'selectorsConfig'
101+
| 'sortingConfig'
77102
> {}
78103

79104
export interface DeploymentConfigDiffAccordionProps extends Pick<CollapseProps, 'onTransitionEnd'> {
@@ -88,3 +113,18 @@ export interface DeploymentConfigDiffAccordionProps extends Pick<CollapseProps,
88113
export type DiffHeadingDataType<DeploymentTemplate> = DeploymentTemplate extends true
89114
? DeploymentTemplateDTO
90115
: ConfigMapSecretDataConfigDatumDTO
116+
117+
export type AppEnvDeploymentConfigListParams<IsManifestView> = (IsManifestView extends true
118+
? {
119+
currentList: ManifestTemplateDTO
120+
compareList: ManifestTemplateDTO
121+
sortOrder?: never
122+
}
123+
: {
124+
currentList: AppEnvDeploymentConfigDTO
125+
compareList: AppEnvDeploymentConfigDTO
126+
sortOrder?: SortingOrder
127+
}) & {
128+
getNavItemHref: (resourceType: EnvResourceType, resourceName: string) => string
129+
isManifestView?: IsManifestView
130+
}

0 commit comments

Comments
 (0)