From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: dc/TokenEdit: fix editing existing tokens
Date: Fri, 12 Feb 2021 16:01:15 +0100 [thread overview]
Message-ID: <20210212150115.27602-1-d.csapak@proxmox.com> (raw)
we always have to calculate the url correctly, not only on creation
otherwise we try to edit the token by doing a 'PUT' request on
/access/users
and not on
/access/users/USERID/token/TOKENID
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/manager6/dc/TokenEdit.js | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/www/manager6/dc/TokenEdit.js b/www/manager6/dc/TokenEdit.js
index 3edf18cc..7039249c 100644
--- a/www/manager6/dc/TokenEdit.js
+++ b/www/manager6/dc/TokenEdit.js
@@ -21,14 +21,12 @@ Ext.define('PVE.dc.TokenEdit', {
let me = this;
let win = me.up('pveDcTokenEdit');
win.url = '/api2/extjs/access/users/';
- if (win.isCreate) {
- let uid = encodeURIComponent(values.userid);
- let tid = encodeURIComponent(values.tokenid);
- delete values.userid;
- delete values.tokenid;
+ let uid = encodeURIComponent(values.userid);
+ let tid = encodeURIComponent(values.tokenid);
+ delete values.userid;
+ delete values.tokenid;
- win.url += `${uid}/token/${tid}`;
- }
+ win.url += `${uid}/token/${tid}`;
return values;
},
column1: [
@@ -36,8 +34,8 @@ Ext.define('PVE.dc.TokenEdit', {
xtype: 'pmxDisplayEditField',
cbind: {
editable: (get) => get('isCreate') && !get('fixedUser'),
- submitValue: (get) => get('isCreate') || get('fixedUser'),
},
+ submitValue: true,
editConfig: {
xtype: 'pveUserSelector',
allowBlank: false,
@@ -54,6 +52,7 @@ Ext.define('PVE.dc.TokenEdit', {
},
name: 'tokenid',
fieldLabel: gettext('Token ID'),
+ submitValue: true,
minLength: 2,
allowBlank: false,
},
--
2.20.1
next reply other threads:[~2021-02-12 15:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 15:01 Dominik Csapak [this message]
2021-02-19 15:41 ` [pve-devel] applied: " 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=20210212150115.27602-1-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