aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts
blob: 87acab658591c59c2f95ed90a44d5027797eec7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
import {GraphColors} from "app/utils/constants";
import constant = require("lodash/constant");
import {ImagesUrl} from "app/utils/constants";
import {AngularJSBridge} from "app/services/angular-js-bridge-service";
/**
 * Created by obarda on 12/18/2016.
 */
export class ComponentInstanceNodesStyle {

    public static getCompositionGraphStyle = ():Array<Cy.Stylesheet>  => {
        return [
            {
                selector: 'core',
                css: {
                    'shape': 'rectangle',
                    'active-bg-size': 0,
                    'selection-box-color': 'rgb(0, 159, 219)',
                    'selection-box-opacity': 0.2,
                    'selection-box-border-color': '#009fdb',
                    'selection-box-border-width': 1

                }
            },
            {
                selector: 'node',
                css: {
                    'font-family': 'omnes-regular,sans-serif',
                    'font-size': 14,
                    'events': 'yes',
                    'text-events': 'yes',
                    'text-border-width': 15,
                    'text-border-color': GraphColors.NODE_UCPE,
                    'text-margin-y': 5
                }
            },
            {
                selector: '.vf-node',
                css: {
                    'background-color': 'transparent',
                    'shape': 'rectangle',
                    'label': 'data(displayName)',
                    'background-image': 'data(img)',
                    'width': 65,
                    'height': 65,
                    'background-opacity': 0,
                    "background-width": 65,
                    "background-height": 65,
                    'text-valign': 'bottom',
                    'text-halign': 'center',
                    'background-fit': 'cover',
                    'background-clip': 'node',
                    'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
                    'overlay-opacity': 0
                }
            },

            {
                selector: '.service-node',
                css: {
                    'background-color': 'transparent',
                    'label': 'data(displayName)',
                    'events': 'yes',
                    'text-events': 'yes',
                    'background-image': 'data(img)',
                    'width': 64,
                    'height': 64,
                    "border-width": 0,
                    'text-valign': 'bottom',
                    'text-halign': 'center',
                    'background-opacity': 0,
                    'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
                    'overlay-opacity': 0
                }
            },
            {
                selector: '.cp-node',
                css: {
                    'background-color': 'rgb(255,255,255)',
                    'shape': 'rectangle',
                    'label': 'data(displayName)',
                    'background-image': 'data(img)',
                    'background-width': 21,
                    'background-height': 21,
                    'width': 21,
                    'height': 21,
                    'text-valign': 'bottom',
                    'text-halign': 'center',
                    'background-opacity': 0,
                    'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
                    'overlay-opacity': 0
                }
            },
            {
                selector: '.vl-node',
                css: {
                    'background-color': 'rgb(255,255,255)',
                    'shape': 'rectangle',
                    'label': 'data(displayName)',
                    'background-image': 'data(img)',
                    'background-width': 21,
                    'background-height': 21,
                    'width': 21,
                    'height': 21,
                    'text-valign': 'bottom',
                    'text-halign': 'center',
                    'background-opacity': 0,
                    'overlay-color': GraphColors.NODE_BACKGROUND_COLOR,
                    'overlay-opacity': 0
                }
            },
            {
                selector: '.ucpe-cp',
                css: {
                    'background-color': GraphColors.NODE_UCPE_CP,
                    'background-width': 15,
                    'background-height': 15,
                    'width': 15,
                    'height': 15,
                    'text-halign': 'center',
                    'overlay-opacity': 0,
                    'label': 'data(displayName)',
                    'text-valign': 'data(textPosition)',
                    'text-margin-y': (ele:Cy.Collection) => {
                        return (ele.data('textPosition') == 'top') ? -5 : 5;
                    },
                    'font-size': 12
                }
            },
            {
                selector: '.ucpe-node',
                css: {
                    'background-fit': 'cover',
                    'padding-bottom': 0,
                    'padding-top': 0
                }
            },
            {
                selector: '.simple-link',
                css: {
                    'width': 1,
                    'line-color': GraphColors.BASE_LINK,
                    'target-arrow-color': '#3b7b9b',
                    'target-arrow-shape': 'triangle',
                    'curve-style': 'bezier',
                    'control-point-step-size': 30
                }
            },
            {
                selector: '.vl-link',
                css: {
                    'width': 3,
                    'line-color': GraphColors.VL_LINK,
                    'curve-style': 'bezier',
                    'control-point-step-size': 30
                }
            },
            {
                selector: '.ucpe-host-link',
                css: {
                    'width': 0
                }
            },
            {
                selector: '.not-certified-link',
                css: {
                    'width': 1,
                    'line-color': GraphColors.NOT_CERTIFIED_LINK,
                    'curve-style': 'bezier',
                    'control-point-step-size': 30,
                    'line-style': 'dashed',
                    'target-arrow-color': '#3b7b9b',
                    'target-arrow-shape': 'triangle'

                }
            },

            {
                selector: '.not-certified',
                css: {
                    'shape': 'rectangle',
                    'background-image': (ele:Cy.Collection) => {
                        return ele.data().initImage(ele)
                    },
                    "border-width": 0
                }
            },
            {
                selector: 'node:selected',
                css: {
                    "border-width": 2,
                    "border-color": GraphColors.NODE_SELECTED_BORDER_COLOR,
                    'shape': 'rectangle'
                }
            },
            {
                selector: 'edge:selected',
                css: {
                    'line-color': GraphColors.ACTIVE_LINK

                }
            },
            {
                selector: 'edge:active',
                css: {
                    'overlay-opacity': 0
                }
            }
        ]
    }

    public static getBasicNodeHanlde = () => {
        return {
            positionX: "center",
            positionY: "top",
            offsetX: 15,
            offsetY: -20,
            color: "#27a337",
            type: "default",
            single: false,
            nodeTypeNames: ["basic-node"],
            imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
            lineWidth: 2,
            lineStyle: 'dashed'

        }
    }

    public static getBasicSmallNodeHandle = () => {
        return {
            positionX: "center",
            positionY: "top",
            offsetX: 3,
            offsetY: -25,
            color: "#27a337",
            type: "default",
            single: false,
            nodeTypeNames: ["basic-small-node"],
            imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
            lineWidth: 2,
            lineStyle: 'dashed'
        }
    }

    public static getUcpeCpNodeHandle = () => {
        return {
            positionX: "center",
            positionY: "center",
            offsetX: -8,
            offsetY: -10,
            color: "#27a337",
            type: "default",
            single: false,
            nodeTypeNames: ["ucpe-cp-node"],
            imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
            lineWidth: 2,
            lineStyle: 'dashed'
        }
    }
}