Skip to content

Commit

Permalink
Merge branch 'develop' into feat/patch-dt
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhishekA1509 committed Nov 22, 2024
2 parents 74cf9f4 + 5f3046d commit 81d80f7
Show file tree
Hide file tree
Showing 45 changed files with 855 additions and 512 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ src/Common/BreadCrumb/BreadcrumbStore.tsx
src/Common/CIPipeline.Types.ts
src/Common/ChartVersionAndTypeSelector.tsx
src/Common/Checkbox.tsx
src/Common/ClipboardButton/ClipboardButton.tsx
src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx
src/Common/CodeEditor/CodeEditor.tsx
src/Common/Common.service.ts
Expand Down
88 changes: 61 additions & 27 deletions package-lock.json

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

3 changes: 2 additions & 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": "1.0.3-beta-8",
"version": "1.1.3",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down Expand Up @@ -97,6 +97,7 @@
"fast-json-patch": "^3.1.1",
"jsonpath-plus": "^10.0.0",
"react-dates": "^21.8.0",
"react-diff-viewer-continued": "^3.4.0",
"react-monaco-editor": "^0.54.0",
"sass": "^1.69.7",
"tslib": "2.7.0"
Expand Down
3 changes: 3 additions & 0 deletions src/Assets/Icon/ic-hash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/Assets/Icon/ic-info-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Assets/Icon/ic-pull-request.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/Assets/Icon/ic-tag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 14 additions & 3 deletions src/Common/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,33 @@ function fetchInTime<T = object>(
options?: APIOptions,
isMultipartRequest?: boolean,
): Promise<ResponseType> {
const controller = new AbortController()
const { signal } = controller
const controller = options?.abortControllerRef?.current ?? new AbortController()
const signal = options?.abortControllerRef?.current?.signal || options?.signal || controller.signal
const timeoutPromise: Promise<ResponseType> = new Promise((resolve, reject) => {
const requestTimeout = (window as any)?._env_?.GLOBAL_API_TIMEOUT || FALLBACK_REQUEST_TIMEOUT
const timeout = options?.timeout ? options.timeout : requestTimeout

setTimeout(() => {
controller.abort()
if (options?.abortControllerRef?.current) {
options.abortControllerRef.current = new AbortController()
}

reject({
code: 408,
errors: [{ code: 408, internalMessage: 'Request cancelled', userMessage: 'Request Cancelled' }],
})
}, timeout)
})
return Promise.race([
fetchAPI(url, type, data, options?.signal || signal, options?.preventAutoLogout || false, isMultipartRequest),
fetchAPI(
url,
type,
data,
signal,
options?.preventAutoLogout || false,
isMultipartRequest,
),
timeoutPromise,
]).catch((err) => {
if (err instanceof ServerErrors) {
Expand Down
Loading

0 comments on commit 81d80f7

Please sign in to comment.