Skip to content

Commit 26566fa

Browse files
raveningRakesh Venkatesh
authored andcommitted
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 <r.venkatesh@global.leaseweb.com> Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 76f87ff commit 26566fa

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

ui/src/config/section/image.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ export default {
4343
}
4444
return fields
4545
},
46-
details: ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled', 'directdownload', 'deployasis', 'isextractable', 'isdynamicallyscalable', 'ispublic', 'isfeatured', 'crosszones', 'type', 'account', 'domain', 'created', 'url'],
46+
details: () => {
47+
var fields = ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled',
48+
'directdownload', 'deployasis', 'ispublic', 'isfeatured', 'isextractable', 'isdynamicallyscalable', 'crosszones', 'type',
49+
'account', 'domain', 'created']
50+
if (['Admin'].includes(store.getters.userInfo.roletype)) {
51+
fields.push('templatetype', 'url')
52+
}
53+
return fields
54+
},
4755
searchFilters: ['name', 'zoneid', 'tags'],
4856
related: [{
4957
name: 'vm',
@@ -94,9 +102,14 @@ export default {
94102
args: (record, store) => {
95103
var fields = ['name', 'displaytext', 'passwordenabled', 'ostypeid', 'isdynamicallyscalable']
96104
if (['Admin'].includes(store.userInfo.roletype)) {
97-
fields.push('isrouting')
105+
fields.push('isrouting', 'templatetype')
98106
}
99107
return fields
108+
},
109+
mapping: {
110+
templatetype: {
111+
options: ['BUILTIN', 'USER', 'SYSTEM', 'ROUTING']
112+
}
100113
}
101114
},
102115
{

ui/src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,7 @@
20802080
"label.templates": "Templates",
20812081
"label.templatesubject": "Subject",
20822082
"label.templatetotal": "Template",
2083-
"label.templatetype": "Email Template",
2083+
"label.templatetype": "Template Type",
20842084
"label.tftp.dir": "TFTP Directory",
20852085
"label.tftpdir": "Tftp root directory",
20862086
"label.theme.default": "Default Theme",

0 commit comments

Comments
 (0)