Skip to content

Commit 0155a8c

Browse files
committed
Merge branch 'main' of github.com:devtron-labs/dashboard into feat/inactive-user
2 parents 58a7f98 + dbaaf48 commit 0155a8c

File tree

30 files changed

+1198
-118
lines changed

30 files changed

+1198
-118
lines changed

.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ HIDE_GITOPS_OR_HELM_OPTION=true
2424
CONFIGURABLE_TIMEOUT=
2525
HIDE_APPLICATION_GROUPS=true
2626
REACT_APP_K8S_CLIENT=false
27-
USE_V2=false
2827
CLUSTER_TERMINAL_CONNECTION_POLLING_INTERVAL=7000
2928
CLUSTER_TERMINAL_CONNECTION_RETRY_COUNT=7
3029
ENABLE_CHART_SEARCH_IN_HELM_DEPLOY=false

config.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
| SENTRY_PERFORMANCE_ENABLED | false | To send persormance sentry |
1616
| SENTRY_DSN | '' | SENTRY Data Source Name |
1717
| SENTRY_TRACES_SAMPLE_RATE | 0.2 | Rate at which data send to sentry.(min=0 max=1)|
18-
| USE_V2 | "true" | Use the v2 APIs |
1918
| ENABLE_RESTART_WORKLOAD | "false" | Show restart pods option in app details page |
2019
| ENABLE_BUILD_CONTEXT | "true" | Enable build context in Devtron UI |
2120
| FORCE_SECURITY_SCANNING | "false" | Force security scanning |

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.59-beta-8",
7+
"@devtron-labs/devtron-fe-common-lib": "0.0.62",
88
"@rjsf/core": "^5.13.3",
99
"@rjsf/utils": "^5.13.3",
1010
"@rjsf/validator-ajv8": "^5.13.3",

src/assets/icons/ic-lines.svg

Lines changed: 3 additions & 0 deletions
Loading

