Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "4.0.4-pre-0",
"version": "4.0.6-pre-0",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
5 changes: 5 additions & 0 deletions src/Pages-Devtron-2.0/Shared/Routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ export const BASE_ROUTES = {
ROOT: 'cluster-env',
MANAGE_CATEGORIES: 'manage-categories',
},
NODE_AUTOSCALER: {
ROOT: 'node-autoscaler',
CREATE_PROFILE: 'create-profile',
EDIT_PROFILE: 'edit/:profileId',
},
DOCKER: 'docker',
PROJECTS: 'projects',
AUTH: {
Expand Down
25 changes: 16 additions & 9 deletions src/Shared/Components/ExportToCsv/ExportToCsv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ const ExportToCsv = <HeaderItemType extends string>({
downloadRequestId,
}: ExportToCsvProps<HeaderItemType>) => {
const csvRef = useRef(null)
const abortControllerRef = useRef<AbortController>(new AbortController())
const abortControllerRef = useRef<AbortController>(null)

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

const handleInitiateDownload = async () => {
if (disabled) {
Expand All @@ -41,8 +42,7 @@ const ExportToCsv = <HeaderItemType extends string>({
setDataFetchError(null)
const data = await apiPromise({ signal: abortControllerRef.current.signal })
setDataToExport(data)

csvRef.current?.link?.click()
setPendingDownload(true)
} catch (error) {
if (!getIsRequestAborted(error)) {
showError(error)
Expand All @@ -64,12 +64,12 @@ const ExportToCsv = <HeaderItemType extends string>({
}
}

useEffect(
() => () => {
abortControllerRef.current.abort()
},
[],
)
useEffect(() => {
abortControllerRef.current = new AbortController()
return () => {
abortControllerRef.current?.abort()
}
}, [])

useEffect(() => {
if (!isNullOrUndefined(downloadRequestId)) {
Expand All @@ -78,6 +78,13 @@ const ExportToCsv = <HeaderItemType extends string>({
}
}, [downloadRequestId])

useEffect(() => {
if (pendingDownload) {
csvRef.current?.link?.click()
setPendingDownload(false)
}
}, [pendingDownload])

const handleCancelRequest = () => {
abortControllerRef.current.abort()
abortControllerRef.current = new AbortController()
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ export interface customEnv {
FEATURE_ATHENA_DEBUG_MODE_ENABLE?: boolean
/** Org ID for grafana */
GRAFANA_ORG_ID?: number
/**
* @default false
*/
FEATURE_NODE_AUTOSCALER_ENABLE?: boolean
}

declare global {
Expand Down
Loading