Skip to content
Snippets Groups Projects
Commit 334795d2 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #14454 TIME 0:10 save filters notif admin

parent 86e4f801
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,12 @@ export class AdministrationService {
page: 0,
field: ''
},
admin_tag: {
sort: 'label',
sortDirection: 'asc',
page: 0,
field: ''
},
};
dataSource: MatTableDataSource<any>;
filterColumns: string[];
......
......@@ -28,7 +28,7 @@
<div class="table-head">
<div class="table-head-result">
<mat-form-field style="font-size: 13px;">
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="{{lang.filterBy}}">
<input matInput [formControl]="adminService.getFilterField()" placeholder="{{lang.filterBy}}">
</mat-form-field>
</div>
<div class="table-head-tool">
......@@ -37,8 +37,7 @@
</div>
</div>
<div style="height:90%;overflow:auto;position:absolute;width:100%;">
<mat-table id="contact-list" #tableContactListSort="matSort" [dataSource]="dataSource" matSort
matSortActive="label" matSortDirection="asc" style="width:100%;">
<mat-table id="contact-list" #tableContactListSort="matSort" [dataSource]="adminService.getDataSource()" matSort matSortDisableClear style="width:100%;">
<ng-container matColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.label}}</mat-header-cell>
<mat-cell mat-cell *matCellDef="let element">
......
......@@ -4,7 +4,6 @@ import { LANG } from '../../translate.component';
import { NotificationService } from '../../../service/notification/notification.service';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { HeaderService } from '../../../service/header.service';
import { AppService } from '../../../service/app.service';
import { tap, finalize, filter, exhaustMap, catchError } from 'rxjs/operators';
......@@ -12,6 +11,7 @@ import { ConfirmComponent } from '../../../plugins/modal/confirm.component';
import { MatDialog } from '@angular/material/dialog';
import {FunctionsService} from '../../../service/functions.service';
import { of } from 'rxjs/internal/observable/of';
import { AdministrationService } from '../administration.service';
declare var tinymce: any;
......@@ -25,21 +25,13 @@ export class TagsAdministrationComponent implements OnInit {
lang: any = LANG;
loading: boolean = true;
dataSource: any;
resultsLength: number = 0;
displayedColumns = ['label', 'description', 'actions'];
filterColumns = ['label', 'description'];
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort;
applyFilter(filterValue: string) {
filterValue = filterValue.trim(); // Remove whitespace
filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches
this.dataSource.filter = filterValue;
this.dataSource.filterPredicate = (template: any, filter: string) => {
return this.functions.filterUnSensitive(template, filter, ['label', 'description']);
};
}
constructor(
public http: HttpClient,
......@@ -48,6 +40,7 @@ export class TagsAdministrationComponent implements OnInit {
public appService: AppService,
public dialog: MatDialog,
public functions: FunctionsService,
public adminService: AdministrationService,
private viewContainerRef: ViewContainerRef
) { }
......@@ -63,16 +56,10 @@ export class TagsAdministrationComponent implements OnInit {
this.loading = true;
this.http.get('../rest/tags').pipe(
tap((data: any) => {
this.resultsLength = data.tags.length;
setTimeout(() => {
this.dataSource = new MatTableDataSource(data.tags);
this.resultsLength = data.tags.length;
this.dataSource.paginator = this.paginator;
this.dataSource.sortingDataAccessor = this.functions.listSortingDataAccessor;
this.sort.active = 'label';
this.sort.direction = 'asc';
this.dataSource.sort = this.sort;
this.adminService.setDataSource('admin_tag', data.tags, this.sort, this.paginator, this.filterColumns);
}, 0);
}),
finalize(() => this.loading = false)
).subscribe();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment