Skip to content

Commit 6434434

Browse files
committed
Merge branch 'main' into vite_exploration
2 parents a21e059 + 2327bac commit 6434434

File tree

8 files changed

+35
-13
lines changed

8 files changed

+35
-13
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ export default function NewCDPipeline({
268268
description: env.description,
269269
isVirtualEnvironment: env.isVirtualEnvironment,
270270
allowedDeploymentTypes: env.allowedDeploymentTypes || [],
271+
isDigestEnforcedForEnv: env.isDigestEnforcedForEnv,
271272
}
272273
})
273274
sortObjectArrayAlphabetically(list, 'name')
@@ -451,8 +452,7 @@ export default function NewCDPipeline({
451452
form.enableCustomTag = pipelineConfigFromRes.enableCustomTag
452453
form.customTagStage = pipelineConfigFromRes.customTagStage
453454
form.isDigestEnforcedForEnv = pipelineConfigFromRes.isDigestEnforcedForEnv
454-
form.isDigestEnforcedForPipeline =
455-
pipelineConfigFromRes.isDigestEnforcedForEnv || pipelineConfigFromRes.isDigestEnforcedForPipeline
455+
form.isDigestEnforcedForPipeline = pipelineConfigFromRes.isDigestEnforcedForPipeline
456456

457457
if (pipelineConfigFromRes?.preDeployStage) {
458458
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
@@ -242,7 +242,11 @@ export default function DeploymentTemplateGUIView({ fetchingValues, value, readO
242242
<CustomInput
243243
data-testid="httprequests-routes-path-textbox"
244244
name={BASIC_FIELDS.PATH}
245-
data-index={index}
245+
inputProps={
246+
{
247+
'data-index': index,
248+
} as React.InputHTMLAttributes<HTMLInputElement>
249+
}
246250
value={path}
247251
rootClassName="w-100 br-4 en-2 bw-1 pl-10 pr-10 pt-5 pb-5"
248252
onChange={handleInputChange}

src/components/globalConfigurations/GlobalConfiguration.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ const Body = ({ getHostURLConfig, checkList, serverMode, handleChecklistUpdate,
638638
)}
639639
{PullImageDigest && (
640640
<Route path={URLS.GLOBAL_CONFIG_PULL_IMAGE_DIGEST}>
641-
<PullImageDigest />
641+
<PullImageDigest isSuperAdmin={isSuperAdmin}/>
642642
</Route>
643643
)}
644644
{TagListContainer && (

src/config/constants.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,10 @@ export const SERVER_ERROR_CODES = {
808808
}
809809

810810
export const ENV_ALREADY_EXIST_ERROR = 'Deployment pipeline already exists for this environment'
811-
export const CVE_ID_NOT_FOUND = 'CVE ID not found'
812-
export const CONFIGURE_LINK_NO_NAME = 'Please provide name for the tool you want to link'
813-
export const NO_HOST_URL = 'Please enter host url'
814-
export const WEBHOOK_NO_API_TOKEN_ERROR = 'API Token is required to execute webhook'
815-
export const DIGEST_DISABLE_TOGGLE_MESSAGE =
816-
'Pull image digest policy is enforced in Global Configurations. Go to Global Configurations to change.'
811+
export const CVE_ID_NOT_FOUND = "CVE ID not found"
812+
export const CONFIGURE_LINK_NO_NAME = "Please provide name for the tool you want to link"
813+
export const NO_HOST_URL = "Please enter host url"
814+
export const WEBHOOK_NO_API_TOKEN_ERROR = "API Token is required to execute webhook"
815+
export const DIGEST_DISABLE_TOGGLE_MESSAGE_GLOBAL_ONLY= "Enforced from Global Configurations. Go to Global Configurations to change."
816+
export const DIGEST_DISABLE_TOGGLE_MESSAGE_FOR_PIPELINE= "Enforced from Global Configurations. To change, first disable it in Global Configurations, then come back here."
817+

src/css/base.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,6 +2846,10 @@ textarea,
28462846
width: 250px;
28472847
}
28482848

2849+
.w-250-imp {
2850+
width: 250px !important;
2851+
}
2852+
28492853
.w-280 {
28502854
width: 280px;
28512855
}

0 commit comments

Comments
 (0)