Skip to content

Commit 3c63b08

Browse files
Merge pull request #1049 from devtron-labs/chore/merge-user-export-list
chore: merge user export list
2 parents 47735f3 + ecec7d6 commit 3c63b08

5 files changed

Lines changed: 28 additions & 12 deletions

File tree

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": "4.0.4-pre-0",
3+
"version": "4.0.6-pre-0",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Pages-Devtron-2.0/Shared/Routes/routes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ export const BASE_ROUTES = {
288288
ROOT: 'cluster-env',
289289
MANAGE_CATEGORIES: 'manage-categories',
290290
},
291+
NODE_AUTOSCALER: {
292+
ROOT: 'node-autoscaler',
293+
CREATE_PROFILE: 'create-profile',
294+
EDIT_PROFILE: 'edit/:profileId',
295+
},
291296
DOCKER: 'docker',
292297
PROJECTS: 'projects',
293298
AUTH: {

src/Shared/Components/ExportToCsv/ExportToCsv.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ const ExportToCsv = <HeaderItemType extends string>({
2424
downloadRequestId,
2525
}: ExportToCsvProps<HeaderItemType>) => {
2626
const csvRef = useRef(null)
27-
const abortControllerRef = useRef<AbortController>(new AbortController())
27+
const abortControllerRef = useRef<AbortController>(null)
2828

2929
const [dataToExport, setDataToExport] = useState<Awaited<ReturnType<typeof apiPromise>>>([])
3030
const [confirmationModalType, setConfirmationModalType] = useState<'default' | 'custom' | null>(null)
3131
const [isLoading, setIsLoading] = useState(false)
3232
const [dataFetchError, setDataFetchError] = useState<ServerErrors>(null)
33+
const [pendingDownload, setPendingDownload] = useState(false)
3334

3435
const handleInitiateDownload = async () => {
3536
if (disabled) {
@@ -41,8 +42,7 @@ const ExportToCsv = <HeaderItemType extends string>({
4142
setDataFetchError(null)
4243
const data = await apiPromise({ signal: abortControllerRef.current.signal })
4344
setDataToExport(data)
44-
45-
csvRef.current?.link?.click()
45+
setPendingDownload(true)
4646
} catch (error) {
4747
if (!getIsRequestAborted(error)) {
4848
showError(error)
@@ -64,12 +64,12 @@ const ExportToCsv = <HeaderItemType extends string>({
6464
}
6565
}
6666

67-
useEffect(
68-
() => () => {
69-
abortControllerRef.current.abort()
70-
},
71-
[],
72-
)
67+
useEffect(() => {
68+
abortControllerRef.current = new AbortController()
69+
return () => {
70+
abortControllerRef.current?.abort()
71+
}
72+
}, [])
7373

7474
useEffect(() => {
7575
if (!isNullOrUndefined(downloadRequestId)) {
@@ -78,6 +78,13 @@ const ExportToCsv = <HeaderItemType extends string>({
7878
}
7979
}, [downloadRequestId])
8080

81+
useEffect(() => {
82+
if (pendingDownload) {
83+
csvRef.current?.link?.click()
84+
setPendingDownload(false)
85+
}
86+
}, [pendingDownload])
87+
8188
const handleCancelRequest = () => {
8289
abortControllerRef.current.abort()
8390
abortControllerRef.current = new AbortController()

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ export interface customEnv {
190190
FEATURE_ATHENA_DEBUG_MODE_ENABLE?: boolean
191191
/** Org ID for grafana */
192192
GRAFANA_ORG_ID?: number
193+
/**
194+
* @default false
195+
*/
196+
FEATURE_NODE_AUTOSCALER_ENABLE?: boolean
193197
}
194198

195199
declare global {

0 commit comments

Comments
 (0)