@@ -229,7 +229,7 @@ export class ScenariosComponent implements OnInit, OnDestroy {
229
229
230
230
private initFilters ( ) {
231
231
const allTagsInScenario : string [ ] = this . findAllTags ( ) ;
232
- this . tags = this . getTagsForComboModel ( allTagsInScenario ) ;
232
+ this . tags = allTagsInScenario . map ( tag => this . toSelectOption ( tag , tag ) ) ;
233
233
this . status = [ ...new Set ( this . scenarios . map ( scenario => scenario . status ) ) ] . map ( status => this . toSelectOption ( status , this . translateService . instant ( ExecutionStatus . toString ( status ) ) ) ) ;
234
234
}
235
235
@@ -256,7 +256,7 @@ export class ScenariosComponent implements OnInit, OnDestroy {
256
256
private setSelectedTags ( ) {
257
257
const savedTags = this . stateService . getTags ( ) ;
258
258
if ( savedTags != null ) {
259
- this . selectedTags = this . getTagsForComboModel ( savedTags ) ;
259
+ this . selectedTags = this . tags . filter ( tag => savedTags . includes ( tag . id ) ) ;
260
260
}
261
261
}
262
262
@@ -277,7 +277,7 @@ export class ScenariosComponent implements OnInit, OnDestroy {
277
277
}
278
278
if ( params [ 'tags' ] ) {
279
279
const uriTag = params [ 'tags' ] . split ( ',' ) ;
280
- this . selectedTags = this . getTagsForComboModel ( uriTag ) ;
280
+ this . selectedTags = this . tags . filter ( tag => uriTag . includes ( tag . id ) ) ;
281
281
}
282
282
this . applyFilters ( ) ;
283
283
this . urlParams ?. unsubscribe ( )
@@ -354,16 +354,7 @@ export class ScenariosComponent implements OnInit, OnDestroy {
354
354
}
355
355
}
356
356
357
-
358
357
private getSelectedTags ( ) {
359
358
return this . selectedTags . map ( ( i ) => i . text ) ;
360
359
}
361
-
362
- private getTagsForComboModel ( tags : String [ ] ) {
363
- let index = 0 ;
364
- return tags . map ( ( t ) => {
365
- index ++ ;
366
- return { 'id' : index , 'text' : t } ;
367
- } ) ;
368
- }
369
360
}
0 commit comments