Skip to content

Commit b01ab2c

Browse files
committed
Merge branch 'fix/cd-trigger' of https://github.com/devtron-labs/dashboard into test/cd-trigger
2 parents 44ea65c + 0c4826e commit b01ab2c

File tree

18 files changed

+410
-479
lines changed

18 files changed

+410
-479
lines changed

index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@import url('https://fonts.googleapis.com/css2?family=Inconsolata&display=swap');
33
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700;900&display=swap');
44
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');
5+
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:[email protected]&display=swap');
56

67
/*
78
* Although this is duplicated but this would help us with consistent loader in case

src/components/CIPipelineN/VariableDataTable/ValueConfigOverlay.tsx

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
Textarea,
3232
TextareaProps,
3333
Tooltip,
34+
UsePopoverReturnType,
3435
validateRequiredPositiveNumber,
3536
VariableTypeFormat,
3637
} from '@devtron-labs/devtron-fe-common-lib'
@@ -174,10 +175,10 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
174175
}
175176

176177
// RENDERERS
177-
const renderContent = () => {
178+
const renderContent = (scrollableRef: UsePopoverReturnType['scrollableRef']) => {
178179
if (isFormatFile) {
179180
return (
180-
<div className="dc__overflow-auto p-12 flex-grow-1 flexbox-col dc__gap-12">
181+
<div ref={scrollableRef} className="dc__overflow-auto p-12 flex-grow-1 flexbox-col dc__gap-12">
181182
<CustomInput
182183
name={`file-mount-${rowId}`}
183184
label="File mount path"
@@ -228,7 +229,7 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
228229

229230
if (isFormatBoolOrDate) {
230231
return (
231-
<div className="p-12 flex-grow-1">
232+
<div ref={scrollableRef} className="p-12 flex-grow-1">
232233
<div className="dc__border-dashed br-6 p-16 flexbox-col dc__align-items-center dc__gap-12">
233234
<ICInfoOutlineGrey className="icon-dim-24" />
234235
<div className="w-100 dc__text-center fs-12 lh-18 flexbox-col dc__gap-2">
@@ -242,7 +243,7 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
242243

243244
if (choices.length) {
244245
return (
245-
<div className="flexbox-col dc__gap-6 pt-12 min-h-100">
246+
<div ref={scrollableRef} className="flexbox-col dc__gap-6 pt-12 min-h-100">
246247
<div className="py-4 px-12">
247248
<Button
248249
text="Add choice"
@@ -318,45 +319,49 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
318319
}
319320
position="bottom"
320321
>
321-
<>
322-
{renderContent()}
323-
{(choices.length || AskValueAtRuntimeCheckbox) && (
324-
<div className="dc__border-top-n1 p-12 flexbox-col dc__gap-8">
325-
{!!choices.length && (
326-
<Checkbox
327-
isChecked={!blockCustomValue}
328-
rootClassName="mb-0 flex top dc_max-width__max-content"
329-
value={CHECKBOX_VALUE.CHECKED}
330-
onChange={handleAllowCustomInput}
331-
data-testid="allow-custom-input"
332-
>
333-
<Tooltip
334-
alwaysShowTippyOnHover
335-
className="w-200"
336-
placement="bottom-start"
337-
content={
338-
<div className="fs-12 lh-18 flexbox-col dc__gap-2">
339-
<p className="m-0 fw-6">Allow custom input</p>
340-
<p className="m-0">Allow entering any value other than provided choices</p>
341-
</div>
342-
}
322+
{({ scrollableRef }) => (
323+
<>
324+
{renderContent(scrollableRef)}
325+
{(choices.length || AskValueAtRuntimeCheckbox) && (
326+
<div className="dc__border-top-n1 p-12 flexbox-col dc__gap-8">
327+
{!!choices.length && (
328+
<Checkbox
329+
isChecked={!blockCustomValue}
330+
rootClassName="mb-0 flex top dc_max-width__max-content"
331+
value={CHECKBOX_VALUE.CHECKED}
332+
onChange={handleAllowCustomInput}
333+
data-testid="allow-custom-input"
343334
>
344-
<div className="dc__border-dashed--n3-bottom fs-13 cn-9 lh-20">
345-
Allow Custom input
346-
</div>
347-
</Tooltip>
348-
</Checkbox>
349-
)}
350-
{AskValueAtRuntimeCheckbox && (
351-
<AskValueAtRuntimeCheckbox
352-
isChecked={askValueAtRuntime}
353-
value={CHECKBOX_VALUE.CHECKED}
354-
onChange={handleAskValueAtRuntime}
355-
/>
356-
)}
357-
</div>
358-
)}
359-
</>
335+
<Tooltip
336+
alwaysShowTippyOnHover
337+
className="w-200"
338+
placement="bottom-start"
339+
content={
340+
<div className="fs-12 lh-18 flexbox-col dc__gap-2">
341+
<p className="m-0 fw-6">Allow custom input</p>
342+
<p className="m-0">
343+
Allow entering any value other than provided choices
344+
</p>
345+
</div>
346+
}
347+
>
348+
<div className="dc__border-dashed--n3-bottom fs-13 cn-9 lh-20">
349+
Allow Custom input
350+
</div>
351+
</Tooltip>
352+
</Checkbox>
353+
)}
354+
{AskValueAtRuntimeCheckbox && (
355+
<AskValueAtRuntimeCheckbox
356+
isChecked={askValueAtRuntime}
357+
value={CHECKBOX_VALUE.CHECKED}
358+
onChange={handleAskValueAtRuntime}
359+
/>
360+
)}
361+
</div>
362+
)}
363+
</>
364+
)}
360365
</VariableDataTablePopupMenu>
361366
)
362367
}

src/components/CIPipelineN/VariableDataTable/VariableConfigOverlay.tsx

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -60,51 +60,53 @@ export const VariableConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOver
6060

6161
return (
6262
<VariableDataTablePopupMenu showHeaderIcon heading="Variable configuration" position="right">
63-
<>
64-
<div className="p-12 flexbox-col dc__gap-12">
65-
<CustomInput
66-
placeholder="Enter variable name"
67-
name="variable-name"
68-
onChange={handleVariableName}
69-
value={data.variable.value}
70-
label="Variable"
71-
required
72-
autoFocus
73-
/>
74-
<Textarea
75-
label="Description"
76-
value={variableDescription}
77-
placeholder="Describe this variable"
78-
onChange={handleVariableDescriptionChange}
79-
name="variable-description"
80-
/>
81-
</div>
82-
<div className="dc__border-top-n1 p-12 flexbox-col dc__gap-8">
83-
<Checkbox
84-
isChecked={isVariableRequired}
85-
rootClassName="mb-0 flex top dc_max-width__max-content"
86-
value={CHECKBOX_VALUE.CHECKED}
87-
onChange={handleVariableRequired}
88-
data-testid="ask-value-is-required"
89-
>
90-
<Tooltip
91-
alwaysShowTippyOnHover
92-
className="w-200"
93-
placement="bottom-start"
94-
content={
95-
<div className="fs-12 lh-18 flexbox-col dc__gap-2">
96-
<p className="m-0 fw-6">Value is required</p>
97-
<p className="m-0">
98-
Value for required variables must be provided for pipeline execution
99-
</p>
100-
</div>
101-
}
63+
{({ scrollableRef }) => (
64+
<>
65+
<div ref={scrollableRef} className="p-12 flexbox-col dc__gap-12">
66+
<CustomInput
67+
placeholder="Enter variable name"
68+
name="variable-name"
69+
onChange={handleVariableName}
70+
value={data.variable.value}
71+
label="Variable"
72+
required
73+
autoFocus
74+
/>
75+
<Textarea
76+
label="Description"
77+
value={variableDescription}
78+
placeholder="Describe this variable"
79+
onChange={handleVariableDescriptionChange}
80+
name="variable-description"
81+
/>
82+
</div>
83+
<div className="dc__border-top-n1 p-12 flexbox-col dc__gap-8">
84+
<Checkbox
85+
isChecked={isVariableRequired}
86+
rootClassName="mb-0 flex top dc_max-width__max-content"
87+
value={CHECKBOX_VALUE.CHECKED}
88+
onChange={handleVariableRequired}
89+
data-testid="ask-value-is-required"
10290
>
103-
<div className="dc__border-dashed--n3-bottom fs-13 cn-9 lh-20">Value is required</div>
104-
</Tooltip>
105-
</Checkbox>
106-
</div>
107-
</>
91+
<Tooltip
92+
alwaysShowTippyOnHover
93+
className="w-200"
94+
placement="bottom-start"
95+
content={
96+
<div className="fs-12 lh-18 flexbox-col dc__gap-2">
97+
<p className="m-0 fw-6">Value is required</p>
98+
<p className="m-0">
99+
Value for required variables must be provided for pipeline execution
100+
</p>
101+
</div>
102+
}
103+
>
104+
<div className="dc__border-dashed--n3-bottom fs-13 cn-9 lh-20">Value is required</div>
105+
</Tooltip>
106+
</Checkbox>
107+
</div>
108+
</>
109+
)}
108110
</VariableDataTablePopupMenu>
109111
)
110112
}

src/components/CIPipelineN/VariableDataTable/VariableDataTablePopupMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const VariableDataTablePopupMenu = ({
7373
triggerElement={triggerElement}
7474
buttonProps={null}
7575
>
76-
<div className="flexbox-col w-100 mxh-350 dc__overflow-auto" ref={scrollableRef}>
76+
<div className="flexbox-col w-100 mxh-350 dc__overflow-auto">
7777
<div className="px-12 py-8 flexbox dc__align-items-center dc__content-space dc__gap-8 dc__border-bottom-n1">
7878
<div className="flexbox dc__align-items-center dc__gap-8">
7979
{showHeaderIcon && <ICSlidersVertical className="icon-dim-16" />}
@@ -93,7 +93,7 @@ export const VariableDataTablePopupMenu = ({
9393
disabled={disableClose}
9494
/>
9595
</div>
96-
{children}
96+
{children({ scrollableRef })}
9797
</div>
9898
</Popover>
9999
)

src/components/CIPipelineN/VariableDataTable/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
RefVariableType,
2323
SelectPickerOptionType,
2424
UsePopoverProps,
25+
UsePopoverReturnType,
2526
VariableType,
2627
VariableTypeFormat,
2728
} from '@devtron-labs/devtron-fe-common-lib'
@@ -144,7 +145,7 @@ export interface VariableDataTablePopupMenuProps {
144145
showIconDot?: boolean
145146
disableClose?: boolean
146147
onClose?: () => void
147-
children: JSX.Element
148+
children: (props: Pick<UsePopoverReturnType, 'scrollableRef'>) => JSX.Element
148149
position: UsePopoverProps['position']
149150
}
150151

src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const ClusterSelectionBody: React.FC<ClusterSelectionBodyTypes> = ({
6161
initialSortKey: ClusterMapListSortableKeys.CLUSTER_NAME,
6262
})
6363

64-
const { handleBulkSelection, getSelectedIdentifiersCount } =
64+
const { handleBulkSelection, getSelectedIdentifiersCount, selectedIdentifiers } =
6565
useBulkSelection<BulkSelectionIdentifiersType<ClusterDetail>>()
6666

6767
const identifierCount = getSelectedIdentifiersCount()
@@ -119,6 +119,7 @@ const ClusterSelectionBody: React.FC<ClusterSelectionBodyTypes> = ({
119119
count={identifierCount}
120120
handleClearBulkSelection={handleClearBulkSelection}
121121
onChangeShowKubeConfigModal={onChangeShowKubeConfigModal}
122+
selectedIdentifiersIds={Object.keys(selectedIdentifiers).map((key) => selectedIdentifiers[key].id)}
122123
/>
123124
)
124125
}

src/components/ResourceBrowser/ResourceList/ResourceFilterOptions.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
SegmentedControlProps,
3636
SelectPicker,
3737
SelectPickerOptionType,
38+
SelectPickerProps,
3839
useAsync,
3940
useRegisterShortcut,
4041
} from '@devtron-labs/devtron-fe-common-lib'
@@ -181,6 +182,14 @@ const ResourceFilterOptions = ({
181182
const getResourcesToExport = (): Promise<Record<ResourceRecommenderHeaderType, string>[]> =>
182183
Promise.resolve(getResourceRecommendationsCSVData(filteredRows.map((row) => row.data)))
183184

185+
const onNamespaceFilterKeyDown: SelectPickerProps['onKeyDown'] = (e) => {
186+
if (e.key === 'Escape' || e.key === 'Esc') {
187+
e.preventDefault()
188+
namespaceFilterRef.current?.blurInput()
189+
namespaceFilterRef.current?.blur()
190+
}
191+
}
192+
184193
return (
185194
<>
186195
{typeof renderRefreshBar === 'function' && renderRefreshBar()}
@@ -217,6 +226,7 @@ const ResourceFilterOptions = ({
217226
handleSearchChange={handleOnChangeSearchText}
218227
initialSearchText={searchText}
219228
keyboardShortcut="/"
229+
containerClassName="w-250"
220230
/>
221231
</div>
222232
</div>
@@ -284,6 +294,7 @@ const ResourceFilterOptions = ({
284294
icon={<NamespaceIcon className="fcn-6" />}
285295
disabledTippyContent={NAMESPACE_NOT_APPLICABLE_TEXT}
286296
shouldMenuAlignRight
297+
onKeyDown={onNamespaceFilterKeyDown}
287298
keyboardShortcut="N"
288299
/>
289300
</div>

src/components/chartRepo/chartRepo.service.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { post, get, trash } from '@devtron-labs/devtron-fe-common-lib'
17+
import { post, get, trash, APIOptions } from '@devtron-labs/devtron-fe-common-lib'
1818
import { Routes } from '../../config'
1919

2020
export const getChartProviderConfig = (id: number): Promise<any> => {
@@ -37,9 +37,9 @@ export const validateChartRepoConfiguration = (request: any): Promise<any> => {
3737
return post(URL, request)
3838
}
3939

40-
export const reSyncChartRepo = (): Promise<any> => {
40+
export const reSyncChartRepo = ({ signal }: Pick<APIOptions, 'signal'> = {}) => {
4141
const URL = `${Routes.CHART_REPO}/${Routes.CHART_RESYNC}`
42-
return post(URL, undefined)
42+
return post(URL, undefined, { signal })
4343
}
4444

4545
export function deleteChartRepo(request) {

src/components/charts/charts.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
HelmProjectUpdatePayload,
3434
DeleteInstalledChartParamsType,
3535
ChartDetailsDTO,
36+
ChartListType,
3637
} from './charts.types'
3738

3839
interface RootObject {
@@ -288,8 +289,8 @@ export function updateHelmAppProject(payload: HelmProjectUpdatePayload): Promise
288289
return put(Routes.UPDATE_HELM_APP_META_INFO, payload)
289290
}
290291

291-
export function getChartProviderList(): Promise<ResponseType> {
292-
return get('app-store/chart-provider/list')
292+
export function getChartProviderList() {
293+
return get<ChartListType[]>('app-store/chart-provider/list')
293294
}
294295

295296
export function updateChartProviderList(payload) {

src/components/charts/list/AddChartSource.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const AddChartSource = ({ text }: { text?: string }) => (
2727
text,
2828
dataTestId: 'add-chart-source-button',
2929
startIcon: <Icon name="ic-add" color="B500" />,
30-
size: ComponentSizeType.xxs,
30+
size: ComponentSizeType.small,
3131
variant: ButtonVariantType.borderLess,
3232
}}
3333
/>

0 commit comments

Comments
 (0)