From f2d2e03a6c8294d64d843864a969a9814aa7cf99 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Sat, 8 Feb 2020 14:30:32 +0530 Subject: [PATCH] storage: custom upload action for template, iso, volume (#144) This implements custom upload action form for template, iso, volume with progress bar. Signed-off-by: Rohit Yadav Co-authored-by: Rohit Yadav --- ui/src/config/section/image.js | 14 +- ui/src/config/section/storage.js | 18 +- ui/src/views/AutogenView.vue | 1 + ui/src/views/image/RegisterIso.vue | 241 ----- ui/src/views/image/RegisterOrUploadIso.vue | 396 ++++++++ .../views/image/RegisterOrUploadTemplate.vue | 952 ++++++++++++++++++ ui/src/views/image/RegisterTemplate.vue | 798 --------------- ui/src/views/storage/UploadLocalVolume.vue | 222 +++- 8 files changed, 1566 insertions(+), 1076 deletions(-) delete mode 100644 ui/src/views/image/RegisterIso.vue create mode 100644 ui/src/views/image/RegisterOrUploadIso.vue create mode 100644 ui/src/views/image/RegisterOrUploadTemplate.vue delete mode 100644 ui/src/views/image/RegisterTemplate.vue diff --git a/ui/src/config/section/image.js b/ui/src/config/section/image.js index b8d837d6765..14f908fffe3 100644 --- a/ui/src/config/section/image.js +++ b/ui/src/config/section/image.js @@ -48,10 +48,10 @@ export default { { api: 'registerTemplate', icon: 'plus', - label: 'Create template', + label: 'Register Template', listView: true, popup: true, - component: () => import('@/views/image/RegisterTemplate.vue') + component: () => import('@/views/image/RegisterOrUploadTemplate.vue') }, { api: 'getUploadParamsForTemplate', @@ -59,7 +59,7 @@ export default { label: 'Upload Local Template', listView: true, popup: true, - component: () => import('@/views/image/UploadLocalTemplate.vue') + component: () => import('@/views/image/RegisterOrUploadTemplate.vue') }, { api: 'updateTemplate', @@ -88,7 +88,7 @@ export default { { api: 'updateTemplatePermissions', icon: 'reconciliation', - label: 'Update template permissions', + label: 'Update Template Permissions', dataView: true, popup: true, show: (record, store) => { return (['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && (record.domainid === store.userInfo.domainid && record.account === store.userInfo.account) || record.templatetype !== 'BUILTIN') }, @@ -139,15 +139,15 @@ export default { label: 'Register ISO', listView: true, popup: true, - component: () => import('@/views/image/RegisterIso.vue') + component: () => import('@/views/image/RegisterOrUploadIso.vue') }, { api: 'getUploadParamsForIso', icon: 'cloud-upload', - label: 'Upload Local Iso', + label: 'Upload Local ISO', listView: true, popup: true, - component: () => import('@/views/image/UploadLocalIso.vue') + component: () => import('@/views/image/RegisterOrUploadIso.vue') }, { api: 'updateIso', diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js index bd7e009cd25..34a46e93cfc 100644 --- a/ui/src/config/section/storage.js +++ b/ui/src/config/section/storage.js @@ -40,7 +40,16 @@ export default { label: 'Create Volume', listView: true, args: ['name', 'zoneid', 'diskofferingid'] - }, { + }, + { + api: 'getUploadParamsForVolume', + icon: 'cloud-upload', + label: 'Upload Local Volume', + listView: true, + popup: true, + component: () => import('@/views/storage/UploadLocalVolume.vue') + }, + { api: 'uploadVolume', icon: 'link', label: 'Upload Volume From URL', @@ -51,13 +60,6 @@ export default { options: ['RAW', 'VHD', 'VHDX', 'OVA', 'QCOW2'] } } - }, { - api: 'getUploadParamsForVolume', - icon: 'cloud-upload', - label: 'Upload Local Volume', - listView: true, - popup: true, - component: () => import('@/views/storage/UploadLocalVolume.vue') }, { api: 'attachVolume', diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index b8727b6ddea..f267d1ff64d 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -74,6 +74,7 @@ :is="currentAction.component" :resource="resource" :loading="loading" + :action="{currentAction}" v-bind="{currentAction}" @refresh-data="fetchData" @poll-action="pollActionCompletion" diff --git a/ui/src/views/image/RegisterIso.vue b/ui/src/views/image/RegisterIso.vue deleted file mode 100644 index ec44460863d..00000000000 --- a/ui/src/views/image/RegisterIso.vue +++ /dev/null @@ -1,241 +0,0 @@ -// 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. - - - - - - diff --git a/ui/src/views/image/RegisterOrUploadIso.vue b/ui/src/views/image/RegisterOrUploadIso.vue new file mode 100644 index 00000000000..664833668c5 --- /dev/null +++ b/ui/src/views/image/RegisterOrUploadIso.vue @@ -0,0 +1,396 @@ +// 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. + + + + + + diff --git a/ui/src/views/image/RegisterOrUploadTemplate.vue b/ui/src/views/image/RegisterOrUploadTemplate.vue new file mode 100644 index 00000000000..ad8617887b9 --- /dev/null +++ b/ui/src/views/image/RegisterOrUploadTemplate.vue @@ -0,0 +1,952 @@ +// 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. + + + + + + diff --git a/ui/src/views/image/RegisterTemplate.vue b/ui/src/views/image/RegisterTemplate.vue deleted file mode 100644 index 5f5f061b9ee..00000000000 --- a/ui/src/views/image/RegisterTemplate.vue +++ /dev/null @@ -1,798 +0,0 @@ -// 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. - - - - - - diff --git a/ui/src/views/storage/UploadLocalVolume.vue b/ui/src/views/storage/UploadLocalVolume.vue index e5bd7ee91c8..a145ca6ef39 100644 --- a/ui/src/views/storage/UploadLocalVolume.vue +++ b/ui/src/views/storage/UploadLocalVolume.vue @@ -16,41 +16,219 @@ // under the License. -