Skip to content

Commit 6bacf89

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feat/approval-policy
2 parents c973f5f + 3e889ce commit 6bacf89

File tree

9 files changed

+29
-22
lines changed

9 files changed

+29
-22
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": "1.2.17-beta-4",
3+
"version": "1.3.0-beta-4",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/CIPipeline.Types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,15 @@ export enum RefVariableStageType {
9999
POST_CI = 'POST_CI',
100100
}
101101

102+
export enum FilePropertyTypeSizeUnit {
103+
KB = 'KB',
104+
MB = 'MB',
105+
}
106+
102107
export interface FilePropertyType {
103108
allowedExtensions: string[]
104109
maxUploadSize: number
110+
sizeUnit: FilePropertyTypeSizeUnit
105111
}
106112

107113
export interface ConstraintType {

src/Common/CodeEditor/CodeEditor.reducer.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,16 @@ export const parseValueToCode = (value: string, mode: string, tabSize: number) =
5252
let final = value
5353

5454
if (obj) {
55-
final = mode === MODES.JSON ? JSON.stringify(obj, null, tabSize) : YAMLStringify(obj)
55+
switch (mode) {
56+
case MODES.JSON:
57+
final = JSON.stringify(obj, null, tabSize)
58+
break
59+
case MODES.YAML:
60+
final = YAMLStringify(obj)
61+
break
62+
default:
63+
break
64+
}
5665
}
5766

5867
return final
@@ -68,7 +77,7 @@ export const initialState = ({
6877
}: CodeEditorInitialValueType): CodeEditorState => ({
6978
mode: mode as MODES,
7079
theme: (theme || CodeEditorThemesKeys.vs) as CodeEditorThemesKeys,
71-
code: parseValueToCode(value, mode, tabSize),
80+
code: noParsing ? value : parseValueToCode(value, mode, tabSize),
7281
diffMode: diffView,
7382
noParsing: [MODES.JSON, MODES.YAML].includes(mode as MODES) ? noParsing : true,
7483
})

src/Common/CodeEditor/CodeEditor.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
9292
const monacoRef = useRef(null)
9393
const { width, height: windowHeight } = useWindowSize()
9494
const memoisedReducer = React.useCallback(CodeEditorReducer, [])
95-
const [state, dispatch] = useReducer(memoisedReducer, initialState({ mode, theme, value, diffView, noParsing, tabSize }))
95+
const [state, dispatch] = useReducer(
96+
memoisedReducer,
97+
initialState({ mode, theme, value, diffView, noParsing, tabSize }),
98+
)
9699
const [, json, yamlCode, error] = useJsonYaml(state.code, tabSize, state.mode, !state.noParsing)
97100
const [, originalJson, originlaYaml] = useJsonYaml(defaultValue, tabSize, state.mode, !state.noParsing)
98101
const [contentHeight, setContentHeight] = useState(

src/Common/Common.service.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { MutableRefObject } from 'react'
1818
import moment from 'moment'
1919
import { sanitizeApprovalConfigData, sanitizeUserApprovalList } from '@Shared/Helpers'
2020
import { RuntimeParamsAPIResponseType, RuntimePluginVariables } from '@Shared/types'
21-
import { get, getIsRequestAborted, post } from './Api'
22-
import { API_STATUS_CODES, GitProviderType, ROUTES } from './Constants'
21+
import { get, post } from './Api'
22+
import { GitProviderType, ROUTES } from './Constants'
2323
import { getUrlWithSearchParams, showError, sortCallback } from './Helper'
2424
import {
2525
TeamList,
@@ -43,8 +43,6 @@ import {
4343
} from './Types'
4444
import { ApiResourceType } from '../Pages'
4545
import { RefVariableType } from './CIPipeline.Types'
46-
import { ServerErrors } from './ServerError'
47-
import { ToastManager, ToastVariantType } from '@Shared/Services'
4846

4947
export const getTeamListMin = (): Promise<TeamList> => {
5048
// ignore active field
@@ -472,16 +470,6 @@ export const getGlobalVariables = async ({
472470

473471
return variableList
474472
} catch (err) {
475-
if (!getIsRequestAborted(err)) {
476-
if (err instanceof ServerErrors && err.code === API_STATUS_CODES.PERMISSION_DENIED) {
477-
ToastManager.showToast({
478-
variant: ToastVariantType.notAuthorized,
479-
description: 'You are not authorized to access global variables',
480-
})
481-
} else {
482-
showError(err)
483-
}
484-
}
485473
throw err
486474
}
487475
}

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const DOCUMENTATION = {
3333
}
3434

3535
export const PATTERNS = {
36+
DECIMAL_NUMBERS: /^-?\d*\.?\d*$/,
3637
NATURAL_NUMBERS: /^\d*\.?\d*$/,
3738
KUBERNETES_KEY_PREFIX: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/,
3839
KUBERNETES_KEY_NAME: /^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$/,

src/Shared/Components/DynamicDataTable/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
width: 100%;
5555

5656
> button {
57-
padding: 10px 8px;
57+
padding: 9px 8px;
5858
width: 100%;
5959
height: 100%;
6060
border-radius: 0;

src/Shared/Components/SelectPicker/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
141141
IsMulti,
142142
GroupBase<SelectPickerOptionType<OptionValue>>
143143
>,
144-
'onCreateOption' | 'formatCreateLabel'
144+
'onCreateOption' | 'formatCreateLabel' | 'menuPortalTarget'
145145
>
146146
> & {
147147
/**

0 commit comments

Comments
 (0)