Skip to content

Commit 0143e81

Browse files
committed
feat: add prop to configure showError for mandatory plugins
1 parent dc6eaa2 commit 0143e81

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Common/Policy.Types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import { PluginDataStoreType } from '../Shared'
1818
import { VariableType } from './CIPipeline.Types'
19+
import { ServerErrors } from './ServerError'
1920
import { ResponseType } from './Types'
2021

2122
export enum ApplyPolicyToStage {
@@ -62,6 +63,7 @@ export interface MandatoryPluginDataType {
6263
export interface ProcessPluginDataReturnType {
6364
mandatoryPluginData: MandatoryPluginDataType
6465
pluginDataStore: PluginDataStoreType
66+
mandatoryPluginsError?: ServerErrors
6567
}
6668

6769
export enum ConsequenceAction {

src/Shared/Components/Plugin/service.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const getPluginsDetail = async ({
1616
appId,
1717
parentPluginIds,
1818
pluginIds,
19+
shouldShowError = true,
1920
}: PluginDetailServiceParamsType): Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>> => {
2021
try {
2122
const payload: PluginDetailPayloadType = {
@@ -34,7 +35,9 @@ export const getPluginsDetail = async ({
3435
pluginStore,
3536
}
3637
} catch (error) {
37-
showError(error)
38+
if (shouldShowError) {
39+
showError(error)
40+
}
3841
throw error
3942
}
4043
}

src/Shared/Components/Plugin/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export interface PluginDetailServiceParamsType {
6262
appId: number
6363
pluginIds?: number[]
6464
parentPluginIds?: number[]
65+
/**
66+
* @default true
67+
*/
68+
shouldShowError?: boolean
6569
}
6670

6771
export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsType, 'appId'> {

0 commit comments

Comments
 (0)