web: fix needed because recent upgrade to task breaks spinner button (#10142) web: fix broken Task plug-in rebase and fix package json Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Ken Sternberg <133134217+kensternberg-authentik@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
![98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
eef02f2892
commit
2f42144b33
@ -66,7 +66,11 @@ export abstract class BaseTaskButton extends CustomEmitterElement(AKElement) {
|
||||
this.onSuccess = this.onSuccess.bind(this);
|
||||
this.onError = this.onError.bind(this);
|
||||
this.onClick = this.onClick.bind(this);
|
||||
this.actionTask = new Task(this, {
|
||||
this.actionTask = this.buildTask();
|
||||
}
|
||||
|
||||
buildTask() {
|
||||
return new Task(this, {
|
||||
task: () => this.callAction(),
|
||||
args: () => [],
|
||||
autoRun: false,
|
||||
@ -77,8 +81,9 @@ export abstract class BaseTaskButton extends CustomEmitterElement(AKElement) {
|
||||
|
||||
onComplete() {
|
||||
setTimeout(() => {
|
||||
this.actionTask.status = TaskStatus.INITIAL;
|
||||
this.dispatchCustomEvent(`${this.eventPrefix}-reset`);
|
||||
// set-up for the next task...
|
||||
this.actionTask = this.buildTask();
|
||||
this.requestUpdate();
|
||||
}, SPINNER_TIMEOUT);
|
||||
}
|
||||
@ -98,7 +103,8 @@ export abstract class BaseTaskButton extends CustomEmitterElement(AKElement) {
|
||||
}
|
||||
|
||||
onClick() {
|
||||
if (this.actionTask.status !== TaskStatus.INITIAL) {
|
||||
// Don't accept clicks when a task is in progress..
|
||||
if (this.actionTask.status === TaskStatus.PENDING) {
|
||||
return;
|
||||
}
|
||||
this.dispatchCustomEvent(`${this.eventPrefix}-click`);
|
||||
|
Reference in New Issue
Block a user