From 93560e881e6ebe83503590c48cf81dc0c2e5e002 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 20 Jan 2023 11:39:34 +0100 Subject: [PATCH] info and protocols --- .../src/app/app-routing.module.ts | 4 +- .../src/app/app.component.css | 18 +++ .../src/app/app.component.html | 32 ++++- .../src/app/app.component.spec.ts | 41 +++++- .../src/app/app.component.ts | 13 +- .../dnet-is-application/src/app/app.module.ts | 16 +-- .../src/app/info/info.component.html | 121 +++++++++--------- .../src/app/info/info.component.ts | 16 +-- .../src/app/iscommon.service.ts | 6 +- .../main-container.component.css | 17 --- .../main-container.component.html | 26 ---- .../main-container.component.spec.ts | 40 ------ .../main-container.component.ts | 21 --- .../main-menu-tree.component.ts | 2 + .../src/app/model/controller.model.ts | 14 +- .../src/app/protocols/protocols.component.css | 0 .../app/protocols/protocols.component.html | 51 ++++++++ .../app/protocols/protocols.component.spec.ts | 23 ++++ .../src/app/protocols/protocols.component.ts | 35 +++++ 19 files changed, 297 insertions(+), 199 deletions(-) delete mode 100644 frontends/dnet-is-application/src/app/main-container/main-container.component.css delete mode 100644 frontends/dnet-is-application/src/app/main-container/main-container.component.html delete mode 100644 frontends/dnet-is-application/src/app/main-container/main-container.component.spec.ts delete mode 100644 frontends/dnet-is-application/src/app/main-container/main-container.component.ts create mode 100644 frontends/dnet-is-application/src/app/protocols/protocols.component.css create mode 100644 frontends/dnet-is-application/src/app/protocols/protocols.component.html create mode 100644 frontends/dnet-is-application/src/app/protocols/protocols.component.spec.ts create mode 100644 frontends/dnet-is-application/src/app/protocols/protocols.component.ts diff --git a/frontends/dnet-is-application/src/app/app-routing.module.ts b/frontends/dnet-is-application/src/app/app-routing.module.ts index eed5d44a..835c774c 100644 --- a/frontends/dnet-is-application/src/app/app-routing.module.ts +++ b/frontends/dnet-is-application/src/app/app-routing.module.ts @@ -1,9 +1,11 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { InfoComponent } from './info/info.component'; +import { ProtocolsComponent } from './protocols/protocols.component'; const routes: Routes = [ - {path:"info", component:InfoComponent} + { path:"info" , component:InfoComponent}, + { path:"adv_resources/protocol" , component:ProtocolsComponent} ]; @NgModule({ diff --git a/frontends/dnet-is-application/src/app/app.component.css b/frontends/dnet-is-application/src/app/app.component.css index e69de29b..16aa103f 100644 --- a/frontends/dnet-is-application/src/app/app.component.css +++ b/frontends/dnet-is-application/src/app/app.component.css @@ -0,0 +1,18 @@ +.sidenav-container { + height: 100%; + } + + .sidenav { + width: 400px; + } + + .sidenav .mat-toolbar { + background: inherit; + } + + .mat-toolbar.mat-primary { + position: sticky; + top: 0; + z-index: 1; + } + \ No newline at end of file diff --git a/frontends/dnet-is-application/src/app/app.component.html b/frontends/dnet-is-application/src/app/app.component.html index 69ad4098..699393a0 100644 --- a/frontends/dnet-is-application/src/app/app.component.html +++ b/frontends/dnet-is-application/src/app/app.component.html @@ -1,5 +1,27 @@ - - - - - + + + Menu + + + + + + {{title}} + + + + + + + + \ No newline at end of file diff --git a/frontends/dnet-is-application/src/app/app.component.spec.ts b/frontends/dnet-is-application/src/app/app.component.spec.ts index 32f1f92c..56222f55 100644 --- a/frontends/dnet-is-application/src/app/app.component.spec.ts +++ b/frontends/dnet-is-application/src/app/app.component.spec.ts @@ -1,8 +1,44 @@ -import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { LayoutModule } from '@angular/cdk/layout'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatListModule } from '@angular/material/list'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatToolbarModule } from '@angular/material/toolbar'; import { AppComponent } from './app.component'; describe('AppComponent', () => { + + let component: AppComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AppComponent], + imports: [ + NoopAnimationsModule, + LayoutModule, + MatButtonModule, + MatIconModule, + MatListModule, + MatSidenavModule, + MatToolbarModule, + ] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AppComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should compile', () => { + expect(component).toBeTruthy(); + }); + beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ @@ -33,3 +69,6 @@ describe('AppComponent', () => { expect(compiled.querySelector('.content span')?.textContent).toContain('dnet-is-application app is running!'); }); }); + + + diff --git a/frontends/dnet-is-application/src/app/app.component.ts b/frontends/dnet-is-application/src/app/app.component.ts index c5d87ed9..3ddfee01 100644 --- a/frontends/dnet-is-application/src/app/app.component.ts +++ b/frontends/dnet-is-application/src/app/app.component.ts @@ -1,5 +1,8 @@ import { Component } from '@angular/core'; import { TitleStrategy } from '@angular/router'; +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; +import { Observable } from 'rxjs'; +import { map, shareReplay } from 'rxjs/operators'; @Component({ selector: 'app-root', @@ -7,6 +10,14 @@ import { TitleStrategy } from '@angular/router'; styleUrls: ['./app.component.css'] }) export class AppComponent { - title = 'dnet-is-application'; + title = 'D-NET Information Service Application'; + isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) + .pipe( + map(result => result.matches), + shareReplay() + ); + + constructor(private breakpointObserver: BreakpointObserver) {} + } diff --git a/frontends/dnet-is-application/src/app/app.module.ts b/frontends/dnet-is-application/src/app/app.module.ts index 460ffe7b..b8e42ec0 100644 --- a/frontends/dnet-is-application/src/app/app.module.ts +++ b/frontends/dnet-is-application/src/app/app.module.ts @@ -14,24 +14,22 @@ import { MatButtonModule } from '@angular/material/button'; import { MatSidenavModule } from '@angular/material/sidenav'; import { MatIconModule } from '@angular/material/icon'; import { MatListModule } from '@angular/material/list'; -import {FlatTreeControl} from '@angular/cdk/tree'; -import {MatTree, MatTreeFlatDataSource, MatTreeFlattener, MatTreeNode, MatTreeModule} from '@angular/material/tree'; -import { MainContainerComponent } from './main-container/main-container.component'; +import { MatTreeModule} from '@angular/material/tree'; import { MainMenuTreeComponent } from './main-menu-tree/main-menu-tree.component'; import { MatBadgeModule } from '@angular/material/badge'; import { MatCardModule } from '@angular/material/card'; -import {MatFormFieldModule} from '@angular/material/form-field'; -import {MatInputModule} from '@angular/material/input' -import {MatTableModule} from '@angular/material/table'; - +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input' +import { MatTableModule } from '@angular/material/table'; +import { ProtocolsComponent } from './protocols/protocols.component'; @NgModule({ declarations: [ AppComponent, InfoComponent, DatafilterPipe, - MainContainerComponent, - MainMenuTreeComponent + MainMenuTreeComponent, + ProtocolsComponent ], imports: [ BrowserModule, diff --git a/frontends/dnet-is-application/src/app/info/info.component.html b/frontends/dnet-is-application/src/app/info/info.component.html index e582a1c0..3768a4f4 100644 --- a/frontends/dnet-is-application/src/app/info/info.component.html +++ b/frontends/dnet-is-application/src/app/info/info.component.html @@ -1,79 +1,80 @@ -
- -

Container Info

- - + + + Container Info + + + + Filter - - + + - - - - {{section.name}} - - +
+
+

{{section.name}}

- + - + - + - + + + + + +
Property {{element.k}} Value {{element.v}}
No data matching the filter "{{input.value}}"
+
+
+ + +
+

Modules

+ + + + + + + + + + + + + + + + + + + + + + + + +
Group {{element.group}} Name {{element.name}} Versions {{element.versions}} Files {{element.files}}
No data matching the filter "{{input.value}}"
- - - +
+ +
+
+ + + - - - Modules - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Group {{element.group}} Name {{element.name}} Versions {{element.versions}} Files {{element.files}}
No data matching the filter "{{input.value}}"
-
-
-
@@ -118,6 +119,4 @@ ---> - - +--> \ No newline at end of file diff --git a/frontends/dnet-is-application/src/app/info/info.component.ts b/frontends/dnet-is-application/src/app/info/info.component.ts index 1c617ebd..eec79597 100644 --- a/frontends/dnet-is-application/src/app/info/info.component.ts +++ b/frontends/dnet-is-application/src/app/info/info.component.ts @@ -16,7 +16,7 @@ export interface Module { export interface KeyValueDatasource { name: string; - datasource: MatTableDataSource; + datasource: MatTableDataSource; } @@ -26,7 +26,6 @@ export interface KeyValueDatasource { styleUrls: ['./info.component.css'] }) export class InfoComponent { - infoFilter?:string; kvDatasources:KeyValueDatasource[] = []; moduleDatasource:MatTableDataSource = new MatTableDataSource([]); @@ -58,18 +57,5 @@ export class InfoComponent { this.kvDatasources.forEach(s => s.datasource.filter = filterValue) this.moduleDatasource.filter = filterValue; } - - getFilteredInfo(data:any[]) { - if (this.infoFilter) { - return data.filter(obj => { - return Object.keys(obj).reduce((acc, curr) => { - return acc || obj[curr].toString().toLowerCase().includes(this.infoFilter); - }, false); - }) - } - else - return data - - } } diff --git a/frontends/dnet-is-application/src/app/iscommon.service.ts b/frontends/dnet-is-application/src/app/iscommon.service.ts index 1ff5af32..798f3cef 100644 --- a/frontends/dnet-is-application/src/app/iscommon.service.ts +++ b/frontends/dnet-is-application/src/app/iscommon.service.ts @@ -1,7 +1,8 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { ResourceType } from './model/controller.model'; +import { ResourceType,Protocol } from './model/controller.model'; import { Observable, Observer } from 'rxjs'; + @Injectable({ providedIn: 'root' }) @@ -18,5 +19,8 @@ export class ISCommonService { return this.client.get("/ajax/info/"); } + loadProtocols():Observable { + return this.client.get("/ajax/protocols/"); + } } diff --git a/frontends/dnet-is-application/src/app/main-container/main-container.component.css b/frontends/dnet-is-application/src/app/main-container/main-container.component.css deleted file mode 100644 index ac9b3b14..00000000 --- a/frontends/dnet-is-application/src/app/main-container/main-container.component.css +++ /dev/null @@ -1,17 +0,0 @@ -.sidenav-container { - height: 100%; -} - -.sidenav { - width: 400px; -} - -.sidenav .mat-toolbar { - background: inherit; -} - -.mat-toolbar.mat-primary { - position: sticky; - top: 0; - z-index: 1; -} diff --git a/frontends/dnet-is-application/src/app/main-container/main-container.component.html b/frontends/dnet-is-application/src/app/main-container/main-container.component.html deleted file mode 100644 index cd9d52b1..00000000 --- a/frontends/dnet-is-application/src/app/main-container/main-container.component.html +++ /dev/null @@ -1,26 +0,0 @@ - - - Menu - - - - - - dnet-is-application - - - - - - - diff --git a/frontends/dnet-is-application/src/app/main-container/main-container.component.spec.ts b/frontends/dnet-is-application/src/app/main-container/main-container.component.spec.ts deleted file mode 100644 index 552f7705..00000000 --- a/frontends/dnet-is-application/src/app/main-container/main-container.component.spec.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { LayoutModule } from '@angular/cdk/layout'; -import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { MatButtonModule } from '@angular/material/button'; -import { MatIconModule } from '@angular/material/icon'; -import { MatListModule } from '@angular/material/list'; -import { MatSidenavModule } from '@angular/material/sidenav'; -import { MatToolbarModule } from '@angular/material/toolbar'; - -import { MainContainerComponent } from './main-container.component'; - -describe('MainContainerComponent', () => { - let component: MainContainerComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [MainContainerComponent], - imports: [ - NoopAnimationsModule, - LayoutModule, - MatButtonModule, - MatIconModule, - MatListModule, - MatSidenavModule, - MatToolbarModule, - ] - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MainContainerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should compile', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontends/dnet-is-application/src/app/main-container/main-container.component.ts b/frontends/dnet-is-application/src/app/main-container/main-container.component.ts deleted file mode 100644 index 6b7e30d4..00000000 --- a/frontends/dnet-is-application/src/app/main-container/main-container.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component } from '@angular/core'; -import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Observable } from 'rxjs'; -import { map, shareReplay } from 'rxjs/operators'; - -@Component({ - selector: 'app-main-container', - templateUrl: './main-container.component.html', - styleUrls: ['./main-container.component.css'] -}) -export class MainContainerComponent { - - isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) - .pipe( - map(result => result.matches), - shareReplay() - ); - - constructor(private breakpointObserver: BreakpointObserver) {} - -} diff --git a/frontends/dnet-is-application/src/app/main-menu-tree/main-menu-tree.component.ts b/frontends/dnet-is-application/src/app/main-menu-tree/main-menu-tree.component.ts index 0c4bcf4b..671fce34 100644 --- a/frontends/dnet-is-application/src/app/main-menu-tree/main-menu-tree.component.ts +++ b/frontends/dnet-is-application/src/app/main-menu-tree/main-menu-tree.component.ts @@ -56,8 +56,10 @@ export class MainMenuTreeComponent { badge: resType.count.toString() } if (resType.simple) { + item.route = '/resources/' + resType.id; simpleResources.push(item) } else { + item.route = '/adv_resources/' + resType.id; advancedResources.push(item) } }) diff --git a/frontends/dnet-is-application/src/app/model/controller.model.ts b/frontends/dnet-is-application/src/app/model/controller.model.ts index 75a17602..e9e8119d 100644 --- a/frontends/dnet-is-application/src/app/model/controller.model.ts +++ b/frontends/dnet-is-application/src/app/model/controller.model.ts @@ -1,4 +1,4 @@ -export interface ResourceType{ +export interface ResourceType { id:string name:string contentType:string @@ -6,3 +6,15 @@ export interface ResourceType{ simple:boolean } +export interface ProtocolParams { + name:string + label:string + type:string + optional:boolean + hasSelFunction:boolean +} + +export interface Protocol { + id: string + params: ProtocolParams[] +} \ No newline at end of file diff --git a/frontends/dnet-is-application/src/app/protocols/protocols.component.css b/frontends/dnet-is-application/src/app/protocols/protocols.component.css new file mode 100644 index 00000000..e69de29b diff --git a/frontends/dnet-is-application/src/app/protocols/protocols.component.html b/frontends/dnet-is-application/src/app/protocols/protocols.component.html new file mode 100644 index 00000000..c9b1046d --- /dev/null +++ b/frontends/dnet-is-application/src/app/protocols/protocols.component.html @@ -0,0 +1,51 @@ + + + Harvesting Protocols + + +
+

{{prot.protocol}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + +
Name {{element.name}} Label {{element.label}} Type {{element.type}} Required + + Has Sel Function + +
No parameters
+
+
+ +
\ No newline at end of file diff --git a/frontends/dnet-is-application/src/app/protocols/protocols.component.spec.ts b/frontends/dnet-is-application/src/app/protocols/protocols.component.spec.ts new file mode 100644 index 00000000..341b9b31 --- /dev/null +++ b/frontends/dnet-is-application/src/app/protocols/protocols.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProtocolsComponent } from './protocols.component'; + +describe('ProtocolsComponent', () => { + let component: ProtocolsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ProtocolsComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ProtocolsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontends/dnet-is-application/src/app/protocols/protocols.component.ts b/frontends/dnet-is-application/src/app/protocols/protocols.component.ts new file mode 100644 index 00000000..6602d753 --- /dev/null +++ b/frontends/dnet-is-application/src/app/protocols/protocols.component.ts @@ -0,0 +1,35 @@ +import { Component } from '@angular/core'; +import { ISCommonService } from '../iscommon.service'; +import { MatTableDataSource } from '@angular/material/table'; +import { Protocol, ProtocolParams } from '../model/controller.model'; + +export interface ProtocolDatasource { + protocol: string; + datasource: MatTableDataSource; +} + +@Component({ + selector: 'app-protocols', + templateUrl: './protocols.component.html', + styleUrls: ['./protocols.component.css'] +}) +export class ProtocolsComponent { + protDatasources:ProtocolDatasource[] = []; + colums : string[] = ['name', 'label', 'type', 'optional', 'hasSelFunction']; + + constructor(public service:ISCommonService) { + this.service.loadProtocols().subscribe({ + next:(data:Protocol[]) => { + data.forEach(p => { + this.protDatasources.push({ + protocol : p.id, + datasource : new MatTableDataSource(p.params) + }); + }) + }, + error:error => console.log(error), + complete:() => console.log("Completed") + }) + } + +}