From aa37e07adf77642cbc7c41a5c790404b13b3d86a Mon Sep 17 00:00:00 2001 From: Rakesh Venkatesh Date: Tue, 27 Oct 2020 19:07:43 +0100 Subject: [PATCH 1/3] Allow changing template type by admin Currently the template has following types: 'BUILTIN', 'USER', 'SYSTEM', 'ROUTING', 'PERHOST' Provide ui support for admins os that they can change the template type --- src/config/section/image.js | 17 +++++++++++++++-- src/locales/en.json | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/config/section/image.js b/src/config/section/image.js index cba21248d..c98c99ddb 100644 --- a/src/config/section/image.js +++ b/src/config/section/image.js @@ -43,7 +43,15 @@ export default { } return fields }, - details: ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled', 'directdownload', 'deployasis', 'isextractable', 'isdynamicallyscalable', 'ispublic', 'isfeatured', 'crosszones', 'type', 'account', 'domain', 'created', 'url'], + details: () => { + var fields = ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled', + 'directdownload', 'deployasis', 'isextractable', 'isdynamicallyscalable', 'crosszones', 'type', + 'account', 'domain', 'created'] + if (['Admin'].includes(store.getters.userInfo.roletype)) { + fields.push('ispublic', 'isrouting', 'isfeatured', 'templatetype', 'url') + } + return fields + }, searchFilters: ['name', 'zoneid', 'tags'], related: [{ name: 'vm', @@ -94,9 +102,14 @@ export default { args: (record, store) => { var fields = ['name', 'displaytext', 'passwordenabled', 'ostypeid', 'isdynamicallyscalable'] if (['Admin'].includes(store.userInfo.roletype)) { - fields.push('isrouting') + fields.push('isrouting', 'templatetype') } return fields + }, + mapping: { + templatetype: { + options: ['BUILTIN', 'USER', 'SYSTEM', 'ROUTING', 'PERHOST'] + } } }, { diff --git a/src/locales/en.json b/src/locales/en.json index 922dda58b..5b8c0ce6c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2079,7 +2079,7 @@ "label.templates": "Templates", "label.templatesubject": "Subject", "label.templatetotal": "Template", -"label.templatetype": "Email Template", +"label.templatetype": "Template Type", "label.tftp.dir": "TFTP Directory", "label.tftpdir": "Tftp root directory", "label.theme.default": "Default Theme", From 1ce12f805bdbb3aabfc51d64a43cb14f095f07a5 Mon Sep 17 00:00:00 2001 From: Rakesh Venkatesh Date: Wed, 28 Oct 2020 11:28:08 +0100 Subject: [PATCH 2/3] add extr afields --- src/config/section/image.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/section/image.js b/src/config/section/image.js index c98c99ddb..a1c278e15 100644 --- a/src/config/section/image.js +++ b/src/config/section/image.js @@ -45,10 +45,10 @@ export default { }, details: () => { var fields = ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled', - 'directdownload', 'deployasis', 'isextractable', 'isdynamicallyscalable', 'crosszones', 'type', + 'directdownload', 'deployasis', 'ispublic', 'isfeatured', 'isextractable', 'isdynamicallyscalable', 'crosszones', 'type', 'account', 'domain', 'created'] if (['Admin'].includes(store.getters.userInfo.roletype)) { - fields.push('ispublic', 'isrouting', 'isfeatured', 'templatetype', 'url') + fields.push('templatetype', 'url') } return fields }, From b2c10b417f42028b651523d2199930ec29bbe36a Mon Sep 17 00:00:00 2001 From: Rakesh Venkatesh Date: Thu, 29 Oct 2020 10:00:53 +0100 Subject: [PATCH 3/3] remove perhost --- src/config/section/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/section/image.js b/src/config/section/image.js index a1c278e15..eba2f8499 100644 --- a/src/config/section/image.js +++ b/src/config/section/image.js @@ -108,7 +108,7 @@ export default { }, mapping: { templatetype: { - options: ['BUILTIN', 'USER', 'SYSTEM', 'ROUTING', 'PERHOST'] + options: ['BUILTIN', 'USER', 'SYSTEM', 'ROUTING'] } } },