diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js
index be81e0bb39a..81dfe3ebd38 100644
--- a/ui/src/config/section/network.js
+++ b/ui/src/config/section/network.js
@@ -430,6 +430,14 @@ export default {
permission: ['listLoadBalancers'],
columns: ['name', 'sourceipaddress', 'loadbalancerrule', 'algorithm', 'account', 'domain'],
details: ['name', 'sourceipaddress', 'loadbalancerrule', 'algorithm', 'account', 'domain'],
+ tabs: [{
+ name: 'details',
+ component: () => import('@/components/view/DetailsTab.vue')
+ }, {
+ name: 'Assigned VMs',
+ component: () => import('@/views/network/InternalLBAssignedVmTab.vue'),
+ show: () => true
+ }],
actions: [
{
api: 'createLoadBalancer',
@@ -458,7 +466,9 @@ export default {
api: 'assignToLoadBalancerRule',
icon: 'plus',
label: 'Assign VMs',
- dataView: true
+ dataView: true,
+ popup: true,
+ component: () => import('@/views/network/InternalLBAssignVmForm.vue')
},
{
api: 'deleteLoadBalancer',
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index 8e8352d7a65..882aad20ab0 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -280,6 +280,7 @@
"intervaltype": "Interval Type",
"invitations": "Invitations",
"ip": "IP Address",
+"ips": "IPs",
"ip4Netmask": "IPv4 Netmask",
"ip4dns1": "IPv4 DNS1",
"ip4dns2": "IPv4 DNS2",
@@ -405,6 +406,7 @@
"label.action.register.ncc": "Register NCC",
"label.action.release.ip": "Release IP",
"label.action.remove.host": "Remove Host",
+"label.action.remove.vm": "Release VM",
"label.action.reset.password": "Reset Password",
"label.action.resize.volume": "Resize Volume",
"label.action.restore.instance": "Restore Instance",
diff --git a/ui/src/views/network/InternalLBAssignVmForm.vue b/ui/src/views/network/InternalLBAssignVmForm.vue
new file mode 100644
index 00000000000..d9f7cbb43ee
--- /dev/null
+++ b/ui/src/views/network/InternalLBAssignVmForm.vue
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+
+
+
+
+
+
+
+ {{ vm.name }}
+
+
+
+
+ {{ nic }}{{ nicIndex === 0 ? ' (Primary)' : null }}
+
+
+
+
+
{{ vm.instancename }}
+
{{ vm.displayname }}
+
+
{{ vm.account }}
+
{{ vm.zonename }}
+
fetchNics(e, index)" />
+
+
+
+
+
+
+
+ {{ $t('Cancel') }}
+
+
+ {{ $t('OK') }}
+
+
+
+
+
+
+
+
diff --git a/ui/src/views/network/InternalLBAssignedVmTab.vue b/ui/src/views/network/InternalLBAssignedVmTab.vue
new file mode 100644
index 00000000000..a44d52e3db7
--- /dev/null
+++ b/ui/src/views/network/InternalLBAssignedVmTab.vue
@@ -0,0 +1,157 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+
+
+ {{ record.displayname || record.name }}
+
+
+
+ {{ nic.ipaddress }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui/src/views/network/IpAddressesTab.vue b/ui/src/views/network/IpAddressesTab.vue
index d241f971db3..7d63894c9b4 100644
--- a/ui/src/views/network/IpAddressesTab.vue
+++ b/ui/src/views/network/IpAddressesTab.vue
@@ -20,6 +20,23 @@
{{ $t("label.acquire.new.ip") }}
+
+ Select Tier:
+
+
+ {{ $t('Show All') }}
+
+
+ {{ network.name }}
+
+
+
{{ record.virtualmachinename || record.virtualmachineid }}
+
+ {{ record.associatednetworkname || record.associatednetworkid }}
+
+
diff --git a/ui/src/views/network/VpcTiersTab.vue b/ui/src/views/network/VpcTiersTab.vue
index be891e2209c..0fdec7ea3f1 100644
--- a/ui/src/views/network/VpcTiersTab.vue
+++ b/ui/src/views/network/VpcTiersTab.vue
@@ -17,9 +17,9 @@
- Add Network
+ Add Network
-
+
-
-
-
- Internal LB
+
+
+
+
+
+
+ {{ $t('Add Instance') }}
-
-
-
- Public LB IP
+
+
+ {{ item.name }}
+
+
+
+
+ {{ nic.isdefault === true ? nic.ipaddress : '' }}
+
+
+
+
+
+
+
+
+ {{ $t('label.add.internal.lb') }}
-
-
-
-
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
@@ -119,6 +168,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ key }}
+
+
+
+
+
+
@@ -144,11 +236,99 @@ export default {
data () {
return {
networks: [],
+ networkid: '',
fetchLoading: false,
showCreateNetworkModal: false,
+ showAddInternalLB: false,
networkOfferings: [],
networkAclList: [],
- modalLoading: false
+ modalLoading: false,
+ internalLB: {},
+ LBPublicIPs: {},
+ staticNats: {},
+ vms: {},
+ algorithms: {
+ Source: 'source',
+ 'Round-robin': 'roundrobin',
+ 'Least connections': 'leastconn'
+ },
+ internalLbCols: [
+ {
+ title: this.$t('name'),
+ dataIndex: 'name',
+ scopedSlots: { customRender: 'name' }
+ },
+ {
+ title: this.$t('sourceipaddress'),
+ dataIndex: 'sourceipaddress'
+ },
+ {
+ title: this.$t('algorithm'),
+ dataIndex: 'algorithm'
+ },
+ {
+ title: this.$t('account'),
+ dataIndex: 'account'
+ }
+ ],
+ LBPublicIPCols: [
+ {
+ title: this.$t('ip'),
+ dataIndex: 'ipaddress',
+ scopedSlots: { customRender: 'ipaddress' }
+ },
+ {
+ title: this.$t('state'),
+ dataIndex: 'state'
+ },
+ {
+ title: this.$t('networkid'),
+ dataIndex: 'associatedNetworkName'
+ },
+ {
+ title: this.$t('vm'),
+ dataIndex: 'virtualmachinename'
+ }
+ ],
+ StaticNatCols: [
+ {
+ title: this.$t('ips'),
+ dataIndex: 'ipaddress',
+ scopedSlots: { customRender: 'ipaddress' }
+ },
+ {
+ title: this.$t('zoneid'),
+ dataIndex: 'zonename'
+ },
+ {
+ title: this.$t('networkid'),
+ dataIndex: 'associatedNetworkName'
+ },
+ {
+ title: this.$t('state'),
+ dataIndex: 'state'
+ }
+ ],
+ vmCols: [
+ {
+ title: this.$t('name'),
+ dataIndex: 'name',
+ scopedSlots: { customRender: 'name' }
+ },
+ {
+ title: this.$t('ip'),
+ scopedSlots: { customRender: 'ip' }
+ }
+ ],
+ customStyle: 'margin-bottom: -10px; border-bottom-style: none',
+ page: 1,
+ pageSize: 10,
+ itemCounts: {
+ internalLB: {},
+ publicIps: {},
+ snats: {},
+ vms: {}
+ }
}
},
mounted () {
@@ -165,24 +345,21 @@ export default {
this.form = this.$form.createForm(this)
},
methods: {
+ showIlb (network) {
+ return network.service.filter(s => (s.name === 'Lb') && (s.capability.filter(c => c.name === 'LbSchemes' && c.value === 'Internal').length > 0)).length > 0 || false
+ },
fetchData () {
- this.fetchLoading = true
- api('listNetworks', { vpcid: this.resource.id }).then(json => {
- this.networks = json.listnetworksresponse.network
- }).catch(error => {
- this.$notification.error({
- message: 'Request Failed',
- description: error.response.headers['x-description']
- })
- }).finally(() => {
- this.fetchLoading = false
- })
+ this.networks = this.resource.network
+ for (const network of this.networks) {
+ this.fetchLoadBalancers(network.id)
+ this.fetchVMs(network.id)
+ }
},
fetchNetworkAclList () {
this.fetchLoading = true
this.modalLoading = true
api('listNetworkACLLists', { vpcid: this.resource.id }).then(json => {
- this.networkAclList = json.listnetworkacllistsresponse.networkacllist
+ this.networkAclList = json.listnetworkacllistsresponse.networkacllist || []
this.$nextTick(function () {
this.form.setFieldsValue({
acl: this.networkAclList[0].id
@@ -191,7 +368,8 @@ export default {
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
- description: error.response.headers['x-description']
+ description: error.response.headers['x-description'],
+ duration: 0
})
}).finally(() => {
this.fetchLoading = false
@@ -207,7 +385,7 @@ export default {
supportedServices: 'SourceNat',
state: 'Enabled'
}).then(json => {
- this.networkOfferings = json.listnetworkofferingsresponse.networkoffering
+ this.networkOfferings = json.listnetworkofferingsresponse.networkoffering || []
this.$nextTick(function () {
this.form.setFieldsValue({
networkOffering: this.networkOfferings[0].id
@@ -216,19 +394,58 @@ export default {
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
- description: error.response.headers['x-description']
+ description: error.response.headers['x-description'],
+ duration: 0
})
}).finally(() => {
this.fetchLoading = false
this.modalLoading = false
})
},
+ fetchLoadBalancers (id) {
+ this.fetchLoading = true
+ api('listLoadBalancers', {
+ networkid: id,
+ page: this.page,
+ pagesize: this.pageSize
+ }).then(json => {
+ this.internalLB[id] = json.listloadbalancersresponse.loadbalancer || []
+ this.itemCounts.internalLB[id] = json.listloadbalancersresponse.count || 0
+ this.$forceUpdate()
+ }).finally(() => {
+ this.fetchLoading = false
+ })
+ },
+ fetchVMs (id) {
+ this.fetchLoading = true
+ api('listVirtualMachines', {
+ listAll: true,
+ vpcid: this.resource.id,
+ networkid: id,
+ page: this.page,
+ pagesize: this.pageSize
+ }).then(json => {
+ this.vms[id] = json.listvirtualmachinesresponse.virtualmachine || []
+ this.itemCounts.vms[id] = json.listvirtualmachinesresponse.count || 0
+ this.$forceUpdate()
+ }).finally(() => {
+ this.fetchLoading = false
+ })
+ },
+ closeModal () {
+ this.$emit('close-action')
+ },
handleOpenModal () {
this.form = this.$form.createForm(this)
this.fetchNetworkAclList()
this.fetchNetworkOfferings()
this.showCreateNetworkModal = true
},
+ handleAddInternalLB (id) {
+ this.form = this.$form.createForm(this)
+ this.showAddInternalLB = true
+ this.networkid = id
+ },
handleAddNetworkSubmit () {
this.fetchLoading = true
@@ -259,13 +476,72 @@ export default {
}).catch(error => {
this.$notification.error({
message: 'Request Failed',
- description: error.response.headers['x-description']
+ description: error.response.headers['x-description'],
+ duration: 0
})
}).finally(() => {
- this.fetchLoading = false
this.fetchData()
})
})
+ },
+ handleAddInternalLBSubmit () {
+ this.fetchLoading = true
+ this.modalLoading = true
+ this.form.validateFields((errors, values) => {
+ if (errors) {
+ this.fetchLoading = false
+ return
+ }
+ api('createLoadBalancer', {
+ name: values.name,
+ sourceport: values.sourcePort,
+ instanceport: values.instancePort,
+ algorithm: values.algorithm,
+ networkid: this.networkid,
+ sourceipaddressnetworkid: this.networkid,
+ scheme: 'Internal'
+ }).then(response => {
+ this.$store.dispatch('AddAsyncJob', {
+ title: `Creating Internal LB`,
+ jobid: response.createloadbalancerresponse.jobid,
+ description: values.name,
+ status: 'progress'
+ })
+ this.$pollJob({
+ jobId: response.createloadbalancerresponse.jobid,
+ successMessage: `Successfully created Internal LB`,
+ successMethod: () => {
+ this.fetchData()
+ },
+ errorMessage: 'Failed to create Internal LB' + response,
+ errorMethod: () => {
+ this.fetchData()
+ },
+ loadingMessage: `Creation of Internal LB is in progress`,
+ catchMessage: 'Error encountered while fetching async job result',
+ catchMethod: () => {
+ this.fetchData()
+ }
+ })
+ }).catch(error => {
+ console.error(error)
+ this.$message.error('Failed to create Internal LB')
+ }).finally(() => {
+ this.modalLoading = false
+ this.showAddInternalLB = false
+ this.fetchData()
+ })
+ })
+ },
+ changePage (page, pageSize) {
+ this.page = page
+ this.pageSize = pageSize
+ this.fetchData()
+ },
+ changePageSize (currentPage, pageSize) {
+ this.page = currentPage
+ this.pageSize = pageSize
+ this.fetchData()
}
}
}