Skip to content

Commit 7939d74

Browse files
committed
ui: only show USER type template
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent d14e5d2 commit 7939d74

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ui/src/utils/plugins.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,10 @@ export const imagesUtilPlugin = {
568568
install (app) {
569569
app.config.globalProperties.$fetchTemplateTypes = function (hypervisor) {
570570
const baseTypes = ['USER']
571-
if (hypervisor !== 'External') {
572-
baseTypes.push('VNF')
571+
if (hypervisor === 'External') {
572+
return baseTypes.map(type => ({ id: type, name: type, description: type }))
573573
}
574+
baseTypes.push('VNF')
574575
const adminTypes = ['SYSTEM', 'BUILTIN', 'ROUTING']
575576
const types = [...baseTypes]
576577
if (store.getters.userInfo?.roletype === 'Admin') {

ui/src/views/image/RegisterOrUploadTemplate.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,9 @@ export default {
10611061
this.fetchNicAdapterTypes()
10621062
this.fetchKeyboardType()
10631063
this.templateTypes.opts = this.$fetchTemplateTypes(hyperVisor)
1064+
if (this.form.templatetype && !this.templateTypes.opts.find(opt => opt.id === this.form.templatetype)) {
1065+
this.form.templatetype = undefined
1066+
}
10641067
10651068
this.form.rootDiskControllerType = this.rootDisk.opts.length > 0 ? 'osdefault' : ''
10661069
},

0 commit comments

Comments
 (0)