web/admin: make table dispatch refresh event on refresh button instead of just fetching

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-07-05 09:48:14 +02:00
parent edfab0995f
commit abed254ca1
3 changed files with 43 additions and 11 deletions

View File

@ -15,7 +15,7 @@ export class OutpostHealthElement extends LitElement {
outpostId?: string;
@property({attribute: false})
outpostHealth: OutpostHealth[] = [];
outpostHealth?: OutpostHealth[];
static get styles(): CSSResult[] {
return [PFBase, AKGlobal];
@ -23,7 +23,8 @@ export class OutpostHealthElement extends LitElement {
constructor() {
super();
this.addEventListener(EVENT_REFRESH, () => {
window.addEventListener(EVENT_REFRESH, () => {
this.outpostHealth = undefined;
this.firstUpdated();
});
}
@ -38,7 +39,7 @@ export class OutpostHealthElement extends LitElement {
}
render(): TemplateResult {
if (!this.outpostId) {
if (!this.outpostId || !this.outpostHealth) {
return html`<ak-spinner></ak-spinner>`;
}
if (this.outpostHealth.length === 0) {