adding searchable select, plus minor changes (work in progress...)

This commit is contained in:
Maria Teresa Paratore 2023-09-13 16:37:21 +02:00
parent 4c9bed13b5
commit 3dafb27bb8
9 changed files with 251 additions and 10 deletions

95
egacy-peer-deps Normal file
View File

@ -0,0 +1,95 @@
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< org.gcube.isdashboard:isdashboard >------------------
[INFO] Building Isdashboard 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot:3.1.1:run (default-cli) > test-compile @ isdashboard >>>
[INFO]
[INFO] --- resources:3.3.1:copy-resources (default-resources) @ isdashboard ---
[INFO] Copying 4 resources from src/main/resources to target/classes
[INFO] Copying 5 resources from src/main/resources to target/classes
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ isdashboard ---
[INFO] Copying 4 resources from src/main/resources to target/classes
[INFO] Copying 5 resources from src/main/resources to target/classes
[INFO]
[INFO] --- enforcer:3.3.0:enforce (enforce-versions) @ isdashboard ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO]
[INFO] --- enforcer:3.3.0:enforce (enforce-dependencyConvergence) @ isdashboard ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence passed
[INFO]
[INFO] --- properties:1.1.0:read-project-properties (default) @ isdashboard ---
[INFO]
[INFO] --- jacoco:0.8.10:prepare-agent (pre-unit-tests) @ isdashboard ---
[INFO] argLine set to -javaagent:/Users/mariateresaparatore/.m2/repository/org/jacoco/org.jacoco.agent/0.8.10/org.jacoco.agent-0.8.10-runtime.jar=destfile=/Users/mariateresaparatore/Documents/workspace-spring/isdashboard/target/jacoco.exec -Djava.security.egd=file:/dev/./urandom -Xmx1G
[INFO]
[INFO] --- spotless:2.37.0:apply (spotless) @ isdashboard ---
[INFO] Spotless.Java is keeping 45 files clean - 0 were changed to be clean, 0 were already clean, 45 were skipped because caching determined they were already clean
[INFO]
[INFO] --- checksum:1.11:files (create-pre-compiled-webapp-checksum) @ isdashboard ---
[INFO]
[INFO] --- antrun:3.1.0:run (eval-frontend-checksum) @ isdashboard ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO]
[INFO] --- frontend:1.13.4:install-node-and-npm (install-node-and-npm) @ isdashboard ---
[INFO] Node v18.16.1 is already installed.
[INFO] NPM 9.8.0 is already installed.
[INFO]
[INFO] --- frontend:1.13.4:npm (npm install) @ isdashboard ---
[INFO] Running 'npm install' in /Users/mariateresaparatore/Documents/workspace-spring/isdashboard
[INFO] npm ERR! code ERESOLVE
[INFO] npm ERR! ERESOLVE unable to resolve dependency tree
[INFO] npm ERR!
[INFO] npm ERR! While resolving: isdashboard@0.0.1-SNAPSHOT
[INFO] npm ERR! Found: @angular/core@16.1.4
[INFO] npm ERR! node_modules/@angular/core
[INFO] npm ERR! @angular/core@"16.1.4" from the root project
[INFO] npm ERR! peer @angular/core@"^16.0.0 || ^17.0.0" from @angular/material-moment-adapter@16.1.4
[INFO] npm ERR! node_modules/@angular/material-moment-adapter
[INFO] npm ERR! @angular/material-moment-adapter@"16.1.4" from the root project
[INFO] npm ERR! 1 more (@angular/material)
[INFO] npm ERR!
[INFO] npm ERR! Could not resolve dependency:
[INFO] npm ERR! peer @angular/core@"16.2.4" from @angular/animations@16.2.4
[INFO] npm ERR! node_modules/@angular/animations
[INFO] npm ERR! @angular/animations@"^16.1.4" from the root project
[INFO] npm ERR! peer @angular/animations@"^16.0.0 || ^17.0.0" from @angular/material@16.1.4
[INFO] npm ERR! node_modules/@angular/material
[INFO] npm ERR! @angular/material@"^16.1.4" from the root project
[INFO] npm ERR! 1 more (@angular/material-moment-adapter)
[INFO] npm ERR!
[INFO] npm ERR! Fix the upstream dependency conflict, or retry
[INFO] npm ERR! this command with --force or --legacy-peer-deps
[INFO] npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
[INFO] npm ERR!
[INFO] npm ERR!
[INFO] npm ERR! For a full report see:
[INFO] npm ERR! /Users/mariateresaparatore/.npm/_logs/2023-09-13T08_30_20_929Z-eresolve-report.txt
[INFO]
[INFO] npm ERR! A complete log of this run can be found in: /Users/mariateresaparatore/.npm/_logs/2023-09-13T08_30_20_929Z-debug-0.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.541 s
[INFO] Finished at: 2023-09-13T10:30:23+02:00
[INFO] ------------------------------------------------------------------------
[WARNING]
[WARNING] Plugin validation issues were detected in 2 plugin(s)
[WARNING]
[WARNING] * org.jacoco:jacoco-maven-plugin:0.8.10
[WARNING] * org.apache.maven.plugins:maven-resources-plugin:3.3.1
[WARNING]
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING]
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.13.4:npm (npm install) on project isdashboard: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

