Skip to content

Commit 58a7f98

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

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

src/components/cdPipeline/BuildCD.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export default function BuildCD({
150150
? GeneratedHelmPush.DO_NOT_PUSH
151151
: GeneratedHelmPush.PUSH
152152
_form.allowedDeploymentTypes = selection.allowedDeploymentTypes
153+
_form.isDigestEnforcedForEnv = _form.environments.find((env) => env.id == selection.id)?.isDigestEnforcedForEnv
153154
setFormDataErrorObj(_formDataErrorObj)
154155
setFormData(_form)
155156
} else {

src/components/cdPipeline/NewCDPipeline.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ export default function NewCDPipeline({
263263
description: env.description,
264264
isVirtualEnvironment: env.isVirtualEnvironment,
265265
allowedDeploymentTypes: env.allowedDeploymentTypes || [],
266+
isDigestEnforcedForEnv: env.isDigestEnforcedForEnv,
266267
}
267268
})
268269
sortObjectArrayAlphabetically(list, 'name')
@@ -447,7 +448,7 @@ export default function NewCDPipeline({
447448
form.enableCustomTag = pipelineConfigFromRes.enableCustomTag
448449
form.customTagStage = pipelineConfigFromRes.customTagStage
449450
form.isDigestEnforcedForEnv = pipelineConfigFromRes.isDigestEnforcedForEnv
450-
form.isDigestEnforcedForPipeline = pipelineConfigFromRes.isDigestEnforcedForEnv || pipelineConfigFromRes.isDigestEnforcedForPipeline
451+
form.isDigestEnforcedForPipeline = pipelineConfigFromRes.isDigestEnforcedForPipeline
451452

452453
if (pipelineConfigFromRes?.preDeployStage) {
453454
if(pipelineConfigFromRes.preDeployStage.steps?.length > 0){

src/components/cdPipeline/PullImageDigestToggle.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react'
33
import Tippy from '@tippyjs/react'
44
import { ReactComponent as DockerWithImage } from '../../assets/icons/ic-docker-with-image.svg'
55
import { PullImageDigestToggleType } from './types'
6-
import { DIGEST_DISABLE_TOGGLE_MESSAGE } from '../../config'
6+
import { DIGEST_DISABLE_TOGGLE_MESSAGE_FOR_PIPELINE, DIGEST_DISABLE_TOGGLE_MESSAGE_GLOBAL_ONLY } from '../../config'
77

88
function PullImageDigestToggle({ formData, setFormData }: PullImageDigestToggleType): JSX.Element {
99
const handleImageDigestToggle = (): void => {
@@ -12,19 +12,29 @@ function PullImageDigestToggle({ formData, setFormData }: PullImageDigestToggleT
1212
setFormData(_formData)
1313
}
1414

15+
const getContentText = () => {
16+
let text = ''
17+
if (formData.isDigestEnforcedForPipeline && formData.isDigestEnforcedForEnv) {
18+
text = DIGEST_DISABLE_TOGGLE_MESSAGE_FOR_PIPELINE
19+
} else if (formData.isDigestEnforcedForEnv) {
20+
text = DIGEST_DISABLE_TOGGLE_MESSAGE_GLOBAL_ONLY
21+
}
22+
return text
23+
}
24+
1525
const renderDogestToggle = () => {
1626
return (
1727
<ConditionalWrap
1828
condition={formData.isDigestEnforcedForEnv}
1929
wrap={(children) => (
20-
<Tippy className="default-tt w-200" content={DIGEST_DISABLE_TOGGLE_MESSAGE}>
30+
<Tippy className="default-tt w-200" content={getContentText()}>
2131
<div>{children}</div>
2232
</Tippy>
2333
)}
2434
>
2535
<div className={`w-32 h-20 ${formData.isDigestEnforcedForEnv ? 'dc__opacity-0_4' : ''}`}>
2636
<Toggle
27-
selected={formData.isDigestEnforcedForPipeline}
37+
selected={formData.isDigestEnforcedForPipeline || formData.isDigestEnforcedForEnv}
2838
onSelect={handleImageDigestToggle}
2939
dataTestId="create-build-pipeline-image-pull-digest-toggle"
3040
disabled={formData.isDigestEnforcedForEnv}

src/components/cdPipeline/cdPipeline.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface Environment {
5858
isClusterCdActive: boolean
5959
isVirtualEnvironment?: boolean
6060
allowedDeploymentTypes?: DeploymentAppTypes[]
61+
isDigestEnforcedForEnv?: boolean
6162
}
6263
export interface CommonError {
6364
isValid: boolean
@@ -135,6 +136,7 @@ export interface PipelineConfig {
135136
userApprovalConfig?: {
136137
requiredCount: number
137138
}
139+
isDigestEnforcedForEnv?: boolean
138140
}
139141

140142
export interface BasicCDPipelineModalProps {

src/components/deploymentConfig/DeploymentTemplateView/DeploymentTemplateGUIView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ export default function DeploymentTemplateGUIView({ fetchingValues, value, readO
238238
<CustomInput
239239
data-testid="httprequests-routes-path-textbox"
240240
name={BASIC_FIELDS.PATH}
241-
data-index={index}
241+
inputProps={
242+
{
243+
'data-index': index,
244+
} as React.InputHTMLAttributes<HTMLInputElement>
245+
}
242246
value={path}
243247
rootClassName="w-100 br-4 en-2 bw-1 pl-10 pr-10 pt-5 pb-5"
244248
onChange={handleInputChange}

src/components/globalConfigurations/GlobalConfiguration.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ function Body({ getHostURLConfig, checkList, serverMode, handleChecklistUpdate,
631631
)}
632632
{PullImageDigest && (
633633
<Route path={URLS.GLOBAL_CONFIG_PULL_IMAGE_DIGEST}>
634-
<PullImageDigest />
634+
<PullImageDigest isSuperAdmin={isSuperAdmin}/>
635635
</Route>
636636
)}
637637
{TagListContainer && (

src/config/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,8 @@ export const CVE_ID_NOT_FOUND = 'CVE ID not found'
811811
export const CONFIGURE_LINK_NO_NAME = 'Please provide name for the tool you want to link'
812812
export const NO_HOST_URL = 'Please enter host url'
813813
export const WEBHOOK_NO_API_TOKEN_ERROR = 'API Token is required to execute webhook'
814-
export const DIGEST_DISABLE_TOGGLE_MESSAGE= "Pull image digest policy is enforced in Global Configurations. Go to Global Configurations to change."
815-
814+
export const DIGEST_DISABLE_TOGGLE_MESSAGE_GLOBAL_ONLY= "Enforced from Global Configurations. Go to Global Configurations to change."
815+
export const DIGEST_DISABLE_TOGGLE_MESSAGE_FOR_PIPELINE= "Enforced from Global Configurations. To change, first disable it in Global Configurations, then come back here."
816816
export const DEFAULT_SECRET_PLACEHOLDER = '••••••••'
817817

818818
export const API_STATUS_CODES = {

src/css/base.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,6 +2861,10 @@ textarea,
28612861
width: 250px;
28622862
}
28632863

2864+
.w-250-imp {
2865+
width: 250px !important;
2866+
}
2867+
28642868
.w-280 {
28652869
width: 280px;
28662870
}

0 commit comments

Comments
 (0)