34
34
</div >
35
35
<div class =" subtitle" >Port Whitelist:</div >
36
36
<div class =" port-input-container" >
37
- <input class =" first-tag-condition-editing-input" type =" number " v-model =" selectedPort" placeholder =" Enter Port Number" @keydown.enter.prevent =" addPort" >
37
+ <input class =" first-tag-condition-editing-input" type =" text " v-model =" selectedPort" placeholder =" Enter Port Number" @keydown.enter.prevent =" addPort" >
38
38
<font-awesome-icon icon =" fa-solid fa-plus" class =" adding-icon" @click =" addPort" />
39
39
</div >
40
40
<div v-for =" (port, index) in portsWhitelist" :key =" index" class =" whitelist-item" >
@@ -60,7 +60,8 @@ const emit = defineEmits<{
60
60
}>()
61
61
62
62
const props = defineProps <{
63
- layout: string
63
+ layout: any ,
64
+ queryConditions: any
64
65
}>();
65
66
66
67
const allowDuplicates = ref (true );
@@ -79,7 +80,6 @@ const saveForm = () => {
79
80
dataProtocolsWhitelist: dataProtocolsWhitelist .value ,
80
81
portsWhitelist: portsWhitelist .value
81
82
};
82
- console .log (jsonData );
83
83
LayoutService .setQueryConditions (' test' ,jsonData );
84
84
cancelForm ();
85
85
};
@@ -92,8 +92,8 @@ const cancelForm = () => {
92
92
emit (' isVisible' );
93
93
};
94
94
95
- const addProtocol = (type ) => {
96
- const selectedProtocol = type === ' flow' ? selectedFlowProtocols : selectedDataProtocols ;
95
+ const addProtocol = (type : string ) => {
96
+ const selectedProtocol: string = type === ' flow' ? selectedFlowProtocols : selectedDataProtocols ;
97
97
if (selectedProtocol && ! flowProtocolsWhitelist .value .includes (selectedProtocol ) && ! dataProtocolsWhitelist .value .includes (selectedProtocol )) {
98
98
if (type === ' flow' ) {
99
99
flowProtocolsWhitelist .value .push (selectedProtocol );
@@ -108,7 +108,7 @@ const addProtocol = (type) => {
108
108
}
109
109
};
110
110
111
- const removeProtocol = (type , index ) => {
111
+ const removeProtocol = (type : string , index : number ) => {
112
112
if (type === ' flow' ) {
113
113
flowProtocolsWhitelist .value .splice (index , 1 );
114
114
} else {
@@ -117,8 +117,8 @@ const removeProtocol = (type, index) => {
117
117
};
118
118
119
119
const addPort = () => {
120
- const port = parseInt (selectedPort );
121
- if (! isNaN (port ) && ! portsWhitelist .value .includes (port )) {
120
+ const port: number = parseInt (selectedPort );
121
+ if (! isNaN (port ) && port <= 65535 && ! portsWhitelist .value .includes (port )) {
122
122
portsWhitelist .value .push (port );
123
123
selectedPort = ' ' ;
124
124
}
@@ -136,6 +136,10 @@ const handleOverlayClick = (event) => {
136
136
};
137
137
138
138
onMounted (() => {
139
+ allowDuplicates .value = props .queryConditions .allowDuplicates ;
140
+ flowProtocolsWhitelist .value = props .queryConditions .flowProtocolsWhitelist ;
141
+ dataProtocolsWhitelist .value = props .queryConditions .dataProtocolsWhitelist ;
142
+ portsWhitelist .value = props .queryConditions .portsWhitelist ;
139
143
document .addEventListener (' keydown' , (event ) => {
140
144
if (event .key === ' Escape' ) {
141
145
cancelForm ();
@@ -146,13 +150,16 @@ onMounted(() => {
146
150
</script >
147
151
148
152
<style scoped>
149
- .first-tag-condition-editing-input {
153
+
154
+
155
+ .first-tag-condition-editing-input {
150
156
border : 1px solid #424242 ;
151
157
border-radius : 4px ;
152
- font-size : 2 vh ;
158
+ font-size : 1.5 vh ;
153
159
width : 90% ;
154
- padding : 2% ;
155
- margin : 0.5vh 0 ;
160
+ padding : 4px ;
161
+ margin-bottom : 10px ;
162
+ background : white ;
156
163
}
157
164
158
165
.first-tag-condition-editing-input :focus {
@@ -164,30 +171,40 @@ onMounted(() => {
164
171
align-items : center ;
165
172
margin-bottom : 5px ;
166
173
margin-left : 15px ;
174
+ font-size : 1.5vh ;
175
+ width : 40% ;
167
176
}
168
177
169
178
.dot {
170
179
margin-right : 10px ;
171
- font-size : 1.2 em ;
180
+ font-size : 1.5 vh ;
172
181
}
173
182
174
183
.protocol-text {
175
- margin-right : 10px ;
184
+ display : inline-block ;
185
+ white-space : nowrap ;
186
+ overflow : hidden ;
187
+ text-overflow : ellipsis ;
188
+ }
189
+
190
+ .removal-icon {
191
+ margin-left : auto ;
192
+ cursor : pointer ;
176
193
}
177
194
178
195
.port-input-container {
179
196
display : flex ;
180
197
align-items : center ;
198
+ width : 90% ;
181
199
}
182
200
183
201
.port-input-container input {
184
202
margin-right : 10px ;
203
+ flex : 1 ;
185
204
}
186
205
187
- .port-input-container button {
188
- padding : 8px 16px ;
189
- border : none ;
190
- border-radius : 5px ;
206
+ .adding-icon {
207
+ margin-bottom : 10px ;
191
208
cursor : pointer ;
192
209
}
193
210
@@ -214,37 +231,33 @@ onMounted(() => {
214
231
border-radius : 5px ;
215
232
max-height : 400px ;
216
233
overflow-y : auto ;
234
+ margin-bottom : 10px ;
235
+ width : 35vh ;
236
+ box-sizing : border-box ;
217
237
}
218
238
219
239
.title {
220
240
font-weight : bold ;
221
- font-size : 24 px ;
241
+ font-size : 3 vh ;
222
242
margin-bottom : 10px ;
223
243
}
224
244
225
245
.layout-title {
226
- font-size : 18 px ;
246
+ font-size : 2 vh ;
227
247
margin-bottom : 15px ;
228
248
}
229
249
230
250
.subtitle {
231
251
font-size : 12px ;
232
- margin-bottom : 10 px ;
252
+ margin-bottom : 5 px ;
233
253
color : #666 ;
234
254
}
235
255
236
256
.subtitle-duplicates {
237
257
font-size : 1.8vh ;
238
258
margin-bottom : 10px ;
239
259
color : #666 ;
240
- }
241
-
242
- .query-condition-form input ,
243
- .query-condition-form select {
244
- margin-bottom : 10px ;
245
- width : 100% ;
246
- padding : 8px ;
247
- box-sizing : border-box ;
260
+ margin-top : 10px ;
248
261
}
249
262
250
263
.button-container {
@@ -309,12 +322,13 @@ onMounted(() => {
309
322
.theme-checkbox :checked , .scrollable-selector-include-exclude-traffic input [type = " checkbox" ]:checked {
310
323
background-position : 100% ;
311
324
}
325
+
312
326
.scrollable-selector-include-exclude-traffic {
313
327
display : flex ;
314
328
flex-direction : row ;
315
329
align-items : center ;
316
330
justify-content : space-between ;
317
- width : 70 % ;
331
+ width : 60 % ;
318
332
font-size : 2vh ;
319
333
}
320
334
</style >
0 commit comments