File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212/** @var $copyValue string */
1313
1414// when generating multi-job, we need to copy the current configurations and apply our setting for every of them
15- // we have the interval, so we need to go from min to max in steps and copy all configurations and add the corresponding setting for each of them
16- if (!empty ($ copyData [$ e ['id ' ] . "-parameter " ]) && isset ($ copyData [$ copyData [$ e ['id ' ] . "-parameter " ] . "-percentage " ])) { // special handle for checkbox selections
17- $ copyValue = $ copyData [$ copyData [$ e ['id ' ] . "-parameter " ] . "-percentage " ];
15+ if (!empty ($ copyData [$ e ['id ' ] . "-parameter " ])) {
16+ $ parameterName = $ copyData [$ e ['id ' ] . "-parameter " ] . "-percentage " ;
17+
18+ if (empty ($ copyData [$ parameterName ])) {
19+ $ copyValue = 0 ;
20+ } else {
21+ $ copyValue = $ copyData [$ parameterName ];
22+ }
1823}
Original file line number Diff line number Diff line change 3131 throw new Exception ("Dependency value for percentage dependency element is not set " );
3232 }
3333
34- if (!isset ($ percentage ) && is_numeric ($ percentage )) {
35- throw new Exception ("No or non-numeric value set for: " . $ parameter . "-percentage " );
34+ if (!isset ($ percentage )) {
35+ throw new Exception ("No value set for: " . $ parameter . "-percentage " );
36+ } else if (!is_numeric ($ percentage )) {
37+ if ($ percentage == "" ) {
38+ $ percentage = 0 ;
39+ } else {
40+ throw new Exception ("Non-numeric value set for: " . $ parameter . "-percentage " );
41+ }
3642 }
3743
3844 $ value = $ copy [Define::CONFIGURATION_PARAMETERS ][$ dep ] * $ percentage / 100 ;
Original file line number Diff line number Diff line change 88 < input type ="hidden " name ="[[parameter]]-dependency " value ="[[dependency]] ">
99 < b > [[name]]</ b > (< i > [[parameter]]</ i > )
1010 < div class ="row ">
11- < div class ="col-md-3 ">
11+ < div class ="col-md-4 ">
1212 Percentage of < b > < i > [[dependency]]</ i > </ b >
1313 < div class ="input-group ">
1414 < span class ="input-group-addon "> %</ span >
15- < input name ="[[parameter]]-percentage " id ="parameter-[[parameter]]-percentage " type ="number " class ="form-control " placeholder ="Percentage "{{IF !empty ([[copy]])}} value ="[[copy]] "{{ENDIF}}{{IF empty ([[copy]]) && [[default]] ! = false}} value ="[[default]] "{{ENDIF}} >
15+ < input name ="[[parameter]]-percentage " id ="parameter-[[parameter]]-percentage " type ="number " class ="form-control " placeholder ="Percentage "{{IF isset ([[copy]])}} value ="[[copy]] "{{ENDIF}}{{IF !isset ([[copy]]) && [[default]] ! = false}} value ="[[default]] "{{ENDIF}} >
1616 </ div >
1717 </ div >
18- < div class ="col-md-9 ">
18+ < div class ="col-md-8 ">
1919 < div class ="row ">
2020 < div class ="col-md-4 ">
2121 Start
Original file line number Diff line number Diff line change 1212/** @var $copyValue string */
1313
1414// when copy the experiment, we need to copy the current configurations and apply our setting for every of them
15- if (!empty ($ copyData [$ e ['id ' ] . "-parameter " ])) { // special handle for checkbox selections
15+ if (!empty ($ copyData [$ e ['id ' ] . "-parameter " ])) {
1616 $ parameterName = $ copyData [$ e ['id ' ] . "-parameter " ];
1717 if (empty ($ copyData [$ parameterName . "-numberOfVersions " ])) {
1818 var_dump ($ copyData );
2424 for ($ i = 0 ; $ i < $ numberOfVersions ; $ i ++) {
2525 $ copyValue [$ i ] = $ copyData [$ parameterName . "-version- " . $ i ];
2626 }
27+ } else {
28+ // Migrate from old elements, if there is a string element with the same parameter name, we use it
29+ $ copyValue = [];
30+ $ i = 0 ;
31+ if (!empty ($ copyData [$ e ['parameter ' ]])) {
32+ foreach (explode (", " , $ copyData [$ e ['parameter ' ]]) as $ version ) {
33+ $ copyValue [$ i ] = $ version ;
34+ $ i ++;
35+ }
36+ }
2737}
Original file line number Diff line number Diff line change 2323 }
2424}
2525
26+
2627$ allConfigurations = $ newConfigurations ;
Original file line number Diff line number Diff line change 77 < b > [[name]]</ b > (< i > [[parameter]]</ i > )
88 < div class ="input-group ">
99 < span class ="input-group-addon text-bold " style ="background-color: #f7f7f7; "> Number of Versions</ span >
10- < input id ="numberOfVersionsInput " name ="[[parameter]]-numberOfVersions " type ="number " class ="form-control " placeholder ="Number of versions to compare " min ="0 ">
10+ < input id ="numberOfVersionsInput " name ="[[parameter]]-numberOfVersions " type ="number " class ="form-control " placeholder ="Number of versions to compare " min ="1 ">
1111 </ div >
1212 < div id ="versionInputsContainer "> </ div >
1313
1414 < script >
1515 const copy = JSON . parse ( '[[json_encode([[copy]])]]' ) ;
16- const initialNumberOfVersions = copy . length ;
16+ const initialNumberOfVersions = Math . max ( copy . length , 1 ) ;
1717
1818 document . addEventListener ( 'DOMContentLoaded' , function ( ) {
1919 const numberOfVersionsInput = document . getElementById ( 'numberOfVersionsInput' ) ;
3636 input . name = `[[parameter]]-version-${ index } ` ;
3737 input . type = 'text' ;
3838 input . classList . add ( 'form-control' ) ;
39- input . placeholder = `Branch for version ${ index + 1 } ` ;
39+ input . required = true ;
40+ input . placeholder = `Default branch for version ${ index + 1 } ` ;
4041 if ( value ) {
4142 input . value = value ;
4243 }
You can’t perform that action at this time.
0 commit comments