Addd resource types tree and raw json view

This commit is contained in:
Maria Teresa Paratore 2023-10-17 17:35:23 +02:00
parent a0a608b712
commit b61cd64a03
24 changed files with 49715 additions and 78 deletions

View File

@ -0,0 +1,2 @@
boot.project.validation.builder.JAVA.project.prefs.enabled=true
eclipse.preferences.version=1

3904
myLogFile.2023-10-16.log Normal file

File diff suppressed because it is too large Load Diff

45550
myLogFile.2023-10-17.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -50,9 +50,9 @@ public class TokenManager {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<UmaResponseDTO> response = restTemplate.exchange(tokenUri, HttpMethod.POST, entity, UmaResponseDTO.class);
UmaResponseDTO umaResponceDTO = response.getBody();
log.debug("UmaResponceDTO: {}", umaResponceDTO);
String umaToken=umaResponceDTO.getAccess_token();
UmaResponseDTO umaResponseDTO = response.getBody();
log.debug("UmaResponseDTO: {}", umaResponseDTO);
String umaToken=umaResponseDTO.getAccess_token();
log.debug("UmaToken: {}", umaToken);
return umaToken;
}

View File

@ -6,11 +6,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager;
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
@Service
public class ContextService {

View File

@ -36,9 +36,9 @@ public class InformationSystemService {
}
public List<Context> getAllContext(String context) throws Exception {
log.debug("GetAllContext: [context={}]",context);
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(context);
public List<Context> getAllContext(String rootCtx) throws Exception {
log.debug("GetAllContext: [rootCtx=]",rootCtx);
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(rootCtx);
//List<Context> contexts=new ArrayList<>();
//contexts.add(new ContextImpl("/gcube"));
List<Context>contexts=resourceRegistryClient.getAllContext();

View File

@ -130,7 +130,6 @@ public class UserService {
if (details.get("resource_access") != null) {
JSONObject resourceAccessJSON=(JSONObject)details.get("resource_access");
logger.debug("ResourceAccess KeySet: {}",resourceAccessJSON.keySet());
LinkedHashMap<String, ArrayList<String>> resourceAccess=new LinkedHashMap<>();
for(String key: resourceAccessJSON.keySet()) {
JSONObject valueJSON=(JSONObject)resourceAccessJSON.get(key);

View File

@ -28,40 +28,21 @@
<root level="${logging.level.root}">
<appender-ref ref="ASYNC"/>
<appender-ref ref="FILE"/>
</root>
<logger name="javax.activation" level="WARN"/>
<logger name="javax.mail" level="WARN"/>
<logger name="javax.management.remote" level="WARN"/>
<logger name="javax.xml.bind" level="WARN"/>
<logger name="ch.qos.logback" level="WARN"/>
<logger name="com.ryantenney" level="WARN"/>
<logger name="com.sun" level="WARN"/>
<logger name="com.zaxxer" level="WARN"/>
<logger name="io.undertow" level="WARN"/>
<logger name="io.undertow.websockets.jsr" level="ERROR"/>
<logger name="org.apache" level="WARN"/>
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
<logger name="org.bson" level="WARN"/>
<logger name="org.hibernate.validator" level="WARN"/>
<logger name="org.springframework" level="WARN"/>
<logger name="org.springframework.web" level="WARN"/>
<logger name="org.springframework.security" level="WARN"/>
<logger name="org.springframework.cache" level="WARN"/>
<logger name="org.thymeleaf" level="WARN"/>
<logger name="org.xnio" level="WARN"/>
<logger name="io.swagger.v3" level="INFO"/>
<logger name="sun.rmi" level="WARN"/>
<logger name="sun.rmi.transport" level="WARN"/>
<!-- See https://github.com/jhipster/generator-jhipster/issues/13835 -->
<logger name="Validator" level="INFO"/>
<logger name="Validator" level="ERROR"/>
<!-- See https://github.com/jhipster/generator-jhipster/issues/14444 -->
<logger name="_org.springframework.web.servlet.HandlerMapping.Mappings" level="INFO"/>
<logger name="_org.springframework.web.servlet.HandlerMapping.Mappings" level="WARN"/>
<!-- jhipster-needle-logback-add-log - JHipster will add a new log with level -->
<!-- mt: added for debugging purposes-->
<logger name="org.gcube.fullstackapps.informationsystemmonitor.service" level="DEBUG">
<!--<appender-ref ref="FILE" />-->
</logger>
<logger name="org.gcube.fullstackapps.informationsystemmonitor.service" level="DEBUG"/>
<!-- https://logback.qos.ch/manual/configuration.html#shutdownHook and https://jira.qos.ch/browse/LOGBACK-1090 -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>

View File

@ -26,7 +26,8 @@ import { PageRibbonComponent } from './layouts/profiles/page-ribbon.component';
import { ActiveMenuDirective } from './layouts/navbar/active-menu.directive';
import { ErrorComponent } from './layouts/error/error.component';
import { SortableDirective } from './table-nodes/sortable.directive';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { RawjsonPaneComponent } from './rawjson-pane/rawjson-pane.component';
@NgModule({
imports: [
@ -41,7 +42,8 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
NgxWebstorageModule.forRoot({ prefix: 'jhi', separator: '-', caseSensitive: true }),
TranslationModule,
SortableDirective,
NgbModule
NgbModule,
RawjsonPaneComponent
],
providers: [
Title,

View File

@ -1,5 +1,5 @@
export class appProperties {
public static BASEURL_API = "http://localhost:8080/api/";
public static BASEURL_API = "http://localhost:8080/";
}

View File

@ -1,11 +1,10 @@
<div class="row">
<div class="col-md-3">
<jhi-ctx-tree></jhi-ctx-tree>
<jhi-rsc-tree></jhi-rsc-tree>
</div>
<div class="col-md-9">
<h1 class="display-4"><span jhiTranslate="home.title">Welcome!</span></h1>
<jhi-table-nodes></jhi-table-nodes>
<div [ngSwitch]="account !== null">
<div class="alert alert-success" *ngSwitchCase="true">
<span id="home-logged-message" *ngIf="account" jhiTranslate="home.logged.message"
@ -28,6 +27,9 @@
<!--TODO: formattare correttamente per visualizzare in pagina-->
<jhi-table-nodes></jhi-table-nodes>
</div>
<div>
<jhi-rawjson-pane></jhi-rawjson-pane>
</div>
</div>
</div>
</div>

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/restrict-plus-operands */
import { Component, OnInit } from '@angular/core';
import { LoginService } from 'app/login/login.service';
@ -15,6 +17,7 @@ export class HomeComponent implements OnInit {
constructor(private accountService: AccountService, private loginService: LoginService) { }
ngOnInit(): void {
//questo identifica l'utente e riempie il campo account
this.accountService.identity().subscribe(account => (this.account = account));
}
@ -27,7 +30,7 @@ export class HomeComponent implements OnInit {
element!==null&&element.startsWith("%2F"));
contexts=contexts.sort();
// eslint-disable-next-line no-console
console.log(contexts);
console.log("*****contexts..."+contexts);
return contexts;
} else {

View File

@ -6,10 +6,11 @@ import { HOME_ROUTE } from './home.route';
import { HomeComponent } from './home.component';
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
import { TableNodesModule } from 'app/table-nodes/table-nodes.module';
import { CtxTreeModule } from 'app/ctx-tree/ctx-tree.module';
import { RscTreeModule } from 'app/rsc-tree/rsc-tree.module';
import { RawjsonPaneComponent } from 'app/rawjson-pane/rawjson-pane.component';
@NgModule({
imports: [SharedModule, RouterModule.forChild([HOME_ROUTE]),NgbDropdownModule, TableNodesModule, CtxTreeModule],
imports: [SharedModule, RouterModule.forChild([HOME_ROUTE]),NgbDropdownModule, TableNodesModule, RscTreeModule,RawjsonPaneComponent],
declarations: [HomeComponent],
schemas:[CUSTOM_ELEMENTS_SCHEMA]
})

View File

@ -0,0 +1,25 @@
<h2 class="display-8" id="tree-title"><span>Available Resources</span></h2>
<mat-tree [dataSource]="nestedDataSource" [treeControl]="nestedTreeControl" class="example-tree">
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle>
<button mat-button (click)="loadTable(node)">
{{ node.name }}
</button>
</mat-tree-node>
<mat-nested-tree-node *matTreeNodeDef="let node; when: hasNestedChild">
<div class="mat-tree-node">
<button mat-icon-button matTreeNodeToggle>
<mat-icon class="mat-icon-rtl-mirror">
{{ nestedTreeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}
</mat-icon>
</button>
<button mat-button (click)="loadTable(node)">
{{ node.name }}
</button>
</div>
<div [class.example-tree-invisible]="!nestedTreeControl.isExpanded(node)" role="group">
<ng-container matTreeNodeOutlet></ng-container>
</div>
</mat-nested-tree-node>
</mat-tree>

View File

@ -0,0 +1,38 @@
@import url('https://fonts.googleapis.com/css?family=Roboto:400,700|Material+Icons');
@import '~@angular/material/theming';
#tree-title {
text-align: left;
color: teal;
padding-bottom: 3%;
}
.example-tree-invisible {
display: none;
}
.example-tree ul,
.example-tree li {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
/*
* This padding sets alignment of the nested nodes.
*/
.example-tree .mat-nested-tree-node div[role='group'] {
padding-left: 25px;
}
/*
* Padding for leaf nodes.
* Leaf nodes need to have padding so as to align with other non-leaf nodes
* under the same parent.
*/
.example-tree div[role='group'] > .mat-tree-node {
padding-left: 25px;
}

View File

@ -0,0 +1,41 @@
/* eslint-disable no-console */
import { Component , OnInit } from '@angular/core';
import { MatTreeNestedDataSource } from '@angular/material/tree';
import { NestedTreeControl } from '@angular/cdk/tree';
//import { IContextNode } from 'app/services/i-context-node';
import { RESOURCES } from 'app/services/restypes';
import { IResource } from 'app/services/i-resource';
@Component({
selector: 'jhi-rsc-tree',
templateUrl: './rsc-tree.component.html',
styleUrls: ['./rsc-tree.component.scss'],
})
export class RscTreeComponent{
nestedTreeControl = new NestedTreeControl<IResource>(node => node.children);
nestedDataSource = new MatTreeNestedDataSource<IResource>();
//@Output() treeNode = new EventEmitter<IResource>(); //emitting event to parent
constructor() {
this.nestedDataSource.data = RESOURCES;
}
hasNestedChild(_: number, node: IResource): boolean {
if (node.children == null) {
return false;
} else {
return node.children.length > 0;
}
}
loadTable(choosenResType:IResource):boolean{
//TODO: qui va chiamato il componente hnodes-table e conseguentemente visualizzato
//this.showTable = true;
//return this.showTable;
return true;
}
}

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { SharedModule } from 'app/shared/shared.module';
import { MatIconModule } from '@angular/material/icon';
import { MatTreeModule } from '@angular/material/tree';
import { RscTreeComponent } from './rsc-tree.component';
@NgModule({
imports: [SharedModule, MatIconModule,MatTreeModule],
declarations: [
RscTreeComponent
],
entryComponents: [RscTreeComponent],
exports: [RscTreeComponent]
})
export class RscTreeModule { }

View File

@ -13,11 +13,12 @@ export class ContextsLoaderService {
};
constructor(private http: HttpClient) {}
/*
getData(): Observable<IContextNode[]> {
//TODO: pipe per gestione errori
return this.http.get<IContextNode[]>(appProperties.MOCK_BASEURL_API + '/allcontext');
}
*/
getRawData(): Observable<string> {
//TODO: pipe per gestione errori

View File

@ -36,4 +36,5 @@ export class ResourcesLoaderService {
//TODO: pipe per gestione errori
return this.http.get<string>('http://localhost:3002/is/hostingnodes/detail');
}
}

View File

@ -0,0 +1,84 @@
import { IResource } from "./i-resource";
export const RESOURCES: IResource[] = [{
"id": "9a7",
"name": "Resources",
"type": 1000,
"children": [{
"id": "4e6a",
"name": "Actor",
"type":1100,
"children": [{
"id": "8efe07z",
"type":1110,
"name": "LegalBody",
"children": []
},{
"id": "8efe0zz",
"type":1120,
"name": "Person",
"children": []
}]
},
{
"id": "2a9f4a",
"name": "ConfigurationTemplate",
"type":1200,
"children": [{
"id": "8efe07f5",
"name": "Configuration",
"type":1210,
"children": []
}
]
},
{
"id": "2a9za",
"name": "Schema",
"type":1300,
"children": [
]
},
{
"id": "2a2ygba",
"name": "Service",
"type":1400,
"children": [{
"id": "8edasfe07z",
"name": "EService",
"type":1410,
"children": [{
"id": "14gfe0zz",
"name": "RunningPlugin",
"type":1411,
"children": []
}]
},
{
"id": "8edll7z",
"name": "HostingNode",
"type":1420,
"children": []
},
{
"id": "8ewwsfe07z",
"name": "VirtualMachine",
"type":1430,
"children": []
},
{
"id": "8edhhe07z",
"name": "VirtualService",
"type":1440,
"children": []
}]
},
{
"id": "agr6he07z",
"name": "Site",
"type":1500,
"children": []
}
]
}]

View File

@ -1,12 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({
declarations: [],
imports: [
CommonModule
]
})
export class TableNodeModule { }

View File

@ -0,0 +1,24 @@
th[sortable] {
cursor: pointer;
user-select: none;
-webkit-user-select: none
}
***CLASSI PER FRECCE ORDINAMENTO***
th[sortable].desc:before,th[sortable].asc:before {
content: "";
display: block;
background:
no-repeat;
background-size: 22px;
width: 22px;
height: 22px;
float: left;
margin-left: -22px
}
th[sortable].desc:before {
transform: rotate(180deg);
-ms-transform: rotate(180deg)
}

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TableNodesComponent } from './table-nodes.component';
describe('TableNodesComponent', () => {
let component: TableNodesComponent;
let fixture: ComponentFixture<TableNodesComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TableNodesComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(TableNodesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -14,7 +14,7 @@
<link rel="stylesheet" href="content/css/loading.css" />
<!--
<link href="https://fonts.googleapis.com/css?family=Material+Icons%7CMaterial+Icons+Outlined%7CMaterial+Icons+Two+Tone%7CMaterial+Icons+Round%7CMaterial+Icons+Sharp" rel="stylesheet">
-->
-->
<!-- jhipster-needle-add-resources-to-root - JHipster will add new resources here -->
</head>
<body>