This repository was archived by the owner on Mar 25, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +23
-11
lines changed Expand file tree Collapse file tree 4 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,12 @@ export class EventListComponent implements OnInit {
6666 }
6767
6868 public getEvents ( params = { reload : false } ) : void {
69- if ( params . reload ) { this . loading = true ; }
69+ if ( params . reload ) {
70+ this . loading = true ;
71+ }
7072 this . getEventsObservable ( params )
71- . subscribe ( ( ) => this . loading = false ) ;
73+ . finally ( ( ) => this . loading = false )
74+ . subscribe ( ) ;
7275 }
7376
7477 public getEventsObservable ( params : { reload : boolean } ) : Observable < Array < Event > > {
@@ -109,7 +112,9 @@ export class EventListComponent implements OnInit {
109112 }
110113
111114 private filterBySearch ( events : Array < Event > ) : Array < Event > {
112- if ( ! this . query ) { return events ; }
115+ if ( ! this . query ) {
116+ return events ;
117+ }
113118
114119 const queryLower = this . query . toLowerCase ( ) ;
115120 return events . filter ( ( event : Event ) => {
@@ -169,12 +174,19 @@ export class EventListComponent implements OnInit {
169174 }
170175
171176 private getEventTypes ( events : Array < Event > ) : Array < string > {
172- return events . reduce ( ( acc , event ) => {
177+ const types = events . reduce ( ( acc , event ) => {
173178 if ( ! acc . includes ( event . type ) ) {
174179 acc . push ( event . type ) ;
175180 }
176181 return acc ;
177182 } , [ ] ) ;
183+
184+ return this . selectedTypes . reduce ( ( acc , type ) => {
185+ if ( ! acc . includes ( type ) ) {
186+ acc . push ( type ) ;
187+ }
188+ return acc ;
189+ } , types ) ;
178190 }
179191
180192 private initTableModel ( translations : any ) : void {
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class NotificationService implements NotificationService {
2222 }
2323
2424 public message ( message : string | ParametrizedTranslation ) : Observable < MdlSnackbarComponent > {
25- let obs = new Subject < MdlSnackbarComponent > ( ) ;
25+ const obs = new Subject < MdlSnackbarComponent > ( ) ;
2626 this . getTranslatedMessage ( message )
2727 . switchMap ( translatedMessage => {
2828 return this . snackbar . showSnackbar ( {
@@ -40,7 +40,7 @@ export class NotificationService implements NotificationService {
4040 handler : ( ) => { } ,
4141 text : 'OK'
4242 } ) : Observable < MdlSnackbarComponent > {
43- let obs = new Subject < MdlSnackbarComponent > ( ) ;
43+ const obs = new Subject < MdlSnackbarComponent > ( ) ;
4444 this . getTranslatedMessage ( message )
4545 . switchMap ( translatedMessage => {
4646 return this . snackbar . showSnackbar ( { message : translatedMessage , action} ) ;
@@ -60,7 +60,7 @@ export class NotificationService implements NotificationService {
6060 handler : ( ) => { } ,
6161 text : 'OK'
6262 } ) : Observable < MdlSnackbarComponent > {
63- let obs = new Subject < MdlSnackbarComponent > ( ) ;
63+ const obs = new Subject < MdlSnackbarComponent > ( ) ;
6464 this . getTranslatedMessage ( message )
6565 . switchMap ( translatedMessage => {
6666 return this . snackbar . showSnackbar ( {
Original file line number Diff line number Diff line change 1010 > </ cs-vm-filter >
1111 </ ng-container >
1212
13- < ng-container *loading ="!vmList " cs-list >
13+ < ng-container *loading ="!vmList.length " cs-list >
1414 < ng-container *ngIf ="showSubsections && !showSections ">
1515 < ng-container *ngFor ="let subsection of subsections ">
1616 < cs-vm-list-subsection
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ export class VmListComponent implements OnInit {
5252 public sections : Array < VmListSection > = [ ] ;
5353 public subsections : Array < VmListSubsection > = [ ] ;
5454
55- public vmList : Array < VirtualMachine > ;
56- public visibleVmList : Array < VirtualMachine > ;
55+ public vmList : Array < VirtualMachine > = [ ] ;
56+ public visibleVmList : Array < VirtualMachine > = [ ] ;
5757
5858 constructor (
5959 public listService : ListService ,
@@ -96,7 +96,7 @@ export class VmListComponent implements OnInit {
9696 }
9797
9898 public updateFilters ( filterData ?: VmFilter ) : void {
99- if ( ! this . vmList ) {
99+ if ( ! this . vmList . length ) {
100100 return ;
101101 }
102102 if ( ! filterData && ! this . filterData ) {
You can’t perform that action at this time.
0 commit comments