+<form [formGroup]="search">
+ <eg-combobox formControlName="field">
+ <eg-combobox-entry *ngFor="let authorityField of authorityFields"
+ [entryId]="authorityField.id()"
+ [entryLabel]="authorityField.name()">
+ </eg-combobox-entry>
+ </eg-combobox>
+</form>
+{{field}}
<eg-grid #grid [dataSource]="gridSource"
persistKey="cat.authorities.manage">
<eg-grid-column path="record.id" label="ID" i18n-label [index]="true" [hidden]="true"></eg-grid-column>
+import {FormGroup, FormControl} from '@angular/forms';
import {PcrudService} from '@eg/core/pcrud.service';
import {Component} from '@angular/core';
import {GridDataSource} from '@eg/share/grid/grid';
import {Pager} from '@eg/share/util/pager';
+import { IdlObject } from '@eg/core/idl.service';
@Component({
templateUrl: './manage.component.html',
})
export class ManageAuthoritiesComponent {
gridSource: GridDataSource;
+ search: FormGroup;
+ authorityFields: IdlObject[] = [];
constructor(
private pcrud: PcrudService
- ) {
+ ) {
+ this.search = new FormGroup({
+ field: new FormControl()
+ });
+
+ this.pcrud.search('acsaf', {'main_entry': null})
+ .subscribe((field) => this.authorityFields.push(field));
this.gridSource = new GridDataSource();
this.gridSource.getRows = (pager: Pager) => {
- return this.pcrud.search('ash', {
- 'record': { 'in': {
- 'from': 'are', 'select': {'are': ['id']}, 'where': {'deleted': 'false'}}},
- 'atag': { 'in': {
- 'from': 'acsaf', 'select': {'acsaf': ['id']}, 'where': {'main_entry': null}}},
- },
- {flesh: 2,
- flesh_fields: {
- are: ['creator', 'editor', 'owner'],
- ash: ['record']
- }
- });
+ if (this.field.value) {
+ return this.pcrud.search('ash', {
+ 'record': { 'in': {
+ 'from': 'are', 'select': {'are': ['id']}, 'where': {'deleted': 'false'}}},
+ 'atag': this.field.value.id,
+ },
+ {flesh: 2,
+ flesh_fields: {
+ are: ['creator', 'editor', 'owner'],
+ ash: ['record']
+ }
+ });
+ }
};
}
+ get field() {
+ return this.search.get('field');
+ }
}