--- /dev/null
+
+<div class="row mt-2">
+ <div class="col-lg-4">
+ <ng-container *ngIf="tree">
+ <div class="d-flex">
+ <button class="btn btn-warning mr-1" (click)="deleteNode()"
+ [disabled]="!hasActiveNode()" i18n>
+ Remove Selected Node
+ </button>
+ </div>
+ <div class="pt-2">
+ <eg-tree
+ [tree]="tree"
+ (nodeClicked)="nodeClicked($event)">
+ </eg-tree>
+ </div>
+ </ng-container>
+</div>
+
--- /dev/null
+import {Component, OnInit, ViewChild, AfterViewInit, Input} from '@angular/core';
+import {IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {Tree, TreeNode} from '@eg/share/tree/tree';
+
+@Component({
+ selector: 'eg-match-set-expression',
+ templateUrl: 'match-set-expression.component.html'
+})
+export class MatchSetExpressionComponent implements OnInit {
+
+ // Match set arrives from parent async.
+ matchSet_: IdlObject;
+ @Input() set matchSet(ms: IdlObject) {
+ this.matchSet_ = ms;
+ if (ms && !this.initDone) {
+ this.initDone = true;
+ this.refreshTree();
+ }
+ }
+
+ tree: Tree;
+ initDone: boolean;
+
+ constructor(
+ private pcrud: PcrudService,
+ private org: OrgService
+ ) { }
+
+ ngOnInit() {
+ }
+
+ refreshTree() {
+ if (!this.matchSet_) { return; }
+
+ this.pcrud.search('vmsp',
+ {match_set: this.matchSet_.id()}, {}, {atomic: true}
+ ).toPromise().then(points => {
+
+ // create tree nodes
+ const nodes = [];
+ const idmap: any = {};
+ points.forEach(point => {
+ const node = new TreeNode({
+ id: point.id(),
+ expanded: true,
+ label: point.bool_op()
+ || point.svf()
+ || (point.tag() + ' ‡' + point.subfield())
+ });
+ nodes.push(node);
+ idmap[node.id + ''] = node;
+ });
+
+ // then apply the parent/child relationship
+
+ points.forEach(point => {
+ const node = idmap[point.id() + ''];
+ if (point.parent()) {
+ idmap[point.parent() + ''].children.push(node);
+ } else {
+ this.tree = new Tree(node);
+ }
+ });
+ });
+ }
+
+ nodeClicked(node: TreeNode) {
+ console.log('node clicked: ' + node.label
+ + ' expanded ' + node.expanded);
+ }
+
+ deleteNode() {
+ this.tree.removeNode(this.tree.activeNode());
+ }
+
+ hasActiveNode(): boolean {
+ return Boolean(this.tree.activeNode());
+ }
+}
+
this.contextOrg = this.org.get(this.auth.user().ws_ou());
this.gridSource.getRows = (pager: Pager) => {
- const orgs = this.org.descendants(this.contextOrg, true);
+ const orgs = this.org.ancestors(this.contextOrg, true);
return this.pcrud.search('vms', {owner: orgs}, {
order_by: {vms: ['name']},
limit: pager.limit,
+<div class="row pb-2" *ngIf="matchSet">
+ <div class="col-lg-4">
+ <div class="card tight-card">
+ <h5 class="card-header" i18n>Match Set Summary</h5>
+ <div class="card-body">
+ <div class="row">
+ <div class="col-lg-6" i18n>Match Set Name:</div>
+ <div class="col-lg-6">{{matchSet.name()}}</div>
+ </div>
+ <div class="row">
+ <div class="col-lg-6" i18n>Owning Library:</div>
+ <div class="col-lg-6">{{matchSet.owner().shortname()}}</div>
+ </div>
+ <div class="row">
+ <div class="col-lg-6" i18n>Type:</div>
+ <div class="col-lg-6">{{matchSet.mtype()}}</div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
<ngb-tabset [activeId]="matchSetTab" (tabChange)="onTabChange($event)">
<ngb-tab title="Match Set Editor" i18n-title id="editor">
<ng-template ngbTabContent>
+ <eg-match-set-expression [matchSet]="matchSet">
+ </eg-match-set-expression>
</ng-template>
</ngb-tab>
<ngb-tab title="Match Set Quality Metrics" i18n-title id="quality">
import {Component, OnInit, ViewChild} from '@angular/core';
import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
@Component({
templateUrl: 'match-set.component.html'
})
-export class MatchSetComponent {
+export class MatchSetComponent implements OnInit {
+ matchSet: IdlObject;
matchSetId: number;
matchSetTab: string;
constructor(
private router: Router,
- private route: ActivatedRoute) {
+ private route: ActivatedRoute,
+ private pcrud: PcrudService,
+ private org: OrgService
+ ) {
this.route.paramMap.subscribe((params: ParamMap) => {
this.matchSetId = +params.get('id');
this.matchSetTab = params.get('matchSetTab');
});
}
+ ngOnInit() {
+ this.pcrud.retrieve('vms', this.matchSetId)
+ .toPromise().then(ms => {
+ ms.owner(this.org.get(ms.owner()));
+ this.matchSet = ms;
+ });
+ }
+
// Changing a tab in the UI means changing the route.
// Changing the route ultimately results in changing the tab.
onTabChange(evt: NgbTabChangeEvent) {
import {RecordItemsComponent} from './record-items.component';
import {MatchSetListComponent} from './match-set-list.component';
import {MatchSetComponent} from './match-set.component';
+import {MatchSetExpressionComponent} from './match-set-expression.component';
+import {TreeModule} from '@eg/share/tree/tree.module';
@NgModule({
declarations: [
QueueItemsComponent,
RecordItemsComponent,
MatchSetListComponent,
- MatchSetComponent
+ MatchSetComponent,
+ MatchSetExpressionComponent
],
imports: [
+ TreeModule,
StaffCommonModule,
CatalogCommonModule,
VandelayRoutingModule,
})
export class VandelayModule {
-
}