]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/window/ACMEAccount.js
1 Ext
.define('Proxmox.window.ACMEAccountCreate', {
2 extend
: 'Proxmox.window.Edit',
3 mixins
: ['Proxmox.Mixin.CBind'],
4 xtype
: 'pmxACMEAccountCreate',
9 title
: gettext('Register Account'),
12 submitText
: gettext('Register'),
18 xtype
: 'proxmoxtextfield',
19 fieldLabel
: gettext('Account Name'),
22 emptyText
: (get) => get('defaultExists') ? '' : 'default',
23 allowBlank
: (get) => !get('defaultExists'),
31 fieldLabel
: gettext('E-Mail'),
34 xtype
: 'proxmoxComboGrid',
36 reference
: 'directory',
40 fieldLabel
: gettext('ACME Directory'),
43 fields
: ['name', 'url'],
45 proxy
: { type
: 'proxmox' },
54 header
: gettext('Name'),
59 header
: gettext('URL'),
66 change: function(combogrid
, value
) {
73 let acmeUrl
= me
.up('window').acmeUrl
;
75 let disp
= me
.up('window').down('#tos_url_display');
76 let field
= me
.up('window').down('#tos_url');
77 let checkbox
= me
.up('window').down('#tos_checkbox');
79 disp
.setValue(gettext('Loading'));
80 field
.setValue(undefined);
81 checkbox
.setValue(undefined);
82 checkbox
.setHidden(true);
84 Proxmox
.Utils
.API2Request({
85 url
: `${acmeUrl}/tos`,
90 success: function(response
, opt
) {
91 field
.setValue(response
.result
.data
);
92 disp
.setValue(response
.result
.data
);
93 checkbox
.setHidden(false);
95 failure: function(response
, opt
) {
96 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
103 xtype
: 'displayfield',
104 itemId
: 'tos_url_display',
105 renderer
: Proxmox
.Utils
.render_optional_url
,
106 name
: 'tos_url_display',
114 xtype
: 'proxmoxcheckbox',
115 itemId
: 'tos_checkbox',
116 boxLabel
: gettext('Accept TOS'),
118 validateValue: function(value
) {
119 if (value
&& this.checked
) {
127 initComponent: function() {
131 throw "no acmeUrl given";
134 me
.url
= `${me.acmeUrl}/account`;
138 me
.lookup('directory')
141 .setUrl(`/api2/json/${me.acmeUrl}/directories`);
145 Ext
.define('Proxmox.window.ACMEAccountView', {
146 extend
: 'Proxmox.window.Edit',
147 xtype
: 'pmxACMEAccountView',
154 title
: gettext('Account'),
158 xtype
: 'displayfield',
159 fieldLabel
: gettext('E-Mail'),
163 xtype
: 'displayfield',
164 fieldLabel
: gettext('Created'),
168 xtype
: 'displayfield',
169 fieldLabel
: gettext('Status'),
173 xtype
: 'displayfield',
174 fieldLabel
: gettext('Directory'),
175 renderer
: Proxmox
.Utils
.render_optional_url
,
179 xtype
: 'displayfield',
180 fieldLabel
: gettext('Terms of Services'),
181 renderer
: Proxmox
.Utils
.render_optional_url
,
186 initComponent: function() {
191 // hide OK/Reset button, because we just want to show data
192 me
.down('toolbar[dock=bottom]').setVisible(false);
195 success: function(response
) {
196 var data
= response
.result
.data
;
197 data
.email
= data
.account
.contact
[0];
198 data
.createdAt
= data
.account
.createdAt
;
199 data
.status
= data
.account
.status
;