public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH manager 2/4] ui: data/PermPathStore: show/load acl paths for realms
Date: Thu, 17 Jun 2021 15:32:01 +0200	[thread overview]
Message-ID: <20210617133203.549-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210617133203.549-1-d.csapak@proxmox.com>

save the realm list on login, and if that list exists, show that
in the acl selector, else load the list and save it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
not really sure about it, also maybe we should simply load it everytime?

 www/manager6/data/PermPathStore.js | 32 ++++++++++++++++++++++++++++++
 www/manager6/window/LoginWindow.js | 22 ++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/www/manager6/data/PermPathStore.js b/www/manager6/data/PermPathStore.js
index 1dc276b6..f55257cc 100644
--- a/www/manager6/data/PermPathStore.js
+++ b/www/manager6/data/PermPathStore.js
@@ -42,6 +42,38 @@ Ext.define('PVE.data.PermPathStore', {
 		donePaths[path] = 1;
 	    }
 	});
+
+	if (PVE.Utils.realmList !== undefined) {
+	    PVE.Utils.realmList.forEach((realm) => {
+		me.add({
+		    value: `/access/realm/${realm}`,
+		});
+	    });
+	} else {
+	    Proxmox.Utils.API2Request({
+		url: `/access/domains`,
+		success: function(response) {
+		    PVE.Utils.realmList = [];
+		    me.suspendEvents();
+		    response.result.data.forEach((realm) => {
+			me.add({
+			    value: `/access/realm/${realm.realm}`,
+			});
+			PVE.Utils.realmList.push(realm.realm);
+		    });
+		    me.resumeEvents();
+
+		    me.fireEvent('refresh', me);
+		    me.fireEvent('datachanged', me);
+		    me.sort({
+			    property: 'value',
+			    direction: 'ASC',
+		    });
+		    PVE.Utils.realmList.sort();
+		},
+	    });
+	}
+
 	me.resumeEvents();
 
 	me.fireEvent('refresh', me);
diff --git a/www/manager6/window/LoginWindow.js b/www/manager6/window/LoginWindow.js
index 72078080..596ccbba 100644
--- a/www/manager6/window/LoginWindow.js
+++ b/www/manager6/window/LoginWindow.js
@@ -143,6 +143,27 @@ Ext.define('PVE.window.LoginWindow', {
 	    });
 	},
 
+	init: function(view) {
+	    let me = this;
+	    let realm_cb = me.lookup('realmCB');
+	    let realm_store = realm_cb.getStore();
+	    view.mon(
+		realm_store,
+		'load',
+		function(store, records, success) {
+		    if (!success || !records || !records.length) {
+			return;
+		    }
+		    if (!PVE.Utils.realmList) {
+			let realms = records.map((rec) => rec.data.realm).sort();
+			PVE.Utils.realmList = realms;
+		    }
+		},
+		view,
+		{ single: true },
+	    );
+	},
+
 	control: {
 	    'field[name=username]': {
 		specialkey: function(f, e) {
@@ -228,6 +249,7 @@ Ext.define('PVE.window.LoginWindow', {
 	    {
 		xtype: 'pmxRealmComboBox',
 		name: 'realm',
+		reference: 'realmCB',
 	    },
 	    {
 		xtype: 'proxmoxLanguageSelector',
-- 
2.20.1





  reply	other threads:[~2021-06-17 13:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 13:32 [pve-devel] [PATCH manager 1/4] ui: data/PermPathStore: add missing basic acl paths to acl selector Dominik Csapak
2021-06-17 13:32 ` Dominik Csapak [this message]
2021-06-17 13:32 ` [pve-devel] [RFC PATCH manager 3/4] ui: data/PermPathStore: load list of groups to show their path Dominik Csapak
2021-06-17 13:32 ` [pve-devel] [PATCH manager 4/4] ui: dc/ACLView: make the window wider Dominik Csapak
2021-06-18 15:09   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 15:07 ` [pve-devel] applied: [PATCH manager 1/4] ui: data/PermPathStore: add missing basic acl paths to acl selector Thomas Lamprecht

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=20210617133203.549-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal