2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import { GraphColors, GraphUIObjects} from "app/utils/constants";
22 import constant = require("lodash/constant");
23 import {ImagesUrl} from "app/utils/constants";
24 import {AngularJSBridge} from "app/services/angular-js-bridge-service";
25 import { CanvasHandleTypes } from "app/utils";
27 * Created by obarda on 12/18/2016.
29 export class ComponentInstanceNodesStyle {
31 public static getCompositionGraphStyle = ():Array<Cy.Stylesheet> => {
38 'selection-box-color': 'rgb(0, 159, 219)',
39 'selection-box-opacity': 0.2,
40 'selection-box-border-color': '#009fdb',
41 'selection-box-border-width': 1
48 'font-family': 'OpenSans-Regular,sans-serif',
53 'text-border-width': 15,
54 'text-border-color': GraphColors.NODE_UCPE,
61 'background-color': 'transparent',
63 'label': 'data(displayName)',
64 'background-image': 'data(img)',
65 'width': GraphUIObjects.DEFAULT_RESOURCE_WIDTH,
66 'height': GraphUIObjects.DEFAULT_RESOURCE_WIDTH,
67 'background-opacity': 0,
68 "background-width": GraphUIObjects.DEFAULT_RESOURCE_WIDTH,
69 "background-height": GraphUIObjects.DEFAULT_RESOURCE_WIDTH,
70 'text-valign': 'bottom',
71 'text-halign': 'center',
72 'background-fit': 'cover',
73 'background-clip': 'node',
74 'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
80 selector: '.service-node',
82 'background-color': 'transparent',
83 'label': 'data(displayName)',
86 'background-image': 'data(img)',
90 'text-valign': 'bottom',
91 'text-halign': 'center',
92 'background-opacity': 0,
93 'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
100 'background-color': 'rgb(255,255,255)',
101 'shape': 'rectangle',
102 'label': 'data(displayName)',
103 'background-image': 'data(img)',
104 'background-width': GraphUIObjects.SMALL_RESOURCE_WIDTH,
105 'background-height': GraphUIObjects.SMALL_RESOURCE_WIDTH,
106 'width': GraphUIObjects.SMALL_RESOURCE_WIDTH + GraphUIObjects.HANDLE_SIZE,
107 'height': GraphUIObjects.SMALL_RESOURCE_WIDTH + GraphUIObjects.HANDLE_SIZE/2,
108 'background-position-x': GraphUIObjects.HANDLE_SIZE / 2,
109 'background-position-y': GraphUIObjects.HANDLE_SIZE / 2,
110 'text-valign': 'bottom',
111 'text-halign': 'center',
112 'background-opacity': 0,
113 'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
118 selector: '.vl-node',
120 'background-color': 'rgb(255,255,255)',
121 'shape': 'rectangle',
122 'label': 'data(displayName)',
123 'background-image': 'data(img)',
124 'background-width': GraphUIObjects.SMALL_RESOURCE_WIDTH,
125 'background-height': GraphUIObjects.SMALL_RESOURCE_WIDTH,
126 'background-position-x': GraphUIObjects.HANDLE_SIZE / 2,
127 'background-position-y': GraphUIObjects.HANDLE_SIZE / 2,
128 'width': GraphUIObjects.SMALL_RESOURCE_WIDTH + GraphUIObjects.HANDLE_SIZE,
129 'height': GraphUIObjects.SMALL_RESOURCE_WIDTH + GraphUIObjects.HANDLE_SIZE / 2,
130 'text-valign': 'bottom',
131 'text-halign': 'center',
132 'background-opacity': 0,
133 'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
138 selector: '.ucpe-cp',
140 'background-color': GraphColors.NODE_UCPE_CP,
141 'background-width': 15,
142 'background-height': 15,
145 'text-halign': 'center',
146 'overlay-opacity': 0,
147 'label': 'data(displayName)',
148 'text-valign': 'data(textPosition)',
149 'text-margin-y': (ele:Cy.Collection) => {
150 return (ele.data('textPosition') == 'top') ? -5 : 5;
156 selector: '.ucpe-node',
158 'background-fit': 'cover',
164 selector: '.simple-link',
167 'line-color': GraphColors.BASE_LINK,
168 'target-arrow-color': '#3b7b9b',
169 'target-arrow-shape': 'triangle',
170 'curve-style': 'bezier',
171 'control-point-step-size': 30
175 selector: '.archived',
177 'shape': 'rectangle',
178 'background-image': (ele:Cy.Collection) => {
179 return ele.data().setArchivedImageBgStyle(ele, GraphUIObjects.NODE_OVERLAP_MIN_SIZE); //Change name to setArchivedImageBgStyle ??
185 selector: '.vl-link',
188 'line-color': GraphColors.VL_LINK,
189 'curve-style': 'bezier',
190 'control-point-step-size': 30
194 selector: '.vl-link-1',
197 'line-color': GraphColors.ACTIVE_LINK,
198 'curve-style': 'unbundled-bezier',
199 'target-arrow-color': '#3b7b9b',
200 'target-arrow-shape': 'triangle',
201 'control-point-step-size': 30
205 selector: '.ucpe-host-link',
211 selector: '.not-certified-link',
214 'line-color': GraphColors.NOT_CERTIFIED_LINK,
215 'curve-style': 'bezier',
216 'control-point-step-size': 30,
217 'line-style': 'dashed',
218 'target-arrow-color': '#3b7b9b',
219 'target-arrow-shape': 'triangle'
225 selector: '.service-path-link',
228 'line-color': GraphColors.SERVICE_PATH_LINK,
229 'target-arrow-color': GraphColors.SERVICE_PATH_LINK,
230 'target-arrow-shape': 'triangle',
231 'curve-style': 'bezier',
232 'control-point-step-size': 30
236 selector: '.not-certified',
238 'shape': 'rectangle',
239 'background-image': (ele:Cy.Collection) => {
240 return ele.data().initUncertifiedImage(ele, GraphUIObjects.NODE_OVERLAP_MIN_SIZE);
246 selector: '.dependent',
248 'shape': 'rectangle',
249 'background-image': (ele:Cy.Collection) => {
250 return ele.data().initDependentImage(ele, GraphUIObjects.NODE_OVERLAP_MIN_SIZE)
256 selector: '.dependent.not-certified',
258 'shape': 'rectangle',
259 'background-image': (ele:Cy.Collection) => {
260 return ele.data().initUncertifiedDependentImage(ele, GraphUIObjects.NODE_OVERLAP_MIN_SIZE)
266 selector: 'node:selected',
269 "border-color": GraphColors.NODE_SELECTED_BORDER_COLOR,
274 selector: 'edge:selected',
276 'line-color': GraphColors.ACTIVE_LINK
281 selector: 'edge:active',
286 selector: '.configuration-node',
288 'background-color': 'rgb(255,255,255)',
289 'shape': 'rectangle',
290 'label': 'data(displayName)',
291 'background-image': 'data(img)',
292 'background-width': GraphUIObjects.SMALL_RESOURCE_WIDTH,
293 'background-height': GraphUIObjects.SMALL_RESOURCE_WIDTH,
294 'background-position-x': GraphUIObjects.HANDLE_SIZE / 2,
295 'background-position-y': GraphUIObjects.HANDLE_SIZE / 2,
296 'width': GraphUIObjects.SMALL_RESOURCE_WIDTH + GraphUIObjects.HANDLE_SIZE,
297 'height': GraphUIObjects.SMALL_RESOURCE_WIDTH + GraphUIObjects.HANDLE_SIZE/2,
298 'text-valign': 'bottom',
299 'text-halign': 'center',
300 'background-opacity': 0,
301 'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
308 public static getAddEdgeHandle = () => {
312 type: CanvasHandleTypes.ADD_EDGE,
313 imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
314 lineColor: '#27a337',
321 public static getTagHandle = () => {
324 type: CanvasHandleTypes.TAG_AVAILABLE,
325 imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_TAG_ICON,
329 public static getTaggedPolicyHandle = () => {
332 type: CanvasHandleTypes.TAGGED_POLICY,
333 imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_POLICY_TAGGED_ICON,
337 public static getTaggedGroupHandle = () => {
340 type: CanvasHandleTypes.TAGGED_GROUP,
341 imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_GROUP_TAGGED_ICON,
346 // public static getUcpeCpNodeHandle = () => {
348 // positionX: "center",
349 // positionY: "center",
355 // nodeTypeNames: ["ucpe-cp-node"],
356 // imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
358 // lineStyle: 'dashed'