95
legacy-peer-deps Normal file
View File

@ -0,0 +1,95 @@
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< org.gcube.isdashboard:isdashboard >------------------
[INFO] Building Isdashboard 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot:3.1.1:run (default-cli) > test-compile @ isdashboard >>>
[INFO]
[INFO] --- resources:3.3.1:copy-resources (default-resources) @ isdashboard ---
[INFO] Copying 4 resources from src/main/resources to target/classes
[INFO] Copying 5 resources from src/main/resources to target/classes
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ isdashboard ---
[INFO] Copying 4 resources from src/main/resources to target/classes
[INFO] Copying 5 resources from src/main/resources to target/classes
[INFO]
[INFO] --- enforcer:3.3.0:enforce (enforce-versions) @ isdashboard ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO]
[INFO] --- enforcer:3.3.0:enforce (enforce-dependencyConvergence) @ isdashboard ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence passed
[INFO]
[INFO] --- properties:1.1.0:read-project-properties (default) @ isdashboard ---
[INFO]
[INFO] --- jacoco:0.8.10:prepare-agent (pre-unit-tests) @ isdashboard ---
[INFO] argLine set to -javaagent:/Users/mariateresaparatore/.m2/repository/org/jacoco/org.jacoco.agent/0.8.10/org.jacoco.agent-0.8.10-runtime.jar=destfile=/Users/mariateresaparatore/Documents/workspace-spring/isdashboard/target/jacoco.exec -Djava.security.egd=file:/dev/./urandom -Xmx1G
[INFO]
[INFO] --- spotless:2.37.0:apply (spotless) @ isdashboard ---
[INFO] Spotless.Java is keeping 45 files clean - 0 were changed to be clean, 0 were already clean, 45 were skipped because caching determined they were already clean
[INFO]
[INFO] --- checksum:1.11:files (create-pre-compiled-webapp-checksum) @ isdashboard ---
[INFO]
[INFO] --- antrun:3.1.0:run (eval-frontend-checksum) @ isdashboard ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO]
[INFO] --- frontend:1.13.4:install-node-and-npm (install-node-and-npm) @ isdashboard ---
[INFO] Node v18.16.1 is already installed.
[INFO] NPM 9.8.0 is already installed.
[INFO]
[INFO] --- frontend:1.13.4:npm (npm install) @ isdashboard ---
[INFO] Running 'npm install' in /Users/mariateresaparatore/Documents/workspace-spring/isdashboard
[INFO] npm ERR! code ERESOLVE
[INFO] npm ERR! ERESOLVE unable to resolve dependency tree
[INFO] npm ERR!
[INFO] npm ERR! While resolving: isdashboard@0.0.1-SNAPSHOT
[INFO] npm ERR! Found: @angular/core@16.1.4
[INFO] npm ERR! node_modules/@angular/core
[INFO] npm ERR! @angular/core@"16.1.4" from the root project
[INFO] npm ERR! peer @angular/core@"^16.0.0 || ^17.0.0" from @angular/material-moment-adapter@16.1.4
[INFO] npm ERR! node_modules/@angular/material-moment-adapter
[INFO] npm ERR! @angular/material-moment-adapter@"16.1.4" from the root project
[INFO] npm ERR! 1 more (@angular/material)
[INFO] npm ERR!
[INFO] npm ERR! Could not resolve dependency:
[INFO] npm ERR! peer @angular/core@"16.2.4" from @angular/animations@16.2.4
[INFO] npm ERR! node_modules/@angular/animations
[INFO] npm ERR! @angular/animations@"^16.1.4" from the root project
[INFO] npm ERR! peer @angular/animations@"^16.0.0 || ^17.0.0" from @angular/material@16.1.4
[INFO] npm ERR! node_modules/@angular/material
[INFO] npm ERR! @angular/material@"^16.1.4" from the root project
[INFO] npm ERR! 1 more (@angular/material-moment-adapter)
[INFO] npm ERR!
[INFO] npm ERR! Fix the upstream dependency conflict, or retry
[INFO] npm ERR! this command with --force or --legacy-peer-deps
[INFO] npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
[INFO] npm ERR!
[INFO] npm ERR!
[INFO] npm ERR! For a full report see:
[INFO] npm ERR! /Users/mariateresaparatore/.npm/_logs/2023-09-11T07_58_56_685Z-eresolve-report.txt
[INFO]
[INFO] npm ERR! A complete log of this run can be found in: /Users/mariateresaparatore/.npm/_logs/2023-09-11T07_58_56_685Z-debug-0.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.200 s
[INFO] Finished at: 2023-09-11T09:58:58+02:00
[INFO] ------------------------------------------------------------------------
[WARNING]
[WARNING] Plugin validation issues were detected in 2 plugin(s)
[WARNING]
[WARNING] * org.jacoco:jacoco-maven-plugin:0.8.10
[WARNING] * org.apache.maven.plugins:maven-resources-plugin:3.3.1
[WARNING]
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING]
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.13.4:npm (npm install) on project isdashboard: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

