web/elements: fix ActionButton

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-03 23:23:29 +02:00
parent 1f781eb78a
commit 195951a61a
2 changed files with 6 additions and 7 deletions

View File

@ -16,7 +16,7 @@ export class ActionButton extends SpinnerButton {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
apiRequest: () => Promise<any> = () => { throw new Error(); };
defaultCallAction(): void {
callAction = (): void => {
if (this.isRunning === true) {
return;
}
@ -39,5 +39,5 @@ export class ActionButton extends SpinnerButton {
}
this.setDone(ERROR_CLASS);
});
}
};
}

View File

@ -12,7 +12,7 @@ export class SpinnerButton extends LitElement {
isRunning = false;
@property()
callAction: () => void = () => {};
callAction?: () => void;
static get styles(): CSSResult[] {
return [
@ -51,9 +51,6 @@ export class SpinnerButton extends LitElement {
}, 1000);
}
defaultCallAction(): void {
}
render(): TemplateResult {
return html`<button
class="pf-c-button pf-m-progress ${this.classList.toString()}"
@ -62,7 +59,9 @@ export class SpinnerButton extends LitElement {
return;
}
this.setLoading();
if (this.callAction) {
this.callAction();
}
}}>
${this.isRunning
? html` <span class="pf-c-button__progress">