Skip to content

Commit

Permalink
[front: editLog] path filter
Browse files Browse the repository at this point in the history
  • Loading branch information
t8g committed Sep 1, 2017
1 parent d8c5ed5 commit 6bece45
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/src/app/isari-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions client/src/app/isari-logs/EditLogApiOptions.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export class EditLogApiOptions {
whoID?: string;
isariLab?: string;
isariRole?: string;
path?: string;
}
10 changes: 8 additions & 2 deletions client/src/app/log-table/log-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
</md-select>
</th>

<th>{{ 'editLogs.fields' | translate }}</th>
<th>
<md-select *ngIf="filterForm.controls['path']"
[placeholder]="'editLogs.fields' | translate"
[formControl]="filterForm.controls['path']">
<md-option>{{ 'editLogs.actions.all' | translate }}</md-option>
<md-option *ngFor="let field of fields" [value]="field.value">{{ field.label }}</md-option>
</md-select>
</th>

<th style="max-width:25%;border:1px solid #ddd;background:#f2f2f2;">
<div style="display:flex">
Expand Down Expand Up @@ -130,6 +137,5 @@
<!-- remove me style WTF ??? -->
<md-input style="display:none" placeholder="Company (disabled)" disabled value="Google"></md-input>


</md-card>

11 changes: 11 additions & 0 deletions client/src/app/log-table/log-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;
Expand All @@ -43,6 +46,7 @@ export class LogTableComponent implements OnInit {
'startDate',
'endDate',
'limit',
'path',
].forEach(key => {
this.filterForm.addControl(key, new FormControl(this.options[key] || ''));
});
Expand All @@ -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() {
Expand Down
4 changes: 0 additions & 4 deletions client/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 6bece45

Please sign in to comment.