-
(Default)
-
{{ item.networkname }}
- Mac Address: {{ item.macaddress }}
-
Address: {{ item.ipaddress }}
- Netmask: {{ item.netmask }}
- Gateway: {{ item.gateway }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ "Change IP Address" }}
+
+
+
+
+
+
+ {{ "Manage Secondary IP Addresses" }}
+
+
+
+
+
+
+
-
+
+
{{ item.networkname }}
+
+ {{ $t('default') }}
+
+
+ {{ item.type }}
+
+
+ {{ item.broadcasturi }}
+
+
+ {{ item.isolationuri }}
+
+
+ {{ $t('macaddress') }}: {{ item.macaddress }}
+
+ {{ $t('IP Address') }}: {{ item.ipaddress }}
+
+
+
+ {{ $t('Secondary IPs') }}: {{ item.secondaryip.map(x => x.ipaddress).join(', ') }}
+
+
+
+ {{ $t('netmask') }}: {{ item.netmask }}
+
+
+
+ {{ $t('gateway') }}: {{ item.gateway }}
+
+
{{ item.id }}
-
-
-
-
- Type: {{ item.type }}
- Broadcast URI: {{ item.broadcasturi }}
- Isolation URI: {{ item.isolationuri }}
-
+
+
+ {{ $t('message.network.addVM.desc') }}
+
+
+
+
+
+
+ {{ $t('message.network.updateIp') }}
+
+
+
+
+
+
+
+ {{ $t('message.network.secondaryIP') }}
+
+
+
+
+
Add Secondary IP
+
Close
+
+
+
+
+
+
+
+ {{ ip.ipaddress }}
+
+
+
+
+
@@ -120,12 +285,27 @@ export default {
default: false
}
},
+ inject: ['parentFetchData'],
data () {
return {
vm: {},
volumes: [],
totalStorage: 0,
- activeKey: ['1', '2', '3']
+ activeKey: ['1', '2', '3'],
+ showAddNetworkModal: false,
+ showUpdateIpModal: false,
+ showSecondaryIpModal: false,
+ addNetworkData: {
+ allNetworks: [],
+ network: '',
+ ip: ''
+ },
+ loadingNic: false,
+ editIpAddressNic: '',
+ editIpAddressValue: '',
+ secondaryIPs: [],
+ selectedNicId: '',
+ newSecondaryIp: ''
}
},
created () {
@@ -154,26 +334,339 @@ export default {
}
this.$set(this.resource, 'volumes', this.volumes)
})
+ },
+ listNetworks () {
+ api('listNetworks', {
+ listAll: 'true',
+ zoneid: this.vm.zoneid
+ }).then(response => {
+ this.addNetworkData.allNetworks = response.listnetworksresponse.network.filter(network => !this.vm.nic.map(nic => nic.networkid).includes(network.id))
+ this.addNetworkData.network = this.addNetworkData.allNetworks[0].id
+ })
+ },
+ fetchSecondaryIPs (nicId) {
+ this.showSecondaryIpModal = true
+ this.selectedNicId = nicId
+ api('listNics', {
+ nicId: nicId,
+ keyword: '',
+ virtualmachineid: this.vm.id
+ }).then(response => {
+ this.secondaryIPs = response.listnicsresponse.nic[0].secondaryip
+ })
+ },
+ showAddModal () {
+ this.showAddNetworkModal = true
+ this.listNetworks()
+ },
+ closeModals () {
+ this.showAddNetworkModal = false
+ this.showUpdateIpModal = false
+ this.showSecondaryIpModal = false
+ this.addNetworkData.network = ''
+ this.addNetworkData.ip = ''
+ this.editIpAddressValue = ''
+ this.newSecondaryIp = ''
+ },
+ submitAddNetwork () {
+ const params = {}
+ params.virtualmachineid = this.vm.id
+ params.networkid = this.addNetworkData.network
+ if (this.addNetworkData.ip) {
+ params.ipaddress = this.addNetworkData.ip
+ }
+ this.showAddNetworkModal = false
+ this.loadingNic = true
+ api('addNicToVirtualMachine', params).then(response => {
+ this.$pollJob({
+ jobId: response.addnictovirtualmachineresponse.jobid,
+ successMessage: `Successfully added network`,
+ successMethod: () => {
+ this.loadingNic = false
+ this.closeModals()
+ this.parentFetchData()
+ },
+ errorMessage: 'Adding network failed',
+ errorMethod: () => {
+ this.loadingNic = false
+ this.closeModals()
+ this.parentFetchData()
+ },
+ loadingMessage: `Adding network...`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.loadingNic = false
+ this.closeModals()
+ this.parentFetchData()
+ }
+ })
+ }).catch(error => {
+ this.$notification.error({
+ message: `Error ${error.response.status}`,
+ description: error.response.data.errorresponse.errortext
+ })
+ this.loadingNic = false
+ })
+ },
+ setAsDefault (item) {
+ this.loadingNic = true
+ api('updateDefaultNicForVirtualMachine', {
+ virtualmachineid: this.vm.id,
+ nicid: item.id
+ }).then(response => {
+ this.$pollJob({
+ jobId: response.updatedefaultnicforvirtualmachineresponse.jobid,
+ successMessage: `Successfully set ${item.networkname} to default. Please manually update the default NIC on the VM now.`,
+ successMethod: () => {
+ this.loadingNic = false
+ this.parentFetchData()
+ },
+ errorMessage: `Error setting ${item.networkname} to default`,
+ errorMethod: () => {
+ this.loadingNic = false
+ this.parentFetchData()
+ },
+ loadingMessage: `Setting ${item.networkname} to default...`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.loadingNic = false
+ this.parentFetchData()
+ }
+ })
+ }).catch(error => {
+ this.$notification.error({
+ message: `Error ${error.response.status}`,
+ description: error.response.data.errorresponse.errortext
+ })
+ this.loadingNic = false
+ })
+ },
+ submitUpdateIP () {
+ this.loadingNic = true
+ this.showUpdateIpModal = false
+ api('updateVmNicIp', {
+ nicId: this.editIpAddressNic,
+ ipaddress: this.editIpAddressValue
+ }).then(response => {
+ this.$pollJob({
+ jobId: response.updatevmnicipresponse.jobid,
+ successMessage: `Successfully updated IP Address`,
+ successMethod: () => {
+ this.loadingNic = false
+ this.closeModals()
+ this.parentFetchData()
+ },
+ errorMessage: `Error`,
+ errorMethod: () => {
+ this.loadingNic = false
+ this.closeModals()
+ this.parentFetchData()
+ },
+ loadingMessage: `Updating IP Address...`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.loadingNic = false
+ this.closeModals()
+ this.parentFetchData()
+ }
+ })
+ })
+ .catch(error => {
+ this.$notification.error({
+ message: `Error ${error.response.status}`,
+ description: error.response.data.errorresponse.errortext
+ })
+ this.loadingNic = false
+ })
+ },
+ removeNIC (item) {
+ this.loadingNic = true
+
+ api('removeNicFromVirtualMachine', {
+ nicid: item.id,
+ virtualmachineid: this.vm.id
+ }).then(response => {
+ this.$pollJob({
+ jobId: response.removenicfromvirtualmachineresponse.jobid,
+ successMessage: `Successfully removed`,
+ successMethod: () => {
+ this.loadingNic = false
+ this.parentFetchData()
+ },
+ errorMessage: `There was an error`,
+ errorMethod: () => {
+ this.loadingNic = false
+ this.parentFetchData()
+ },
+ loadingMessage: `Removing NIC...`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.loadingNic = false
+ this.parentFetchData()
+ }
+ })
+ })
+ .catch(error => {
+ this.$notification.error({
+ message: `Error ${error.response.status}`,
+ description: error.response.data.errorresponse.errortext
+ })
+ this.loadingNic = false
+ })
+ },
+ submitSecondaryIP () {
+ this.loadingNic = true
+
+ const params = {}
+ params.nicid = this.selectedNicId
+ if (this.newSecondaryIp) {
+ params.ipaddress = this.newSecondaryIp
+ }
+
+ api('addIpToNic', params).then(response => {
+ this.$pollJob({
+ jobId: response.addiptovmnicresponse.jobid,
+ successMessage: `Successfully added secondary IP Address`,
+ successMethod: () => {
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ this.parentFetchData()
+ },
+ errorMessage: `There was an error adding the secondary IP Address`,
+ errorMethod: () => {
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ this.parentFetchData()
+ },
+ loadingMessage: `Add Secondary IP address...`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ this.parentFetchData()
+ }
+ })
+ }).catch(error => {
+ this.$notification.error({
+ message: `Error ${error.response.status}`,
+ description: error.response.data.addiptovmnicresponse.errortext
+ })
+ this.loadingNic = false
+ })
+ },
+ removeSecondaryIP (id) {
+ this.loadingNic = true
+
+ api('removeIpFromNic', { id }).then(response => {
+ this.$pollJob({
+ jobId: response.removeipfromnicresponse.jobid,
+ successMessage: `Successfully removed secondary IP Address`,
+ successMethod: () => {
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ this.parentFetchData()
+ },
+ errorMessage: `There was an error removing the secondary IP Address`,
+ errorMethod: () => {
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ this.parentFetchData()
+ },
+ loadingMessage: `Removing Secondary IP address...`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ this.parentFetchData()
+ }
+ })
+ }).catch(error => {
+ this.$notification.error({
+ message: `Error ${error.response.status}`,
+ description: error.response.data.errorresponse.errortext
+ })
+ this.loadingNic = false
+ this.fetchSecondaryIPs(this.selectedNicId)
+ })
}
}
}
-
+
+
diff --git a/ui/src/views/infra/InfraSummary.vue b/ui/src/views/infra/InfraSummary.vue
index d2af42474dd..1ef76d0568a 100644
--- a/ui/src/views/infra/InfraSummary.vue
+++ b/ui/src/views/infra/InfraSummary.vue
@@ -19,23 +19,24 @@
-
+
-
-
- {{ $t('Refresh') }}
+ icon="reload"
+ size="small"
+ shape="round"
+ @click="fetchData()" >
+ {{ $t('refresh') }}
- {{ $t('SSL Certificate') }}
+ style="margin-left: 12px; margin-top: 4px"
+ icon="safety-certificate"
+ size="small"
+ shape="round"
+ @click="sslFormVisible = true">
+ {{ $t('Setup SSL Certificate') }}