Skip to content

Commit f0e0aa4

Browse files
committed
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plugins
2 parents 47c151f + d85eb0d commit f0e0aa4

File tree

17 files changed

+152
-68
lines changed

17 files changed

+152
-68
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "4.0.2-beta-1",
3+
"version": "0.5.1-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Policy.Types.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ import { ServerErrors } from './ServerError'
2121
export enum ApplyPolicyToStage {
2222
PRE_CI = 'PRE_CI',
2323
POST_CI = 'POST_CI',
24+
PRE_CD = 'PRE_CD',
25+
POST_CD = 'POST_CD',
26+
/**
27+
* @deprecated in mandatory plugin policy v2
28+
*/
2429
PRE_OR_POST_CI = 'PRE_OR_POST_CI',
2530
POST_CD = 'POST_CD',
2631
PRE_CD = 'PRE_CD',
@@ -95,8 +100,17 @@ export type ProcessPluginDataParamsType = {
95100
} & (ProcessPluginDataCIParamsType | ProcessPluginDataCDParamsType)
96101

97102
export enum ConsequenceAction {
103+
/**
104+
* This is used if the policy is enforced immediately.
105+
*/
98106
BLOCK = 'BLOCK',
107+
/**
108+
* This is used if the policy will be enforced after a certain timestamp.
109+
*/
99110
ALLOW_UNTIL_TIME = 'ALLOW_UNTIL_TIME',
111+
/**
112+
* This is used if the policy is not enforced yet (just to show waring).
113+
*/
100114
ALLOW_FOREVER = 'ALLOW_FOREVER',
101115
}
102116

src/Common/RJSF/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export const parseSchemaHiddenType = (hiddenSchema: HiddenType): MetaHiddenType
166166
const clone = structuredClone(hiddenSchema)
167167
if (typeof clone === 'string') {
168168
return {
169-
value: false,
169+
value: true,
170170
path: conformPathToPointers(clone),
171171
}
172172
}

src/Shared/Components/Button/Button.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const Button = ({
171171
<ButtonElement
172172
{...props}
173173
disabled={isDisabled}
174-
className={`br-4 flex cursor dc__tab-focus dc__position-rel dc__capitalize ${getButtonDerivedClass({ size, variant, style, isLoading, icon })} ${isDisabled ? 'dc__disabled' : ''}`}
174+
className={`br-4 flex cursor dc__tab-focus dc__position-rel dc__capitalize ${getButtonDerivedClass({ size, variant, style, isLoading, icon })} ${isDisabled ? 'dc__disabled' : ''} dc__w-fit-content`}
175175
data-testid={dataTestId}
176176
aria-label={ariaLabel}
177177
>

src/Shared/Components/DatePicker/DateTimePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ const DateTimePicker = ({
112112
onChange={handleTimeChange}
113113
data-testid={dataTestIdForTime}
114114
menuSize={ComponentSizeType.xs}
115-
menuPosition="absolute"
116115
size={ComponentSizeType.large}
116+
shouldMenuAlignRight
117117
/>
118118
</div>
119119
)}

src/Shared/Components/DatePicker/TimeSelect.tsx

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { ReactComponent as ErrorIcon } from '@Icons/ic-warning.svg'
1817
import { ReactComponent as ClockIcon } from '@Icons/ic-clock.svg'
1918
import { ComponentSizeType } from '@Shared/constants'
2019
import { DEFAULT_TIME_OPTIONS } from './utils'
@@ -29,26 +28,18 @@ export const TimePickerSelect = ({
2928
error,
3029
selectedTimeOption,
3130
}: TimeSelectProps) => (
32-
<>
33-
<SelectPicker
34-
inputId={DATE_PICKER_IDS.TIME}
35-
placeholder="12:00 AM"
36-
options={DEFAULT_TIME_OPTIONS}
37-
isSearchable={false}
38-
isDisabled={disabled}
39-
{...timePickerProps}
40-
value={selectedTimeOption}
41-
icon={<ClockIcon className="icon-dim-20 fcn-6" />}
42-
onChange={onChange}
43-
data-testid={DATE_PICKER_IDS.TIME}
44-
size={ComponentSizeType.large}
45-
menuPosition="absolute"
46-
/>
47-
{error && (
48-
<div className="form__error">
49-
<ErrorIcon className="form__icon form__icon--error" />
50-
{error}
51-
</div>
52-
)}
53-
</>
31+
<SelectPicker
32+
inputId={DATE_PICKER_IDS.TIME}
33+
placeholder="12:00 AM"
34+
options={DEFAULT_TIME_OPTIONS}
35+
isSearchable={false}
36+
isDisabled={disabled}
37+
{...timePickerProps}
38+
value={selectedTimeOption}
39+
icon={<ClockIcon className="icon-dim-20 fcn-6" />}
40+
onChange={onChange}
41+
data-testid={DATE_PICKER_IDS.TIME}
42+
size={ComponentSizeType.large}
43+
error={error}
44+
/>
5445
)

src/Shared/Components/Plugin/PluginImageContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import { ImageWithFallback } from '../ImageWithFallback'
2121
const PluginImageContainer = ({ imageProps, fallbackImageClassName }: PluginImageContainerProps) => (
2222
<ImageWithFallback
2323
fallbackImage={<ICLegoBlock className={`dc__no-shrink ${fallbackImageClassName}`} />}
24-
imageProps={imageProps}
24+
imageProps={{
25+
loading: 'lazy',
26+
...imageProps,
27+
}}
2528
/>
2629
)
2730

src/Shared/Components/Plugin/service.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ export const getPluginsDetail = async ({
3636
pluginIds,
3737
signal,
3838
shouldShowError = true,
39+
parentPluginIdentifiers,
3940
}: PluginDetailServiceParamsType): Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>> => {
4041
try {
4142
const payload: PluginDetailPayloadType = {
4243
appId,
4344
parentPluginId: parentPluginIds,
4445
pluginId: pluginIds,
46+
parentPluginIdentifier: parentPluginIdentifiers ? `${parentPluginIdentifiers}` : null,
4547
}
4648

4749
const { result } = await get<PluginDetailDTO>(
@@ -68,14 +70,13 @@ export const getPluginStoreData = async ({
6870
appId,
6971
offset = 0,
7072
signal,
71-
size = 20,
7273
}: GetPluginStoreDataServiceParamsType): Promise<GetPluginStoreDataReturnType> => {
7374
try {
7475
const payload: GetPluginListPayloadType = {
7576
searchKey,
7677
offset,
7778
appId,
78-
size,
79+
size: 20,
7980
tag: selectedTags,
8081
}
8182
const { result } = await get<PluginDetailDTO>(getUrlWithSearchParams(ROUTES.PLUGIN_GLOBAL_LIST_V2, payload), {
@@ -116,7 +117,7 @@ export const getAvailablePluginTags = async (appId: number): Promise<string[]> =
116117
}
117118
}
118119

119-
export const getParentPluginList = async (appId?: number): Promise<ResponseType<MinParentPluginDTO[]>> => {
120-
const queryParams: GetParentPluginListPayloadType = { appId }
121-
return get<MinParentPluginDTO[]>(getUrlWithSearchParams(ROUTES.PLUGIN_LIST_MIN, queryParams))
122-
}
120+
export const getParentPluginList = async (
121+
params?: Partial<GetParentPluginListPayloadType>,
122+
): Promise<ResponseType<MinParentPluginDTO[]>> =>
123+
get<MinParentPluginDTO[]>(getUrlWithSearchParams(ROUTES.PLUGIN_LIST_MIN, params))

src/Shared/Components/Plugin/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export interface PluginAPIBaseQueryParamsType {
3030
}
3131

3232
export interface GetPluginTagsPayloadType extends PluginAPIBaseQueryParamsType {}
33-
export interface GetParentPluginListPayloadType extends PluginAPIBaseQueryParamsType {}
33+
export interface GetParentPluginListPayloadType extends PluginAPIBaseQueryParamsType {
34+
type?: 'ALL'
35+
}
3436

3537
export interface PluginTagNamesDTO {
3638
tagNames: string[]
@@ -73,7 +75,7 @@ export interface ParentPluginDTO {
7375
pluginIdentifier: string
7476
}
7577

76-
export interface MinParentPluginDTO extends Pick<ParentPluginDTO, 'id' | 'name' | 'icon'> {}
78+
export interface MinParentPluginDTO extends Pick<ParentPluginDTO, 'id' | 'name' | 'icon' | 'pluginIdentifier'> {}
7779

7880
export interface PluginDetailDTO {
7981
parentPlugins: ParentPluginDTO[]
@@ -84,6 +86,7 @@ export interface PluginDetailServiceParamsType {
8486
appId: number
8587
pluginIds?: number[]
8688
parentPluginIds?: number[]
89+
parentPluginIdentifiers?: string[]
8790
/**
8891
* @default true
8992
*/
@@ -94,6 +97,7 @@ export interface PluginDetailServiceParamsType {
9497
export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsType, 'appId'> {
9598
pluginId?: PluginDetailServiceParamsType['pluginIds']
9699
parentPluginId?: PluginDetailServiceParamsType['parentPluginIds']
100+
parentPluginIdentifier?: PluginDetailServiceParamsType['parentPluginIdentifiers'][number]
97101
}
98102

99103
export interface PluginListFiltersType extends Pick<BaseFilterQueryParams<unknown>, 'searchKey'> {
@@ -178,7 +182,6 @@ export interface GetPluginStoreDataServiceParamsType extends Pick<PluginListFilt
178182
signal: AbortSignal
179183
appId: number
180184
offset?: number
181-
size?: number
182185
}
183186

184187
export interface GetPluginListPayloadType

0 commit comments

Comments
 (0)