Getting resources
parent
7e58e23727
commit
e58d3c34a7
@ -1,3 +1,4 @@
|
|||||||
export class ISManageable {
|
export class ISManageable {
|
||||||
'@class': string;
|
'@class': string;
|
||||||
|
'@superClasses'?: Array<string>;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
import { TypeDefinition } from '../is-model/types/TypeDefinition';
|
||||||
|
|
||||||
|
export const CLASS_PROPERTY_KEY = '@class';
|
||||||
|
export const SUPERCLASSES_PROPERTY_KEY = '@superClasses';
|
||||||
|
export const HEADER_PROPERTY_KEY = 'header';
|
||||||
|
|
||||||
|
export class FacetDefinition {
|
||||||
|
|
||||||
|
public typeName: string;
|
||||||
|
public mandatoryProperties: Set<string>;
|
||||||
|
public typeDefinition: TypeDefinition;
|
||||||
|
|
||||||
|
// private first = true;
|
||||||
|
|
||||||
|
constructor(typeName: string, typeDefinition: TypeDefinition) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
this.typeDefinition = typeDefinition;
|
||||||
|
this.analyseType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public analyseType() {
|
||||||
|
this.mandatoryProperties = new Set<string>();
|
||||||
|
|
||||||
|
for (const p of this.typeDefinition.properties) {
|
||||||
|
switch (p.name) {
|
||||||
|
|
||||||
|
case (CLASS_PROPERTY_KEY || SUPERCLASSES_PROPERTY_KEY || HEADER_PROPERTY_KEY) : {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
if (p.mandatory) {
|
||||||
|
this.mandatoryProperties.add(p.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (this.first) {
|
||||||
|
const facet = resource.consistsOf[0].target;
|
||||||
|
for (const propertyKey in facet) {
|
||||||
|
if (propertyKey.localeCompare(CLASS_PROPERTY_KEY) === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (propertyKey.localeCompare(SUPERCLASSES_PROPERTY_KEY) === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (propertyKey.localeCompare(HEADER_PROPERTY_KEY) === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
this.mandatoryProperties.add(propertyKey);
|
||||||
|
}
|
||||||
|
this.first = false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
@ -1,36 +0,0 @@
|
|||||||
import { Resource } from '../is-model/reference/entities/Resource';
|
|
||||||
|
|
||||||
export const TYPE_PROPERTY_KEY = '@class';
|
|
||||||
export const HEADER_PROPERTY_KEY = 'header';
|
|
||||||
|
|
||||||
export class ResourceIdentification {
|
|
||||||
|
|
||||||
public type: string;
|
|
||||||
public mandatoryProperties: Set<string>;
|
|
||||||
public resources: Array<Resource>;
|
|
||||||
|
|
||||||
private first = true;
|
|
||||||
|
|
||||||
constructor(type: string) {
|
|
||||||
this.type = type;
|
|
||||||
this.mandatoryProperties = new Set<string>();
|
|
||||||
this.resources = new Array<Resource>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public addResource(resource: Resource) {
|
|
||||||
if (this.first) {
|
|
||||||
const facet = resource.consistsOf[0].target;
|
|
||||||
for (const propertyKey in facet) {
|
|
||||||
if (propertyKey.localeCompare(TYPE_PROPERTY_KEY) === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (propertyKey.localeCompare(HEADER_PROPERTY_KEY) === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
this.mandatoryProperties.add(propertyKey);
|
|
||||||
}
|
|
||||||
this.first = false;
|
|
||||||
}
|
|
||||||
this.resources.push(resource);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,15 @@
|
|||||||
<ul id="resource-tree" class="list-group">
|
<ul id="resource-tree" class="list-group">
|
||||||
<ng-template #recursiveList let-resources>
|
<ng-template #recursiveList let-resources>
|
||||||
<li *ngFor="let type of resources" class="list-group-item">
|
<li *ngFor="let type of resources" class="list-group-item">
|
||||||
<a class="nav-link" href="#" [title]="type.description" (click)="loadResources(type.name)">{{ type.name }}</a>
|
<a class="nav-link" href="#" [title]="type.description" (click)="list.resourceType = type.name">{{ type.name }}</a>
|
||||||
<ul *ngIf="type.children.length > 0">
|
<ul *ngIf="type.children.length > 0">
|
||||||
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: type.children }"></ng-container>
|
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: type.children }"></ng-container>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: resources }"></ng-container>
|
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: resources }"></ng-container>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="list-and-details">
|
||||||
|
<app-resource-list #list></app-resource-list>
|
||||||
|
<app-resource-details></app-resource-details>
|
||||||
|
</div>
|
@ -0,0 +1,85 @@
|
|||||||
|
import { Resource } from './is-model/reference/entities/Resource';
|
||||||
|
|
||||||
|
export const resources: Array<Resource> = [
|
||||||
|
{
|
||||||
|
'@class': 'HostingNode',
|
||||||
|
header: {
|
||||||
|
'@class': 'Header',
|
||||||
|
uuid: 'f0460614-9ffb-4ecd-bf52-d91e8d81d604',
|
||||||
|
creator: 'luca.frosini',
|
||||||
|
modifiedBy: 'luca.frosini',
|
||||||
|
creationTime: '2109-06-29 12:00:00.000 CEST',
|
||||||
|
lastUpdateTime: '2109-06-29 12:00:00.000 CEST'
|
||||||
|
},
|
||||||
|
consistsOf: [
|
||||||
|
{
|
||||||
|
'@class': 'IsIdentifiedBy',
|
||||||
|
header: {
|
||||||
|
'@class': 'Header',
|
||||||
|
uuid: '84d5756a-693e-4b4d-99dd-a150cf843c3e',
|
||||||
|
creator: 'luca.frosini',
|
||||||
|
modifiedBy: 'luca.frosini',
|
||||||
|
creationTime: '2109-06-29 12:00:00.000 CEST',
|
||||||
|
lastUpdateTime: '2109-06-29 12:00:00.000 CEST'
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
'@class': 'NetworkingFacet',
|
||||||
|
header: {
|
||||||
|
'@class': 'Header',
|
||||||
|
uuid: 'aff4173c-ef7d-4f4f-9195-6b33d852e033',
|
||||||
|
creator: 'luca.frosini',
|
||||||
|
modifiedBy: 'luca.frosini',
|
||||||
|
creationTime: '2109-06-29 12:00:00.000 CEST',
|
||||||
|
lastUpdateTime: '2109-06-29 12:00:00.000 CEST'
|
||||||
|
},
|
||||||
|
hostName: 'pc-frosini.isti.cnr.it',
|
||||||
|
domainName: 'isti.cnr.it',
|
||||||
|
mask: null,
|
||||||
|
broadcastAddress: null,
|
||||||
|
ipaddress: '127.0.1.1',
|
||||||
|
Port: 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
isRelatedTo: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'@class': 'EService',
|
||||||
|
header: {
|
||||||
|
'@class': 'Header',
|
||||||
|
uuid: '23b6145f-b5f0-42d1-9630-17590d9831d6',
|
||||||
|
creator: 'luca.frosini',
|
||||||
|
modifiedBy: 'luca.frosini',
|
||||||
|
creationTime: '2109-06-29 12:00:00.000 CEST',
|
||||||
|
lastUpdateTime: '2109-06-29 12:00:00.000 CEST'
|
||||||
|
},
|
||||||
|
consistsOf: [
|
||||||
|
{
|
||||||
|
'@class': 'IsIdentifiedBy',
|
||||||
|
header: {
|
||||||
|
'@class': 'Header',
|
||||||
|
uuid: '7fcff150-4007-4ad0-8618-a8f3ba83a366',
|
||||||
|
creator: 'luca.frosini',
|
||||||
|
modifiedBy: 'luca.frosini',
|
||||||
|
creationTime: '2109-06-29 12:00:00.000 CEST',
|
||||||
|
lastUpdateTime: '2109-06-29 12:00:00.000 CEST'
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
'@class': 'SoftwareFacet',
|
||||||
|
header: {
|
||||||
|
'@class': 'Header',
|
||||||
|
uuid: '4e664568-1669-4b38-a3db-acf1de789c96',
|
||||||
|
creator: 'luca.frosini',
|
||||||
|
modifiedBy: 'luca.frosini',
|
||||||
|
creationTime: '2109-06-29 12:00:00.000 CEST',
|
||||||
|
lastUpdateTime: '2109-06-29 12:00:00.000 CEST'
|
||||||
|
},
|
||||||
|
group: 'vre-management',
|
||||||
|
name: 'whn-manager',
|
||||||
|
version: '1.3.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
isRelatedTo: []
|
||||||
|
}
|
||||||
|
];
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue