Skip to content

Commit 5e3f276

Browse files
Merge branch 'main' into patch-502
2 parents aea9b9c + c61dff4 commit 5e3f276

File tree

9 files changed

+43
-13
lines changed

9 files changed

+43
-13
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ ANNOUNCEMENT_BANNER_MSG=
3838
LOGIN_PAGE_IMAGE=
3939
LOGIN_PAGE_IMAGE_BG=
4040
HIDE_DEFAULT_CLUSTER=false
41+
GLOBAL_API_TIMEOUT=60000
42+
TRIGGER_API_TIMEOUT=60000

config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@
2828
| LOGIN_PAGE_IMAGE | "" | Login page image url |
2929
| LOGIN_PAGE_IMAGE_BG | "" | Login page image background color code |
3030
| DEFAULT_CI_TRIGGER_TYPE_MANUAL | "false" | Change default trigger behaviour of newly created ci-pipeline to manual |
31+
| GLOBAL_API_TIMEOUT | 60000 | Default timeout for all API requests in DASHBOARD |
32+
| TRIGGER_API_TIMEOUT | 60000 | Default timeout for all API requests for Trigger calls (Deploy artifacts, charts) in DASHBOARD |
3133

3234
# DASHBOARD CONFIG SECRET

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "0.0.48",
7+
"@devtron-labs/devtron-fe-common-lib": "0.0.49",
88
"@rjsf/core": "^5.13.3",
99
"@rjsf/utils": "^5.13.3",
1010
"@rjsf/validator-ajv8": "^5.13.3",

src/components/app/service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
DeploymentNodeType,
1010
put,
1111
} from '@devtron-labs/devtron-fe-common-lib'
12-
import { createGitCommitUrl, handleUTCTime, ISTTimeModal } from '../common'
12+
import { createGitCommitUrl, getAPIOptionsWithTriggerTimeout, handleUTCTime, ISTTimeModal } from '../common'
1313
import moment from 'moment-timezone'
1414
import { History } from './details/cicdHistory/types'
1515
import { AppDetails, ArtifactsCiJob, EditAppRequest } from './types'
@@ -334,7 +334,9 @@ export const triggerCDNode = (
334334
request['wfrIdForDeploymentWithSpecificTrigger'] = wfrId
335335
}
336336
}
337-
return post(Routes.CD_TRIGGER_POST, request)
337+
const options = getAPIOptionsWithTriggerTimeout()
338+
339+
return post(Routes.CD_TRIGGER_POST, request, options)
338340
}
339341

