Damans227 commented on code in PR #14215:
URL: https://github.com/apache/cloudstack/pull/14215#discussion_r4283797264
##########
ui/src/config/section/storage.js:
##########
@@ -291,6 +291,15 @@ export default {
return (['Admin', 'DomainAdmin'].includes(store.userInfo.roletype)
|| store.features.allowuserexpungerecovervolume) && record.state === 'Destroy'
}
},
+ {
+ api: 'assignVolume',
+ icon: 'user-add-outlined',
+ label: 'label.assign.volume.another',
+ dataView: true,
+ show: (record) => { return !record.virtualmachineid },
Review Comment:
should we hide this for volumes in destroy state too? the owners count
already went down when it was destroyed, so moving it takes it off a second time
##########
ui/src/views/storage/AssignVolume.vue:
##########
@@ -0,0 +1,176 @@
+// 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.
+
+<template>
+ <div>
+ <div class="form" v-ctrl-enter="submitData">
+
+ <div v-if="loading" class="loading">
+ <loading-outlined style="color: #1890ff;" />
+ </div>
+
+ <ownership-selection @fetch-owner="fetchOwnerOptions" accountId/>
+
+ <div class="submit-btn">
+ <a-button @click="closeAction">
+ {{ $t('label.cancel') }}
+ </a-button>
+ <a-button type="primary" @click="submitData" ref="submit">
+ {{ $t('label.submit') }}
+ </a-button>
+ </div>
+
+ </div>
+
+ </div>
+</template>
+
+<script>
+import { postAPI } from '@/api'
+import ResourceIcon from '@/components/view/ResourceIcon'
+import OwnershipSelection from '@/views/compute/wizard/OwnershipSelection.vue'
+
+export default {
+ name: 'AssignVolume',
+ props: {
+ resource: {
+ type: Object,
+ required: true
+ }
+ },
+ components: {
+ ResourceIcon,
+ OwnershipSelection
+ },
+ inject: ['parentFetchData'],
+ data () {
+ return {
+ domains: [],
+ accounts: [],
+ projects: [],
+ selectedAccountType: 'Account',
+ selectedDomain: null,
+ selectedAccount: null,
+ selectedAccountId: null,
+ selectedProject: null,
+ accountError: false,
+ projectError: false,
+ loading: false
+ }
+ },
+ methods: {
+ fetchOwnerOptions (selectedOptions) {
+ this.selectedAccountType = selectedOptions.selectedAccountType
+ this.selectedAccount = selectedOptions.selectedAccount
+ this.selectedAccountId = selectedOptions.selectedAccountId
+ this.selectedDomain = selectedOptions.selectedDomain
+ this.selectedProject = selectedOptions.selectedProject
+ },
+ closeAction () {
+ this.$emit('close-action')
+ },
+ submitData () {
+ if (this.loading) return
+ let variableKey = ''
+ let variableValue = ''
+
+ if (this.selectedAccountType === 'Account') {
+ if (!this.selectedAccountId) {
+ this.accountError = true
Review Comment:
should this show an error on the form? nothing reads this flag, so submit
with no account picked just does nothing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]