File tree Expand file tree Collapse file tree 8 files changed +75
-2
lines changed
Pages/GlobalConfigurations Expand file tree Collapse file tree 8 files changed +75
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export const URLS = {
58
58
APP_TRIGGER : 'trigger' ,
59
59
GLOBAL_CONFIG_DOCKER : '/global-config/docker' ,
60
60
DEPLOYMENT_HISTORY_CONFIGURATIONS : '/configuration' ,
61
+ GLOBAL_CONFIG_SCOPED_VARIABLES : '/global-config/scoped-variables' ,
61
62
}
62
63
63
64
export const ROUTES = {
Original file line number Diff line number Diff line change @@ -235,6 +235,9 @@ export interface RadioInterface {
235
235
showTippy ?: boolean
236
236
tippyContent ?: any
237
237
tippyPlacement ?: string
238
+ /**
239
+ * If false would make radio group controlled
240
+ */
238
241
canSelect ?: boolean
239
242
isDisabled ?: boolean
240
243
tippyClass ?: string
Original file line number Diff line number Diff line change
1
+ export * from './types'
Original file line number Diff line number Diff line change
1
+ export enum ScopedVariablesFileViewType {
2
+ /**
3
+ * Used to show yaml editor for editing/creating variables
4
+ */
5
+ YAML = 'yaml' ,
6
+ /**
7
+ * Shows the variable list view
8
+ */
9
+ SAVED = 'variable-list' ,
10
+ /**
11
+ * Shows the variables in environment list view
12
+ */
13
+ ENVIRONMENT_LIST = 'environments' ,
14
+ }
15
+
16
+ export interface SavedVariablesViewParamsType {
17
+ currentView : ScopedVariablesFileViewType
18
+ }
Original file line number Diff line number Diff line change 16
16
17
17
export * from './BuildInfra'
18
18
export * from './Authorization'
19
+ export * from './ScopedVariables'
Original file line number Diff line number Diff line change 15
15
*/
16
16
17
17
import Tippy from '@tippyjs/react'
18
- import { components } from 'react-select'
18
+ import { components , MenuListProps } from 'react-select'
19
19
import { Progressing , stopPropagation } from '../../../Common'
20
20
21
21
export const getCommonSelectStyle = ( styleOverrides = { } ) => ( {
@@ -166,3 +166,24 @@ export const GroupHeading = (props: any) => {
166
166
}
167
167
168
168
export const commonSelectStyles = getCommonSelectStyle ( )
169
+
170
+ export const MenuListWithApplyButton = ( {
171
+ handleApplyFilter,
172
+ ...props
173
+ } : MenuListProps & { handleApplyFilter : ( ) => void } ) => (
174
+ < >
175
+ < components . MenuList { ...props } />
176
+ { props . selectProps . options . length > 0 && (
177
+ < div className = "p-8 dc__position-sticky dc__bottom-0 dc__border-top-n1 bcn-0 dc__bottom-radius-4" >
178
+ < button
179
+ type = "button"
180
+ className = "dc__unset-button-styles w-100 br-4 h-28 flex bcb-5 cn-0 fw-6 lh-28 fs-12 h-28 br-4 pt-5 pr-12 pb-5 pl-12"
181
+ onClick = { handleApplyFilter }
182
+ aria-label = "Apply filters"
183
+ >
184
+ Apply
185
+ </ button >
186
+ </ div >
187
+ ) }
188
+ </ >
189
+ )
Original file line number Diff line number Diff line change @@ -221,3 +221,30 @@ export const validateIfImageExist = (url: string): Promise<ValidationResponseTyp
221
221
} )
222
222
}
223
223
} )
224
+
225
+ export const validateUniqueKeys = ( keys : string [ ] ) => {
226
+ const keysMap : Record < string , number > = keys . reduce (
227
+ ( acc , key ) => {
228
+ if ( acc [ key ] ) {
229
+ acc [ key ] += 1
230
+ return acc
231
+ }
232
+
233
+ acc [ key ] = 1
234
+ return acc
235
+ } ,
236
+ { } as Record < string , number > ,
237
+ )
238
+
239
+ const duplicateKeys = Object . keys ( keysMap ) . filter ( ( key ) => keysMap [ key ] > 1 )
240
+ if ( ! duplicateKeys . length ) {
241
+ return {
242
+ isValid : true ,
243
+ }
244
+ }
245
+
246
+ return {
247
+ isValid : false ,
248
+ message : `Duplicate variable name: ${ duplicateKeys . join ( ', ' ) } ` ,
249
+ }
250
+ }
Original file line number Diff line number Diff line change @@ -71,7 +71,8 @@ export interface customEnv {
71
71
ENABLE_RESOURCE_SCAN_V2 ?: boolean
72
72
ENABLE_GITOPS_BITBUCKET_SOURCE : boolean
73
73
HIDE_RESOURCE_WATCHER ?: boolean
74
- ORGANIZATION_NAME : string
74
+ ORGANIZATION_NAME ?: string
75
+ FEATURE_SCOPED_VARIABLE_ENVIRONMENT_LIST_ENABLE ?: boolean
75
76
}
76
77
declare global {
77
78
interface Window {
You can’t perform that action at this time.
0 commit comments