Skip to content

Commit eb2c89a

Browse files
committed
chore: misc fixes
1 parent 32db75e commit eb2c89a

File tree

11 files changed

+65
-35
lines changed

11 files changed

+65
-35
lines changed

src/Pages/App/CreateAppModal/AppClone/AppCloneList.tsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
Button,
1919
ComponentSizeType,
2020
DetectBottom,
21+
GenericFilterEmptyState,
2122
GenericInfoCardBorderVariant,
2223
GenericInfoCardListing,
2324
GenericInfoListSkeleton,
@@ -72,24 +73,30 @@ export const AppCloneList = ({ handleCloneAppClick, isJobView, handleCreationMet
7273
inputProps={{
7374
placeholder: `Search ${isJobView ? 'job' : 'application'}`,
7475
}}
76+
isLoading={isListLoading || isLoadingMore}
7577
/>
7678
)}
7779
</div>
7880
<div className="flex-grow-1 flexbox-col dc__gap-12 p-20 dc__overflow-auto">
79-
<GenericInfoCardListing
80-
borderVariant={GenericInfoCardBorderVariant.ROUNDED}
81-
list={list}
82-
searchKey={searchKey}
83-
isLoading={isListLoading}
84-
error={listError}
85-
reloadList={reloadList}
86-
handleClearFilters={clearFilters}
87-
emptyStateConfig={{
88-
title: 'Nothing to Clone… Yet!',
89-
subTitle: `You haven’t created any ${isJobView ? 'job' : 'application'} to clone. Kick things off by crafting one from scratch—it’s quick and easy!`,
90-
renderButton: renderCreateFromScratchButton,
91-
}}
92-
/>
81+
{/* Empty filter state for jobs since job list is paginated */}
82+
{isJobView && searchKey && !isListLoading && !listError && !list.length ? (
83+
<GenericFilterEmptyState handleClearFilters={clearFilters} />
84+
) : (
85+
<GenericInfoCardListing
86+
borderVariant={GenericInfoCardBorderVariant.ROUNDED}
87+
list={list}
88+
searchKey={isJobView ? '' : searchKey} // Not filtering on FE for jobs since job list is paginated
89+
isLoading={isListLoading}
90+
error={listError}
91+
reloadList={reloadList}
92+
handleClearFilters={clearFilters}
93+
emptyStateConfig={{
94+
title: 'Nothing to Clone… Yet!',
95+
subTitle: `You haven’t created any ${isJobView ? 'job' : 'application'} to clone. Kick things off by crafting one from scratch—it’s quick and easy!`,
96+
renderButton: renderCreateFromScratchButton,
97+
}}
98+
/>
99+
)}
93100
{hasMoreData && isLoadingMore && <GenericInfoListSkeleton />}
94101

95102
{hasMoreData && !isLoadingMore && <DetectBottom callback={handleLoadMore} hasError={hasError} />}

