1 import {Component, Input, OnInit} from "@angular/core";
2 import {ComponentType, SdcElementType, ResourceType} from "../../../../utils/constants";
5 export class ElementIcon {
8 backgroundColor: string;
13 constructor(name?: string, type?:string, backgroundColor?:string, color?:string, shape?: string, size?:string) {
14 this.iconName = name || 'default';
15 this.type = type || 'resource_24';
16 this.backgroundColor = backgroundColor || 'primary';
17 this.color = color || "white";
18 this.shape = shape || "circle";
19 this.size = size || "x_large";
24 selector: 'sdc-element-icon',
25 templateUrl: './sdc-element-icon.component.html',
26 styleUrls: ['./sdc-element-icon.component.less']
28 export class SdcElementIconComponent {
30 @Input() iconName: string;
31 @Input() elementType: string;
32 @Input() uncertified: boolean = false;
36 private createIconForDisplay = () => {
37 switch (this.elementType) {
39 case ComponentType.SERVICE:
40 this.elementIcon = new ElementIcon(this.iconName, "services_24", "lightBlue");
42 case ComponentType.SERVICE_PROXY:
43 case ComponentType.SERVICE_SUBSTITUTION:
44 this.elementIcon = new ElementIcon(this.iconName, "services_24", "white", "primary");
46 case ResourceType.CONFIGURATION:
47 this.elementIcon = new ElementIcon(this.iconName, "resources_24", "purple", "white", 'circle', "medium");
49 case SdcElementType.GROUP:
50 this.elementIcon = new ElementIcon("group", "resources_24", "blue", 'white', 'rectangle');
52 case SdcElementType.POLICY:
53 this.elementIcon = new ElementIcon("policy", "resources_24", "darkBlue2", 'white', 'rectangle');
55 case ResourceType.VFC:
58 this.elementIcon = new ElementIcon(this.iconName, "resources_24", "purple", '', '', 'medium');
61 this.elementIcon = new ElementIcon(this.iconName, "resources_24", "purple");
66 this.createIconForDisplay();