From 6bece456fdcf66731d15fd8739128be994a711fd Mon Sep 17 00:00:00 2001 From: t8g Date: Fri, 1 Sep 2017 16:22:47 +0200 Subject: [PATCH] [front: editLog] path filter --- client/src/app/isari-data.service.ts | 2 +- client/src/app/isari-logs/EditLogApiOptions.class.ts | 1 + client/src/app/log-table/log-table.component.html | 10 ++++++++-- client/src/app/log-table/log-table.component.ts | 11 +++++++++++ client/src/styles.css | 4 ---- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/client/src/app/isari-data.service.ts b/client/src/app/isari-data.service.ts index 4f435ae9..fed69cdd 100644 --- a/client/src/app/isari-data.service.ts +++ b/client/src/app/isari-data.service.ts @@ -190,7 +190,7 @@ export class IsariDataService { return this.getColumnsInfo(feature).then(info => info['defaults']); } - private getSchema(feature: string, path?: string) { + getSchema(feature: string, path?: string) { if (!this.schemasCache[feature]) { const url = `${this.schemaUrl}/${singular[feature]}`; this.schemasCache[feature] = this.http.get(url, this.getHttpOptions()) diff --git a/client/src/app/isari-logs/EditLogApiOptions.class.ts b/client/src/app/isari-logs/EditLogApiOptions.class.ts index 3bea2223..adfc25a8 100644 --- a/client/src/app/isari-logs/EditLogApiOptions.class.ts +++ b/client/src/app/isari-logs/EditLogApiOptions.class.ts @@ -6,4 +6,5 @@ export class EditLogApiOptions { whoID?: string; isariLab?: string; isariRole?: string; + path?: string; } diff --git a/client/src/app/log-table/log-table.component.html b/client/src/app/log-table/log-table.component.html index 97680356..88d88a8e 100644 --- a/client/src/app/log-table/log-table.component.html +++ b/client/src/app/log-table/log-table.component.html @@ -39,7 +39,14 @@ - {{ 'editLogs.fields' | translate }} + + + {{ 'editLogs.actions.all' | translate }} + {{ field.label }} + +
@@ -130,6 +137,5 @@ - diff --git a/client/src/app/log-table/log-table.component.ts b/client/src/app/log-table/log-table.component.ts index 7babe547..85b08177 100644 --- a/client/src/app/log-table/log-table.component.ts +++ b/client/src/app/log-table/log-table.component.ts @@ -5,6 +5,8 @@ import { TranslateService } from 'ng2-translate'; import { Component, Input, OnInit, Output, EventEmitter, OnChanges } from '@angular/core'; import { EditLogApiOptions } from '../isari-logs/EditLogApiOptions.class'; +import zipObject from 'lodash/zipObject'; + @Component({ selector: 'isari-log-table', templateUrl: './log-table.component.html', @@ -17,6 +19,7 @@ export class LogTableComponent implements OnInit { itemSettings: { api: any, src: any, stringValue: any } = { api: null, src: null, stringValue: null }; labSettings: { api: any, src: any, stringValue: any } = { api: null, src: null, stringValue: null }; roles: any[]; + fields: any[]; limits: number[] = [3, 5, 10, 20, 50, 100, 200]; filterForm: FormGroup; @@ -43,6 +46,7 @@ export class LogTableComponent implements OnInit { 'startDate', 'endDate', 'limit', + 'path', ].forEach(key => { this.filterForm.addControl(key, new FormControl(this.options[key] || '')); }); @@ -67,11 +71,18 @@ export class LogTableComponent implements OnInit { this.labSettings.src = this.isariDataService.srcForeignBuilder('organizations'); this.labSettings.stringValue = this.isariDataService.getForeignLabel('organizations', this.options.isariLab); + // roles select this.isariDataService.getEnum('isariRoles') .subscribe(roles => this.roles = roles.map(role => Object.assign({}, role, { label: role.label[this.translate.currentLang] }))); + // field select + Observable.fromPromise(this.isariDataService.getSchema(this.feature)) + .subscribe(schema => + this.fields = Object.keys(schema).reduce((acc, value) => + ([...acc, { value, label: schema[value].label[this.translate.currentLang] } ]) + , [])) } navigatePrev() { diff --git a/client/src/styles.css b/client/src/styles.css index ddbc0ad8..57d3a559 100644 --- a/client/src/styles.css +++ b/client/src/styles.css @@ -96,7 +96,3 @@ md-dialog-container { md-dialog-container [md-raised-button].md-primary { background-color: #E6142D; } - -.md-select-panel { - max-height: none !important; -}