isdashboard/src/main/webapp/app/tabbed-page/tabbed-page.component.ts

40 lines
1.5 KiB
TypeScript

import { Component, ViewChild } from '@angular/core';
import { SharedModule } from 'app/shared/shared.module';
import { CtxTreeModule } from 'app/ctx-tree/ctx-tree.module';
import { IContextNode } from 'app/services/i-context-node';
import { DynTabComponent } from 'app/dyn-tab/dyn-tab.component';
import { ListScreenComponent } from 'app/tab-items/list-screen.component';
import { RawjsonViewComponent } from 'app/tab-items/rawjson-view.component';
import { IHostingnode } from 'app/services/i-hostinngnode';
import { DynTabsComponent } from 'app/dyn-tabs/dyn-tabs.component';
@Component({
standalone: true,
imports: [CtxTreeModule, SharedModule, DynTabComponent, DynTabsComponent, ListScreenComponent, RawjsonViewComponent],
selector: 'jhi-tabbed-page',
templateUrl: './tabbed-page.component.html',
styleUrls: ['./tabbed-page.component.scss'],
})
export class TabbedPageComponent {
currentNodeCtx: IContextNode;
chosenItem: IHostingnode;
//attenzione a usare la conversione giusta per il nome del file del template (rawjson-view.component)
@ViewChild('rawjsonView') rawjsonTemplate: any;
@ViewChild(DynTabsComponent) dynTabsComponent: any;
constructor() {
this.currentNodeCtx = {} as IContextNode;
this.chosenItem = {} as IHostingnode;
}
loadTreeNode(node: IContextNode): void {
this.currentNodeCtx = node;
}
onViewRawJson(item: IHostingnode): void {
this.chosenItem = item;
this.dynTabsComponent.openTab(`${this.chosenItem.name}`, this.rawjsonTemplate, this.chosenItem, true);
}
}