mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-15 07:20:26 +00:00
ui: hide 'no tags' field and edit icon without VM.Config.Options
they cannot edit them anyway, so no point in showing them that there is no tag Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
56dee217bc
commit
1b48b8b7a1
@ -7,6 +7,9 @@ Ext.define('PVE.panel.TagEditContainer', {
|
|||||||
align: 'middle',
|
align: 'middle',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// set to false to hide the 'no tags' field and the edit button
|
||||||
|
canEdit: true,
|
||||||
|
|
||||||
controller: {
|
controller: {
|
||||||
xclass: 'Ext.app.ViewController',
|
xclass: 'Ext.app.ViewController',
|
||||||
|
|
||||||
@ -241,6 +244,7 @@ Ext.define('PVE.panel.TagEditContainer', {
|
|||||||
if (view.tags) {
|
if (view.tags) {
|
||||||
me.loadTags(view.tags);
|
me.loadTags(view.tags);
|
||||||
}
|
}
|
||||||
|
me.getViewModel().set('canEdit', view.canEdit);
|
||||||
|
|
||||||
me.mon(Ext.GlobalEvents, 'loadedUiOptions', () => {
|
me.mon(Ext.GlobalEvents, 'loadedUiOptions', () => {
|
||||||
view.toggleCls('hide-handles', PVE.Utils.shouldSortTags());
|
view.toggleCls('hide-handles', PVE.Utils.shouldSortTags());
|
||||||
@ -253,11 +257,15 @@ Ext.define('PVE.panel.TagEditContainer', {
|
|||||||
data: {
|
data: {
|
||||||
tagCount: 0,
|
tagCount: 0,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
|
canEdit: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
formulas: {
|
formulas: {
|
||||||
hideNoTags: function(get) {
|
hideNoTags: function(get) {
|
||||||
return get('tagCount') !== 0;
|
return get('tagCount') !== 0 || !get('canEdit');
|
||||||
|
},
|
||||||
|
hideEditBtn: function(get) {
|
||||||
|
return get('editMode') || !get('canEdit');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -326,7 +334,7 @@ Ext.define('PVE.panel.TagEditContainer', {
|
|||||||
cls: 'pve-tag-inline-button',
|
cls: 'pve-tag-inline-button',
|
||||||
html: `<i data-qtip="${gettext('Edit Tags')}" class="fa fa-pencil"></i>`,
|
html: `<i data-qtip="${gettext('Edit Tags')}" class="fa fa-pencil"></i>`,
|
||||||
bind: {
|
bind: {
|
||||||
hidden: '{editMode}',
|
hidden: '{hideEditBtn}',
|
||||||
},
|
},
|
||||||
listeners: {
|
listeners: {
|
||||||
click: 'editClick',
|
click: 'editClick',
|
||||||
|
@ -186,6 +186,7 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
|
|
||||||
let tagsContainer = Ext.create('PVE.panel.TagEditContainer', {
|
let tagsContainer = Ext.create('PVE.panel.TagEditContainer', {
|
||||||
tags: vm.tags,
|
tags: vm.tags,
|
||||||
|
canEdit: !!caps.vms['VM.Config.Options'],
|
||||||
listeners: {
|
listeners: {
|
||||||
change: function(tags) {
|
change: function(tags) {
|
||||||
Proxmox.Utils.API2Request({
|
Proxmox.Utils.API2Request({
|
||||||
|
@ -222,6 +222,7 @@ Ext.define('PVE.qemu.Config', {
|
|||||||
|
|
||||||
let tagsContainer = Ext.create('PVE.panel.TagEditContainer', {
|
let tagsContainer = Ext.create('PVE.panel.TagEditContainer', {
|
||||||
tags: vm.tags,
|
tags: vm.tags,
|
||||||
|
canEdit: !!caps.vms['VM.Config.Options'],
|
||||||
listeners: {
|
listeners: {
|
||||||
change: function(tags) {
|
change: function(tags) {
|
||||||
Proxmox.Utils.API2Request({
|
Proxmox.Utils.API2Request({
|
||||||
|
Loading…
Reference in New Issue
Block a user