@@ -74,6 +74,7 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
7474 const [ priorityOptions , setPriorityOptions ] = useState < any > ( ) ;
7575 const [ deletePriorityName , setDeletePriorityName ] = useState ( "" ) ;
7676 const [ deleteModalVisibility , toggleDeleteModalVisibility ] = useState ( false ) ;
77+ const [ priorityOrderTouched , setPriorityOrderTouched ] = useState ( false ) ;
7778
7879 const titleLegend = < div className = { styles . titleLegend } >
7980 < div data-testid = "multipleIconLegend" className = { styles . legendText } > < img className = { styles . arrayImage } src = { arrayIcon } alt = { "" } /> Multiple</ div >
@@ -166,12 +167,7 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
166167
167168 const updateMergeRuleItems = async ( id , newValue , priorityOrderOptions :any [ ] ) => {
168169 if ( id . split ( ":" ) [ 0 ] !== "Timestamp" ) {
169- let editPriorityName ;
170- if ( id . split ( ":" ) [ 1 ] === "Length" ) {
171- editPriorityName = "Length" ;
172- } else {
173- editPriorityName = id . split ( ":" ) [ 0 ] ;
174- }
170+ let editPriorityName = id . split ( ":" ) [ 1 ] ;
175171 for ( let priorityOption of priorityOrderOptions ) {
176172 let value = priorityOption . value ;
177173 let priorityName ;
@@ -189,11 +185,11 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
189185 } ;
190186
191187 const renderPriorityOrderTimeline = ( ) => {
192- return < div data-testid = { "active-priorityOrder-timeline" } > < TimelineVis items = { priorityOrderOptions } options = { strategyOptions } clickHandler = { onPriorityOrderTimelineItemClicked } /> </ div > ;
188+ return < div data-testid = { "active-priorityOrder-timeline" } > < TimelineVis items = { priorityOrderOptions } options = { strategyOptions } clickHandler = { onPriorityOrderTimelineItemClicked } borderMargin = "14px" /> </ div > ;
193189 } ;
194190
195191 const renderDefaultPriorityOrderTimeline = ( ) => {
196- return < div data-testid = { "default-priorityOrder-timeline" } > < TimelineVisDefault items = { priorityOrderOptions } options = { strategyOptions } /> </ div > ;
192+ return < div data-testid = { "default-priorityOrder-timeline" } > < TimelineVisDefault items = { priorityOrderOptions } options = { strategyOptions } borderMargin = "14px" /> </ div > ;
197193 } ;
198194
199195 const timelineOrder = ( a , b ) => {
@@ -234,6 +230,7 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
234230 onMove : function ( item , callback ) {
235231 if ( item . value . split ( ":" ) [ 0 ] !== "Timestamp" ) {
236232 if ( item . start >= 0 && item . start <= 100 ) {
233+ setPriorityOrderTouched ( true ) ;
237234 item . value = getStrategyName ( item ) ;
238235 callback ( item ) ;
239236 updateMergeRuleItems ( item . id , item . start . getMilliseconds ( ) . toString ( ) , priorityOrderOptions ) ;
@@ -305,6 +302,7 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
305302 } ;
306303
307304 const confirmAction = ( ) => {
305+ setPriorityOrderTouched ( true ) ;
308306 setPriorityOrderOptions ( handleDeleteSliderOptions ( priorityOptions , priorityOrderOptions ) ) ;
309307 toggleDeleteModalVisibility ( false ) ;
310308 } ;
@@ -350,6 +348,7 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
350348 setNamespaceTouched ( false ) ;
351349 setMaxValueRuleInputTouched ( false ) ;
352350 setMaxSourcesRuleInputTouched ( false ) ;
351+ setPriorityOrderTouched ( false ) ;
353352 } ;
354353
355354 const onCancel = ( ) => {
@@ -380,7 +379,7 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
380379 }
381380 } else if ( mergeType === "Property-specific" ) {
382381 let checkPropertySpecificValues = hasPropertySpecificFormValuesChanged ( ) ;
383- if ( ! propertyTouched && ! mergeTypeTouched && ! checkPropertySpecificValues ) {
382+ if ( ! propertyTouched && ! mergeTypeTouched && ! checkPropertySpecificValues && ! priorityOrderTouched ) {
384383 return false ;
385384 } else {
386385 return true ;
@@ -415,8 +414,8 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
415414
416415 const hasPropertySpecificFormValuesChanged = ( ) => {
417416 if ( ! dropdownOptionTouched
418- && ( ! maxSourcesRuleInputTouched || maxSourcesRuleInput . length === 0 )
419- && ! maxValueRuleInputTouched || maxValueRuleInput . length === 0
417+ && ! maxSourcesRuleInputTouched
418+ && ! maxValueRuleInputTouched
420419 ) {
421420 return false ;
422421 } else {
@@ -501,14 +500,12 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
501500 if ( event . target . value === " " ) {
502501 setStrategyValueTouched ( false ) ;
503502 } else {
504- setStrategyValueTouched ( true ) ;
505503 setStrategyValue ( event . target . value ) ;
506504 }
507505 } else if ( event . target . id === "maxValuesRuleInput" ) {
508506 if ( event . target . value === " " ) {
509507 setMaxValueRuleInputTouched ( false ) ;
510508 } else {
511- setMaxValueRuleInputTouched ( true ) ;
512509 setMaxValueRuleInput ( event . target . value ) ;
513510 setRadioValuesOptionClicked ( 2 ) ;
514511 }
@@ -521,11 +518,13 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
521518 setRadioSourcesOptionClicked ( 2 ) ;
522519 }
523520 } else if ( event . target . name === "maxValues" ) {
521+ setMaxValueRuleInputTouched ( true ) ;
524522 setRadioValuesOptionClicked ( event . target . value ) ;
525523 if ( event . target . value === 1 ) {
526524 setMaxValueRuleInput ( "" ) ;
527525 }
528526 } else if ( event . target . name === "maxSources" ) {
527+ setMaxSourcesRuleInputTouched ( true ) ;
529528 setRadioSourcesOptionClicked ( event . target . value ) ;
530529 if ( event . target . value === 1 ) {
531530 setMaxSourcesRuleInput ( "" ) ;
@@ -602,6 +601,11 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
602601 } ;
603602
604603 const onAddOptions = ( ) => {
604+ priorityOrderOptions . map ( ( option ) => {
605+ if ( option . id . split ( ":" ) [ 0 ] === "Length" && dropdownOption === "Length" ) {
606+ setPriorityOrderTouched ( false ) ;
607+ } else setPriorityOrderTouched ( true ) ;
608+ } ) ;
605609 setPriorityOrderOptions ( addSliderOptions ( priorityOrderOptions , dropdownOption ) ) ;
606610 } ;
607611
@@ -645,13 +649,15 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
645649 type = "discardChanges"
646650 onYes = { discardOk }
647651 onNo = { discardCancel }
652+ labelNo = "DiscardChangesNoButton"
653+ labelYes = "DiscardChangesYesButton"
648654 /> ;
649655
650656 return (
651657 < Modal
652658 visible = { props . createEditMergeRuleDialog }
653659 title = { props . isEditRule ? "Edit Merge Rule" : "Add Merge Rule" }
654- width = { 700 }
660+ width = { 1000 }
655661 onCancel = { ( ) => onCancel ( ) }
656662 onOk = { ( ) => onOk ( ) }
657663 okText = "Save"
@@ -809,8 +815,8 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
809815 labelAlign = "left"
810816 >
811817 < Radio . Group value = { radioValuesOptionClicked } onChange = { handleChange } name = "maxValues" >
812- < Radio value = { 1 } > All</ Radio >
813- < Radio value = { 2 } > < Input id = "maxValuesRuleInput" value = { maxValueRuleInput } placeholder = { "Enter max values" } onChange = { handleChange } onClick = { handleChange } className = { styles . maxInput } > </ Input > </ Radio >
818+ < Radio value = { 1 } aria-label = "maxValuesAllRadio" > All</ Radio >
819+ < Radio value = { 2 } aria-label = "maxValuesOtherRadio" > < Input id = "maxValuesRuleInput" value = { maxValueRuleInput } placeholder = { "Enter max values" } onChange = { handleChange } onClick = { handleChange } className = { styles . maxInput } > </ Input > </ Radio >
814820 </ Radio . Group >
815821 < MLTooltip title = { MergeRuleTooltips . maxValues } >
816822 < Icon type = "question-circle" className = { styles . questionCircle } theme = "filled" />
@@ -822,8 +828,8 @@ const MergeRuleDialog: React.FC<Props> = (props) => {
822828 labelAlign = "left"
823829 >
824830 < Radio . Group value = { radioSourcesOptionClicked } onChange = { handleChange } name = "maxSources" >
825- < Radio value = { 1 } > All</ Radio >
826- < Radio value = { 2 } > < Input id = "maxSourcesRuleInput" value = { maxSourcesRuleInput } onChange = { handleChange } placeholder = { "Enter max sources" } onClick = { handleChange } className = { styles . maxInput } > </ Input > </ Radio >
831+ < Radio value = { 1 } aria-label = "maxSourcesAllRadio" > All</ Radio >
832+ < Radio value = { 2 } aria-label = "maxSourcesOtherRadio" > < Input id = "maxSourcesRuleInput" value = { maxSourcesRuleInput } onChange = { handleChange } placeholder = { "Enter max sources" } onClick = { handleChange } className = { styles . maxInput } > </ Input > </ Radio >
827833 </ Radio . Group >
828834 < MLTooltip title = { MergeRuleTooltips . maxSources } >
829835 < Icon type = "question-circle" className = { styles . questionCircle } theme = "filled" />
0 commit comments