@@ -48,7 +48,6 @@ import {
4848
4949import { importComponentFromFELibrary } from '@Components/common'
5050
51- import { ReactComponent as Close } from '../../assets/icons/ic-close.svg'
5251import { SERVER_MODE , ViewType } from '../../config'
5352import {
5453 OutputTabs ,
@@ -59,26 +58,19 @@ import {
5958} from './bulkedit.utils'
6059import { getSeeExample , updateBulkList , updateImpactedObjectsList } from './bulkedits.service'
6160import { BulkEditsProps , BulkEditsState , BulkEditVersion } from './bulkEdits.type'
62- import { OutputDivider , OutputObjectTabs , STATUS } from './constants'
61+ import {
62+ BULK_EDIT_RESIZE_HANDLE_CLASS ,
63+ INITIAL_OUTPUT_PANEL_HEIGHT_PERCENTAGE ,
64+ OutputDivider ,
65+ OutputObjectTabs ,
66+ ReadmeVersionOptions ,
67+ STATUS ,
68+ } from './constants'
69+ import basicValidatorSchema from './schema.json'
6370
6471import './bulkEdit.scss'
6572
66- const getBulkEditConfig = importComponentFromFELibrary ( 'getBulkEditConfig' , null , 'function' )
67-
68- const ReadmeVersionOptions = [
69- ...( getBulkEditConfig
70- ? [
71- {
72- label : 'v1beta2/application' ,
73- value : BulkEditVersion . v2 ,
74- } ,
75- ]
76- : [ ] ) ,
77- {
78- label : 'v1beta1/application' ,
79- value : BulkEditVersion . v1 ,
80- } ,
81- ]
73+ export const getBulkEditConfig = importComponentFromFELibrary ( 'getBulkEditConfig' , null , 'function' )
8274
8375class BulkEdits extends Component < BulkEditsProps , BulkEditsState > {
8476 private editorAndOutputContainerRef = createRef < HTMLDivElement > ( )
@@ -227,7 +219,7 @@ class BulkEdits extends Component<BulkEditsProps, BulkEditsState> {
227219 const { showExamples } = this . state
228220
229221 return (
230- < div className = "flex bg__primary px-20 py-8 dc__border -bottom dc__content-space" >
222+ < div className = "flex bg__primary px-16 py-8 border__secondary- -bottom dc__content-space" >
231223 < div className = "flexbox dc__gap-12" >
232224 < h1 className = "m-0 fs-13 cn-9 fw-6 lh-20 dc__open-sans" > Script</ h1 >
233225 { ! showExamples && (
@@ -296,22 +288,25 @@ class BulkEdits extends Component<BulkEditsProps, BulkEditsState> {
296288 const { codeEditorPayload, schema, activeOutputTab } = this . state
297289 const { gridTemplateRows } = this . props
298290
291+ const isV2Schema = ( codeEditorPayload ?? '' ) . match ( 'apiVersion:\\s*batch/v1beta2' ) ?. length
292+
293+ const validatorSchema = isV2Schema ? schema : basicValidatorSchema
294+
299295 if ( activeOutputTab === 'none' ) {
300296 return (
301297 < div className = "dc__overflow-hidden flex-grow-1" >
302298 < CodeEditor
299+ key = { isV2Schema }
303300 mode = { MODES . YAML }
304301 height = "100%"
305302 value = { codeEditorPayload }
306303 onChange = { this . handleConfigChange }
307- validatorSchema = { schema }
304+ validatorSchema = { validatorSchema }
308305 />
309306 </ div >
310307 )
311308 }
312309
313- // TODO: make sure to disable cursor selection while dragging
314-
315310 return (
316311 < motion . div
317312 className = "dc__grid flex-grow-1 dc__overflow-hidden"
@@ -320,28 +315,30 @@ class BulkEdits extends Component<BulkEditsProps, BulkEditsState> {
320315 >
321316 < motion . div className = "dc__overflow-hidden flex-grow-1" >
322317 < CodeEditor
318+ key = { isV2Schema }
323319 mode = { MODES . YAML }
324320 height = "100%"
325321 value = { codeEditorPayload }
326322 onChange = { this . handleConfigChange }
327- validatorSchema = { schema }
323+ validatorSchema = { validatorSchema }
328324 />
329325 </ motion . div >
330326
331327 < Draggable
332- handle = ".bulk-edit"
328+ handle = { `.${ BULK_EDIT_RESIZE_HANDLE_CLASS } ` }
329+ defaultClassNameDragging = { `${ BULK_EDIT_RESIZE_HANDLE_CLASS } --dragging` }
333330 axis = "none"
334331 position = { { x : 0 , y : 0 } }
335332 bounds = { { left : 0 , right : 0 } }
336333 onDrag = { this . handleDrag }
337334 >
338- < div className = "bulk-edit border__secondary flex dc__zi-10" >
335+ < div className = { ` ${ BULK_EDIT_RESIZE_HANDLE_CLASS } border__primary--bottom flex dc__zi-10` } >
339336 < Icon name = "ic-resize-handle" size = { 16 } color = { null } />
340337 </ div >
341338 </ Draggable >
342339
343340 < motion . div className = "bulk-output-drawer bg__primary flexbox-col dc__overflow-auto" >
344- < div className = "bulk-output-header flex left pl-20 pr-20 pt-6 dc__border-top dc__border -bottom bg__primary" >
341+ < div className = "bulk-output-header flex left px-16 pt-6 border__secondary- -bottom bg__primary" >
345342 < OutputTabs
346343 handleOutputTabs = { ( ) => this . handleOutputTab ( 'output' ) }
347344 outputName = { activeOutputTab }
@@ -486,7 +483,7 @@ class BulkEdits extends Component<BulkEditsProps, BulkEditsState> {
486483 const { selectedReadmeVersionOption, readmeVersionOptions } = this . state
487484
488485 return (
489- < div className = "dc__border- bottom bg__primary py-8 px-20 flex dc__content-space" >
486+ < div className = "border__secondary-- bottom bg__primary py-10 px-16 flex dc__content-space" >
490487 < div className = "flex left dc__gap-16" >
491488 < div className = "fw-6 cn-9" data-testid = "sample-application" >
492489 Sample:
@@ -505,13 +502,14 @@ class BulkEdits extends Component<BulkEditsProps, BulkEditsState> {
505502 />
506503 </ div >
507504 < Button
508- icon = { < Close /> }
505+ icon = { < Icon name = "ic-close-large" color = { null } /> }
509506 onClick = { this . onClickHideExamples }
510507 dataTestId = "hide-examples-button"
511508 variant = { ButtonVariantType . borderLess }
512509 style = { ButtonStyleType . negativeGrey }
513510 ariaLabel = "Hide Sample"
514- size = { ComponentSizeType . small }
511+ showAriaLabelInTippy = { false }
512+ size = { ComponentSizeType . xs }
515513 />
516514 </ div >
517515 )
@@ -589,7 +587,7 @@ class BulkEdits extends Component<BulkEditsProps, BulkEditsState> {
589587}
590588
591589const BulkEditsWithUseResizable = ( props : Pick < BulkEditsProps , 'serverMode' > ) => {
592- const outputHeightMV = useMotionValue ( 50 )
590+ const outputHeightMV = useMotionValue ( INITIAL_OUTPUT_PANEL_HEIGHT_PERCENTAGE )
593591 const gridTemplateRows = useMotionTemplate `1fr 1px ${ outputHeightMV } %`
594592
595593 return < BulkEdits { ...{ ...props , outputHeightMV, gridTemplateRows } } />
0 commit comments