You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/06/28 13:15:23 UTC
[cloudstack-primate] 01/02: network: fix network related issues
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
commit 06a438f3d08c0e366308807e8967f568c345ce08
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sun Jun 28 18:36:02 2020 +0530
network: fix network related issues
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
src/components/view/InfoCard.vue | 13 ++++++--
src/components/view/ListView.vue | 6 ++++
src/components/widgets/Status.vue | 37 ++++++++++++---------
src/views/network/InternalLBAssignVmForm.vue | 2 +-
src/views/network/InternalLBAssignedVmTab.vue | 4 ++-
src/views/network/LoadBalancing.vue | 41 +++++++++++------------
src/views/network/PortForwarding.vue | 47 ++++++++++++++++-----------
src/views/network/VpcTiersTab.vue | 10 +++++-
8 files changed, 100 insertions(+), 60 deletions(-)
diff --git a/src/components/view/InfoCard.vue b/src/components/view/InfoCard.vue
index 6adc9fe..673d3f2 100644
--- a/src/components/view/InfoCard.vue
+++ b/src/components/view/InfoCard.vue
@@ -334,6 +334,13 @@
<router-link :to="{ path: '/guestnetwork/' + resource.associatednetworkid }">{{ resource.associatednetworkname || resource.associatednetworkid }} </router-link>
</div>
</div>
+ <div class="resource-detail-item" v-if="resource.sourceipaddressnetworkid">
+ <div class="resource-detail-item__label">{{ $t('label.network') }}</div>
+ <div class="resource-detail-item__details">
+ <a-icon type="wifi" />
+ <router-link :to="{ path: '/guestnetwork/' + resource.sourceipaddressnetworkid }">{{ resource.sourceipaddressnetworkname || resource.sourceipaddressnetworkid }} </router-link>
+ </div>
+ </div>
<div class="resource-detail-item" v-if="resource.guestnetworkid">
<div class="resource-detail-item__label">{{ $t('label.guestnetwork') }}</div>
<div class="resource-detail-item__details">
@@ -386,14 +393,14 @@
<div class="resource-detail-item__label">{{ $t('label.backupofferingid') }}</div>
<a-icon type="cloud-upload" />
<router-link v-if="$router.resolve('/backupoffering/' + resource.backupofferingid).route.name !== '404'" :to="{ path: '/backupoffering/' + resource.backupofferingid }">{{ resource.backupofferingname || resource.backupofferingid }} </router-link>
- <span v-else>{{ resource.backupofferingname || resourece.backupofferingid }}</span>
+ <span v-else>{{ resource.backupofferingname || resource.backupofferingid }}</span>
</div>
<div class="resource-detail-item" v-if="resource.networkofferingid">
<div class="resource-detail-item__label">{{ $t('label.networkofferingid') }}</div>
<div class="resource-detail-item__details">
<a-icon type="wifi" />
<router-link v-if="$router.resolve('/networkoffering/' + resource.networkofferingid).route.name !== '404'" :to="{ path: '/networkoffering/' + resource.networkofferingid }">{{ resource.networkofferingname || resource.networkofferingid }} </router-link>
- <span v-else>{{ resource.networkofferingname || resourece.networkofferingid }}</span>
+ <span v-else>{{ resource.networkofferingname || resource.networkofferingid }}</span>
</div>
</div>
<div class="resource-detail-item" v-if="resource.vpcofferingid">
@@ -401,7 +408,7 @@
<div class="resource-detail-item__details">
<a-icon type="deployment-unit" />
<router-link v-if="$router.resolve('/vpcoffering/' + resource.vpcofferingid).route.name !== '404'" :to="{ path: '/vpcoffering/' + resource.vpcofferingid }">{{ resource.vpcofferingname || resource.vpcofferingid }} </router-link>
- <span v-else>{{ resource.vpcofferingname || resourece.vpcofferingid }}</span>
+ <span v-else>{{ resource.vpcofferingname || resource.vpcofferingid }}</span>
</div>
</div>
<div class="resource-detail-item" v-if="resource.storageid">
diff --git a/src/components/view/ListView.vue b/src/components/view/ListView.vue
index 4534c36..e5ec25e 100644
--- a/src/components/view/ListView.vue
+++ b/src/components/view/ListView.vue
@@ -97,6 +97,9 @@
<a slot="vmname" slot-scope="text, record" href="javascript:;">
<router-link :to="{ path: '/vm/' + record.virtualmachineid }">{{ text }}</router-link>
</a>
+ <a slot="virtualmachinename" slot-scope="text, record" href="javascript:;">
+ <router-link :to="{ path: '/vm/' + record.virtualmachineid }">{{ text }}</router-link>
+ </a>
<span slot="hypervisor" slot-scope="text, record">
<span v-if="$route.name === 'hypervisorcapability'">
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
@@ -121,6 +124,9 @@
<a slot="guestnetworkname" slot-scope="text, record" href="javascript:;">
<router-link :to="{ path: '/guestnetwork/' + record.guestnetworkid }">{{ text }}</router-link>
</a>
+ <a slot="associatednetworkname" slot-scope="text, record" href="javascript:;">
+ <router-link :to="{ path: '/guestnetwork/' + record.associatednetworkid }">{{ text }}</router-link>
+ </a>
<a slot="vpcname" slot-scope="text, record" href="javascript:;">
<router-link :to="{ path: '/vpc/' + record.vpcid }">{{ text }}</router-link>
</a>
diff --git a/src/components/widgets/Status.vue b/src/components/widgets/Status.vue
index fa032ce..2301d56 100644
--- a/src/components/widgets/Status.vue
+++ b/src/components/widgets/Status.vue
@@ -48,44 +48,51 @@ export default {
getBadgeStatus (state) {
var status = 'default'
switch (state) {
- case 'Running':
- case 'Ready':
- case 'Up':
- case 'BackedUp':
- case 'Implemented':
- case 'Enabled':
- case 'enabled':
case 'Active':
+ case 'BackedUp':
case 'Completed':
case 'Connected':
- case 'Started':
case 'Download Complete':
+ case 'Enabled':
+ case 'Implemented':
+ case 'Ready':
+ case 'Running':
+ case 'Setup':
+ case 'Started':
case 'Successfully Installed':
case 'True':
+ case 'Up':
+ case 'enabled':
status = 'success'
break
+ case 'Alert':
+ case 'Declined':
case 'Disabled':
+ case 'Disconnected':
case 'Down':
case 'Error':
- case 'Stopped':
- case 'Declined':
- case 'Disconnected':
case 'False':
+ case 'Stopped':
status = 'error'
break
case 'Migrating':
+ case 'Scaling':
+ case 'Scheduled':
case 'Starting':
case 'Stopping':
- case 'Scheduled':
- case 'Scaling':
case 'Upgrading':
status = 'processing'
break
- case 'Alert':
case 'Allocated':
+ if (this.$route.path.startsWith('/publicip')) {
+ status = 'success'
+ } else {
+ status = 'warning'
+ }
+ break
case 'Created':
- case 'Pending':
case 'Maintenance':
+ case 'Pending':
status = 'warning'
break
}
diff --git a/src/views/network/InternalLBAssignVmForm.vue b/src/views/network/InternalLBAssignVmForm.vue
index 1d891e9..330a8e5 100644
--- a/src/views/network/InternalLBAssignVmForm.vue
+++ b/src/views/network/InternalLBAssignVmForm.vue
@@ -167,7 +167,7 @@ export default {
this.addVmModalNicLoading = true
api('listNics', {
virtualmachineid: e.target.value,
- networkid: this.resource.associatednetworkid
+ networkid: this.resource.networkid
}).then(response => {
if (!response.listnicsresponse.nic[0]) return
const newItem = []
diff --git a/src/views/network/InternalLBAssignedVmTab.vue b/src/views/network/InternalLBAssignedVmTab.vue
index 5e92587..9be6101 100644
--- a/src/views/network/InternalLBAssignedVmTab.vue
+++ b/src/views/network/InternalLBAssignedVmTab.vue
@@ -30,7 +30,9 @@
</template>
<template slot="ipaddress" slot-scope="text, record">
<span v-for="nic in record.nic" :key="nic.id">
- {{ nic.ipaddress }} <br/>
+ <span v-if="nic.networkid === resource.networkid">
+ {{ nic.ipaddress }} <br/>
+ </span>
</span>
</template>
<template slot="remove" slot-scope="text, record">
diff --git a/src/views/network/LoadBalancing.vue b/src/views/network/LoadBalancing.vue
index 2feb090..a3d0a59 100644
--- a/src/views/network/LoadBalancing.vue
+++ b/src/views/network/LoadBalancing.vue
@@ -18,21 +18,6 @@
<template>
<div>
<div>
- <div class="filter" v-if="'vpcid' in resource && !('associatednetworkid' in resource)">
- <div class="form">
- <div class="form__item" ref="newRuleTier">
- <div class="form__label">{{ $t('label.tiername') }}</div>
- <a-select v-model="newRule.tier">
- <a-select-option
- v-for="tier in tiers.data"
- :loading="tiers.loading"
- :key="tier.id">
- {{ tier.displaytext }}
- </a-select-option>
- </a-select>
- </div>
- </div>
- </div>
<div class="form">
<div class="form__item" ref="newRuleName">
<div class="form__label"><span class="form__required">*</span>{{ $t('label.name') }}</div>
@@ -294,6 +279,21 @@
@cancel="closeModal"
>
<div>
+ <span
+ v-if="'vpcid' in resource && !('associatednetworkid' in resource)">
+ <strong>{{ $t('label.select.tier') }} </strong>
+ <a-select
+ v-model="selectedTier"
+ @change="fetchVirtualMachines()"
+ :placeholder="$t('label.select.tier')" >
+ <a-select-option
+ v-for="tier in tiers.data"
+ :loading="tiers.loading"
+ :key="tier.id">
+ {{ tier.displaytext }}
+ </a-select-option>
+ </a-select>
+ </span>
<a-input-search
class="input-search"
placeholder="Search"
@@ -377,6 +377,7 @@ export default {
tagsModalLoading: false,
tags: [],
selectedRule: null,
+ selectedTier: null,
stickinessModalVisible: false,
stickinessPolicies: [],
stickinessPolicyForm: this.$form.createForm(this),
@@ -524,7 +525,7 @@ export default {
vpcid: this.resource.vpcid
}).then(json => {
this.tiers.data = json.listnetworksresponse.network || []
- this.newRule.tier = this.tiers.data && this.tiers.data[0].id ? this.tiers.data[0].id : null
+ this.selectedTier = this.tiers.data && this.tiers.data[0].id ? this.tiers.data[0].id : null
this.$forceUpdate()
}).catch(error => {
this.$notifyError(error)
@@ -982,7 +983,7 @@ export default {
api('listNics', {
virtualmachineid: e.target.value,
- networkid: this.resource.associatednetworkid
+ networkid: ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
}).then(response => {
if (!response || !response.listnicsresponse || !response.listnicsresponse.nic[0]) return
const newItem = []
@@ -1002,7 +1003,7 @@ export default {
this.vmCount = 0
this.vms = []
this.addVmModalLoading = true
- const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.newRule.tier : this.resource.associatednetworkid
+ const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
api('listVirtualMachines', {
listAll: true,
keyword: this.searchQuery,
@@ -1085,7 +1086,7 @@ export default {
return
}
- const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.newRule.tier : this.resource.associatednetworkid
+ const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
api('createLoadBalancerRule', {
openfirewall: false,
networkid: networkId,
@@ -1496,7 +1497,7 @@ export default {
.input-search {
margin-bottom: 10px;
- width: 220px;
+ width: 50%;
float: right;
}
</style>
diff --git a/src/views/network/PortForwarding.vue b/src/views/network/PortForwarding.vue
index dabf6e3..5d53101 100644
--- a/src/views/network/PortForwarding.vue
+++ b/src/views/network/PortForwarding.vue
@@ -18,21 +18,6 @@
<template>
<div>
<div>
- <div class="filter" v-if="'vpcid' in resource && !('associatednetworkid' in resource)">
- <div class="form">
- <div class="form__item" ref="newRuleTier">
- <div class="form__label">{{ $t('label.tiername') }}</div>
- <a-select v-model="newRule.tier">
- <a-select-option
- v-for="tier in tiers.data"
- :loading="tiers.loading"
- :key="tier.id">
- {{ tier.displaytext }}
- </a-select-option>
- </a-select>
- </div>
- </div>
- </div>
<div class="form">
<div class="form__item">
<div class="form__label">{{ $t('label.privateport') }}</div>
@@ -175,6 +160,21 @@
@cancel="closeModal"
>
<div>
+ <span
+ v-if="'vpcid' in resource && !('associatednetworkid' in resource)">
+ <strong>{{ $t('label.select.tier') }} </strong>
+ <a-select
+ v-model="selectedTier"
+ @change="fetchVirtualMachines()"
+ :placeholder="$t('label.select.tier')" >
+ <a-select-option
+ v-for="tier in tiers.data"
+ :loading="tiers.loading"
+ :key="tier.id">
+ {{ tier.displaytext }}
+ </a-select-option>
+ </a-select>
+ </span>
<a-input-search
class="input-search"
placeholder="Search"
@@ -261,6 +261,7 @@ export default {
},
tagsModalVisible: false,
selectedRule: null,
+ selectedTier: null,
tags: [],
newTag: {
key: null,
@@ -382,7 +383,7 @@ export default {
vpcid: this.resource.vpcid
}).then(json => {
this.tiers.data = json.listnetworksresponse.network || []
- this.newRule.tier = this.tiers.data && this.tiers.data[0].id ? this.tiers.data[0].id : null
+ this.selectedTier = this.tiers.data && this.tiers.data[0].id ? this.tiers.data[0].id : null
this.$forceUpdate()
}).catch(error => {
this.$notifyError(error)
@@ -425,7 +426,7 @@ export default {
addRule () {
this.loading = true
this.addVmModalVisible = false
- const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.newRule.tier : this.resource.associatednetworkid
+ const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
api('createPortForwardingRule', {
...this.newRule,
ipaddressid: this.resource.id,
@@ -436,11 +437,13 @@ export default {
successMessage: `Successfully added new Port Forwarding rule`,
successMethod: () => {
this.closeModal()
+ this.parentFetchData()
this.fetchData()
},
errorMessage: 'Adding new Port Forwarding rule failed',
errorMethod: () => {
this.closeModal()
+ this.parentFetchData()
this.fetchData()
},
loadingMessage: `Adding new Port Forwarding rule...`,
@@ -578,7 +581,7 @@ export default {
this.newRule.virtualmachineid = e.target.value
api('listNics', {
virtualmachineid: e.target.value,
- networkid: this.resource.associatednetworkid
+ networkId: ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
}).then(response => {
if (!response.listnicsresponse.nic || response.listnicsresponse.nic.length < 1) return
const nic = response.listnicsresponse.nic[0]
@@ -598,7 +601,7 @@ export default {
this.vmCount = 0
this.vms = []
this.addVmModalLoading = true
- const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.newRule.tier : this.resource.associatednetworkid
+ const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
api('listVirtualMachines', {
listAll: true,
keyword: this.searchQuery,
@@ -832,4 +835,10 @@ export default {
width: 100%;
}
}
+
+ .input-search {
+ margin-bottom: 10px;
+ width: 50%;
+ float: right;
+ }
</style>
diff --git a/src/views/network/VpcTiersTab.vue b/src/views/network/VpcTiersTab.vue
index 8cb1261..b4be7a6 100644
--- a/src/views/network/VpcTiersTab.vue
+++ b/src/views/network/VpcTiersTab.vue
@@ -83,9 +83,12 @@
:to="{ path: '/vm/'+item.id}">{{ item.name }}
</router-link>
</template>
+ <template slot="state" slot-scope="text, item">
+ <status :text="item.state" displayText></status>
+ </template>
<template slot="ip" slot-scope="text, item">
<div v-for="nic in item.nic" :key="nic.id">
- {{ nic.isdefault === true ? nic.ipaddress : '' }}
+ {{ nic.networkid === network.id ? nic.ipaddress : '' }}
</div>
</template>
</a-table>
@@ -331,6 +334,11 @@ export default {
scopedSlots: { customRender: 'name' }
},
{
+ title: this.$t('label.state'),
+ dataIndex: 'state',
+ scopedSlots: { customRender: 'state' }
+ },
+ {
title: this.$t('label.ip'),
scopedSlots: { customRender: 'ip' }
}