Skip to content

Commit f4d7a03

Browse files
authored
Merge pull request #212 from devtron-labs/feat/lock-deployment-configuration
feat: lock deployment configuration
2 parents b1aae68 + 236d1e3 commit f4d7a03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+917
-103
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": "0.1.19",
3+
"version": "0.2.0",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-book-open.svg

Lines changed: 16 additions & 0 deletions
Loading

src/Assets/Icon/ic-filter-applied.svg

Lines changed: 16 additions & 0 deletions
Loading

src/Assets/Icon/ic-filter.svg

Lines changed: 16 additions & 0 deletions
Loading

src/Assets/Icon/ic-lego-block.svg

Lines changed: 16 additions & 0 deletions
Loading

src/Common/ChartVersionAndTypeSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const ChartVersionAndTypeSelector = ({ setSelectedChartRefId }: ChartVersionAndT
7070
return (
7171
<div className="flex">
7272
<div className="chart-type-options flex" data-testid="chart-type-options">
73-
<span className="chart-type-options-label mr-4">Chart Type</span>
73+
<span className="cn-7 mr-4">Chart Type</span>
7474
<ReactSelect
7575
value={selectedChartType ?? chartTypeOptions[0]}
7676
options={chartTypeOptions}
@@ -79,7 +79,7 @@ const ChartVersionAndTypeSelector = ({ setSelectedChartRefId }: ChartVersionAndT
7979
/>
8080
</div>
8181
<div className="chart-version-options flex" data-testid="chart-version-options">
82-
<span className="chart-version-options-label mr-4">Chart Version</span>
82+
<span className="cn-7 mr-4">Chart Version</span>
8383
<ReactSelect
8484
value={selectedChartVersion ?? chartVersionOptions[0]}
8585
options={chartVersionOptions}

src/Common/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ export const ROUTES = {
9595
CONFIG_CD_PIPELINE: 'config/cd-pipeline',
9696
MODULE_CONFIGURED: 'module/config',
9797
RESOURCE_HISTORY_DEPLOYMENT: 'resource/history/deployment',
98+
APP_LIST_MIN: 'app/min',
99+
CLUSTER_LIST_MIN: 'cluster/autocomplete',
98100
PLUGIN_GLOBAL_LIST_DETAIL_V2: 'plugin/global/list/detail/v2',
99101
PLUGIN_GLOBAL_LIST_V2: 'plugin/global/list/v2',
100102
PLUGIN_GLOBAL_LIST_TAGS: 'plugin/global/list/tags',

src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const SortableTableHeaderCell = ({
6161
return (
6262
<button
6363
type="button"
64-
className="dc__transparent p-0 bcn-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text"
64+
className={`dc__transparent p-0 bcn-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text ${!isSortable ? 'cursor-default' : ''}`}
6565
onClick={isSortable ? triggerSorting : noop}
6666
disabled={disabled}
6767
>

src/Common/Tippy.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { useEffect, useRef, useState } from 'react'
218
import TippyJS, { TippyProps as TippyJSProps } from '@tippyjs/react'
319

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
export * from './types'

src/Pages/GlobalConfigurations/ScopedVariables/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
export enum ScopedVariablesFileViewType {
218
/**
319
* Used to show yaml editor for editing/creating variables
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
export { default as DetectBottom } from './DetectBottom.component'

src/Shared/Components/FilterChips/FilterChips.component.tsx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const FilterChip = ({
2424
handleRemoveFilter,
2525
getFormattedLabel = noop,
2626
getFormattedValue = noop,
27+
showRemoveIcon,
2728
shouldHideLabel = false,
2829
}: FilterChipProps) => {
2930
const removeFilter = () => {
@@ -45,14 +46,16 @@ const FilterChip = ({
4546
</>
4647
)}
4748
<span className="dc__ellipsis-right">{valueToDisplay}</span>
48-
<button
49-
type="button"
50-
className="flex p-0 dc__transparent"
51-
onClick={removeFilter}
52-
aria-label="Remove filter"
53-
>
54-
<CloseIcon className="icon-dim-12 icon-use-fill-n6" />
55-
</button>
49+
{showRemoveIcon && (
50+
<button
51+
type="button"
52+
className="flex p-0 dc__transparent dc__hover-n50 br-4"
53+
onClick={removeFilter}
54+
aria-label="Remove filter"
55+
>
56+
<CloseIcon className="icon-dim-12 icon-use-fill-n6" />
57+
</button>
58+
)}
5659
</div>
5760
)
5861
)
@@ -69,6 +72,7 @@ const FilterChips = <T = Record<string, unknown>,>({
6972
getFormattedValue,
7073
className = '',
7174
clearButtonClassName = '',
75+
showClearAndRemove = true,
7276
shouldHideLabel,
7377
}: FilterChipsProps<T>) => {
7478
const handleRemoveFilter = (filterKey, valueToRemove) => {
@@ -101,6 +105,7 @@ const FilterChips = <T = Record<string, unknown>,>({
101105
handleRemoveFilter={handleRemoveFilter}
102106
getFormattedLabel={getFormattedLabel}
103107
getFormattedValue={getFormattedValue}
108+
showRemoveIcon={showClearAndRemove}
104109
shouldHideLabel={shouldHideLabel}
105110
/>
106111
))
@@ -112,19 +117,22 @@ const FilterChips = <T = Record<string, unknown>,>({
112117
handleRemoveFilter={handleRemoveFilter}
113118
getFormattedLabel={getFormattedLabel}
114119
getFormattedValue={getFormattedValue}
120+
showRemoveIcon={showClearAndRemove}
115121
shouldHideLabel={shouldHideLabel}
116122
/>
117123
),
118124
)}
119-
<div className="flex">
120-
<button
121-
type="button"
122-
className={`cta text fs-13-imp lh-20-imp h-20 p-0-imp ${clearButtonClassName}`}
123-
onClick={clearFilters}
124-
>
125-
Clear All Filters
126-
</button>
127-
</div>
125+
{showClearAndRemove && (
126+
<div className="flex">
127+
<button
128+
type="button"
129+
className={`cta text fs-13-imp lh-20-imp h-20 p-0-imp ${clearButtonClassName}`}
130+
onClick={clearFilters}
131+
>
132+
Clear All Filters
133+
</button>
134+
</div>
135+
)}
128136
</div>
129137
)
130138
)

src/Shared/Components/FilterChips/types.ts

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,50 @@ export interface FilterChipProps {
3737
* If passed, the label will be formatted accordingly
3838
*/
3939
getFormattedValue?: (filterKey: string, filterValue: unknown) => ReactNode
40+
showRemoveIcon: boolean
4041
/**
4142
* If true, would hide the label
4243
* @default false
4344
*/
4445
shouldHideLabel?: boolean
4546
}
4647

47-
export interface FilterChipsProps<T = Record<string, unknown>>
48-
extends Pick<FilterChipProps, 'getFormattedLabel' | 'getFormattedValue' | 'shouldHideLabel'> {
48+
export type FilterChipsProps<T = Record<string, unknown>> = Pick<
49+
FilterChipProps,
50+
'getFormattedLabel' | 'getFormattedValue' | 'shouldHideLabel'
51+
> & {
4952
/**
5053
* Current filter configuration
5154
*/
5255
filterConfig: T
53-
/**
54-
* Callback handler for removing the filters
55-
*/
56-
clearFilters: () => void
57-
/**
58-
* Handler for removing a applied filter
59-
*/
60-
onRemoveFilter: (filterConfig: T) => void
6156
/**
6257
* Class name for the container
6358
*/
6459
className?: string
65-
/**
66-
* Class name for the clear filter button
67-
*/
68-
clearButtonClassName?: string
69-
}
60+
} & (
61+
| {
62+
/**
63+
* If false, anything related to removing filters is not shown
64+
* @default 'true'
65+
*/
66+
showClearAndRemove: false
67+
clearFilters?: never
68+
onRemoveFilter?: never
69+
clearButtonClassName?: never
70+
}
71+
| {
72+
showClearAndRemove?: true
73+
/**
74+
* Callback handler for removing the filters
75+
*/
76+
clearFilters: () => void
77+
/**
78+
* Handler for removing a applied filter
79+
*/
80+
onRemoveFilter: (filterConfig: T) => void
81+
/**
82+
* Class name for the clear filter button
83+
*/
84+
clearButtonClassName?: string
85+
}
86+
)

src/Shared/Components/KeyValueTable/KeyValueTable.component.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
/*
2-
* Copyright (c) 2024 Devtron Inc.
3-
* All rights reserved.
4-
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1615
*/
1716

1817
import React, { createRef, useEffect, useRef, useState } from 'react'

0 commit comments

Comments
 (0)