Skip to content

Commit 22a6e4f

Browse files
committed
code refactoring
1 parent 3128353 commit 22a6e4f

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { lazy, Suspense, useRef, useState, useEffect } from 'react'
22
import { Route, Switch, Redirect, useHistory, useLocation } from 'react-router-dom'
3-
import { APPROVAL_MODAL_TYPE, URLS } from './config'
3+
import { URLS } from './config'
44
import { toast } from 'react-toastify'
55
import 'patternfly/dist/css/patternfly.css'
66
import 'patternfly/dist/css/patternfly-additions.css'
@@ -19,7 +19,7 @@ import {
1919
ErrorBoundary,
2020
importComponentFromFELibrary,
2121
} from './components/common'
22-
import { showError, BreadcrumbStore, Reload, DevtronProgressing } from '@devtron-labs/devtron-fe-common-lib'
22+
import { showError, BreadcrumbStore, Reload, DevtronProgressing, APPROVAL_MODAL_TYPE } from '@devtron-labs/devtron-fe-common-lib'
2323
import * as serviceWorker from './serviceWorker'
2424
import Hotjar from './components/Hotjar/Hotjar'
2525
import { validateToken } from './services/service'
@@ -50,10 +50,10 @@ export default function App() {
5050
const [forceUpdateOnLocationChange, setForceUpdateOnLocationChange] = useState(false)
5151
const [approvalToken, setApprovalToken] = useState<string>('')
5252
const [approvalType, setApprovalType] = useState<APPROVAL_MODAL_TYPE>(APPROVAL_MODAL_TYPE.CONFIG)
53-
5453
const location = useLocation()
5554
const { push } = useHistory()
5655
const didMountRef = useRef(false)
56+
const isDirectApprovalNotification = location.pathname && location.pathname.includes('approve') && location.search && location.search.includes('?token=')
5757

5858
function onlineToast(toastBody: JSX.Element, options) {
5959
if (onlineToastRef.current && toast.isActive(onlineToastRef.current)) {
@@ -130,7 +130,7 @@ export default function App() {
130130
// If not K8S_CLIENT then validateToken otherwise directly redirect
131131
if (!window._env_.K8S_CLIENT) {
132132
// Pass validation for direct email approval notification
133-
if (location.pathname && location.pathname.includes('approve')) {
133+
if (isDirectApprovalNotification) {
134134
redirectToDirectApprovalNotification()
135135
} else {
136136
validation()
@@ -245,8 +245,7 @@ export default function App() {
245245
) : (
246246
<ErrorBoundary>
247247
<BreadcrumbStore>
248-
{ console.log(approvalToken)}
249-
{location.pathname && location.pathname.includes('approve') ? (
248+
{isDirectApprovalNotification ? (
250249
<Switch>
251250
<Route
252251
exact

src/config/constants.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,6 @@ export const SERVER_ERROR_CODES = {
804804
CHART_NAME_RESERVED: '5002',
805805
}
806806

807-
export enum APPROVAL_MODAL_TYPE {
808-
CONFIG = 'CONFIG',
809-
IMAGE = 'IMAGE',
810-
}
811-
812807
export const ENV_ALREADY_EXIST_ERROR = 'Deployment pipeline already exists for this environment'
813808
export const CVE_ID_NOT_FOUND = "CVE ID not found"
814809
export const CONFIGURE_LINK_NO_NAME = "Please provide name for the tool you want to link"

src/css/icons.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@
188188
height: 48px;
189189
}
190190

191+
.icon-dim-72 {
192+
width: 72px;
193+
height: 72px;
194+
}
195+
191196
.icon-dim-80 {
192197
width: 80px;
193198
height: 80px;

0 commit comments

Comments
 (0)