]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: schedule sim: denote if any simulation was done via empty text
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 20 Jan 2023 09:46:53 +0000 (10:46 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 20 Jan 2023 09:46:57 +0000 (10:46 +0100)
As subtle UX hint that the user first needs to press the Simulate
button.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/window/ScheduleSimulator.js

index c8f8be7a45b79328f2c8f772f26a27b664d49459..104e93c9c6f51774044a3c4e35073af72cf9501d 100644 (file)
@@ -3,6 +3,15 @@ Ext.define('PVE.window.ScheduleSimulator', {
 
     title: gettext('Job Schedule Simulator'),
 
+    viewModel: {
+       data: {
+           simulatedOnce: false,
+       },
+       formulas: {
+           gridEmptyText: get => get('simulatedOnce') ? Proxmox.Utils.NoneText : gettext('No simulation done'),
+       },
+    },
+
     controller: {
        xclass: 'Ext.app.ViewController',
        close: function() {
@@ -23,12 +32,14 @@ Ext.define('PVE.window.ScheduleSimulator', {
                    iterations,
                },
                failure: response => {
+                   me.getViewModel().set('simulatedOnce', true);
                    me.lookup('grid').getStore().setData([]);
                    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
                },
                success: function(response) {
                    let schedules = response.result.data;
                    me.lookup('grid').getStore().setData(schedules);
+                   me.getViewModel().set('simulatedOnce', true);
                },
            });
        },
@@ -105,7 +116,9 @@ Ext.define('PVE.window.ScheduleSimulator', {
                {
                    xtype: 'grid',
                    reference: 'grid',
-                   emptyText: Proxmox.Utils.NoneText,
+                   bind: {
+                       emptyText: '{gridEmptyText}',
+                   },
                    scrollable: true,
                    height: 300,
                    columns: [