From 75aacbbe1acf78fa53378f07f0a8c7769449a17e Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 17 Jul 2017 21:12:03 +0300 Subject: [SDC] rebase 1710 code Change-Id: I532ed68979fee7840ea8a5395e7e965b155fb9f9 Signed-off-by: Michael Lando --- .../style/component-instances-nodes-style.ts | 7 ++- .../graphs-v2/palette/palette.directive.ts | 66 +++++++++------------- .../type-map/type-map-directive.html | 2 +- .../property-types/type-map/type-map-directive.ts | 5 ++ .../structure-tree/structure-tree-directive.html | 2 +- .../app/directives/utils/sdc-tags/sdc-tags.less | 4 +- 6 files changed, 41 insertions(+), 45 deletions(-) (limited to 'catalog-ui/src/app/directives') diff --git a/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts b/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts index 0a13ebd799..0dcc93dfa7 100644 --- a/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts +++ b/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,8 @@ export class ComponentInstanceNodesStyle { { selector: 'node', css: { - 'font-family': 'omnes-regular,sans-serif', + 'font-family': 'OpenSans-Regular,sans-serif', + 'font-size': 14, 'events': 'yes', 'text-events': 'yes', diff --git a/catalog-ui/src/app/directives/graphs-v2/palette/palette.directive.ts b/catalog-ui/src/app/directives/graphs-v2/palette/palette.directive.ts index f1c3405cfa..f46dc6c939 100644 --- a/catalog-ui/src/app/directives/graphs-v2/palette/palette.directive.ts +++ b/catalog-ui/src/app/directives/graphs-v2/palette/palette.directive.ts @@ -17,21 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - -import { - Component, - IAppMenu, - LeftPanelModel, - NodesFactory, - LeftPaletteComponent, - CompositionCiNodeBase, - ComponentInstance -} from "app/models"; +import {Component, IAppMenu, LeftPanelModel, NodesFactory, LeftPaletteComponent, CompositionCiNodeBase, ComponentInstance} from "app/models"; import {CompositionGraphGeneralUtils} from "../composition-graph/utils/composition-graph-general-utils"; import {EventListenerService} from "app/services"; import {ResourceType, GRAPH_EVENTS, EVENTS, ComponentInstanceFactory, ModalsHandler} from "app/utils"; import 'sdc-angular-dragdrop'; import {LeftPaletteLoaderService} from "../../../services/components/utils/composition-left-palette-service"; +import {Resource} from "app/models/components/resource"; +import {ComponentType} from "app/utils/constants"; interface IPaletteScope { components:Array; @@ -92,7 +85,7 @@ export class Palette implements ng.IDirective { el.append(this.nodeHtmlSubstitute); this.registerEventListenerForLeftPalette(scope); // this.LeftPaletteLoaderService.loadLeftPanel(scope.currentComponent.componentType); - + this.initComponents(scope); this.initEvents(scope); this.initDragEvents(scope); @@ -103,34 +96,31 @@ export class Palette implements ng.IDirective { }); }; - private registerEventListenerForLeftPalette = (scope:IPaletteScope):void => { - if (scope.currentComponent.isResource()) { - this.EventListenerService.registerObserverCallback(EVENTS.RESOURCE_LEFT_PALETTE_UPDATE_EVENT, () => { - this.updateLeftPanelDisplay(scope); - }); - } - if (scope.currentComponent.isService()) { - this.EventListenerService.registerObserverCallback(EVENTS.SERVICE_LEFT_PALETTE_UPDATE_EVENT, () => { - this.updateLeftPanelDisplay(scope); - }); - } - if (scope.currentComponent.isProduct()) { - this.EventListenerService.registerObserverCallback(EVENTS.PRODUCT_LEFT_PALETTE_UPDATE_EVENT, () => { - this.updateLeftPanelDisplay(scope); - }); + private getUpdateLeftPaletteEventName = (component:Component):string => { + switch (component.componentType) { + case ComponentType.SERVICE: + return EVENTS.SERVICE_LEFT_PALETTE_UPDATE_EVENT; + case ComponentType.RESOURCE: + if((component).resourceType == ResourceType.PNF){ + return EVENTS.RESOURCE_PNF_LEFT_PALETTE_UPDATE_EVENT; + }else{ + return EVENTS.RESOURCE_LEFT_PALETTE_UPDATE_EVENT; + } + default: + console.log('ERROR: Component type '+ component.componentType + ' is not exists'); } }; + private registerEventListenerForLeftPalette = (scope:IPaletteScope):void => { + let updateEventName:string = this.getUpdateLeftPaletteEventName(scope.currentComponent); + this.EventListenerService.registerObserverCallback(updateEventName, () => { + this.updateLeftPanelDisplay(scope); + }); + }; + private unRegisterEventListenerForLeftPalette = (scope:IPaletteScope):void => { - if (scope.currentComponent.isResource()) { - this.EventListenerService.unRegisterObserver(EVENTS.RESOURCE_LEFT_PALETTE_UPDATE_EVENT); - } - if (scope.currentComponent.isService()) { - this.EventListenerService.unRegisterObserver(EVENTS.SERVICE_LEFT_PALETTE_UPDATE_EVENT); - } - if (scope.currentComponent.isProduct()) { - this.EventListenerService.unRegisterObserver(EVENTS.PRODUCT_LEFT_PALETTE_UPDATE_EVENT); - } + let updateEventName:string = this.getUpdateLeftPaletteEventName(scope.currentComponent); + this.EventListenerService.unRegisterObserver(updateEventName); }; private leftPanelResourceFilter(resourcesNotAbstract:Array, resourceFilterTypes:Array):Array { @@ -236,7 +226,7 @@ export class Palette implements ng.IDirective { private updateLeftPanelDisplay(scope:IPaletteScope) { let entityType:string = scope.currentComponent.componentType.toLowerCase(); let resourceFilterTypes:Array = this.sdcConfig.resourceTypesFilter[entityType]; - scope.components = this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent.componentType); + scope.components = this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent); scope.model = this.initLeftPanel(scope.components, resourceFilterTypes); scope.displaySortedCategories = angular.copy(scope.model.sortedCategories); }; @@ -267,7 +257,7 @@ export class Palette implements ng.IDirective { return; } - let component = _.find(this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent.componentType), (componentFullData:LeftPaletteComponent) => { + let component = _.find(this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent), (componentFullData:LeftPaletteComponent) => { return displayComponent.uniqueId === componentFullData.uniqueId; }); this.EventListenerService.notifyObservers(GRAPH_EVENTS.ON_PALETTE_COMPONENT_DRAG_START, scope.dragElement, component); @@ -287,7 +277,7 @@ export class Palette implements ng.IDirective { this.EventListenerService.notifyObservers(GRAPH_EVENTS.ON_PALETTE_COMPONENT_DRAG_ACTION, event); }; scope.setElementTemplate = (e) => { - let dragComponent:LeftPaletteComponent = _.find(this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent.componentType), + let dragComponent:LeftPaletteComponent = _.find(this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent), (fullComponent:LeftPaletteComponent) => { return (angular.element(e.currentTarget).scope()).component.uniqueId === fullComponent.uniqueId; }); diff --git a/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html b/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html index 3a4720676c..ec9aaf1f7f 100644 --- a/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html +++ b/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html @@ -56,7 +56,7 @@
- ;//array of map keys + mapKeysStatic:Array; MapKeyValidationPattern:RegExp; fieldsPrefixName:string; readOnly:boolean; @@ -82,6 +83,8 @@ export class TypeMapDirective implements ng.IDirective { scope.isSchemaTypeDataType = this.DataTypesService.isDataTypeForSchemaType(scope.schemaProperty); if (scope.valueObjRef) { scope.mapKeys = Object.keys(scope.valueObjRef); + //keeping another copy of the keys, as the mapKeys gets overridden sometimes + scope.mapKeysStatic = Object.keys(scope.valueObjRef); } }); @@ -91,6 +94,8 @@ export class TypeMapDirective implements ng.IDirective { scope.valueObjRef = {}; } scope.mapKeys = Object.keys(scope.valueObjRef); + //keeping another copy of the keys, as the mapKeys gets overridden sometimes + scope.mapKeysStatic = Object.keys(scope.valueObjRef); if ($attr.defaultValue) { scope.mapDefaultValue = JSON.parse($attr.defaultValue); diff --git a/catalog-ui/src/app/directives/structure-tree/structure-tree-directive.html b/catalog-ui/src/app/directives/structure-tree/structure-tree-directive.html index 7d8a883b33..706dbefb80 100644 --- a/catalog-ui/src/app/directives/structure-tree/structure-tree-directive.html +++ b/catalog-ui/src/app/directives/structure-tree/structure-tree-directive.html @@ -6,7 +6,7 @@
  • -
    +
    diff --git a/catalog-ui/src/app/directives/utils/sdc-tags/sdc-tags.less b/catalog-ui/src/app/directives/utils/sdc-tags/sdc-tags.less index 942196e663..af24776cd3 100644 --- a/catalog-ui/src/app/directives/utils/sdc-tags/sdc-tags.less +++ b/catalog-ui/src/app/directives/utils/sdc-tags/sdc-tags.less @@ -1,10 +1,10 @@ .tags-box { - height: 297px; + height: 100px; .bg_c; .perfect-scrollbar { - height: 265px; + height: 70px; } .new-tag-input { -- cgit 1.2.3-korg