This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ce0b40  Allow changing template type by admin (#838)
4ce0b40 is described below

commit 4ce0b40560d7e5472199473ffd7f79103f90683a
Author: Rakesh <[email protected]>
AuthorDate: Tue Dec 1 09:28:56 2020 +0100

    Allow changing template type by admin (#838)
    
    * 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
    
    * add extr afields
    
    * remove perhost
    
    Co-authored-by: Rakesh Venkatesh <[email protected]>
---
 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 72e6d6f..1d9a15f 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', 'ispublic', 'isfeatured', 
'isextractable', 'isdynamicallyscalable', 'crosszones', 'type',
+          'account', 'domain', 'created']
+        if (['Admin'].includes(store.getters.userInfo.roletype)) {
+          fields.push('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']
+            }
           }
         },
         {
diff --git a/src/locales/en.json b/src/locales/en.json
index ca3a56b..894b735 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -2080,7 +2080,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",

Reply via email to