summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts')
-rw-r--r--catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts61
1 files changed, 35 insertions, 26 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts b/catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts
index f5d9e88934..7b7754ee34 100644
--- a/catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts
+++ b/catalog-ui/src/app/ng2/components/ui/tile/tile.component.ts
@@ -2,7 +2,8 @@ import {Component, Input, Output, Inject, EventEmitter} from '@angular/core';
import {Component as ComponentModel} from 'app/models';
import {SdcMenuToken, IAppMenu} from "../../../config/sdc-menu.config";
import {ElementIcon} from "../sdc-element-icon/sdc-element-icon.component";
-import {ComponentType, ResourceType, SdcElementType} from "../../../../utils/constants";
+import {ComponentType, DEFAULT_MODEL_NAME, Icon, ResourceType} from "../../../../utils/constants";
+import {DataTypeCatalogComponent} from "../../../../models/data-type-catalog-component";
@Component({
selector: 'ui-tile',
@@ -10,41 +11,49 @@ import {ComponentType, ResourceType, SdcElementType} from "../../../../utils/con
styleUrls: ['./tile.component.less']
})
export class TileComponent {
- @Input() public component: ComponentModel;
- @Output() public onTileClick: EventEmitter<ComponentModel>;
+ @Input() public component: ComponentModel | DataTypeCatalogComponent;
+ @Output() public onTileClick: EventEmitter<ComponentModel | DataTypeCatalogComponent>;
public catalogIcon: ElementIcon;
public hasEllipsis: boolean;
constructor(@Inject(SdcMenuToken) public sdcMenu: IAppMenu) {
- this.onTileClick = new EventEmitter<ComponentModel>();
+ this.onTileClick = new EventEmitter<ComponentModel | DataTypeCatalogComponent>();
this.hasEllipsis = false;
}
ngOnInit(): void {
- switch (this.component.componentType) {
+ if (this.component instanceof ComponentModel) {
+ switch (this.component.componentType) {
+ case ComponentType.SERVICE:
+ if (this.component.icon === Icon.DEFAULT_ICON) {
+ this.catalogIcon = new ElementIcon(this.component.icon, Icon.SERVICE_TYPE_60, Icon.COLOR_LIGHTBLUE, Icon.COLOR_WHITE);
+ } else {
+ this.catalogIcon = new ElementIcon(this.component.icon, Icon.SERVICE_TYPE_60, '', Icon.COLOR_LIGHTBLUE);
+ }
+ break;
+ case ComponentType.RESOURCE:
+ switch (this.component.getComponentSubType()) {
+ case ResourceType.CP:
+ case ResourceType.VL:
+ this.catalogIcon = new ElementIcon(this.component.icon, Icon.RESOURCE_TYPE_24, Icon.COLOR_PURPLE, Icon.COLOR_WHITE, Icon.SHAPE_CIRCLE, Icon.SIZE_MEDIUM);
+ break;
+ default:
+ if (this.component.icon === Icon.DEFAULT_ICON) {
+ this.catalogIcon = new ElementIcon(this.component.icon, Icon.RESOURCE_TYPE_60, Icon.COLOR_PURPLE, Icon.COLOR_WHITE, Icon.SHAPE_CIRCLE, Icon.SIZE_X_LARGE);
+ } else {
+ this.catalogIcon = new ElementIcon(this.component.icon, Icon.RESOURCE_TYPE_60, '', Icon.ERROR);
+ }
- case ComponentType.SERVICE:
- if (this.component.icon === 'defaulticon') {
- this.catalogIcon = new ElementIcon(this.component.icon, "services_60", 'lightBlue', 'white');
- } else {
- this.catalogIcon = new ElementIcon(this.component.icon, "services_60", '', 'lightBlue');
- }
- break;
- case ComponentType.RESOURCE:
- switch (this.component.getComponentSubType()) {
- case ResourceType.CP:
- case ResourceType.VL:
- this.catalogIcon = new ElementIcon(this.component.icon, "resources_24", "purple", "white", "circle", 'medium');
- break;
- default:
- if (this.component.icon === 'defaulticon') {
- this.catalogIcon = new ElementIcon(this.component.icon, "resources_60", "purple", "white", "circle", 'x_large');
- } else {
- this.catalogIcon = new ElementIcon(this.component.icon, "resources_60", '', "error");
- }
-
- }
+ }
+ }
+ }
+ }
+ public getComponentModel() {
+ if (this.component.model === undefined) {
+ return DEFAULT_MODEL_NAME;
+ } else {
+ return this.component.model;
}
}