View File

@ -12,6 +12,7 @@ import LoginComponent from './login/login.component';
import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { TabbedPageComponent } from './tabbed-page/tabbed-page.component';
import { TableScreenComponent } from './table-screen/table-screen.component';
import { RscTreeComponent } from './rsc-tree/rsc-tree.component';
@NgModule({
imports: [
@ -34,6 +35,11 @@ import { TableScreenComponent } from './table-screen/table-screen.component';
path: 'mat-table',
component: TableScreenComponent,
},
{
//TEST
path: 'res-tree',
component: RscTreeComponent,
},
{
path: '',

View File

@ -1,4 +1,27 @@
<h2 class="display-8" id="tree-title"><span>Available contexts</span></h2>
<!--<h2 class="display-8" id="tree-title"><span>Available resources</span></h2>-->
<div class="d-flex flex-row">
<div id="btn-group" class="py-4">
<button mat-raised-button color="primary"><mat-icon>source</mat-icon> <span>File</span></button>
<button mat-raised-button color="primary"><mat-icon>edit</mat-icon> <span>Edit</span></button>
<button mat-raised-button color="primary"><mat-icon>explore</mat-icon> <span>View</span></button>
<button mat-raised-button color="primary"><mat-icon>help</mat-icon><span>Help</span></button>
</div>
<!--
<mat-select [(ngModel)]="selectedValue" name="food">
<mat-option *ngFor="let food of foods" [value]="food.value">
{{food.viewValue}}
</mat-option>
</mat-select>
-->
<mat-form-field class="flex-grow-1 px-4">
<mat-label>Select a context</mat-label>
<mat-select [(ngModel)]="selectedValue" name="food">
<mat-option *ngFor="let food of foods" [value]="food.value" />
</mat-select>
</mat-form-field>
</div>
<mat-tree [dataSource]="nestedDataSource" [treeControl]="nestedTreeControl" class="example-tree">
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle>
<!--<button mat-button (click)="loadTable(node)">-->

View File

@ -21,7 +21,7 @@
* This padding sets alignment of the nested nodes.
*/
.example-tree .mat-nested-tree-node div[role='group'] {
padding-left: 30px;
padding-left: 25px;
}
/*
@ -30,5 +30,5 @@
* under the same parent.
*/
.example-tree div[role='group'] > .mat-tree-node {
padding-left: 30px;
padding-left: 25px;
}

View File

@ -1,21 +1,29 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Output, EventEmitter, AfterViewInit } from '@angular/core';
import { MatTreeNestedDataSource } from '@angular/material/tree';
import { NestedTreeControl } from '@angular/cdk/tree';
import { ResourcesLoaderService } from 'app/services/resources-loader.service';
import { IResource } from 'app/services/i-resource';
import { ContextsLoaderService } from 'app/services/contexts-loader.service';
import { IContextNode } from 'app/services/i-context-node';
@Component({
selector: 'jhi-rsc-tree',
templateUrl: './rsc-tree.component.html',
styleUrls: ['./rsc-tree.component.scss'],
providers: [ResourcesLoaderService],
providers: [ResourcesLoaderService, ContextsLoaderService],
})
export class RscTreeComponent implements OnInit {
export class RscTreeComponent implements OnInit, AfterViewInit {
nestedTreeControl = new NestedTreeControl<IResource>(node => node.children);
nestedDataSource = new MatTreeNestedDataSource<IResource>();
@Output() treeNode = new EventEmitter<IResource>(); //emitting event to parent
allContexts: IContextNode[];
rootName: string;
constructor(private myService: ResourcesLoaderService) {}
constructor(private resLoader: ResourcesLoaderService, private ctxLoader: ContextsLoaderService) {
// this.selected = "option2";
this.allContexts = {} as IContextNode[];
this.rootName = '';
}
hasNestedChild(_: number, node: IResource): boolean {
if (node.children == null) {
@ -26,7 +34,15 @@ export class RscTreeComponent implements OnInit {
}
ngOnInit(): void {
this.myService.getResourcesByContext().subscribe(res => {
this.ctxLoader.getData().subscribe(res => {
this.allContexts = res;
this.rootName = this.allContexts[0].name;
});
}
ngAfterViewInit(): void {
//TODO: qui va passato il CONTEXT_ID alla get
this.resLoader.getResourcesByContext().subscribe(res => {
this.nestedDataSource.data = res;
});
}

View File

@ -1,8 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { MatButtonModule } from '@angular/material/button';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';
@NgModule({
declarations: [],
imports: [CommonModule],
imports: [CommonModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatMenuModule, MatIconModule],
})
export class RscTreeModule {}

View File

@ -1,5 +1,6 @@
export interface IResource {
name: string;
id: string;
type: number; //TODO: codice da assegnare in constants per ogni tipo di risorsa
children?: IResource[];
}

View File

@ -27,6 +27,6 @@ export class ResourcesLoaderService {
//TODO: a regime questo metodo prende un parametro nella get
getResourcesByContext(): Observable<IResource[]> {
//TODO: pipe per gestione errori
return this.http.get<IResource[]>('http://http://localhost:3002/is/ctxresources');
return this.http.get<IResource[]>('http://localhost:3002/is/ctxresources');
}
}