Added windows

This commit is contained in:
2024-09-18 20:37:25 -04:00
parent 1e054dee19
commit 501c2e88d1
15 changed files with 511 additions and 36 deletions

View File

@@ -1,22 +1,30 @@
import { Component } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { TreeComponent } from '../tree/tree.component';
import { TreeNode } from '../../models/tree-node';
import { MetaService } from '../../services/meta.service';
import { Action } from '../../models/action';
import { faAdd } from '@fortawesome/free-solid-svg-icons';
import { faAdd, faFilter } from '@fortawesome/free-solid-svg-icons';
import { QueryService } from '../../services/query.service';
import { combineLatest } from 'rxjs';
import { Query } from '../../models/query';
import { WindowComponent } from '../window/window.component';
@Component({
selector: 'fbi-metadata',
standalone: true,
imports: [TreeComponent],
imports: [TreeComponent, WindowComponent],
templateUrl: './metadata.component.html',
styleUrl: './metadata.component.scss',
})
export class MetadataComponent {
node: TreeNode = new TreeNode({});
@ViewChild(WindowComponent) window!: WindowComponent;
windowComponent = WindowComponent;
windowConfig = {
title: 'test',
};
constructor(metaService: MetaService, private queryService: QueryService) {
combineLatest({
@@ -33,7 +41,10 @@ export class MetadataComponent {
const children = node.children ?? [];
children.forEach((child: Partial<TreeNode>) => recurse(child));
if (children.length === 0) {
const actions = [{ label: 'Add', icon: faAdd, data: ACTIONS.ADD }];
const actions = [
{ label: 'Filter', icon: faFilter, data: ACTIONS.FILTER },
{ label: 'Add', icon: faAdd, data: ACTIONS.ADD },
];
node.actions = actions as Action[];
}
};
@@ -53,6 +64,9 @@ export class MetadataComponent {
case ACTIONS.ADD:
this.queryService.add(event.node.data);
break;
case ACTIONS.FILTER:
this.window.show();
break;
}
}
@@ -72,4 +86,5 @@ export class MetadataComponent {
enum ACTIONS {
ADD = 'add',
FILTER = 'filter',
}