mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
FIX - Detail setting tab interface (#861)
* fixes detail setting tab interface * autofocus to the key Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
89445d24f8
commit
2067454537
@ -28,28 +28,44 @@
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
icon="plus"
|
icon="plus"
|
||||||
:disabled="!('updateTemplate' in $store.getters.apis && 'updateVirtualMachine' in $store.getters.apis && isAdminOrOwner())"
|
:disabled="!('updateTemplate' in $store.getters.apis && 'updateVirtualMachine' in $store.getters.apis && isAdminOrOwner())"
|
||||||
@click="showAddDetail = true">
|
@click="onShowAddDetail">
|
||||||
{{ $t('label.add.setting') }}
|
{{ $t('label.add.setting') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="showAddDetail">
|
<div v-show="showAddDetail">
|
||||||
<a-auto-complete
|
<a-input-group
|
||||||
style="width: 100%"
|
type="text"
|
||||||
:filterOption="filterOption"
|
compact>
|
||||||
:value="newKey"
|
<a-auto-complete
|
||||||
:dataSource="Object.keys(detailOptions)"
|
class="detail-input"
|
||||||
:placeholder="$t('label.name')"
|
ref="keyElm"
|
||||||
@change="e => onAddInputChange(e, 'newKey')" />
|
:filterOption="filterOption"
|
||||||
<a-auto-complete
|
:value="newKey"
|
||||||
style="width: 100%"
|
:dataSource="Object.keys(detailOptions)"
|
||||||
:filterOption="filterOption"
|
:placeholder="$t('label.name')"
|
||||||
:value="newValue"
|
@change="e => onAddInputChange(e, 'newKey')" />
|
||||||
:dataSource="detailOptions[newKey]"
|
<a-input style=" width: 30px; border-left: 0; pointer-events: none; backgroundColor: #fff" placeholder="=" disabled />
|
||||||
:placeholder="$t('label.value')"
|
<a-auto-complete
|
||||||
@change="e => onAddInputChange(e, 'newValue')" />
|
class="detail-input"
|
||||||
|
:filterOption="filterOption"
|
||||||
|
:value="newValue"
|
||||||
|
:dataSource="detailOptions[newKey]"
|
||||||
|
:placeholder="$t('label.value')"
|
||||||
|
@change="e => onAddInputChange(e, 'newValue')" />
|
||||||
|
<a-tooltip arrowPointAtCenter placement="topRight">
|
||||||
|
<template slot="title">
|
||||||
|
{{ $t('label.add.setting') }}
|
||||||
|
</template>
|
||||||
|
<a-button icon="check" @click="addDetail" class="detail-button"></a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-tooltip arrowPointAtCenter placement="topRight">
|
||||||
|
<template slot="title">
|
||||||
|
{{ $t('label.cancel') }}
|
||||||
|
</template>
|
||||||
|
<a-button icon="close" @click="closeDetail" class="detail-button"></a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
</a-input-group>
|
||||||
<p v-if="error" style="color: red"> {{ $t(error) }} </p>
|
<p v-if="error" style="color: red"> {{ $t(error) }} </p>
|
||||||
<a-button type="primary" style="width: 25%" icon="plus" @click="addDetail">{{ $t('label.add.setting') }}</a-button>
|
|
||||||
<a-button type="dashed" style="width: 25%" icon="close" @click="showAddDetail = false">{{ $t('label.cancel') }}</a-button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a-list size="large">
|
<a-list size="large">
|
||||||
@ -169,6 +185,7 @@ export default {
|
|||||||
this.$set(this.details, index, this.details[index])
|
this.$set(this.details, index, this.details[index])
|
||||||
},
|
},
|
||||||
onAddInputChange (val, obj) {
|
onAddInputChange (val, obj) {
|
||||||
|
this.error = false
|
||||||
this[obj] = val
|
this[obj] = val
|
||||||
},
|
},
|
||||||
isAdminOrOwner () {
|
isAdminOrOwner () {
|
||||||
@ -234,7 +251,29 @@ export default {
|
|||||||
deleteDetail (index) {
|
deleteDetail (index) {
|
||||||
this.details.splice(index, 1)
|
this.details.splice(index, 1)
|
||||||
this.runApi()
|
this.runApi()
|
||||||
|
},
|
||||||
|
onShowAddDetail () {
|
||||||
|
this.showAddDetail = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.keyElm.focus()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeDetail () {
|
||||||
|
this.newKey = ''
|
||||||
|
this.newValue = ''
|
||||||
|
this.error = false
|
||||||
|
this.showAddDetail = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.detail-input {
|
||||||
|
width: calc(calc(100% / 2) - 45px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-button {
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user