diff --git a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html index 684b209..b5344cd 100644 --- a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html +++ b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html @@ -1,65 +1,11 @@ \ No newline at end of file diff --git a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html.manual b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html.manual new file mode 100644 index 0000000..684b209 --- /dev/null +++ b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.html.manual @@ -0,0 +1,65 @@ + \ No newline at end of file diff --git a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts index de70bfc..99c576c 100644 --- a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts +++ b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts @@ -1,4 +1,28 @@ import { Component, OnInit } from '@angular/core'; +import { types } from './types'; + +export class Type { + + name: string; + description: string; + abstract: boolean; + parent: Type; + children: Type[]; + + constructor(type: { name: string; description: string; superClasses?: string[]; properties?: any; abstract: boolean; }) { + this.name = type.name; + this.description = type.description; + this.abstract = type.abstract; + this.children = new Array(); + } + + addChild(type: Type) { + type.parent = this; + this.children.push(type); + } + +} + @Component({ selector: 'app-resource-types-tree', @@ -7,9 +31,58 @@ import { Component, OnInit } from '@angular/core'; }) export class ResourceTypesTreeComponent implements OnInit { + resources: Type[]; + + map = new Map(); + + unassociated = new Map(); + constructor() { } + analyseUnassociated(type: Type) { + const associated: string[] = new Array(); + + for (const name of this.unassociated.keys()) { + const t = this.unassociated.get(name); + const parent = t.superClasses[0]; + if (parent === type.name) { + type.addChild(this.map.get(t.name)); + associated.push(t.name); + } + } + + for (const a of associated) { + this.unassociated.delete(a); + } + + } + ngOnInit() { + + for (const t of types) { + const type: Type = new Type(t); + + this.map.set(type.name, type); + + if (type.name !== 'Resource') { + const parent = t.superClasses[0]; + if (this.map.has(parent)) { + this.map.get(parent).addChild(type); + } else { + this.analyseUnassociated(type); + this.unassociated.set(type.name, t); + } + } + } + + this.resources = this.map.get('Resource').children; + } } + + + diff --git a/is-monitor-frontend/src/app/resource-types-tree/types.ts b/is-monitor-frontend/src/app/resource-types-tree/types.ts new file mode 100644 index 0000000..94dfb03 --- /dev/null +++ b/is-monitor-frontend/src/app/resource-types-tree/types.ts @@ -0,0 +1,164 @@ +export const types = [ + { + name: 'Resource', + description: '', + superClasses: [ + 'Entity' + ], + properties: null, + abstract: true + }, + { + name: 'Service', + description: 'Collect Service information through the list of its facets', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: true + }, + { + name: 'HostingNode', + description: 'Collect Hosting Node information through the list of its facets', + superClasses: [ + 'Service' + ], + properties: null, + abstract: false + }, + { + name: 'Software', + description: 'Collect Software information through the list of its facets', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: false + }, + { + name: 'Plugin', + description: 'Collect Plugin information through the list of its facets', + superClasses: [ + 'Software' + ], + properties: null, + abstract: false + }, + { + name: 'Actor', + description: 'Any entity (human or machine) playing an active role.', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: true + }, + { + name: 'LegalBody', + description: 'Actor', + superClasses: [ + 'Actor' + ], + properties: null, + abstract: false + }, + { + name: 'Dataset', + description: 'Collect Dataset information through the list of its facets', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: false + }, + { + name: 'Person', + description: 'Person', + superClasses: [ + 'Actor' + ], + properties: null, + abstract: false + }, + { + name: 'Schema', + description: 'Collect Schema information through the list of its facets', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: false + }, + { + name: 'Site', + description: 'Collect Site information through the list of its facets', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: false + }, + { + name: 'ConcreteDataset', + description: 'Collect Dataset information through the list of its facets', + superClasses: [ + 'Dataset' + ], + properties: null, + abstract: false + }, + { + name: 'VirtualMachine', + description: 'Collect Hosting Node information through the list of its facets', + superClasses: [ + 'Service' + ], + properties: null, + abstract: false + }, + { + name: 'ConfigurationTemplate', + description: 'It represents a template for a configuration. It describe how a configuration has to be realized. E.g. Used to define the accounting configuration parameters template.', + superClasses: [ + 'Resource' + ], + properties: null, + abstract: false + }, + { + name: 'Configuration', + description: 'Collect Configuration information through the list of its facets', + superClasses: [ + 'ConfigurationTemplate' + ], + properties: null, + abstract: false + }, + { + name: 'EService', + description: 'Collect Electronic Service (aka Running Service) information through the list of its facets', + superClasses: [ + 'Service' + ], + properties: null, + abstract: false + }, + { + name: 'VirtualService', + description: 'Collect Virtual Service information through the list of its facets', + superClasses: [ + 'Service' + ], + properties: null, + abstract: false + }, + { + name: 'RunningPlugin', + description: 'Collect Running Plugin information through the list of its facets', + superClasses: [ + 'EService' + ], + properties: null, + abstract: false + } +];