1
- import {
2
- Component ,
3
- EventEmitter ,
4
- HostListener ,
5
- Input ,
6
- OnChanges ,
7
- Output ,
8
- ViewChild ,
9
- } from '@angular/core' ;
1
+ import { Component , EventEmitter , HostListener , Input , Output , ViewChild } from '@angular/core' ;
10
2
import {
11
3
ChangeGroupExpirationDialogComponent ,
12
4
EditFacilityResourceGroupVoDialogComponent ,
@@ -17,7 +9,6 @@ import {
17
9
Group ,
18
10
Member ,
19
11
PaginatedRichGroups ,
20
- Vo ,
21
12
VosManagerService ,
22
13
} from '@perun-web-apps/perun/openapi' ;
23
14
import { GuiAuthResolver , TableCheckbox } from '@perun-web-apps/perun/services' ;
@@ -51,10 +42,9 @@ import { GroupUtilsService } from '@perun-web-apps/perun/services';
51
42
styleUrls : [ './groups-list.component.scss' ] ,
52
43
providers : [ DisableGroupSelectPipe ] ,
53
44
} )
54
- export class GroupsListComponent implements OnChanges {
45
+ export class GroupsListComponent {
55
46
@Input ( ) theme = 'group-theme' ;
56
47
@Input ( ) selection = new SelectionModel < GroupWithStatus > ( true , [ ] ) ;
57
- @Input ( ) filterValue : string ;
58
48
@Input ( ) disableMembers : boolean ;
59
49
@Input ( ) disableGroups : boolean ;
60
50
@Input ( ) groupsToDisableCheckbox : Set < number > = new Set < number > ( ) ;
@@ -151,13 +141,6 @@ export class GroupsListComponent implements OnChanges {
151
141
return this . groupUtils . getSortDataForColumn ( data , column , this . voNames , this . recentIds ) ;
152
142
} ;
153
143
154
- ngOnChanges ( ) : void {
155
- if ( ! this . authResolver . isPerunAdminOrObserver ( ) ) {
156
- this . displayedColumns = this . displayedColumns . filter ( ( column ) => column !== 'id' ) ;
157
- }
158
- this . setDataSource ( ) ;
159
- }
160
-
161
144
exportAllData ( format : string ) : void {
162
145
if ( isDynamicDataSource ( this . dataSource ) ) {
163
146
this . downloadAll . emit ( { format : format , length : this . dataSource . paginator . length } ) ;
@@ -299,39 +282,6 @@ export class GroupsListComponent implements OnChanges {
299
282
) ;
300
283
} ;
301
284
302
- setDataSource ( ) : void {
303
- if ( ! this . dataSource ) {
304
- this . dataSource = new MatTableDataSource < GroupWithStatus > ( ) ;
305
- this . dataSource . sort = this . sort ;
306
- this . dataSource . paginator = this . tableWrapper . paginator ;
307
- this . dataSource . filterPredicate = ( data : Vo , filter : string ) : boolean =>
308
- customDataSourceFilterPredicate (
309
- data ,
310
- filter ,
311
- this . displayedColumns ,
312
- this . getDataForColumnFun
313
- ) ;
314
- this . dataSource . sortData = ( data : GroupWithStatus [ ] , sort : MatSort ) : GroupWithStatus [ ] =>
315
- customDataSourceSort ( data , sort , this . getDataForColumnFun ) ;
316
- }
317
- this . dataSource . filter = this . filterValue ;
318
-
319
- // if groups not loaded yet, skip
320
- if ( ! this . groups ) {
321
- return ;
322
- }
323
-
324
- const paginated = this . isPaginated ( this . groups ) ;
325
- if ( isDynamicDataSource ( this . dataSource ) || paginated ) {
326
- this . dataSource . data = ( this . groups as PaginatedRichGroups ) . data ;
327
- ( this . dataSource as DynamicDataSource < GroupWithStatus > ) . count = (
328
- this . groups as PaginatedRichGroups
329
- ) . totalCount ;
330
- } else if ( ! isDynamicDataSource ( this . dataSource ) && ! paginated ) {
331
- this . dataSource . data = this . groups as GroupWithStatus [ ] ;
332
- }
333
- }
334
-
335
285
private dataSourceInit ( groups : GroupWithStatus [ ] | PaginatedRichGroups ) : void {
336
286
const paginated = this . isPaginated ( groups ) ;
337
287
0 commit comments