]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/qemu/Config.js
api: add proxmox-firewall to versions pkg list
[pve-manager.git] / www / manager6 / qemu / Config.js
index b5f8cc9c1802b3f4773fdd517e692fae46b684fb..f28ee67bb748b857dd9d021580c4106ccf46a98a 100644 (file)
@@ -3,6 +3,7 @@ Ext.define('PVE.qemu.Config', {
     alias: 'widget.PVE.qemu.Config',
 
     onlineHelp: 'chapter_virtual_machines',
+    userCls: 'proxmox-tags-full',
 
     initComponent: function() {
         var me = this;
@@ -66,7 +67,7 @@ Ext.define('PVE.qemu.Config', {
        var migrateBtn = Ext.create('Ext.Button', {
            text: gettext('Migrate'),
            disabled: !caps.vms['VM.Migrate'],
-           hidden: PVE.data.ResourceStore.getNodes().length < 2,
+           hidden: PVE.Utils.isStandaloneNode(),
            handler: function() {
                var win = Ext.create('PVE.window.Migrate', {
                    vmtype: 'qemu',
@@ -125,9 +126,10 @@ Ext.define('PVE.qemu.Config', {
                    itemId: 'removeBtn',
                    disabled: !caps.vms['VM.Allocate'],
                    handler: function() {
-                       Ext.create('PVE.window.SafeDestroy', {
+                       Ext.create('PVE.window.SafeDestroyGuest', {
                            url: base_url,
                            item: { type: 'VM', id: vmid },
+                           taskName: 'qmdestroy',
                        }).show();
                    },
                    iconCls: 'fa fa-trash-o',
@@ -174,11 +176,13 @@ Ext.define('PVE.qemu.Config', {
                }, {
                    text: gettext('Stop'),
                    disabled: !caps.vms['VM.PowerMgmt'],
-                   dangerous: true,
                    tooltip: Ext.String.format(gettext('Stop {0} immediately'), 'VM'),
-                   confirmMsg: Proxmox.Utils.format_task_description('qmstop', vmid),
                    handler: function() {
-                       vm_command("stop", { timeout: 30 });
+                       Ext.create('PVE.GuestStop', {
+                           nodename: nodename,
+                           vm: vm,
+                           autoShow: true,
+                       });
                    },
                    iconCls: 'fa fa-stop',
                }, {
@@ -199,6 +203,7 @@ Ext.define('PVE.qemu.Config', {
            disabled: !caps.vms['VM.Console'],
            hidden: template,
            consoleType: 'kvm',
+           // disable spice/xterm for default action until status api call succeeded
            enableSpice: false,
            enableXtermjs: false,
            consoleName: vm.name,
@@ -217,11 +222,36 @@ Ext.define('PVE.qemu.Config', {
            ],
        });
 
+       let tagsContainer = Ext.create('PVE.panel.TagEditContainer', {
+           tags: vm.tags,
+           canEdit: !!caps.vms['VM.Config.Options'],
+           listeners: {
+               change: function(tags) {
+                   Proxmox.Utils.API2Request({
+                       url: base_url + '/config',
+                       method: 'PUT',
+                       params: {
+                           tags,
+                       },
+                       success: function() {
+                           me.statusStore.load();
+                       },
+                       failure: function(response) {
+                           Ext.Msg.alert('Error', response.htmlStatus);
+                           me.statusStore.load();
+                       },
+                   });
+               },
+           },
+       });
+
+       let vm_text = `${vm.vmid} (${vm.name})`;
+
        Ext.apply(me, {
-           title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm.text, nodename),
+           title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm_text, nodename),
            hstateid: 'kvmtab',
            tbarSpacing: false,
-           tbar: [statusTxt, '->', resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn],
+           tbar: [statusTxt, tagsContainer, '->', resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn],
            defaults: { statusStore: me.statusStore },
            items: [
                {
@@ -268,9 +298,11 @@ Ext.define('PVE.qemu.Config', {
                title: gettext('Task History'),
                itemId: 'tasks',
                xtype: 'proxmoxNodeTasks',
-               iconCls: 'fa fa-list',
+               iconCls: 'fa fa-list-alt',
                nodename: nodename,
-               vmidFilter: vmid,
+               preFilter: {
+                   vmid,
+               },
            },
        );
 
@@ -309,7 +341,7 @@ Ext.define('PVE.qemu.Config', {
            });
        }
 
-       if (caps.vms['VM.Console']) {
+       if (caps.vms['VM.Audit']) {
            me.items.push(
                {
                    xtype: 'pveFirewallRules',
@@ -347,7 +379,12 @@ Ext.define('PVE.qemu.Config', {
                    list_refs_url: base_url + '/firewall/refs',
                    itemId: 'firewall-ipset',
                },
-               {
+           );
+       }
+
+       if (caps.vms['VM.Console']) {
+            me.items.push(
+                {
                    title: gettext('Log'),
                    groups: ['firewall'],
                    iconCls: 'fa fa-list',
@@ -355,6 +392,8 @@ Ext.define('PVE.qemu.Config', {
                    itemId: 'firewall-fwlog',
                    xtype: 'proxmoxLogView',
                    url: '/api2/extjs' + base_url + '/firewall/log',
+                   log_select_timespan: true,
+                   submitFormat: 'U',
                },
            );
        }
@@ -378,11 +417,12 @@ Ext.define('PVE.qemu.Config', {
            var spice = false;
            var xtermjs = false;
            var lock;
+           var rec;
 
            if (!success) {
                status = qmpstatus = 'unknown';
            } else {
-               var rec = s.data.get('status');
+               rec = s.data.get('status');
                status = rec ? rec.data.value : 'unknown';
                rec = s.data.get('qmpstatus');
                qmpstatus = rec ? rec.data.value : 'unknown';
@@ -395,6 +435,9 @@ Ext.define('PVE.qemu.Config', {
                xtermjs = !!s.data.get('serial');
            }
 
+           rec = s.data.get('tags');
+           tagsContainer.loadTags(rec?.data?.value);
+
            if (template) {
                return;
            }