From f8c7b0fd9c1295eb7a6940b5f944e162b57708d3 Mon Sep 17 00:00:00 2001 From: Rakesh Venkatesh Date: Wed, 30 Sep 2020 17:38:40 +0200 Subject: [PATCH] Provide support for adding tags for templates/iso The backed already supports having tags on template and ISO but we dont have support to add it from UI This adds the support for adding tags while registering template/iso or as well as updating already registered template/iso with new tags. --- src/config/section/image.js | 14 ++++++++++---- src/locales/en.json | 1 + src/views/AutogenView.vue | 3 +++ src/views/image/RegisterOrUploadIso.vue | 8 ++++++++ src/views/image/RegisterOrUploadTemplate.vue | 9 +++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/config/section/image.js b/src/config/section/image.js index cba21248d..0c56ef2f1 100644 --- a/src/config/section/image.js +++ b/src/config/section/image.js @@ -43,7 +43,7 @@ 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: ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled', 'directdownload', 'deployasis', 'isextractable', 'isdynamicallyscalable', 'ispublic', 'isfeatured', 'crosszones', 'type', 'templatetag', 'account', 'domain', 'created', 'url'], searchFilters: ['name', 'zoneid', 'tags'], related: [{ name: 'vm', @@ -94,7 +94,7 @@ export default { args: (record, store) => { var fields = ['name', 'displaytext', 'passwordenabled', 'ostypeid', 'isdynamicallyscalable'] if (['Admin'].includes(store.userInfo.roletype)) { - fields.push('isrouting') + fields.push('isrouting', 'templatetag') } return fields } @@ -179,7 +179,7 @@ export default { } return fields }, - details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'crosszones', 'account', 'domain', 'created'], + details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'crosszones', 'templatetag', 'account', 'domain', 'created'], searchFilters: ['name', 'zoneid', 'tags'], related: [{ name: 'vm', @@ -224,7 +224,13 @@ export default { !(record.account === 'system' && record.domainid === 1) && record.isready }, - args: ['name', 'displaytext', 'bootable', 'ostypeid'] + args: (record, store) => { + var fields = ['name', 'displaytext', 'bootable', 'ostypeid'] + if (['Admin'].includes(store.userInfo.roletype)) { + fields.push('templatetag') + } + return fields + } }, { api: 'updateIsoPermissions', diff --git a/src/locales/en.json b/src/locales/en.json index fa54ea1c4..997fef9d3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2076,6 +2076,7 @@ "label.templatenames": "Template", "label.templates": "Templates", "label.templatesubject": "Subject", +"label.templatetag": "Template Tag", "label.templatetotal": "Template", "label.templatetype": "Email Template", "label.tftp.dir": "TFTP Directory", diff --git a/src/views/AutogenView.vue b/src/views/AutogenView.vue index f607ea59d..42470c33c 100644 --- a/src/views/AutogenView.vue +++ b/src/views/AutogenView.vue @@ -946,6 +946,9 @@ export default { if (param.type === 'boolean') { params[key] = false } + if (param.name === 'templatetag') { + params[key] = '' + } break } if (action.mapping && key in action.mapping && action.mapping[key].options) { diff --git a/src/views/image/RegisterOrUploadIso.vue b/src/views/image/RegisterOrUploadIso.vue index d70d282fb..03e31b7e9 100644 --- a/src/views/image/RegisterOrUploadIso.vue +++ b/src/views/image/RegisterOrUploadIso.vue @@ -147,6 +147,14 @@ }]" /> + + + +
{{ this.$t('label.cancel') }} {{ this.$t('label.ok') }} diff --git a/src/views/image/RegisterOrUploadTemplate.vue b/src/views/image/RegisterOrUploadTemplate.vue index 1dc5813c1..c7ff13130 100644 --- a/src/views/image/RegisterOrUploadTemplate.vue +++ b/src/views/image/RegisterOrUploadTemplate.vue @@ -369,6 +369,15 @@ + + + + +
{{ this.$t('label.cancel') }}