@@ -185,25 +185,18 @@ export default {
185185 }
186186 }
187187
188- const userDataOptions = [];
189- const networkDataOptions = [];
188+ let userDataOptions = [];
189+ let networkDataOptions = [];
190190
191- (res .configMaps .value ? .data || []).map ((O ) => {
192- const cloudTemplate =
193- O .metadata ? .labels ? .[HCI_ANNOTATIONS .CLOUD_INIT ];
191+ (res .configMaps .value ? .data || []).map ((configMap ) => {
192+ const cloudTemplate = configMap .metadata ? .labels ? .[HCI_ANNOTATIONS .CLOUD_INIT ];
194193
195194 if (cloudTemplate === ' user' ) {
196- userDataOptions .push ({
197- label: O .id ,
198- value: O .data .cloudInit
199- });
195+ userDataOptions = this .getCloudDataOptions (userDataOptions, configMap);
200196 }
201197
202198 if (cloudTemplate === ' network' ) {
203- networkDataOptions .push ({
204- label: O .id ,
205- value: O .data .cloudInit
206- });
199+ networkDataOptions = this .getCloudDataOptions (networkDataOptions, configMap);
207200 }
208201 });
209202
@@ -591,7 +584,21 @@ export default {
591584
592585 methods: {
593586 stringify,
587+ getCloudDataOptions (options , configMap ) {
588+ // find duplicated value, merge into the same template label name
589+ const duplicatedValue = options .find ((opt ) => opt .value === configMap .data .cloudInit );
594590
591+ if (duplicatedValue) {
592+ duplicatedValue .label += ` , ${ configMap .id } ` ;
593+ } else {
594+ options .push ({
595+ label: configMap .id ,
596+ value: configMap .data .cloudInit
597+ });
598+ }
599+
600+ return options;
601+ },
595602 test () {
596603 const errors = [];
597604
0 commit comments