21
21
</div >
22
22
<div class =" infos" >
23
23
<p >description: </p >
24
- <div >{{ removeBoldTagsFromDescription( layer.description) }}</div >
24
+ <div >{{ layer.description }}</div >
25
25
</div >
26
26
</div >
27
27
</div >
28
28
</div >
29
29
<div class =" create-form" v-bind:class =" { 'create-layer-open': layerListState.createLayerOpen }" >
30
30
<input class =" create-inputs" type =" text" placeholder =" Layer Name" v-model =" createLayerData.name" />
31
- <input class =" create-inputs" type =" text" placeholder =" Layer Type" v-model =" createLayerData.type" />
32
- <div class =" enable-new-layer" >
33
- <p >Enable?</p >
31
+ <select class =" create-dropdown-inputs" required v-model =" createLayerData.type" >
32
+ <option value =" " disabled selected hidden >Select Layer Type</option >
33
+ <option value =" filter" >Filter</option >
34
+ <option value =" aggregation" >Grouping</option >
35
+ <option value =" tag-filter" >Tag Filter</option >
36
+ <option value =" vmware-tagging" >Tag VMware</option >
37
+ <option value =" naming" >Naming</option >
38
+ <option value =" styling" >Styling</option >
39
+ </select >
40
+ <div class =" enable-new-layer" v-if =" createLayerData.type !==''" >
41
+ <p >Enable on creation</p >
34
42
<input type =" checkbox" class =" theme-checkbox" v-model =" createLayerData.enabled" />
35
43
</div >
36
- <FilterConditionBox :emit-filter-conditions =" layerListState.emitFilterConditions" :edit-layer-filter-conditions =" createLayerData.filterList.conditions" @update-filter-conditions =" handleFilterConditionsEmit" />
37
- <div class =" enable-new-layer" >
38
- <p >Implicit Include?</p >
39
- <input type =" checkbox" class =" theme-checkbox" v-model =" createLayerData.filterList.implicitInclude" />
44
+ <div class =" filter-condition" v-if =" createLayerData.type === 'filter'" >
45
+ <FilterConditionBox :edit-layer-filter-conditions =" createLayerData.filterList.conditions" @update-filter-conditions =" handleFilterConditionsEmit" />
46
+ <div class =" enable-new-layer" >
47
+ <p >Implicit Inclusion</p >
48
+ <input type =" checkbox" class =" theme-checkbox" v-model =" createLayerData.filterList.implicitInclude" />
49
+ </div >
50
+ </div >
51
+ <div class =" filter-condition" v-if =" createLayerData.type === 'aggregation'" >
52
+ <AggregationConditionBox :edit-layer-aggregation-matchers =" createLayerData.matchers" @update-aggregation-matchers =" handleFilterConditionsEmit" />
53
+ </div >
54
+ <div class =" filter-condition" v-if =" createLayerData.type === 'tag-filter'" >
55
+ <TagConditionBox :edit-layer-tag-conditions =" createLayerData.conditions" @update-tag-conditions =" handleFilterConditionsEmit" />
56
+ <div class =" enable-new-layer" >
57
+ <p >Implicit Inclusion</p >
58
+ <input type =" checkbox" class =" theme-checkbox" v-model =" createLayerData.implicitInclude" />
59
+ </div >
60
+ </div >
61
+ <div class =" filter-condition" v-if =" createLayerData.type === 'naming'" >
62
+ <NamingConditionBox :edit-layer-naming-conditions =" createLayerData.matchers" @update-naming-conditions =" handleFilterConditionsEmit" />
63
+ <div class =" enable-new-layer" >
64
+ <p >Overwrite with DNS</p >
65
+ <input type =" checkbox" class =" theme-checkbox" v-model =" createLayerData.overwriteWithDns" />
66
+ </div >
67
+ </div >
68
+ <div class =" filter-condition" v-if =" createLayerData.type === 'styling'" >
69
+ <StyleConditionBox :edit-layer-edge-conditions =" createLayerData.edgeStyler" :edit-layer-node-conditions =" createLayerData.nodeStyler" @update-styling-conditions =" handleFilterConditionsEmit" />
40
70
</div >
41
71
</div >
42
72
<div class =" create-layer" @click =" toggleCreateLayerOpen" >
48
78
<script setup lang="ts">
49
79
import {ref , watch , inject } from " vue" ;
50
80
import {FontAwesomeIcon } from " @fortawesome/vue-fontawesome" ;
51
- import FilterConditionBox from " ~/components/FilterConditionBox.vue" ;
52
81
import layerService from " ~/services/layerService" ;
82
+ import FilterConditionBox from " ~/components/conditions/FilterConditionBox.vue" ;
83
+ import AggregationConditionBox from " ~/components/conditions/AggregationConditionBox.vue" ;
84
+ import TagConditionBox from " ~/components/conditions/TagConditionBox.vue" ;
85
+ import NamingConditionBox from " ~/components/conditions/NamingConditionBox.vue" ;
86
+ import StyleConditionBox from " ~/components/conditions/StyleConditionBox.vue" ;
53
87
54
88
export interface FilterConditions {
55
89
sourceAddress: string ,
@@ -66,6 +100,7 @@ export interface Layer {
66
100
name: string ,
67
101
type: string ,
68
102
enabled: boolean ,
103
+ overwriteWithDns: boolean ,
69
104
filterList: {
70
105
conditions: FilterConditions [],
71
106
implicitInclude: boolean
@@ -89,10 +124,16 @@ const createLayerData = ref({
89
124
name: ' ' ,
90
125
type: ' ' ,
91
126
enabled: false ,
127
+ overwriteWithDns: true ,
92
128
filterList: {
93
129
conditions: [] as Array <FilterConditions >,
94
130
implicitInclude: true
95
- }
131
+ },
132
+ implicitInclude: true ,
133
+ conditions: [],
134
+ matchers:[],
135
+ edgeStyler:{},
136
+ nodeStyler:{}
96
137
})
97
138
98
139
const layerListState = ref ({
@@ -103,7 +144,6 @@ const layerListState = ref({
103
144
},
104
145
layerOpen: - 1 ,
105
146
createLayerOpen: false ,
106
- emitFilterConditions: false ,
107
147
isEditExistingLayer: - 1 ,
108
148
doneEmittingFilterConditions: false ,
109
149
});
@@ -115,10 +155,6 @@ const rerenderer = ref({
115
155
116
156
const getLayersOfLayout = inject <() => void >(' getLayersOfLayout' );
117
157
118
- function removeBoldTagsFromDescription(description : string ) {
119
- return description .replace (/ <b>| <\/ b>/ g , ' ' );
120
- }
121
-
122
158
async function getExistingLayer(index : number ) {
123
159
const layerToEdit = await layerService .getLayer (layerListState .value .selectedLayout .name , index );
124
160
Object .assign (createLayerData .value , layerToEdit );
@@ -153,18 +189,35 @@ function setLayerEnabled(index: number, value: boolean) {
153
189
name: ' ' ,
154
190
type: ' ' ,
155
191
enabled: false ,
192
+ overwriteWithDns: true ,
156
193
filterList: {
157
194
conditions: [] as Array <FilterConditions >,
158
- implicitInclude: false
159
- }
195
+ implicitInclude: true
196
+ },
197
+ implicitInclude: true ,
198
+ conditions: [],
199
+ matchers:[],
200
+ edgeStyler:{},
201
+ nodeStyler:{}
160
202
})
161
- getLayersOfLayout !();
162
203
}, 250 );
163
204
}
164
205
165
206
// handle emitted filter conditions from FilterConditionBox
166
- function handleFilterConditionsEmit(newConditions : Array <FilterConditions >, doneEmitting : boolean ) {
167
- createLayerData .value .filterList .conditions = newConditions ;
207
+ function handleFilterConditionsEmit(newConditions : any , doneEmitting : boolean ) {
208
+ if (createLayerData .value .type === ' filter' ){
209
+ createLayerData .value .filterList .conditions = newConditions ;
210
+ }else if (createLayerData .value .type === ' aggregation' ){
211
+ createLayerData .value .matchers = newConditions ;
212
+ }else if (createLayerData .value .type === ' tag-filter' ){
213
+ createLayerData .value .conditions = newConditions ;
214
+ }else if (createLayerData .value .type === ' naming' ){
215
+ createLayerData .value .matchers = newConditions ;
216
+ }else if (createLayerData .value .type === ' styling' ){
217
+ delete (createLayerData .value as { matchers? : any }).matchers ;
218
+ createLayerData .value .edgeStyler = newConditions .edgeStyler ;
219
+ createLayerData .value .nodeStyler = newConditions .nodeStyler ;
220
+ }
168
221
layerListState .value .doneEmittingFilterConditions = doneEmitting ;
169
222
}
170
223
@@ -181,10 +234,22 @@ function toggleCreateLayerOpen() {
181
234
}
182
235
else {
183
236
layerListState .value .createLayerOpen = true ;
184
- if (layerListState .value .isEditExistingLayer > - 1 ) {
185
- layerListState .value .emitFilterConditions = true ;
186
- }
187
237
}
238
+ Object .assign (createLayerData .value , {
239
+ name: ' ' ,
240
+ type: ' ' ,
241
+ enabled: false ,
242
+ overwriteWithDns: true ,
243
+ filterList: {
244
+ conditions: [] as Array <FilterConditions >,
245
+ implicitInclude: true
246
+ },
247
+ implicitInclude: true ,
248
+ conditions: [],
249
+ matchers:[],
250
+ edgeStyler:{},
251
+ nodeStyler:{}
252
+ })
188
253
}
189
254
190
255
function toggleEditExistingLayer(index : number ) {
@@ -196,15 +261,20 @@ function toggleEditExistingLayer(index: number) {
196
261
function editExistingLayerAndReset() {
197
262
editExistingLayer (layerListState .value .isEditExistingLayer );
198
263
layerListState .value .isEditExistingLayer = - 1 ;
199
- layerListState .value .emitFilterConditions = false ;
200
264
Object .assign (createLayerData .value , {
201
265
name: ' ' ,
202
266
type: ' ' ,
203
267
enabled: false ,
268
+ overwriteWithDns: true ,
204
269
filterList: {
205
270
conditions: [] as Array <FilterConditions >,
206
- implicitInclude: false
207
- }
271
+ implicitInclude: true
272
+ },
273
+ implicitInclude: true ,
274
+ conditions: [],
275
+ matchers:[],
276
+ edgeStyler:{},
277
+ nodeStyler:{}
208
278
});
209
279
}
210
280
@@ -215,10 +285,16 @@ function createNewLayerAndReset() {
215
285
name: ' ' ,
216
286
type: ' ' ,
217
287
enabled: false ,
288
+ overwriteWithDns: true ,
218
289
filterList: {
219
290
conditions: [] as Array <FilterConditions >,
220
- implicitInclude: false
221
- }
291
+ implicitInclude: true
292
+ },
293
+ implicitInclude: true ,
294
+ conditions: [],
295
+ matchers:[],
296
+ edgeStyler:{},
297
+ nodeStyler:{}
222
298
});
223
299
}
224
300
@@ -341,6 +417,8 @@ watch(() => props.layers!, (newLayers, oldLayers) => {
341
417
flex-direction : column ;
342
418
align-items : center ;
343
419
height : 94.5% ;
420
+ overflow-y : auto ;
421
+ overflow-x : hidden ;
344
422
}
345
423
346
424
.create-inputs {
@@ -356,6 +434,28 @@ watch(() => props.layers!, (newLayers, oldLayers) => {
356
434
outline : none ;
357
435
}
358
436
437
+ .create-dropdown-inputs {
438
+ width : 91% ;
439
+ border : 1px solid #424242 ;
440
+ background : white ;
441
+ border-radius : 4px ;
442
+ font-size : 2vh ;
443
+ margin-bottom : 1.5vh ;
444
+ padding : 2% ;
445
+ outline : none ;
446
+ color : #424242 ;
447
+ font-family : ' Open Sans' , sans-serif ;
448
+ }
449
+
450
+ .create-dropdown-inputs :focus {
451
+ outline : none ;
452
+ }
453
+
454
+ .filter-condition {
455
+ margin-left : 10% ;
456
+ width : 100% ;
457
+ }
458
+
359
459
.enable-new-layer {
360
460
display : flex ;
361
461
flex-direction : row ;
0 commit comments