all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2 4/4] ui: realm sync: add 'run now' button
Date: Tue, 13 Jun 2023 10:44:01 +0200	[thread overview]
Message-ID: <20230613084401.1282876-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20230613084401.1282876-1-d.csapak@proxmox.com>

by simply passing the sync job config to the 'sync' api endpoint, like
we do for vzdump jobs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
new in v2
 www/manager6/dc/RealmSyncJob.js | 41 +++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/www/manager6/dc/RealmSyncJob.js b/www/manager6/dc/RealmSyncJob.js
index 9541d732..bb2e8d2f 100644
--- a/www/manager6/dc/RealmSyncJob.js
+++ b/www/manager6/dc/RealmSyncJob.js
@@ -35,6 +35,41 @@ Ext.define('PVE.dc.RealmSyncJobView', {
 	    });
 	},
 
+	runNow: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let selection = view.getSelection();
+	    if (!selection || selection.length < 1) {
+		return;
+	    }
+
+	    let params = selection[0].data;
+	    let realm = params.realm;
+
+	    let propertiesToDelete = ['comment', 'realm', 'id', 'type', 'schedule', 'last-run', 'next-run', 'enabled'];
+	    for (const prop of propertiesToDelete) {
+		delete params[prop];
+	    }
+
+	    Proxmox.Utils.API2Request({
+		url: `/access/domains/${realm}/sync`,
+		params,
+		waitMsgTarget: view,
+		method: 'POST',
+		success: function(response, options) {
+		    let upid = response.result.data;
+		    let win = Ext.create('Proxmox.window.TaskProgress', {
+			upid: upid,
+			taskDone: () => { me.reload(); },
+		    });
+		    win.show();
+		},
+		failure: function(response, opts) {
+		    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+		},
+	    });
+	},
+
 	reload: function() {
 	    this.getView().getStore().load();
 	},
@@ -110,6 +145,12 @@ Ext.define('PVE.dc.RealmSyncJobView', {
 	    baseurl: `/api2/extjs/cluster/jobs/realm-sync`,
 	    callback: 'reload',
 	},
+	{
+	    xtype: 'proxmoxButton',
+	    handler: 'runNow',
+	    disabled: true,
+	    text: gettext('Run Now'),
+	},
     ],
 
     listeners: {
-- 
2.30.2





      parent reply	other threads:[~2023-06-13  8:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  8:43 [pve-devel] [PATCH manager v2 0/4] improve ui for reaml sync jobs Dominik Csapak
2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 1/4] ui: realm sync edit: improve ux when there is no ldap/ad realm Dominik Csapak
2023-06-14 15:42   ` [pve-devel] applied-series: " Thomas Lamprecht
2023-06-13  8:43 ` [pve-devel] [PATCH manager v2 2/4] ui: realm sync: change enabled column rendering Dominik Csapak
2023-06-13  8:44 ` [pve-devel] [PATCH manager v2 3/4] ui: realm: move sync job panel into realm panel Dominik Csapak
2023-06-13  8:44 ` Dominik Csapak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230613084401.1282876-5-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal