diff --git a/src/views/compute/DeployVM.vue b/src/views/compute/DeployVM.vue index 9d2ca9666..2446516e7 100644 --- a/src/views/compute/DeployVM.vue +++ b/src/views/compute/DeployVM.vue @@ -137,6 +137,8 @@
@@ -205,6 +210,8 @@
{ + if (field in this.vm) { + this.vm[field] = this.instanceConfig[field] + } + }) } }) this.form.getFieldDecorator('computeofferingid', { initialValue: undefined, preserve: true }) @@ -778,7 +808,6 @@ export default { this.fetchKeyboard() this.fetchBootTypes() this.fetchBootModes() - Vue.nextTick().then(() => { ['name', 'keyboard', 'boottype', 'bootmode', 'userdata'].forEach(this.fillValue) this.instanceConfig = this.form.getFieldsValue() // ToDo: maybe initialize with some other defaults @@ -952,6 +981,12 @@ export default { description: this.$t('message.template.iso') }) return + } else if (values.isoid && (!values.diskofferingid || values.diskofferingid === '0')) { + this.$notification.error({ + message: 'Request Failed', + description: this.$t('Please select a Disk Offering to continue') + }) + return } this.loading.deploy = true @@ -1107,6 +1142,7 @@ export default { param.loading = false _.map(response, (responseItem, responseKey) => { if (Object.keys(responseItem).length === 0) { + this.rowCount[name] = 0 this.options[name] = [] this.$forceUpdate() return @@ -1116,6 +1152,7 @@ export default { } _.map(responseItem, (response, key) => { if (key === 'count') { + this.rowCount[name] = response return } param.opts = response diff --git a/src/views/compute/wizard/AffinityGroupSelection.vue b/src/views/compute/wizard/AffinityGroupSelection.vue index f429249ab..25a9fbd8c 100644 --- a/src/views/compute/wizard/AffinityGroupSelection.vue +++ b/src/views/compute/wizard/AffinityGroupSelection.vue @@ -27,12 +27,25 @@ :columns="columns" :dataSource="items" :rowKey="record => record.id" - :pagination="{showSizeChanger: true}" + :pagination="false" :rowSelection="rowSelection" size="middle" :scroll="{ y: 225 }" > + +
+ +
@@ -46,6 +59,10 @@ export default { type: Array, default: () => [] }, + rowCount: { + type: Number, + default: () => 0 + }, value: { type: Array, default: () => [] @@ -57,6 +74,10 @@ export default { preFillContent: { type: Object, default: () => {} + }, + zoneId: { + type: String, + default: () => '' } }, data () { @@ -74,17 +95,16 @@ export default { width: '60%' } ], - selectedRowKeys: [] - } - }, - computed: { - options () { - return { + selectedRowKeys: [], + oldZoneId: null, + options: { page: 1, pageSize: 10, - keyword: '' + keyword: null } - }, + } + }, + computed: { rowSelection () { return { type: 'checkbox', @@ -107,6 +127,10 @@ export default { this.selectedRowKeys = this.preFillContent.affinitygroupids this.$emit('select-affinity-group-item', this.preFillContent.affinitygroupids) } else { + if (this.oldZoneId === this.zoneId) { + return + } + this.oldZoneId = this.zoneId this.selectedRowKeys = [] this.$emit('select-affinity-group-item', null) } @@ -116,12 +140,19 @@ export default { methods: { handleSearch (value) { this.filter = value + this.options.page = 1 + this.options.pageSize = 10 this.options.keyword = this.filter this.$emit('handle-search-filter', this.options) }, - handleTableChange (pagination) { - this.options.page = pagination.current - this.options.pageSize = pagination.pageSize + onChangePage (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize + this.$emit('handle-search-filter', this.options) + }, + onChangePageSize (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize this.$emit('handle-search-filter', this.options) } } diff --git a/src/views/compute/wizard/ComputeOfferingSelection.vue b/src/views/compute/wizard/ComputeOfferingSelection.vue index 1f6c0f022..6d72af76f 100644 --- a/src/views/compute/wizard/ComputeOfferingSelection.vue +++ b/src/views/compute/wizard/ComputeOfferingSelection.vue @@ -25,16 +25,28 @@ {{ $t('label.cpu') }} {{ $t('label.memory') }} + +
+ +
@@ -46,6 +58,10 @@ export default { type: Array, default: () => [] }, + rowCount: { + type: Number, + default: () => 0 + }, value: { type: String, default: '' @@ -57,6 +73,10 @@ export default { preFillContent: { type: Object, default: () => {} + }, + zoneId: { + type: String, + default: () => '' } }, data () { @@ -79,17 +99,16 @@ export default { width: '30%' } ], - selectedRowKeys: [] - } - }, - computed: { - options () { - return { + selectedRowKeys: [], + oldZoneId: null, + options: { page: 1, pageSize: 10, - keyword: '' + keyword: null } - }, + } + }, + computed: { tableSource () { return this.computeItems.map((item) => { var cpuNumberValue = item.cpunumber + '' @@ -137,6 +156,10 @@ export default { this.selectedRowKeys = [this.preFillContent.computeofferingid] this.$emit('select-compute-item', this.preFillContent.computeofferingid) } else { + if (this.oldZoneId === this.zoneId) { + return + } + this.oldZoneId = this.zoneId if (this.computeItems && this.computeItems.length > 0) { this.selectedRowKeys = [this.computeItems[0].id] this.$emit('select-compute-item', this.computeItems[0].id) @@ -152,12 +175,19 @@ export default { }, handleSearch (value) { this.filter = value + this.options.page = 1 + this.options.pageSize = 10 this.options.keyword = this.filter this.$emit('handle-search-filter', this.options) }, - handleTableChange (pagination) { - this.options.page = pagination.current - this.options.pageSize = pagination.pageSize + onChangePage (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize + this.$emit('handle-search-filter', this.options) + }, + onChangePageSize (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize this.$emit('handle-search-filter', this.options) } } diff --git a/src/views/compute/wizard/DiskOfferingSelection.vue b/src/views/compute/wizard/DiskOfferingSelection.vue index c2bdf50f3..7324eb1d3 100644 --- a/src/views/compute/wizard/DiskOfferingSelection.vue +++ b/src/views/compute/wizard/DiskOfferingSelection.vue @@ -26,10 +26,9 @@ :loading="loading" :columns="columns" :dataSource="tableSource" - :pagination="{showSizeChanger: true}" + :pagination="false" :rowSelection="rowSelection" size="middle" - @change="handleTableChange" :scroll="{ y: 225 }" > {{ $t('label.disksize') }} @@ -46,6 +45,19 @@ - + +
+ +
@@ -57,6 +69,10 @@ export default { type: Array, default: () => [] }, + rowCount: { + type: Number, + default: () => 0 + }, value: { type: String, default: '' @@ -68,6 +84,14 @@ export default { preFillContent: { type: Object, default: () => {} + }, + zoneId: { + type: String, + default: () => '' + }, + isIsoSelected: { + type: Boolean, + default: false } }, data () { @@ -93,20 +117,19 @@ export default { } ], selectedRowKeys: ['0'], - dataItems: [] + dataItems: [], + oldZoneId: null, + options: { + page: 1, + pageSize: 10, + keyword: null + } } }, created () { this.initDataItem() }, computed: { - options () { - return { - page: 1, - pageSize: 10, - keyword: '' - } - }, tableSource () { return this.dataItems.map((item) => { return { @@ -145,23 +168,43 @@ export default { this.selectedRowKeys = [this.preFillContent.diskofferingid] this.$emit('select-disk-offering-item', this.preFillContent.diskofferingid) } else { + if (this.oldZoneId === this.zoneId) { + return + } + this.oldZoneId = this.zoneId this.selectedRowKeys = ['0'] this.$emit('select-disk-offering-item', '0') } } + }, + isIsoSelected () { + if (this.isIsoSelected) { + this.dataItems = this.dataItems.filter(item => item.id !== '0') + } else { + this.dataItems.unshift({ + id: '0', + name: this.$t('label.noselect'), + diskSize: undefined, + miniops: undefined, + maxiops: undefined, + isCustomized: undefined + }) + } } }, methods: { initDataItem () { this.dataItems = [] - this.dataItems.push({ - id: '0', - name: this.$t('label.noselect'), - diskSize: undefined, - miniops: undefined, - maxiops: undefined, - isCustomized: undefined - }) + if (this.options.page === 1 && !this.isIsoSelected) { + this.dataItems.push({ + id: '0', + name: this.$t('label.noselect'), + diskSize: undefined, + miniops: undefined, + maxiops: undefined, + isCustomized: undefined + }) + } }, onSelectRow (value) { this.selectedRowKeys = value @@ -169,12 +212,19 @@ export default { }, handleSearch (value) { this.filter = value + this.options.page = 1 + this.options.pageSize = 10 this.options.keyword = this.filter this.$emit('handle-search-filter', this.options) }, - handleTableChange (pagination) { - this.options.page = pagination.current - this.options.pageSize = pagination.pageSize + onChangePage (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize + this.$emit('handle-search-filter', this.options) + }, + onChangePageSize (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize this.$emit('handle-search-filter', this.options) } } diff --git a/src/views/compute/wizard/NetworkSelection.vue b/src/views/compute/wizard/NetworkSelection.vue index 171ef9a24..2baf4c3db 100644 --- a/src/views/compute/wizard/NetworkSelection.vue +++ b/src/views/compute/wizard/NetworkSelection.vue @@ -30,9 +30,8 @@ :columns="columns" :dataSource="networkItems" :rowKey="record => record.id" - :pagination="{showSizeChanger: true, size: 'small'}" + :pagination="false" :rowSelection="rowSelection" - @change="handleTableChange" :scroll="{ y: 225 }" > + +
+ +
+ [] }, + rowCount: { + type: Number, + default: () => 0 + }, value: { type: Array, default: () => [] @@ -111,17 +128,16 @@ export default { loading: false, opts: [] }, - showCreateForm: false - } - }, - computed: { - options () { - return { + showCreateForm: false, + oldZoneId: null, + options: { page: 1, pageSize: 10, - keyword: '' + keyword: null } - }, + } + }, + computed: { columns () { let vpcFilter = [] if (this.vpcs) { @@ -189,6 +205,10 @@ export default { this.$emit('select-network-item', this.preFillContent.networkids) } else { if (this.items && this.items.length > 0) { + if (this.oldZoneId === this.zoneId) { + return + } + this.oldZoneId = this.zoneId this.selectedRowKeys = [this.items[0].id] this.$emit('select-network-item', this.selectedRowKeys) } else { @@ -225,12 +245,19 @@ export default { }, handleSearch (value) { this.filter = value + this.options.page = 1 + this.options.pageSize = 10 this.options.keyword = this.filter this.$emit('handle-search-filter', this.options) }, - handleTableChange (pagination) { - this.options.page = pagination.current - this.options.pageSize = pagination.pageSize + onChangePage (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize + this.$emit('handle-search-filter', this.options) + }, + onChangePageSize (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize this.$emit('handle-search-filter', this.options) }, listNetworkOfferings () { diff --git a/src/views/compute/wizard/SshKeyPairSelection.vue b/src/views/compute/wizard/SshKeyPairSelection.vue index fe830f889..c33625645 100644 --- a/src/views/compute/wizard/SshKeyPairSelection.vue +++ b/src/views/compute/wizard/SshKeyPairSelection.vue @@ -26,15 +26,26 @@ :loading="loading" :columns="columns" :dataSource="tableSource" - :pagination="{showSizeChanger: true}" :rowSelection="rowSelection" + :pagination="false" size="middle" - @change="handleTableChange" :scroll="{ y: 225 }" > +
+ +
@@ -46,6 +57,10 @@ export default { type: Array, default: () => [] }, + rowCount: { + type: Number, + default: () => 0 + }, value: { type: String, default: '' @@ -57,6 +72,10 @@ export default { preFillContent: { type: Object, default: () => {} + }, + zoneId: { + type: String, + default: () => '' } }, data () { @@ -80,20 +99,19 @@ export default { } ], selectedRowKeys: [this.$t('label.noselect')], - dataItems: [] + dataItems: [], + oldZoneId: null, + options: { + page: 1, + pageSize: 10, + keyword: null + } } }, created () { this.initDataItem() }, computed: { - options () { - return { - page: 1, - pageSize: 10, - keyword: '' - } - }, tableSource () { return this.dataItems.map((item) => { return { @@ -130,8 +148,12 @@ export default { this.selectedRowKeys = [this.preFillContent.keypair] this.$emit('select-ssh-key-pair-item', this.preFillContent.keypair) } else { - this.selectedRowKeys = [this.$t('label.noselect')] - this.$emit('select-ssh-key-pair-item', this.$t('label.noselect')) + if (this.oldZoneId === this.zoneId) { + return + } + this.oldZoneId = this.zoneId + this.selectedRowKeys = [this.dataItems[0].name] + this.$emit('select-ssh-key-pair-item', this.dataItems[0].name) } } } @@ -139,11 +161,13 @@ export default { methods: { initDataItem () { this.dataItems = [] - this.dataItems.push({ - name: this.$t('label.noselect'), - account: '-', - domain: '-' - }) + if (this.options.page === 1) { + this.dataItems.push({ + name: this.$t('label.noselect'), + account: '-', + domain: '-' + }) + } }, onSelectRow (value) { this.selectedRowKeys = value @@ -151,12 +175,19 @@ export default { }, handleSearch (value) { this.filter = value + this.options.page = 1 + this.options.pageSize = 10 this.options.keyword = this.filter this.$emit('handle-search-filter', this.options) }, - handleTableChange (pagination) { - this.options.page = pagination.current - this.options.pageSize = pagination.pageSize + onChangePage (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize + this.$emit('handle-search-filter', this.options) + }, + onChangePageSize (page, pageSize) { + this.options.page = page + this.options.pageSize = pageSize this.$emit('handle-search-filter', this.options) } } diff --git a/src/views/compute/wizard/TemplateIsoRadioGroup.vue b/src/views/compute/wizard/TemplateIsoRadioGroup.vue index a77d97ad5..f351aa77e 100644 --- a/src/views/compute/wizard/TemplateIsoRadioGroup.vue +++ b/src/views/compute/wizard/TemplateIsoRadioGroup.vue @@ -22,7 +22,7 @@ itemLayout="vertical" size="small" :dataSource="osList" - :pagination="pagination"> + :pagination="false"> + +
+ +
@@ -107,19 +120,6 @@ export default { this.$emit('emit-update-template-iso', this.inputDecorator, this.value) }, - computed: { - pagination () { - return { - size: 'small', - page: 1, - pageSize: 10, - total: this.itemCount, - showSizeChanger: true, - onChange: this.onChangePage, - onShowSizeChange: this.onChangePageSize - } - } - }, methods: { isShared (item) { return !item.ispublic && (item.account !== store.getters.userInfo.account) @@ -131,13 +131,13 @@ export default { this.$emit('emit-update-template-iso', this.inputDecorator, id) }, onChangePage (page, pageSize) { - this.pagination.page = page - this.pagination.pageSize = pageSize + this.page = page + this.pageSize = pageSize this.$forceUpdate() }, onChangePageSize (page, pageSize) { - this.pagination.page = page - this.pagination.pageSize = pageSize + this.page = page + this.pageSize = pageSize this.$forceUpdate() }, onFilterTag (tag) { diff --git a/src/views/compute/wizard/TemplateIsoSelection.vue b/src/views/compute/wizard/TemplateIsoSelection.vue index a935c3e0c..ae1725e82 100644 --- a/src/views/compute/wizard/TemplateIsoSelection.vue +++ b/src/views/compute/wizard/TemplateIsoSelection.vue @@ -171,7 +171,6 @@ export default { beforeCreate () { this.form = this.$form.createForm(this) }, - inject: ['vmFetchTemplates', 'vmFetchIsos'], methods: { mappingDataSource () { let mappedItems = {}