Skip to content

Commit 5565b76

Browse files
davidjumaniyadvr
andcommitted
infra: display full list of service providers in NSP tab (#159)
Adds list of SPs for the NSP tab. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: Rohit Yadav <rohit@apache.org>
1 parent 4f9969f commit 5565b76

1 file changed

Lines changed: 66 additions & 11 deletions

File tree

ui/src/views/infra/network/ServiceProvidersTab.vue

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,41 @@
1717

1818
<template>
1919
<a-spin :spinning="fetchLoading">
20-
TODO: implement support for config drive, vpc router, ilbvm, virtual router
2120
<a-tabs :tabPosition="device === 'mobile' ? 'top' : 'left'" :animated="false">
22-
<a-tab-pane v-for="(nsp, index) in nsps" :key="index">
21+
<a-tab-pane v-for="nsp in hardcodedNsps" :key="nsp">
2322
<span slot="tab">
24-
{{ nsp.name }}
25-
<status :text="nsp.state" style="margin-bottom: 6px" />
23+
{{ nsp }}
24+
<status :text="nsp in nsps ? nsps[nsp].state : 'Disabled'" style="margin-bottom: 6px; margin-left: 6px" />
2625
</span>
27-
<router-link :to="{ path: '/nsp/' + nsp.id + '?name=' + nsp.name + '&physicalnetworkid=' + resource.id }">{{ nsp.name }} </router-link>
28-
{{ nsp }}
26+
<a-list size="small" :dataSource="details">
27+
<a-list-item
28+
slot="renderItem"
29+
slot-scope="item">
30+
<div>
31+
<strong>{{ $t(item) }}</strong>
32+
<br />
33+
<div v-if="item === 'name'">
34+
<span v-if="nsp in nsps">
35+
<router-link :to="{ path: '/nsp/' + nsps[nsp].id + '?name=' + nsps[nsp].name + '&physicalnetworkid=' + resource.id }">
36+
{{ nsps[nsp].name }}
37+
</router-link>
38+
</span>
39+
<span v-else>
40+
{{ nsp }}
41+
</span>
42+
</div>
43+
<div v-else-if="item === 'state'">
44+
<status :text="nsp in nsps ? nsps[nsp].state : 'Disabled'" displayText />
45+
</div>
46+
<div v-else-if="item === 'id'">
47+
<span v-if="nsp in nsps"> {{ nsps[nsp].id }} </span>
48+
</div>
49+
<div v-else-if="item === 'servicelist'">
50+
<span v-if="nsp in nsps"> {{ nsps[nsp].servicelist.join(', ') }} </span>
51+
</div>
52+
</div>
53+
</a-list-item>
54+
</a-list>
2955
</a-tab-pane>
3056
</a-tabs>
3157
</a-spin>
@@ -54,7 +80,28 @@ export default {
5480
},
5581
data () {
5682
return {
57-
nsps: [],
83+
nsps: {},
84+
details: ['name', 'state', 'id', 'servicelist'],
85+
hardcodedNsps: [
86+
'BaremetalDhcpProvider',
87+
'BaremetalPxeProvider',
88+
'BigSwitchBcf',
89+
'BrocadeVcs',
90+
'CiscoVnmc',
91+
'ConfigDrive',
92+
'F5BigIp',
93+
'GloboDns',
94+
'InternalLbVm',
95+
'JuniperSRX',
96+
'Netscaler',
97+
'NiciraNvp',
98+
'Opendaylight',
99+
'Ovs',
100+
'PaloAlto',
101+
'SecurityGroupProvider',
102+
'VirtualRouter',
103+
'VpcVirtualRouter'
104+
],
58105
fetchLoading: false
59106
}
60107
},
@@ -70,13 +117,22 @@ export default {
70117
},
71118
methods: {
72119
fetchData () {
120+
this.fetchServiceProvider()
121+
},
122+
fetchServiceProvider (name) {
73123
this.fetchLoading = true
74-
api('listNetworkServiceProviders', { physicalnetworkid: this.resource.id }).then(json => {
75-
this.nsps = json.listnetworkserviceprovidersresponse.networkserviceprovider || []
124+
api('listNetworkServiceProviders', { physicalnetworkid: this.resource.id, name: name }).then(json => {
125+
var sps = json.listnetworkserviceprovidersresponse.networkserviceprovider || []
126+
if (sps.length > 0) {
127+
for (const sp of sps) {
128+
this.nsps[sp.name] = sp
129+
}
130+
}
76131
}).catch(error => {
77132
this.$notification.error({
78133
message: 'Request Failed',
79-
description: error.response.headers['x-description']
134+
description: error.response.headers['x-description'],
135+
duration: 0
80136
})
81137
}).finally(() => {
82138
this.fetchLoading = false
@@ -87,5 +143,4 @@ export default {
87143
</script>
88144

89145
<style lang="less" scoped>
90-
91146
</style>

0 commit comments

Comments
 (0)