src/Pages/App/CreateAppModal/AppClone/useDevtronCloneList.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ export const useDevtronCloneList = ({ handleCloneAppClick, isJobView, searchKey
3838
[],
3939
)
4040

41-
const [isListLoading, listResponse, listError, reloadList, setListResponse] = useAsync(() =>
42-
fetchDevtronCloneList({
43-
isJobView,
44-
searchKey,
45-
cloneListAbortControllerRef,
46-
handleCloneAppClick,
47-
}),
41+
const [isListLoading, listResponse, listError, reloadList, setListResponse] = useAsync(
42+
() =>
43+
fetchDevtronCloneList({
44+
isJobView,
45+
searchKey,
46+
cloneListAbortControllerRef,
47+
handleCloneAppClick,
48+
}),
49+
isJobView ? [searchKey] : [], // Since job list is paginated, we want to refetch the list on searchKey change
4850
)
4951

5052
const loadMoreData = async () => {

src/Pages/App/CreateAppModal/service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ export const fetchDevtronCloneList = async ({
3737
const res = await getJobs({
3838
teams: [],
3939
appStatuses: [],
40-
appNameSearch: '',
40+
appNameSearch: searchKey,
4141
offset,
4242
size: 20,
4343
sortBy: 'appNameSort',
4444
sortOrder: 'ASC',
45-
searchKey,
4645
})
4746

4847
const jobContainers = res.result?.jobContainers ?? []

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/DeploymentTemplate/DeploymentTemplate.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ const DeploymentTemplate = ({
227227
showExpressEditPromptTooltip,
228228
} = state
229229

230+
const initialServiceAbortController = useRef<AbortController>(new AbortController())
230231
const manifestAbortController = useRef<AbortController>(new AbortController())
231232
const loadMergedTemplateAbortController = useRef<AbortController>(new AbortController())
232233
const editorStateBeforeExpressEditView = useRef<DeploymentTemplateEditorDataStateType>(null)
@@ -1061,9 +1062,13 @@ const DeploymentTemplate = ({
10611062
try {
10621063
reloadEnvironments()
10631064
const [chartRefsDataResponse, lockedKeysConfigResponse] = await Promise.allSettled([
1064-
getChartList({ appId, envId, isTemplateView }),
1065+
getChartList({ appId, envId, isTemplateView, signal: initialServiceAbortController.current?.signal }),
10651066
getJsonPath && !isTemplateView
1066-
? getJsonPath(appId, envId || BASE_CONFIGURATION_ENV_ID)
1067+
? getJsonPath(
1068+
appId,
1069+
envId || BASE_CONFIGURATION_ENV_ID,
1070+
initialServiceAbortController.current?.signal,
1071+
)
10671072
: Promise.resolve(null),
10681073
])
10691074

@@ -1072,6 +1077,13 @@ const DeploymentTemplate = ({
10721077
}
10731078
const chartRefsData = chartRefsDataResponse.value
10741079

1080+
if (
1081+
lockedKeysConfigResponse.status === 'rejected' &&
1082+
getIsRequestAborted(lockedKeysConfigResponse.reason)
1083+
) {
1084+
throw lockedKeysConfigResponse.reason
1085+
}
1086+
10751087
const isLockedConfigResponseValid =
10761088
lockedKeysConfigResponse.status === 'fulfilled' && !!lockedKeysConfigResponse.value?.result
10771089

@@ -1088,7 +1100,10 @@ const DeploymentTemplate = ({
10881100

10891101
await handleInitializePublishedAndCurrentEditorData(chartRefsData, lockedKeysConfig)
10901102
} catch (error) {
1091-
showError(error)
1103+
const isReqAbortedError = getIsRequestAborted(error)
1104+
if (!isReqAbortedError) {
1105+
showError(error)
1106+
}
10921107
dispatch({
10931108
type: DeploymentTemplateActionType.INITIAL_DATA_ERROR,
10941109
payload: {
@@ -1101,6 +1116,10 @@ const DeploymentTemplate = ({
11011116
useEffect(() => {
11021117
// eslint-disable-next-line @typescript-eslint/no-floating-promises
11031118
handleInitialDataLoad()
1119+
1120+
return () => {
1121+
initialServiceAbortController.current?.abort()
1122+
}
11041123
}, [])
11051124

11061125
useEffect(() => {

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/DeploymentTemplate/service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import {
18+
APIOptions,
1819
AppConfigProps,
1920
BaseURLParams,
2021
get,
@@ -179,10 +180,12 @@ export async function getBaseDeploymentTemplate(
179180
export const getChartList = async ({
180181
appId,
181182
envId,
183+
signal,
182184
isTemplateView,
183185
}: Pick<BaseURLParams, 'appId' | 'envId'> &
186+
Pick<APIOptions, 'signal'> &
184187
Required<Pick<AppConfigProps, 'isTemplateView'>>): Promise<GetChartListReturnType> => {
185-
const chartRefResp = await getChartReferencesForAppAndEnv(+appId, +envId, isTemplateView)
188+
const chartRefResp = await getChartReferencesForAppAndEnv(+appId, +envId, isTemplateView, signal)
186189

187190
const { chartRefs, latestAppChartRef, latestChartRef, latestEnvChartRef, chartMetadata } = chartRefResp.result
188191
// Sorting chartRefs by version

src/Pages/Shared/CommandBar/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const getCommandBarResourceLists = async (): Promise<CommandBarResourceLi
1616
const appList = promiseResponse[0].status === 'fulfilled' ? promiseResponse[0].value.result : []
1717
const chartList = promiseResponse[1].status === 'fulfilled' ? promiseResponse[1].value.result : []
1818
const clusterList = promiseResponse[2].status === 'fulfilled' ? promiseResponse[2].value : []
19-
const helmAppList = promiseResponse[3].status === 'fulfilled' ? promiseResponse[3].value.result.helmApps : []
19+
const helmAppList = promiseResponse[3].status === 'fulfilled' ? promiseResponse[3].value.result?.helmApps ?? [] : []
2020

2121
return { appList, chartList, clusterList: (clusterList || []).filter((cluster) => !cluster.isVirtual), helmAppList }
2222
}

src/components/CIPipelineN/VariableDataTable/ValueConfigOverlay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
243243

244244
if (choices.length) {
245245
return (
246-
<div ref={scrollableRef} 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 dc__overflow-auto">
247247
<div className="py-4 px-12">
248248
<Button
249249
text="Add choice"
@@ -254,7 +254,7 @@ export const ValueConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOverlay
254254
size={ComponentSizeType.small}
255255
/>
256256
</div>
257-
<div className="flexbox-col dc__gap-6 dc__overflow-auto pb-12 px-12">
257+
<div className="flexbox-col dc__gap-6 pb-12 px-12">
258258
{choices.map(({ id, value, error }, index) => (
259259
<div key={id} className="flexbox dc__align-items-center dc__gap-4 w-100">
260260
<CustomInput

src/components/CIPipelineN/VariableDataTable/VariableConfigOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const VariableConfigOverlay = ({ row, handleRowUpdateAction }: ConfigOver
6262
<VariableDataTablePopupMenu showHeaderIcon heading="Variable configuration" position="right">
6363
{({ scrollableRef }) => (
6464
<>
65-
<div ref={scrollableRef} className="p-12 flexbox-col dc__gap-12">
65+
<div ref={scrollableRef} className="p-12 flexbox-col dc__gap-12 dc__overflow-auto">
6666
<CustomInput
6767
placeholder="Enter variable name"
6868
name="variable-name"

src/components/CIPipelineN/VariableDataTable/VariableDataTablePopupMenu.tsx

Lines changed: 1 addition & 1 deletion
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">
76+
<div className="flexbox-col w-100 mxh-350 dc__overflow-hidden">
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" />}

src/components/Navigation/Navigation.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { useLocation } from 'react-router-dom'
1919

2020
import {
2121
AnimatePresence,
22+
IS_PLATFORM_MAC_OS,
2223
KeyboardShortcut,
2324
ModuleNameMap,
2425
ModuleStatus,
@@ -219,7 +220,7 @@ export const Navigation = ({
219220
tooltip={
220221
<span className="flex dc__gap-2">
221222
Search&nbsp;
222-
<KeyboardShortcut keyboardKey="Meta" />
223+
<KeyboardShortcut keyboardKey={IS_PLATFORM_MAC_OS ? 'Meta' : 'Control'} />
223224
<KeyboardShortcut keyboardKey="K" />
224225
</span>
225226
}

0 commit comments

Comments
 (0)