Skip to content

Commit fb20c42

Browse files
image scanning plugin
1 parent 5d1406b commit fb20c42

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

src/components/CIPipelineN/CIPipeline.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ export default function CIPipeline({
773773
sharedPlugins={sharedPlugins}
774774
isJobView={isJobCard}
775775
mandatoryPluginsMap={mandatoryPluginsMap}
776+
isSecurityModuleInstalled={isSecurityModuleInstalled}
776777
/>
777778
</Route>
778779
)}
@@ -782,6 +783,7 @@ export default function CIPipeline({
782783
presetPlugins={presetPlugins}
783784
sharedPlugins={sharedPlugins}
784785
mandatoryPluginsMap={mandatoryPluginsMap}
786+
isSecurityModuleInstalled={isSecurityModuleInstalled}
785787
/>
786788
</Route>
787789
)}

src/components/CIPipelineN/PluginCardListContainer.tsx

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export function PluginCardListContainer({
66
pluginListTitle,
77
pluginList,
88
setPluginType,
9+
isSecurityModuleInstalled
910
}: {
1011
pluginListTitle: string
1112
pluginList: PluginDetailType[]
@@ -17,36 +18,40 @@ export function PluginCardListContainer({
1718
inputVariables: VariableType[],
1819
outputVariables: VariableType[],
1920
) => void
21+
isSecurityModuleInstalled: boolean
2022
}) {
2123
return (
2224
pluginList.length > 0 && (
2325
<div className="plugin-container">
2426
<div data-testid="preset-plugin-heading" className="cn-5 fw-6 fs-13 mt-20 mb-8">
2527
{pluginListTitle}
2628
</div>
27-
{pluginList.map((pluginDetails) => (
28-
<div
29-
key={pluginDetails.id}
30-
onClick={() =>
31-
setPluginType(
32-
PluginType.PLUGIN_REF,
33-
pluginDetails.id,
34-
pluginDetails.name,
35-
pluginDetails.description,
36-
pluginDetails.inputVariables ?? [],
37-
pluginDetails.outputVariables ?? [],
38-
)
39-
}
40-
>
41-
<PluginCard
42-
dataTestId={`${pluginDetails.name}-button`}
43-
imgSource={pluginDetails.icon}
44-
title={pluginDetails.name}
45-
subTitle={pluginDetails.description}
46-
tags={pluginDetails.tags}
47-
/>
48-
</div>
49-
))}
29+
{pluginList.map(
30+
(pluginDetails) =>
31+
(pluginDetails.name !== 'Image Scanning' || isSecurityModuleInstalled) && (
32+
<div
33+
key={pluginDetails.id}
34+
onClick={() =>
35+
setPluginType(
36+
PluginType.PLUGIN_REF,
37+
pluginDetails.id,
38+
pluginDetails.name,
39+
pluginDetails.description,
40+
pluginDetails.inputVariables ?? [],
41+
pluginDetails.outputVariables ?? [],
42+
)
43+
}
44+
>
45+
<PluginCard
46+
dataTestId={`${pluginDetails.name}-button`}
47+
imgSource={pluginDetails.icon}
48+
title={pluginDetails.name}
49+
subTitle={pluginDetails.description}
50+
tags={pluginDetails.tags}
51+
/>
52+
</div>
53+
),
54+
)}
5055
</div>
5156
)
5257
)

src/components/CIPipelineN/PreBuild.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { importComponentFromFELibrary } from '../common'
2525
import { pipelineContext } from '../workflowEditor/workflowEditor'
2626

2727
const isRequired = importComponentFromFELibrary('isRequired', null, 'function')
28-
export function PreBuild({ presetPlugins, sharedPlugins, mandatoryPluginsMap, isJobView }: PreBuildType) {
28+
export function PreBuild({ presetPlugins, sharedPlugins, mandatoryPluginsMap, isJobView, isSecurityModuleInstalled}: PreBuildType) {
2929
const {
3030
formData,
3131
isCdPipeline,
@@ -151,11 +151,13 @@ export function PreBuild({ presetPlugins, sharedPlugins, mandatoryPluginsMap, is
151151
setPluginType={setPluginType}
152152
pluginListTitle="PRESET PLUGINS"
153153
pluginList={presetPlugins}
154+
isSecurityModuleInstalled={isSecurityModuleInstalled}
154155
/>
155156
<PluginCardListContainer
156157
setPluginType={setPluginType}
157158
pluginListTitle="SHARED PLUGINS"
158159
pluginList={sharedPlugins}
160+
isSecurityModuleInstalled={isSecurityModuleInstalled}
159161
/>
160162
</>
161163
)

src/components/ciPipeline/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ export interface PreBuildType {
395395
sharedPlugins: PluginDetailType[]
396396
mandatoryPluginsMap?: Record<number, MandatoryPluginDetailType>
397397
isJobView?: boolean
398+
isSecurityModuleInstalled?: boolean
398399
}
399400

400401
export enum CIPipelineBuildType {

0 commit comments

Comments
 (0)