From 79ca0e9829ee6ac6900cebe690e654bd0040f7a7 Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Wed, 21 Feb 2024 15:23:32 +0530 Subject: [PATCH 01/10] fix: add optional chaining in DeploymentTemplateOverrideForm.tsx --- .../EnvironmentOverride/DeploymentTemplateOverrideForm.tsx | 4 ++-- src/components/deploymentConfig/DeploymentConfig.tsx | 4 ++-- .../DeploymentTemplateView/DeploymentConfigFormCTA.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx b/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx index 3df7a0025a..da9c9503f9 100644 --- a/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx +++ b/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx @@ -228,7 +228,7 @@ export default function DeploymentTemplateOverrideForm({ const deploymentTemplateResp = isConfigProtectionEnabled ? await checkForProtectedLockedChanges() : await api(+appId, +envId, payload) - if (deploymentTemplateResp.result.isLockConfigError && !saveEligibleChanges) { + if (deploymentTemplateResp.result?.isLockConfigError && !saveEligibleChanges) { // checking if any locked changes and opening drawer to show eligible and locked ones setLockedOverride(deploymentTemplateResp.result?.lockedOverride) setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) @@ -245,7 +245,7 @@ export default function DeploymentTemplateOverrideForm({ } else { dispatch({ type: DeploymentConfigStateActionTypes.tempFormData, - payload: YAML.stringify(deploymentTemplateResp.result.envOverrideValues), + payload: YAML.stringify(deploymentTemplateResp.result?.envOverrideValues), }) } toast.success( diff --git a/src/components/deploymentConfig/DeploymentConfig.tsx b/src/components/deploymentConfig/DeploymentConfig.tsx index fc9a5fe484..1805307348 100644 --- a/src/components/deploymentConfig/DeploymentConfig.tsx +++ b/src/components/deploymentConfig/DeploymentConfig.tsx @@ -518,7 +518,7 @@ export default function DeploymentConfig({ const deploymentTemplateResp = isProtected ? await checkForProtectedLockedChanges() : await getIfLockedConfigNonProtected(requestBody) - if (deploymentTemplateResp.result.isLockConfigError) { + if (deploymentTemplateResp.result?.isLockConfigError) { setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) setLockedOverride(deploymentTemplateResp.result?.lockedOverride) handleLockedDiffDrawer(true) @@ -566,7 +566,7 @@ export default function DeploymentConfig({ const requestBody = prepareDataToSave(true) const api = state.chartConfig.id ? updateDeploymentTemplate : saveDeploymentTemplate const deploymentTemplateResp = await api(requestBody, baseDeploymentAbortController.signal) - if (deploymentTemplateResp.result.isLockConfigError) { + if (deploymentTemplateResp.result?.isLockConfigError) { setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) setLockedOverride(deploymentTemplateResp.result?.lockedOverride) handleLockedDiffDrawer(true) diff --git a/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx b/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx index 69ce9b0638..7751793c5e 100644 --- a/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx +++ b/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx @@ -72,9 +72,9 @@ export default function DeploymentConfigFormCTA({ payload: true, }) const deploymentTemplateResp = await checkForProtectedLockedChanges() - if (deploymentTemplateResp.result.isLockConfigError) { + if (deploymentTemplateResp.result?.isLockConfigError) { setShowLockedDiffForApproval(true) - setLockedOverride(deploymentTemplateResp.result.lockedOverride) + setLockedOverride(deploymentTemplateResp.result?.lockedOverride) handleLockedDiffDrawer(true) } else { setShowLockedDiffForApproval(false) From 303e46535400ad10a6596daa9b2c7b8868d5eb27 Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Thu, 22 Feb 2024 14:06:06 +0530 Subject: [PATCH 02/10] fix: add catch handling to getDefaultConfig calls modified EnvTriggerView.tsx & TriggerView.tsx --- .../ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx | 3 +++ src/components/app/details/triggerView/TriggerView.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx b/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx index 804959d2d9..69cd83a871 100644 --- a/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx +++ b/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx @@ -223,6 +223,9 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou setDefaultConfig(_isDefaultConfig) setConfigPresent(isConfigPresent) }) + .catch((error) => { + showError(error) + }) } const preserveSelection = (_workflows: WorkflowType[]) => { diff --git a/src/components/app/details/triggerView/TriggerView.tsx b/src/components/app/details/triggerView/TriggerView.tsx index 12614ea877..7f223a3760 100644 --- a/src/components/app/details/triggerView/TriggerView.tsx +++ b/src/components/app/details/triggerView/TriggerView.tsx @@ -176,6 +176,9 @@ class TriggerView extends Component { const _isDefaultConfig = response.result.is_default_configured this.setState({ configs: isConfigPresent, isDefaultConfigPresent: _isDefaultConfig }) }) + .catch((error) => { + showError(error) + }) } getWorkflows = (isFromOnMount?: boolean) => { From db40c79a04026a1f7037a3dbe869c75c43f7476e Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Thu, 22 Feb 2024 15:36:20 +0530 Subject: [PATCH 03/10] fix: add catch to call in getDeploymentStatusDetail --- src/components/app/details/appDetails/AppDetails.tsx | 1 + src/components/v2/appDetails/AppDetails.component.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/app/details/appDetails/AppDetails.tsx b/src/components/app/details/appDetails/AppDetails.tsx index ced3f1a2db..d482925b7b 100644 --- a/src/components/app/details/appDetails/AppDetails.tsx +++ b/src/components/app/details/appDetails/AppDetails.tsx @@ -334,6 +334,7 @@ export const Details: React.FC = ({ } }, ) + .catch(noop) }, [ params.appId, diff --git a/src/components/v2/appDetails/AppDetails.component.tsx b/src/components/v2/appDetails/AppDetails.component.tsx index ac3d29fdbb..8edb5a0a8c 100644 --- a/src/components/v2/appDetails/AppDetails.component.tsx +++ b/src/components/v2/appDetails/AppDetails.component.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef, useState } from 'react' import './appDetails.scss' import { useLocation, useParams } from 'react-router' -import { DeploymentAppTypes, Progressing } from '@devtron-labs/devtron-fe-common-lib' +import { DeploymentAppTypes, Progressing, noop } from '@devtron-labs/devtron-fe-common-lib' import { AppDetailsComponentType, AppType } from './appDetails.type' import IndexStore from './index.store' import EnvironmentStatusComponent from './sourceInfo/environmentStatus/EnvironmentStatus.component' @@ -105,6 +105,7 @@ const AppDetailsComponent = ({ } }, ) + .catch(noop) } const processDeploymentStatusData = (deploymentStatusDetailRes: DeploymentStatusDetailsType): void => { From 0f1e06be22d6a219cfd439b2d7296bf7e50d0620 Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Thu, 22 Feb 2024 16:37:31 +0530 Subject: [PATCH 04/10] fix: add missing try catch block in details/main.tsx --- src/components/app/details/main.tsx | 36 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/components/app/details/main.tsx b/src/components/app/details/main.tsx index 9e432d147c..61e4d90bb0 100644 --- a/src/components/app/details/main.tsx +++ b/src/components/app/details/main.tsx @@ -8,6 +8,7 @@ import { ToastBody, DeleteDialog, ErrorScreenManager, + noop, } from '@devtron-labs/devtron-fe-common-lib' import { MultiValue } from 'react-select' import { toast } from 'react-toastify' @@ -73,10 +74,12 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) { const getSavedFilterData = async (groupId?: number): Promise => { setSelectedAppList([]) + setSelectedGroupFilter([]) setAppListLoading(true) setGroupFilterOptions([]) - const { result } = await getEnvGroupList(+appId, FilterParentType.app) - if (result) { + try { + const { result } = await getEnvGroupList(+appId, FilterParentType.app) + if (result) { const _groupFilterOption = [] let _selectedGroup for (const group of result) { @@ -106,26 +109,31 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) { } _groupFilterOption.sort(sortOptionsByLabel) setGroupFilterOptions(_groupFilterOption) + } + } catch (error) { + noop; } - setAppListLoading(false) + setAppListLoading(true) } const getAppListData = async (): Promise => { setSelectedAppList([]) setAppListLoading(true) - const { result } = await getAppOtherEnvironmentMin(appId) - if (result?.length) { + try { + const { result } = await getAppOtherEnvironmentMin(appId) + if (result?.length) { setAppListOptions( - result - .map((app): OptionType => { - return { - value: `${app.environmentId}`, - label: app.environmentName, - } - }) - .sort(sortOptionsByLabel), + result + .map((app): OptionType => { + return { + value: `${app.environmentId}`, + label: app.environmentName, + } + }) + .sort(sortOptionsByLabel), ) - } + } + } catch (error) {noop} setAppListLoading(false) } From f22aa782ae24ddafc90ca1136a90c4f454487565 Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Thu, 22 Feb 2024 19:21:50 +0530 Subject: [PATCH 05/10] fix: add catch blocks to fetch calls Changes in appDetails/AppDetails.tsx, details/main.tsx & appDetails/AppDetails.component.tsx --- src/components/app/details/appDetails/AppDetails.tsx | 4 +++- src/components/app/details/main.tsx | 9 +++++---- src/components/v2/appDetails/AppDetails.component.tsx | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/app/details/appDetails/AppDetails.tsx b/src/components/app/details/appDetails/AppDetails.tsx index d482925b7b..649369fd94 100644 --- a/src/components/app/details/appDetails/AppDetails.tsx +++ b/src/components/app/details/appDetails/AppDetails.tsx @@ -334,7 +334,9 @@ export const Details: React.FC = ({ } }, ) - .catch(noop) + .catch((error) => { + showError(error) + }) }, [ params.appId, diff --git a/src/components/app/details/main.tsx b/src/components/app/details/main.tsx index 61e4d90bb0..75cf17c0b2 100644 --- a/src/components/app/details/main.tsx +++ b/src/components/app/details/main.tsx @@ -8,7 +8,6 @@ import { ToastBody, DeleteDialog, ErrorScreenManager, - noop, } from '@devtron-labs/devtron-fe-common-lib' import { MultiValue } from 'react-select' import { toast } from 'react-toastify' @@ -111,9 +110,9 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) { setGroupFilterOptions(_groupFilterOption) } } catch (error) { - noop; + showError(error) } - setAppListLoading(true) + setAppListLoading(false) } const getAppListData = async (): Promise => { @@ -133,7 +132,9 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) { .sort(sortOptionsByLabel), ) } - } catch (error) {noop} + } catch (error) { + showError(error) + } setAppListLoading(false) } diff --git a/src/components/v2/appDetails/AppDetails.component.tsx b/src/components/v2/appDetails/AppDetails.component.tsx index 8edb5a0a8c..372c2d1cc1 100644 --- a/src/components/v2/appDetails/AppDetails.component.tsx +++ b/src/components/v2/appDetails/AppDetails.component.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef, useState } from 'react' import './appDetails.scss' import { useLocation, useParams } from 'react-router' -import { DeploymentAppTypes, Progressing, noop } from '@devtron-labs/devtron-fe-common-lib' +import { DeploymentAppTypes, Progressing, showError } from '@devtron-labs/devtron-fe-common-lib' import { AppDetailsComponentType, AppType } from './appDetails.type' import IndexStore from './index.store' import EnvironmentStatusComponent from './sourceInfo/environmentStatus/EnvironmentStatus.component' @@ -105,7 +105,9 @@ const AppDetailsComponent = ({ } }, ) - .catch(noop) + .catch((error) => { + showError(error) + }) } const processDeploymentStatusData = (deploymentStatusDetailRes: DeploymentStatusDetailsType): void => { From 39f898d19e0d12639c49e700f1460ae59581c7bd Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Fri, 23 Feb 2024 12:09:56 +0530 Subject: [PATCH 06/10] fix: add catch block to ServerError throwable call Modifications in login/Login.tsx --- src/components/login/Login.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/login/Login.tsx b/src/components/login/Login.tsx index 4d88cf692a..2d2750f110 100644 --- a/src/components/login/Login.tsx +++ b/src/components/login/Login.tsx @@ -61,6 +61,9 @@ export default class Login extends Component { loginList: list, }) }) + .catch(error => { + showError(error) + }) if (typeof Storage !== 'undefined') { if (localStorage.isDashboardAccessed) { return From 471fc5367b89fb1149668ccd21f41cb54363ab05 Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Mon, 26 Feb 2024 20:33:19 +0530 Subject: [PATCH 07/10] refactor: ResizeObserver in Terminal.tsx --- src/components/common/helpers/Helpers.tsx | 26 ------------------- .../NodeDetailTabs/terminal/Terminal.tsx | 13 +++++++--- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/components/common/helpers/Helpers.tsx b/src/components/common/helpers/Helpers.tsx index e12215f364..8670fcf4cf 100644 --- a/src/components/common/helpers/Helpers.tsx +++ b/src/components/common/helpers/Helpers.tsx @@ -1104,32 +1104,6 @@ export const reloadToastBody = () => { ) } -export function useHeightObserver(callback): [RefObject] { - const ref = useRef(null) - const callbackRef = useRef(callback) - - useLayoutEffect(() => { - callbackRef.current = callback - }, [callback]) - - const handleHeightChange = useCallback(() => { - callbackRef.current?.(ref.current.clientHeight) - }, [callbackRef]) - - useLayoutEffect(() => { - if (!ref.current) { - return - } - const observer = new ResizeObserver(handleHeightChange) - observer.observe(ref.current) - return () => { - observer.disconnect() - } - }, [handleHeightChange, ref]) - - return [ref] -} - export const getDeploymentAppType = ( allowedDeploymentTypes: DeploymentAppTypes[], selectedDeploymentAppType: string, diff --git a/src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetailTabs/terminal/Terminal.tsx b/src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetailTabs/terminal/Terminal.tsx index 90f816ad40..22d3b8e577 100644 --- a/src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetailTabs/terminal/Terminal.tsx +++ b/src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetailTabs/terminal/Terminal.tsx @@ -5,7 +5,7 @@ import * as XtermWebfont from 'xterm-webfont' import SockJS from 'sockjs-client' import moment from 'moment' import CopyToast, { handleSelectionChange } from '../CopyToast' -import { elementDidMount, useHeightObserver } from '../../../../../../common/helpers/Helpers' +import { elementDidMount } from '../../../../../../common/helpers/Helpers' import { CLUSTER_STATUS, SocketConnectionType } from '../../../../../../ClusterNodes/constants' import { TERMINAL_STATUS } from './constants' import './terminal.scss' @@ -27,6 +27,7 @@ export default function TerminalView({ dataTestId, }: TerminalViewType) { const socket = useRef(null) + const termDiv = useRef(null) const [firstMessageReceived, setFirstMessageReceived] = useState(false) const [isReconnection, setIsReconnection] = useState(false) const [popupText, setPopupText] = useState(false) @@ -42,7 +43,13 @@ export default function TerminalView({ } } - const [myDivRef] = useHeightObserver(resizeSocket) + useEffect(() => { + /* requestAnimationFrame: will defer the resizeSocket callback to the next repaint; + * sparing us from - ResizeObserver loop completed with undelivered notifications */ + const observer = new ResizeObserver(() => window.requestAnimationFrame(resizeSocket)) + observer.observe(termDiv.current) + return () => observer.disconnect() + }, []) useEffect(() => { if (!terminalRef.current) { @@ -240,7 +247,7 @@ export default function TerminalView({
{renderConnectionStrip()}
Date: Tue, 27 Feb 2024 12:02:36 +0530 Subject: [PATCH 08/10] refactor: remove unused imports & ? checks --- .../Details/TriggerView/EnvTriggerView.tsx | 4 +--- .../DeploymentTemplateOverrideForm.tsx | 8 ++++---- src/components/app/details/appDetails/AppDetails.tsx | 4 +--- src/components/app/details/main.tsx | 8 ++------ src/components/app/details/triggerView/TriggerView.tsx | 4 +--- src/components/common/helpers/Helpers.tsx | 2 +- .../DeploymentTemplateView/DeploymentConfigFormCTA.tsx | 2 +- src/components/login/Login.tsx | 4 +--- src/components/v2/appDetails/AppDetails.component.tsx | 6 ++---- 9 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx b/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx index 69cd83a871..83f231f394 100644 --- a/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx +++ b/src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx @@ -223,9 +223,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou setDefaultConfig(_isDefaultConfig) setConfigPresent(isConfigPresent) }) - .catch((error) => { - showError(error) - }) + .catch() } const preserveSelection = (_workflows: WorkflowType[]) => { diff --git a/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx b/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx index da9c9503f9..68be475508 100644 --- a/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx +++ b/src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx @@ -230,8 +230,8 @@ export default function DeploymentTemplateOverrideForm({ : await api(+appId, +envId, payload) if (deploymentTemplateResp.result?.isLockConfigError && !saveEligibleChanges) { // checking if any locked changes and opening drawer to show eligible and locked ones - setLockedOverride(deploymentTemplateResp.result?.lockedOverride) - setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) + setLockedOverride(deploymentTemplateResp.result.lockedOverride) + setDisableSaveEligibleChanges(deploymentTemplateResp.result.disableSaveEligibleChanges) handleLockedDiffDrawer(true) return } @@ -242,10 +242,10 @@ export default function DeploymentTemplateOverrideForm({ if (envOverrideValuesWithBasic) { editorOnChange(YAML.stringify(envOverrideValuesWithBasic, { indent: 2 }), true) - } else { + } else if (deploymentTemplateResp.result?.envOverrideValues) { dispatch({ type: DeploymentConfigStateActionTypes.tempFormData, - payload: YAML.stringify(deploymentTemplateResp.result?.envOverrideValues), + payload: YAML.stringify(deploymentTemplateResp.result.envOverrideValues), }) } toast.success( diff --git a/src/components/app/details/appDetails/AppDetails.tsx b/src/components/app/details/appDetails/AppDetails.tsx index 649369fd94..3dc83ce753 100644 --- a/src/components/app/details/appDetails/AppDetails.tsx +++ b/src/components/app/details/appDetails/AppDetails.tsx @@ -334,9 +334,7 @@ export const Details: React.FC = ({ } }, ) - .catch((error) => { - showError(error) - }) + .catch() }, [ params.appId, diff --git a/src/components/app/details/main.tsx b/src/components/app/details/main.tsx index 75cf17c0b2..4c2287c0f2 100644 --- a/src/components/app/details/main.tsx +++ b/src/components/app/details/main.tsx @@ -109,9 +109,7 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) { _groupFilterOption.sort(sortOptionsByLabel) setGroupFilterOptions(_groupFilterOption) } - } catch (error) { - showError(error) - } + } catch {} setAppListLoading(false) } @@ -132,9 +130,7 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) { .sort(sortOptionsByLabel), ) } - } catch (error) { - showError(error) - } + } catch {} setAppListLoading(false) } diff --git a/src/components/app/details/triggerView/TriggerView.tsx b/src/components/app/details/triggerView/TriggerView.tsx index 7f223a3760..6b13ec3f25 100644 --- a/src/components/app/details/triggerView/TriggerView.tsx +++ b/src/components/app/details/triggerView/TriggerView.tsx @@ -176,9 +176,7 @@ class TriggerView extends Component { const _isDefaultConfig = response.result.is_default_configured this.setState({ configs: isConfigPresent, isDefaultConfigPresent: _isDefaultConfig }) }) - .catch((error) => { - showError(error) - }) + .catch() } getWorkflows = (isFromOnMount?: boolean) => { diff --git a/src/components/common/helpers/Helpers.tsx b/src/components/common/helpers/Helpers.tsx index 8670fcf4cf..9462973744 100644 --- a/src/components/common/helpers/Helpers.tsx +++ b/src/components/common/helpers/Helpers.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback, useRef, useMemo, RefObject, useLayoutEffect } from 'react' +import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react' import { showError, useThrottledEffect, diff --git a/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx b/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx index 7751793c5e..40d992f873 100644 --- a/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx +++ b/src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx @@ -74,7 +74,7 @@ export default function DeploymentConfigFormCTA({ const deploymentTemplateResp = await checkForProtectedLockedChanges() if (deploymentTemplateResp.result?.isLockConfigError) { setShowLockedDiffForApproval(true) - setLockedOverride(deploymentTemplateResp.result?.lockedOverride) + setLockedOverride(deploymentTemplateResp.result.lockedOverride) handleLockedDiffDrawer(true) } else { setShowLockedDiffForApproval(false) diff --git a/src/components/login/Login.tsx b/src/components/login/Login.tsx index 2d2750f110..369d393020 100644 --- a/src/components/login/Login.tsx +++ b/src/components/login/Login.tsx @@ -61,9 +61,7 @@ export default class Login extends Component { loginList: list, }) }) - .catch(error => { - showError(error) - }) + .catch() if (typeof Storage !== 'undefined') { if (localStorage.isDashboardAccessed) { return diff --git a/src/components/v2/appDetails/AppDetails.component.tsx b/src/components/v2/appDetails/AppDetails.component.tsx index 372c2d1cc1..6c9fe3b2a7 100644 --- a/src/components/v2/appDetails/AppDetails.component.tsx +++ b/src/components/v2/appDetails/AppDetails.component.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef, useState } from 'react' import './appDetails.scss' import { useLocation, useParams } from 'react-router' -import { DeploymentAppTypes, Progressing, showError } from '@devtron-labs/devtron-fe-common-lib' +import { DeploymentAppTypes, Progressing } from '@devtron-labs/devtron-fe-common-lib' import { AppDetailsComponentType, AppType } from './appDetails.type' import IndexStore from './index.store' import EnvironmentStatusComponent from './sourceInfo/environmentStatus/EnvironmentStatus.component' @@ -105,9 +105,7 @@ const AppDetailsComponent = ({ } }, ) - .catch((error) => { - showError(error) - }) + .catch() } const processDeploymentStatusData = (deploymentStatusDetailRes: DeploymentStatusDetailsType): void => { From 3a5939f9630e974d84209ec8486559d552173ae2 Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Fri, 1 Mar 2024 13:02:52 +0530 Subject: [PATCH 09/10] fix: conditional check for optional property edit renderSideInfoColumn in EnvironmentOverview.tsx --- .../EnvironmentOverview.tsx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/ApplicationGroup/Details/EnvironmentOverview/EnvironmentOverview.tsx b/src/components/ApplicationGroup/Details/EnvironmentOverview/EnvironmentOverview.tsx index a500050938..3008e3b7d5 100644 --- a/src/components/ApplicationGroup/Details/EnvironmentOverview/EnvironmentOverview.tsx +++ b/src/components/ApplicationGroup/Details/EnvironmentOverview/EnvironmentOverview.tsx @@ -323,15 +323,18 @@ export default function EnvironmentOverview({
Created by
-
-
- {appGroupListData.createdBy[0]} -
- {appGroupListData.createdBy} -
+ {appGroupListData.createdBy + ? ( +
+
+ {appGroupListData.createdBy[0]} +
+ {appGroupListData.createdBy} +
+ ) : '-'}
From 72480284e62ca779aa670689c093043128cde8cc Mon Sep 17 00:00:00 2001 From: Amrit Borah Date: Fri, 1 Mar 2024 13:17:56 +0530 Subject: [PATCH 10/10] refactor: remove unnecessary optional checks edit in deploymentConfig/DeploymentConfig.tsx --- src/components/deploymentConfig/DeploymentConfig.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/deploymentConfig/DeploymentConfig.tsx b/src/components/deploymentConfig/DeploymentConfig.tsx index 1805307348..20d22ef86b 100644 --- a/src/components/deploymentConfig/DeploymentConfig.tsx +++ b/src/components/deploymentConfig/DeploymentConfig.tsx @@ -519,8 +519,8 @@ export default function DeploymentConfig({ ? await checkForProtectedLockedChanges() : await getIfLockedConfigNonProtected(requestBody) if (deploymentTemplateResp.result?.isLockConfigError) { - setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) - setLockedOverride(deploymentTemplateResp.result?.lockedOverride) + setDisableSaveEligibleChanges(deploymentTemplateResp.result.disableSaveEligibleChanges) + setLockedOverride(deploymentTemplateResp.result.lockedOverride) handleLockedDiffDrawer(true) return } @@ -567,8 +567,8 @@ export default function DeploymentConfig({ const api = state.chartConfig.id ? updateDeploymentTemplate : saveDeploymentTemplate const deploymentTemplateResp = await api(requestBody, baseDeploymentAbortController.signal) if (deploymentTemplateResp.result?.isLockConfigError) { - setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) - setLockedOverride(deploymentTemplateResp.result?.lockedOverride) + setDisableSaveEligibleChanges(deploymentTemplateResp.result.disableSaveEligibleChanges) + setLockedOverride(deploymentTemplateResp.result.lockedOverride) handleLockedDiffDrawer(true) return }