]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/TokenEdit.js
3edf18cc9034e4501c3bb4d878a0695933b8d3ae
1 Ext
.define('PVE.dc.TokenEdit', {
2 extend
: 'Proxmox.window.Edit',
3 alias
: ['widget.pveDcTokenEdit'],
4 mixins
: ['Proxmox.Mixin.CBind'],
6 subject
: gettext('Token'),
7 onlineHelp
: 'pveum_tokens',
14 url
: '/api2/extjs/access/users/',
16 defaultFocus
: 'field[disabled=false][hidden=false][name=tokenid]',
20 onGetValues: function(values
) {
22 let win
= me
.up('pveDcTokenEdit');
23 win
.url
= '/api2/extjs/access/users/';
25 let uid
= encodeURIComponent(values
.userid
);
26 let tid
= encodeURIComponent(values
.tokenid
);
28 delete values
.tokenid
;
30 win
.url
+= `${uid}/token/${tid}`;
36 xtype
: 'pmxDisplayEditField',
38 editable
: (get) => get('isCreate') && !get('fixedUser'),
39 submitValue
: (get) => get('isCreate') || get('fixedUser'),
42 xtype
: 'pveUserSelector',
46 value
: Proxmox
.UserName
,
47 renderer
: Ext
.String
.htmlEncode
,
48 fieldLabel
: gettext('User'),
51 xtype
: 'pmxDisplayEditField',
53 editable
: '{isCreate}',
56 fieldLabel
: gettext('Token ID'),
63 xtype
: 'proxmoxcheckbox',
67 fieldLabel
: gettext('Privilege Separation'),
70 xtype
: 'pmxExpireDate',
78 fieldLabel
: gettext('Comment'),
83 initComponent: function() {
90 success: function(response
, options
) {
91 me
.setValues(response
.result
.data
);
96 apiCallDone: function(success
, response
, options
) {
97 let res
= response
.result
.data
;
98 if (!success
|| !res
.value
) {
102 Ext
.create('PVE.dc.TokenShow', {
104 tokenid
: res
['full-tokenid'],
110 Ext
.define('PVE.dc.TokenShow', {
111 extend
: 'Ext.window.Window',
112 alias
: ['widget.pveTokenShow'],
113 mixins
: ['Proxmox.Mixin.CBind'],
118 title
: gettext('Token Secret'),
130 padding
: '0 10 10 10',
134 fieldLabel
: gettext('Token ID'),
142 fieldLabel
: gettext('Secret'),
143 inputId
: 'token-secret-value',
154 padding
: '10 10 10 10',
156 html
: gettext('Please record the API token secret - it will only be displayed now'),
161 handler: function(b
) {
162 document
.getElementById('token-secret-value').select();
163 document
.execCommand("copy");
165 text
: gettext('Copy Secret Value'),
166 iconCls
: 'fa fa-clipboard',