5656 </a-upload-dragger >
5757 </a-form-item >
5858
59- <a-form-item v-if =" csvData.length > 0" :label =" $t('label.preview')" >
60- <a-table
61- :columns =" columns"
62- :dataSource =" csvData"
63- :pagination =" { pageSize: 5 }"
64- :scroll =" { x: true }"
65- size =" small" >
59+ <a-form-item v-if =" csvData.length > 0" :label =" $t('label.csv.preview')" >
60+ <div class =" csv-preview" >
61+ <a-table
62+ :columns =" columns"
63+ :dataSource =" csvData"
64+ :pagination =" { pageSize: 5 }"
65+ :scroll =" { x: true }"
66+ size =" small" >
6667
67- </a-table >
68+ <template #action =" { record } " >
69+ <a-tag :color =" record.action && record.action.toLowerCase() === 'allow' ? 'green' : 'red'" >
70+ {{ record.action ? record.action.toUpperCase() : 'N/A' }}
71+ </a-tag >
72+ </template >
73+
74+ <template #traffictype =" { record } " >
75+ <a-tag :color =" record.traffictype && record.traffictype.toLowerCase() === 'ingress' ? 'blue' : 'orange'" >
76+ {{ record.traffictype ? record.traffictype.toUpperCase() : 'N/A' }}
77+ </a-tag >
78+ </template >
79+
80+ </a-table >
81+ </div >
6882 </a-form-item >
6983
7084 <div :span =" 24" class =" action-button" >
8599
86100<script >
87101import { ref , reactive , toRaw } from ' vue'
102+ // import { Tag } from 'ant-design-vue'
88103import { postAPI } from ' @/api'
89104import TooltipLabel from ' @/components/widgets/TooltipLabel'
90105
@@ -109,14 +124,15 @@ export default {
109124 {
110125 title: this .$t (' label.protocol' ),
111126 dataIndex: ' protocol' ,
112- scopedSlots : { customRender : ' protocol' } ,
127+ key : ' protocol' ,
113128 width: 100
114129 },
115130 {
116131 title: this .$t (' label.action' ),
117132 dataIndex: ' action' ,
118- scopedSlots: { customRender: ' action' },
119- width: 100
133+ key: ' action' ,
134+ width: 100 ,
135+ slots: { customRender: ' action' }
120136 },
121137 {
122138 title: this .$t (' label.cidr' ),
@@ -137,8 +153,9 @@ export default {
137153 {
138154 title: this .$t (' label.traffictype' ),
139155 dataIndex: ' traffictype' ,
140- scopedSlots: { customRender: ' traffictype' },
141- width: 120
156+ key: ' traffictype' ,
157+ width: 120 ,
158+ slots: { customRender: ' traffictype' }
142159 },
143160 {
144161 title: this .$t (' label.number' ),
@@ -238,7 +255,6 @@ export default {
238255 return Promise .resolve ()
239256 }
240257 } catch (reason) {
241- console .log (reason)
242258 return Promise .reject (rule .message )
243259 }
244260 }
@@ -326,17 +342,23 @@ export default {
326342 params[' rules[' + index + ' ].' + key] = values[key]
327343 }
328344 })
329- console .log (params)
330- postAPI (' importNetworkACL' , params).then (json => {
331- const acl = json .importnetworkaclresponse .acl
332- if (acl) {
333- this .$emit (' refresh-data' )
334- this .$notification .success ({
335- message: ' Import Network ACL' ,
336- description: ' Sucessfully imported network ACL ' + this .resource .name
337- })
338- }
339- this .closeAction ()
345+ postAPI (' importNetworkACL' , params).then (response => {
346+ this .$pollJob ({
347+ jobId: response .importnetworkaclresponse .jobid ,
348+ title: this .$t (' message.success.add.network.acl' ),
349+ successMethod : () => {
350+ this .loading = false
351+ },
352+ errorMessage: this .$t (' message.add.network.acl.failed' ),
353+ errorMethod : () => {
354+ this .loading = false
355+ },
356+ loadingMessage: this .$t (' message.add.network.acl.processing' ),
357+ catchMessage: this .$t (' error.fetching.async.job.result' ),
358+ catchMethod : () => {
359+ this .loading = false
360+ }
361+ })
340362 }).catch (error => {
341363 this .$notifyError (error)
342364 }).finally (() => {
0 commit comments