340342
export const triggerBranchChange = (appIds: number[], envId: number, value: string) => {

src/components/charts/charts.service.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { get, post, put, trash, sortCallback, ResponseType } from '@devtron-labs/devtron-fe-common-lib'
22
import { DELETE_ACTION, Routes } from '../../config'
3-
import { handleUTCTime } from '../common'
3+
import { getAPIOptionsWithTriggerTimeout, handleUTCTime } from '../common'
44
import { ChartValuesType, ChartGroup, HelmTemplateChartRequest, HelmProjectUpdatePayload } from './charts.types'
55
import { SavedValueListResponse } from './SavedValues/types'
66

@@ -26,11 +26,13 @@ export function getInstalledAppDetail(installedAppId, envId) {
2626
}
2727

2828
export function installChart(request) {
29-
return post(`app-store/deployment/application/install`, request)
29+
const options = getAPIOptionsWithTriggerTimeout()
30+
return post(`app-store/deployment/application/install`, request, options)
3031
}
3132

3233
export function updateChart(request) {
33-
return put(Routes.UPDATE_APP_API, request)
34+
const options = getAPIOptionsWithTriggerTimeout()
35+
return put(Routes.UPDATE_APP_API, request, options)
3436
}
3537

3638
export function deleteInstalledChart(installedAppId: string | number, isGitops?: boolean, deleteAction?: DELETE_ACTION) {
@@ -124,13 +126,15 @@ interface ChartValuesCreate {
124126
}
125127

126128
export function createChartValues(request: ChartValuesCreate) {
129+
const options = getAPIOptionsWithTriggerTimeout()
127130
const URL = `${Routes.CHART_STORE}/${Routes.CHART_STORE_VALUES}/${Routes.CHART_VALUES}`
128-
return post(URL, request)
131+
return post(URL, request, options)
129132
}
130133

131134
export function updateChartValues(request) {
135+
const options = getAPIOptionsWithTriggerTimeout()
132136
const URL = `${Routes.CHART_STORE}/${Routes.CHART_STORE_VALUES}/${Routes.CHART_VALUES}`
133-
return put(URL, request)
137+
return put(URL, request, options)
134138
}
135139

136140
export function deleteChartValues(chartId: number): Promise<any> {
@@ -218,8 +222,9 @@ export interface DeployableCharts {
218222
}
219223

220224
export function deployChartGroup(projectId: number, charts: DeployableCharts[], chartGroupId?: number) {
225+
const options = getAPIOptionsWithTriggerTimeout()
221226
// chartGroupId empty when normal deployment
222-
return post(`app-store/group/install`, { projectId, chartGroupId, charts })
227+
return post(`app-store/group/install`, { projectId, chartGroupId, charts }, options)
223228
}
224229

225230
interface appName {

src/components/charts/list/DiscoverCharts.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ function DiscoverChartList({isSuperAdmin} : {isSuperAdmin: boolean}) {
213213
}
214214
try {
215215
setInstalling(true)
216+
// NOTE: This validation call also goes inside component as well discuss about it
216217
const validated = await validateData()
217218
if (!validated) {
218219
toast.warn('Click on highlighted charts and resolve errors.', { autoClose: 5000 })

src/components/common/helpers/Helpers.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
OptionType,
66
DeploymentAppTypes,
77
getLoginInfo,
8+
APIOptions,
89
} from '@devtron-labs/devtron-fe-common-lib'
910
import YAML from 'yaml'
1011
import { useWindowSize } from './UseWindowSize'
@@ -1133,3 +1134,12 @@ export const hasApproverAccess = (approverList: string[]): boolean => {
11331134
export const getNonEditableChartRepoText = (name: string): string => {
11341135
return `Cannot edit chart repo "${name}". Some charts from this repository are being used by helm apps.`
11351136
}
1137+
1138+
export const getAPIOptionsWithTriggerTimeout = (options?: APIOptions): APIOptions => {
1139+
const _options: APIOptions = options ? JSON.parse(JSON.stringify(options)) : {}
1140+
if (Number.isInteger(window._env_.TRIGGER_API_TIMEOUT)) {
1141+
_options.timeout = window._env_.TRIGGER_API_TIMEOUT
1142+
}
1143+
1144+
return _options
1145+
}

src/components/external-apps/ExternalAppService.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import {get, post, put, trash, ResponseType} from '@devtron-labs/devtron-fe-common-lib';
1+
import {get, put, trash, ResponseType} from '@devtron-labs/devtron-fe-common-lib';
22
import {Routes} from '../../config';
33
import {HelmApp, AppEnvironmentDetail} from '../app/list-new/AppListService';
44
import {ResourceTree} from '../v2/appDetails/appDetails.type';
5+
import { getAPIOptionsWithTriggerTimeout } from '../common'
56

67
export interface ReleaseInfoResponse extends ResponseType {
78
result?: ReleaseAndInstalledAppInfo
@@ -125,15 +126,18 @@ export const deleteApplicationRelease = (appId: string): Promise<UninstallReleas
125126
}
126127

127128
export const updateAppReleaseWithoutLinking = (requestPayload: UpdateAppReleaseWithoutLinkingRequest): Promise<UpdateReleaseResponse> => {
128-
return put(Routes.HELM_RELEASE_APP_UPDATE_WITHOUT_LINKING_API, requestPayload);
129+
const options = getAPIOptionsWithTriggerTimeout()
130+
return put(Routes.HELM_RELEASE_APP_UPDATE_WITHOUT_LINKING_API, requestPayload, options);
129131
};
130132

131133
export const updateAppRelease = (requestPayload: UpdateAppReleaseRequest): Promise<any> => {
132-
return put(Routes.UPDATE_APP_API, requestPayload);
134+
const options = getAPIOptionsWithTriggerTimeout()
135+
return put(Routes.UPDATE_APP_API, requestPayload, options);
133136
};
134137

135138
export const linkToChartStore = (request: LinkToChartStoreRequest): Promise<UpdateReleaseResponse> => {
136-
return put(Routes.HELM_LINK_TO_CHART_STORE_API, request);
139+
const options = getAPIOptionsWithTriggerTimeout()
140+
return put(Routes.HELM_LINK_TO_CHART_STORE_API, request, options);
137141
};
138142

139143
export const getManifestUrlInfo = (appId: string): Promise<ResponseType> => {

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ interface customEnv {
4848
LOGIN_PAGE_IMAGE?: string
4949
LOGIN_PAGE_IMAGE_BG?: string
5050
HIDE_DEFAULT_CLUSTER?: boolean
51+
GLOBAL_API_TIMEOUT?: number
52+
TRIGGER_API_TIMEOUT?: number
5153
}
5254
declare global {
5355
interface Window {
@@ -150,6 +152,8 @@ if (!window || !window._env_) {
150152
LOGIN_PAGE_IMAGE: '',
151153
LOGIN_PAGE_IMAGE_BG: '',
152154
HIDE_DEFAULT_CLUSTER: false,
155+
GLOBAL_API_TIMEOUT: 60000,
156+
TRIGGER_API_TIMEOUT: 60000,
153157
}
154158
}
155159

0 commit comments

Comments
 (0)