src/components/ClusterNodes/ClusterSelectionList.tsx

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React, { useState, useEffect } from 'react'
22
import { useHistory, useLocation } from 'react-router-dom'
3-
import { ReactComponent as Search } from '../../assets/icons/ic-search.svg'
4-
import { ReactComponent as Clear } from '../../assets/icons/ic-error.svg'
53
import { handleUTCTime } from '../common'
6-
import { Progressing } from '@devtron-labs/devtron-fe-common-lib'
4+
import { Progressing, SearchBar } from '@devtron-labs/devtron-fe-common-lib'
75
import { ClusterDetail } from './types'
86
import { ReactComponent as Error } from '../../assets/icons/ic-error-exclamation.svg'
97
import { ReactComponent as Success } from '../../assets/icons/appstatus/healthy.svg'
@@ -73,37 +71,36 @@ export default function ClusterSelectionList({
7371
setSearchText('')
7472
}
7573

76-
const handleFilterKeyPress = (event): void => {
77-
const theKeyCode = event.key
78-
if (theKeyCode === 'Enter') {
79-
handleFilterChanges(event.target.value)
74+
const handleFilterKeyPress = (value): void => {
75+
handleFilterChanges(value)
8076
setSearchApplied(true)
81-
} else if (theKeyCode === 'Backspace' && searchText.length === 1) {
82-
clearSearch()
83-
}
77+
}
78+
79+
const handleSearchChange = (value): void => {
80+
setSearchText(value.trim())
81+
}
82+
83+
const handleOnBlur = (event): void => {
84+
event.stopPropagation()
85+
let _searchText = event.target.value
86+
_searchText = _searchText?.trim()
87+
handleFilterChanges(_searchText)
88+
setSearchText(_searchText)
8489
}
8590

8691
const renderSearch = (): JSX.Element => {
8792
return (
88-
<div className="search dc__position-rel margin-right-0 en-2 bw-1 br-4 h-32">
89-
<Search className="search__icon icon-dim-18" />
90-
<input
91-
type="text"
92-
placeholder="Search clusters"
93-
value={searchText}
94-
className="search__input"
95-
onChange={(event) => {
96-
setSearchText(event.target.value)
97-
}}
98-
onKeyDown={handleFilterKeyPress}
99-
disabled={clusterListLoader}
100-
/>
101-
{searchApplied && (
102-
<button className="search__clear-button" type="button" onClick={clearSearch}>
103-
<Clear className="icon-dim-18 icon-n4 dc__vertical-align-middle" />
104-
</button>
105-
)}
106-
</div>
93+
<SearchBar
94+
initialSearchText={searchText}
95+
handleSearchChange={handleSearchChange}
96+
handleEnter={handleFilterKeyPress}
97+
containerClassName="w-250-imp"
98+
inputProps={{
99+
placeholder: 'Search clusters',
100+
autoFocus: true,
101+
disabled: minLoader,
102+
}}
103+
/>
107104
)
108105
}
109106

src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useMemo, useState } from 'react'
1+
import React, { useEffect, useMemo, useRef, useState } from 'react'
22
import { useParams } from 'react-router-dom'
33
import { toast } from 'react-toastify'
44
import YAML from 'yaml'
@@ -27,11 +27,14 @@ import {
2727
validateBasicView,
2828
} from '../deploymentConfig/DeploymentConfig.utils'
2929
import CodeEditor from '../CodeEditor/CodeEditor'
30+
import * as jsonpatch from 'fast-json-patch'
3031

3132
const ConfigToolbar = importComponentFromFELibrary('ConfigToolbar', DeploymentConfigToolbar)
3233
const SaveChangesModal = importComponentFromFELibrary('SaveChangesModal')
3334
const DeleteOverrideDraftModal = importComponentFromFELibrary('DeleteOverrideDraftModal')
3435
const DeploymentTemplateLockedDiff = importComponentFromFELibrary('DeploymentTemplateLockedDiff')
36+
const applyPatches=importComponentFromFELibrary('applyPatches', null, 'function')
37+
3538
export default function DeploymentTemplateOverrideForm({
3639
state,
3740
isConfigProtectionEnabled,
@@ -66,6 +69,9 @@ export default function DeploymentTemplateOverrideForm({
6669
allowed: false,
6770
})
6871
const [disableSaveEligibleChanges, setDisableSaveEligibleChanges] = useState(false)
72+
const [hideLockedKeys, setHideLockedKeys] = useState(false)
73+
const hideLockKeysToggled = useRef(false)
74+
const removedPatches = useRef<Array<jsonpatch.Operation>>([])
6975

7076
useEffect(() => {
7177
// Reset editor value on delete override action
@@ -105,10 +111,15 @@ export default function DeploymentTemplateOverrideForm({
105111

106112
const prepareDataToSave = (envOverrideValuesWithBasic, includeInDraft?: boolean) => {
107113
let valuesOverride = envOverrideValuesWithBasic || obj || state.duplicate
114+
115+
if (applyPatches && hideLockedKeys) {
116+
valuesOverride = applyPatches(valuesOverride, removedPatches.current)
117+
}
118+
108119
if (state.showLockedTemplateDiff) {
109120
// if locked keys
110121
if (!lockedConfigKeysWithLockType.allowed) {
111-
valuesOverride = getUnlockedJSON(lockedOverride, lockedConfigKeysWithLockType.config)
122+
valuesOverride = getUnlockedJSON(lockedOverride, lockedConfigKeysWithLockType.config, true).newDocument
112123
} else {
113124
// if allowed keys
114125
valuesOverride = getLockedJSON(lockedOverride, lockedConfigKeysWithLockType.config)
@@ -216,9 +227,10 @@ export default function DeploymentTemplateOverrideForm({
216227
//loading state for checking locked changes
217228
dispatch({ type: DeploymentConfigStateActionTypes.lockChangesLoading, payload: true })
218229
}
230+
const payload = prepareDataToSave(envOverrideValuesWithBasic, false)
219231
const deploymentTemplateResp = isConfigProtectionEnabled
220232
? await checkForProtectedLockedChanges()
221-
: await api(+appId, +envId, prepareDataToSave(envOverrideValuesWithBasic, false))
233+
: await api(+appId, +envId, payload)
222234
if (deploymentTemplateResp.result.isLockConfigError && !saveEligibleChanges) {
223235
//checking if any locked changes and opening drawer to show eligible and locked ones
224236
setLockedOverride(deploymentTemplateResp.result?.lockedOverride)
@@ -232,6 +244,11 @@ export default function DeploymentTemplateOverrideForm({
232244

233245
if (envOverrideValuesWithBasic) {
234246
editorOnChange(YAML.stringify(envOverrideValuesWithBasic, { indent: 2 }), true)
247+
} else {
248+
dispatch({
249+
type: DeploymentConfigStateActionTypes.tempFormData,
250+
payload: YAML.stringify(deploymentTemplateResp.result.envOverrideValues),
251+
})
235252
}
236253
toast.success(
237254
<div className="toast">
@@ -354,6 +371,7 @@ export default function DeploymentTemplateOverrideForm({
354371
openComparison: state.showReadme && state.selectedTabIndex === 2,
355372
},
356373
})
374+
hideLockKeysToggled.current = true
357375
}
358376

359377
const handleComparisonClick = () => {
@@ -366,6 +384,9 @@ export default function DeploymentTemplateOverrideForm({
366384
const handleTabSelection = (index: number) => {
367385
if (state.unableToParseYaml) return
368386

387+
//setting true to update codeditor values with current locked keys checkbox value
388+
hideLockKeysToggled.current = true
389+
369390
dispatch({
370391
type: DeploymentConfigStateActionTypes.selectedTabIndex,
371392
payload:
@@ -508,6 +529,9 @@ export default function DeploymentTemplateOverrideForm({
508529
: YAML.stringify(state.data.globalConfig, { indent: 2 })
509530
} else if (state.tempFormData) {
510531
codeEditorValue = state.tempFormData
532+
if (applyPatches && hideLockedKeys) {
533+
codeEditorValue = YAML.stringify(applyPatches(YAML.parse(state.tempFormData), removedPatches.current))
534+
}
511535
} else {
512536
const isOverridden = state.latestDraft?.action === 3 ? state.isDraftOverriden : !!state.duplicate
513537
codeEditorValue = isOverridden
@@ -571,6 +595,9 @@ export default function DeploymentTemplateOverrideForm({
571595
<DeploymentTemplateReadOnlyEditorView
572596
value={isValuesOverride ? getCodeEditorValue(true) : manifestDataRHS}
573597
isEnvOverride={true}
598+
lockedConfigKeysWithLockType={lockedConfigKeysWithLockType}
599+
hideLockedKeys={hideLockedKeys}
600+
removedPatches={removedPatches}
574601
/>
575602
)
576603
} else if (state.loadingManifestOverride) {
@@ -581,7 +608,7 @@ export default function DeploymentTemplateOverrideForm({
581608
)
582609
} else {
583610
return (
584-
<DeploymentTemplateEditorView
611+
< DeploymentTemplateEditorView
585612
isEnvOverride={true}
586613
value={isValuesOverride ? getCodeEditorValue(false) : manifestDataRHS}
587614
defaultValue={
@@ -606,6 +633,10 @@ export default function DeploymentTemplateOverrideForm({
606633
convertVariables={convertVariablesOverride}
607634
setConvertVariables={setConvertVariables}
608635
groupedData={groupedData}
636+
hideLockedKeys={hideLockedKeys}
637+
lockedConfigKeysWithLockType={lockedConfigKeysWithLockType}
638+
hideLockKeysToggled={hideLockKeysToggled}
639+
removedPatches={removedPatches}
609640
/>
610641
)
611642
}
@@ -703,6 +734,11 @@ export default function DeploymentTemplateOverrideForm({
703734
componentType={3}
704735
setShowLockedDiffForApproval={setShowLockedDiffForApproval}
705736
setLockedConfigKeysWithLockType={setLockedConfigKeysWithLockType}
737+
lockedConfigKeysWithLockType={lockedConfigKeysWithLockType}
738+
setHideLockedKeys={setHideLockedKeys}
739+
hideLockedKeys={hideLockedKeys}
740+
hideLockKeysToggled={hideLockKeysToggled}
741+
inValidYaml={state.unableToParseYaml}
706742
/>
707743
{state.selectedTabIndex !== 2 && !state.showReadme && renderOverrideInfoStrip()}
708744
{renderValuesView()}

src/components/ResourceBrowser/ResourceList/ResourceList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ export default function ResourceList() {
10801080
}
10811081
return (
10821082
<ShortcutProvider>
1083-
<div className="resource-browser-container h-100">
1083+
<div className="resource-browser-container h-100 bcn-0">
10841084
<PageHeader
10851085
isBreadcrumbs={!!clusterId}
10861086
breadCrumbs={renderBreadcrumbs}

src/components/app/details/triggerView/CiWebhookDebuggingModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default function CiWebhookModal({
174174
</button>
175175
<div className="cn-9 fw-6 fs-14 flex left">
176176
Filter matching results
177-
<button type="button" className="mr-20 dc__transparent dc__align-right" onClick={() => onEditShowEditableCiModal(ciPipelineMaterialId, workflowId)}>
177+
<button type="button" className="mr-20 dc__transparent dc__align-right" onClick={() => onEditShowEditableCiModal(ciPipelineId, workflowId)}> // Here the CI model requires the CiPipelineId not the CiPipelineMaterialId
178178
<Edit className=" icon-dim-24" />
179179
</button>
180180
</div>

src/components/app/service.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@ let stageMap = {
2424
}
2525

2626
export const getAppList = (request, options?) => {
27-
let URL = Routes.APP_LIST
28-
if (window._env_.USE_V2) {
29-
URL += `/${Routes.APP_LIST_V2}`
30-
} else {
31-
URL += `/${Routes.APP_LIST_V1}`
32-
}
33-
return post(URL, request, options)
27+
return post(Routes.APP_LIST, request, options)
3428
}
3529

3630
export function getCITriggerInfo(params: { envId: number | string; ciArtifactId: number | string }) {

src/components/ciPipeline/SourceMaterials.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export const SourceMaterials: React.FC<SourceMaterialsProps> = function (props)
225225
}
226226
/>
227227
{/* Note: In case Error is not shown added height*/}
228-
{errorObj?.isValid && <div className="h-24"></div>}
228+
{(errorObj?.isValid || islinkedCI) && <div className="h-24"></div>}
229229
</div>
230230
)}
231231

@@ -247,11 +247,12 @@ export const SourceMaterials: React.FC<SourceMaterialsProps> = function (props)
247247
)
248248
}}
249249
error={
250-
errorObj && !errorObj.isValid
251-
&& props.validationRules?.sourceValue(_materials[index].regex).message
250+
errorObj &&
251+
!errorObj.isValid &&
252+
props.validationRules?.sourceValue(_materials[index].regex).message
252253
}
253254
/>
254-
{/* Note: In case Error is not shown */}
255+
{/* Note: In case Error is not shown */}
255256
{errorObj?.isValid && <div className="h-24"></div>}
256257
</div>
257258
)}

0 commit comments

Comments
 (0)