-
Type: {{resourceType}}
+
Type: {{resourceType}}
+
diff --git a/src/main/webapp/app/table-screen-es/table-screen-es.component.ts b/src/main/webapp/app/table-screen-es/table-screen-es.component.ts
index 9b3c95e..d40a8df 100644
--- a/src/main/webapp/app/table-screen-es/table-screen-es.component.ts
+++ b/src/main/webapp/app/table-screen-es/table-screen-es.component.ts
@@ -32,7 +32,7 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
providers: [ResourcesImplService],
})
-export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges {
+export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges{
//NB 'actions' CI DEVE ESSERE, altrimenti la tabella non viene visualizzata
//displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'artifact', 'group', 'version', 'endpoint','actions'];
displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'endpoint','actions'];
@@ -41,7 +41,7 @@ export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges
tableDetail: IEService;
dialogRef: MatDialogRef
|undefined;
- @Input() myCtx: IContextNode; //fetching event from parent
+ @Input() currentCtx: IContextNode; //fetching event from parent
@Input() resourceType: string;
@Output() jsonEmitter = new EventEmitter();
@ViewChild(MatSort) sort: MatSort;
@@ -60,7 +60,7 @@ export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges
constructor(private myDataService: ResourcesImplService, private myDialog: MatDialog) {
- this.myCtx = {} as IContextNode;
+ this.currentCtx = {} as IContextNode;
this.tableDetail = {} as IEService;
this.dataFromService = [];
this.sort = new MatSort();
@@ -75,51 +75,27 @@ export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges
}
ngOnInit(): void {
- this.myDataService.fetchResourceImpls('',this.resourceType).subscribe(res => {
+
+ let ctxPath = '';
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
+ if(this.currentCtx.path !== undefined){
+ ctxPath = this.currentCtx.path;
+ }
+
+ this.myDataService.fetchResourceImpls(ctxPath,this.resourceType).subscribe(res => {
this.dataFromService = res;
this.dataSource.data = res;
- //this is to filter only on the 'name' property
- this.dataSource.filterPredicate = function (record:any,filter:string) {
- return record.name.indexOf(filter)!==-1;
- }
- //console.debug(res);
});
}
- ngOnChanges(changes: SimpleChanges): void {
- // console.log('---NELLA ONCHANGES...' + this.myCtx.name);
- for (const propName in changes) {
- if (propName === 'myCtx') {
- const param = changes[propName];
- //TODO: questo รจ un tipo
- this.myCtx = param.currentValue;
- //controllo che l'oggetto non sia vuoto
- if (Object.keys(this.myCtx).length !== 0) {
- //mt qui va passato il parametro ResourceType (preso dall'albero) al rest
- this.myDataService.fetchResourceImpls('',this.resourceType).subscribe(res => {
- this.dataFromService = res;
- this.dataSource.data = res;
- });
- }
- }
- }
- }
-
+
applyFilter(event: Event): void {
const filterValue = (event.target as HTMLInputElement).value;
console.debug("++++++DATASOURCE:");
console.debug(this.dataSource);
this.dataSource.filter = filterValue.trim().toLowerCase();
}
- /*
- filterTable(): void {
- this.dataSource.filterPredicate = (data: IEService, filter: string): boolean => {
- return (
- data.name.toLocaleLowerCase().includes(filter)
- )
- }
- }
- */
+
// per tabbed pane (versione con aggiunta dinamica)
@@ -161,16 +137,41 @@ export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges
}
openDialogAdd(): void {
- // alert('contesto...'+this.myCtx.name);
+ // alert('contesto...'+this.currentCtx.name);
this.dialogRef = this.myDialog.open(ResourceAddComponent, {
//TODO: passare tipo e contesto
- data: {type: this.resourceType, context: this.myCtx},
+ data: {type: this.resourceType, context: this.currentCtx},
});
+
this.dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.dummyRes = result;
});
}
+ reloadTable():void{
+ this.myDataService.fetchResourceImpls(this.currentCtx.path,this.resourceType).subscribe(res => {
+ this.dataFromService = res;
+ this.dataSource.data = res;
+ })
+ }
+
+
+ ngOnChanges(changes: SimpleChanges): void {
+ for (const propName in changes) {
+ if (propName === 'currentCtx') {
+ const param = changes[propName];
+ this.currentCtx = param.currentValue;
+ //controllo che l'oggetto non sia vuoto
+ if (Object.keys(this.currentCtx).length !== 0) {
+ this.myDataService.fetchResourceImpls(this.currentCtx.path,this.resourceType).subscribe(res => {
+ this.dataFromService = res;
+ this.dataSource.data = res;
+ });
+ }
+ }
+ }
+ }
+
}
diff --git a/src/main/webapp/app/table-screen/table-screen.component.html b/src/main/webapp/app/table-screen/table-screen.component.html
index 9804c6e..4d1600d 100644
--- a/src/main/webapp/app/table-screen/table-screen.component.html
+++ b/src/main/webapp/app/table-screen/table-screen.component.html
@@ -1,16 +1,20 @@
-
-
Type: {{resourceType}}
-
-
-
-
-
-
+
+
+ Type: {{resourceType}}
+
+
+
Search by Name
-
+
+
+
+
+
diff --git a/src/main/webapp/app/table-screen/table-screen.component.ts b/src/main/webapp/app/table-screen/table-screen.component.ts
index 139b6ba..00f09e6 100644
--- a/src/main/webapp/app/table-screen/table-screen.component.ts
+++ b/src/main/webapp/app/table-screen/table-screen.component.ts
@@ -1,4 +1,7 @@
+/* eslint-disable @typescript-eslint/restrict-plus-operands */
+/* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable no-console */
+
import {
Component,
Output,
@@ -6,10 +9,10 @@ import {
OnInit,
ViewChild,
AfterViewInit,
- OnChanges,
- SimpleChanges,
Input,
QueryList,
+ OnChanges,
+ SimpleChanges,
} from '@angular/core';
import { MatTableDataSource } from '@angular/material/table';
@@ -40,7 +43,8 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
tableDetail: IHostingNode;
dialogRef: MatDialogRef |undefined;
- @Input() myCtx: IContextNode; //fetching event from parent
+ @Input() currentCtx: IContextNode; //fetching event from parent
+ @Input() currentCtxPath: string; //fetching event from parent
@Input() resourceType: string;
@Output() jsonEmitter = new EventEmitter();
@ViewChild(MatSort) sort: MatSort;
@@ -60,12 +64,13 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
////////// fine tabbed view
constructor(private myDataService: ResourcesImplService, private myDialog: MatDialog) {
- this.myCtx = {} as IContextNode;
+ this.currentCtx = {} as IContextNode;
this.tableDetail = {} as IHostingNode;
this.dataFromService = [];
this.sort = new MatSort();
this.paginator = {} as MatPaginator;
this.resourceType = '';
+ this.currentCtxPath = '';
this.dummyRes = '';
}
@@ -75,29 +80,35 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
}
ngOnInit(): void {
- this.myDataService.fetchResourceImpls('',this.resourceType).subscribe(res => {
+
+ let ctxPath = '';
+ if(this.currentCtx.path !== undefined){
+ ctxPath = this.currentCtx.path;
+ }else if(this.currentCtxPath !== undefined){
+ ctxPath = this.currentCtxPath
+ }
+
+ this.myDataService.fetchResourceImpls(ctxPath,this.resourceType).subscribe(res => {
+
this.dataFromService = res;
this.dataSource.data = res;
//this is to filter only on the 'name' property
this.dataSource.filterPredicate = function (record:any,filter:string) {
return record.name.indexOf(filter)!==-1;
}
- /*
- this.dataSource.filterPredicate =
- (data: IHostingNode, filter: string) => !filter || data.level == filter;
- */
});
}
+
ngOnChanges(changes: SimpleChanges): void {
- // console.log('---NELLA ONCHANGES...' + this.myCtx.name);
+
for (const propName in changes) {
- if (propName === 'myCtx') {
+ if (propName === 'currentCtx') {
const param = changes[propName];
- this.myCtx = param.currentValue;
+ this.currentCtx = param.currentValue;
//controllo che l'oggetto non sia vuoto
- if (Object.keys(this.myCtx).length !== 0) {
- this.myDataService.fetchResourceImpls('',this.resourceType).subscribe(res => {
+ if (Object.keys(this.currentCtx).length !== 0) {
+ this.myDataService.fetchResourceImpls(this.currentCtx.path,this.resourceType).subscribe(res => {
this.dataFromService = res;
this.dataSource.data = res;
});
@@ -105,6 +116,7 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
}
}
}
+
applyFilter(event: Event): void {
const filterValue = (event.target as HTMLInputElement).value;
@@ -132,6 +144,13 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
}
}
+ reloadTable():void{
+ this.myDataService.fetchResourceImpls(this.currentCtx.path,this.resourceType).subscribe(res => {
+ this.dataFromService = res;
+ this.dataSource.data = res;
+ })
+ }
+
closeTab(index: number): void {
/*
console.debug('---------');
@@ -166,7 +185,7 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
// alert('contesto...'+this.myCtx.name);
this.dialogRef = this.myDialog.open(ResourceAddComponent, {
//TODO: passare tipo e contesto
- data: {type: this.resourceType, context: this.myCtx},
+ data: {type: this.resourceType, context: this.currentCtx},
});
this.dialogRef.afterClosed().subscribe(result => {