unclean SPARC
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
class BypassTokenRevokeDialog extends EICDialogContent {
|
||||
|
||||
actions = [
|
||||
{
|
||||
label: 'Cancel',
|
||||
onclick: this.cancel.bind(this),
|
||||
severity: 'secondary',
|
||||
role: 'cancel'
|
||||
},
|
||||
{
|
||||
label: 'Revoke token',
|
||||
onclick: this.revoke.bind(this),
|
||||
severity: 'danger',
|
||||
role: 'revoke',
|
||||
disabled: true
|
||||
}
|
||||
]
|
||||
|
||||
constructor(options) { super(options); }
|
||||
|
||||
DOMContentLoaded(options) {
|
||||
this.model = options.model;
|
||||
|
||||
let components = ui.eicfy(this.el);
|
||||
|
||||
this.form = new Form(this.find('.agreement'));
|
||||
this.pic = options.pic;
|
||||
this.find('input[name="track"]').value = options.track;
|
||||
this.find('input[name="domain"]').value = options.domain;
|
||||
this.optin = this.find('input[name="agreed"]');
|
||||
this.optin.addEventListener('change',this.onAgreement.bind(this));
|
||||
}
|
||||
|
||||
onAgreement() { this.actions.find(o => o.role == 'revoke').button.disabled = !this.optin.checked; }
|
||||
|
||||
revoke() {
|
||||
if(this.form.validate()) {
|
||||
this.actions.find(o => o.role == 'revoke').button.loading = true;
|
||||
this.actions.find(o => o.role == 'cancel').button.disabled = true;
|
||||
this.model.revoke(this.pic, this.form.value)
|
||||
.then( this.commit.bind(this), this.abort.bind(this) )
|
||||
}
|
||||
}
|
||||
|
||||
onRevokeSuccess() {
|
||||
this.actions.find(o => o.role == 'revoke').button.loading = false;
|
||||
this.actions.find(o => o.role == 'cancel').button.disabled = false;
|
||||
this.commit(true);
|
||||
}
|
||||
|
||||
onRevokeFailed() {
|
||||
this.actions.find(o => o.role == 'revoke').button.loading = false;
|
||||
this.actions.find(o => o.role == 'cancel').button.disabled = false;
|
||||
this.abort();
|
||||
}
|
||||
}
|
||||
|
||||
app.registerClass('BypassTokenRevokeDialog',BypassTokenRevokeDialog);
|
||||
Reference in New Issue
Block a user