mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
BulmaDrawer failed
property
This commit is contained in:
parent
421f7d185c
commit
5b4e057279
4 changed files with 42 additions and 13 deletions
|
@ -4,6 +4,7 @@
|
||||||
<BulmaDrawer
|
<BulmaDrawer
|
||||||
header="Kalender-Assistent"
|
header="Kalender-Assistent"
|
||||||
:ready="is_loaded"
|
:ready="is_loaded"
|
||||||
|
:failed="is_failed"
|
||||||
@open="on_open"
|
@open="on_open"
|
||||||
refreshable
|
refreshable
|
||||||
>
|
>
|
||||||
|
@ -64,6 +65,8 @@ import MultiModal from "./calendar/MultiModal.vue";
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_loaded = false;
|
public is_loaded = false;
|
||||||
|
public is_failed = false;
|
||||||
|
|
||||||
public day_parts: DayStrModel[] = [];
|
public day_parts: DayStrModel[] = [];
|
||||||
public day_image_names: DayStrModel[] = [];
|
public day_image_names: DayStrModel[] = [];
|
||||||
|
|
||||||
|
@ -73,6 +76,7 @@ export default class extends Vue {
|
||||||
|
|
||||||
public on_open(): void {
|
public on_open(): void {
|
||||||
this.is_loaded = false;
|
this.is_loaded = false;
|
||||||
|
this.is_failed = false;
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.$advent22.api_get<DayStrModel[]>("admin/day_parts"),
|
this.$advent22.api_get<DayStrModel[]>("admin/day_parts"),
|
||||||
|
@ -83,7 +87,7 @@ export default class extends Vue {
|
||||||
this.day_image_names = day_image_names;
|
this.day_image_names = day_image_names;
|
||||||
this.is_loaded = true;
|
this.is_loaded = true;
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(() => (this.is_failed = true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public door_click(day: number) {
|
public door_click(day: number) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<BulmaDrawer
|
<BulmaDrawer
|
||||||
header="Konfiguration"
|
header="Konfiguration"
|
||||||
:ready="is_loaded"
|
:ready="is_loaded"
|
||||||
|
:failed="is_failed"
|
||||||
@open="on_open"
|
@open="on_open"
|
||||||
refreshable
|
refreshable
|
||||||
>
|
>
|
||||||
|
@ -144,6 +145,8 @@ interface Credentials {
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_loaded = false;
|
public is_loaded = false;
|
||||||
|
public is_failed = true;
|
||||||
|
|
||||||
public config_model: ConfigModel = {
|
public config_model: ConfigModel = {
|
||||||
puzzle: {
|
puzzle: {
|
||||||
title: "Advent22",
|
title: "Advent22",
|
||||||
|
@ -175,6 +178,7 @@ export default class extends Vue {
|
||||||
|
|
||||||
public on_open(): void {
|
public on_open(): void {
|
||||||
this.is_loaded = false;
|
this.is_loaded = false;
|
||||||
|
this.is_failed = false;
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||||
|
@ -188,7 +192,7 @@ export default class extends Vue {
|
||||||
|
|
||||||
this.is_loaded = true;
|
this.is_loaded = true;
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(() => (this.is_failed = true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public load_dav_credentials(): void {
|
public load_dav_credentials(): void {
|
||||||
|
@ -200,7 +204,7 @@ export default class extends Vue {
|
||||||
password: password,
|
password: password,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
public load_ui_credentials(): void {
|
public load_ui_credentials(): void {
|
||||||
|
@ -212,7 +216,7 @@ export default class extends Vue {
|
||||||
password: password,
|
password: password,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<BulmaDrawer header="Türchen bearbeiten" :ready="is_loaded" @open="on_open">
|
<BulmaDrawer
|
||||||
|
header="Türchen bearbeiten"
|
||||||
|
:ready="is_loaded"
|
||||||
|
:failed="is_failed"
|
||||||
|
@open="on_open"
|
||||||
|
>
|
||||||
<div class="is-flex is-align-items-center is-justify-content-space-between">
|
<div class="is-flex is-align-items-center is-justify-content-space-between">
|
||||||
<BulmaButton
|
<BulmaButton
|
||||||
:disabled="current_step === 0"
|
:disabled="current_step === 0"
|
||||||
|
@ -71,6 +76,7 @@ import DoorPlacer from "./editor/DoorPlacer.vue";
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_loaded = false;
|
public is_loaded = false;
|
||||||
|
public is_failed = false;
|
||||||
|
|
||||||
public readonly steps: Step[] = [
|
public readonly steps: Step[] = [
|
||||||
{ label: "Platzieren", icon: "fa-solid fa-crosshairs" },
|
{ label: "Platzieren", icon: "fa-solid fa-crosshairs" },
|
||||||
|
@ -97,8 +103,8 @@ export default class extends Vue {
|
||||||
this.is_loaded = true;
|
this.is_loaded = true;
|
||||||
resolve(data);
|
resolve(data);
|
||||||
})
|
})
|
||||||
.catch(([reason, endpoint]) => {
|
.catch((error) => {
|
||||||
alert(`Fehler: ${reason} in ${endpoint}`);
|
alert(this.$advent22.format_user_error(error));
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -115,8 +121,8 @@ export default class extends Vue {
|
||||||
this.$advent22
|
this.$advent22
|
||||||
.api_put("admin/doors", data)
|
.api_put("admin/doors", data)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(([reason, endpoint]) => {
|
.catch((error) => {
|
||||||
alert(`Fehler: ${reason} in ${endpoint}`);
|
alert(this.$advent22.format_user_error(error));
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -124,7 +130,9 @@ export default class extends Vue {
|
||||||
|
|
||||||
public on_open(): void {
|
public on_open(): void {
|
||||||
this.is_loaded = false;
|
this.is_loaded = false;
|
||||||
this.load_doors().catch(() => {});
|
this.is_failed = false;
|
||||||
|
|
||||||
|
this.load_doors().catch(() => (this.is_failed = true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public on_download() {
|
public on_download() {
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<header class="card-header has-background-grey-lighter is-unselectable">
|
<header class="card-header has-background-grey-lighter is-unselectable">
|
||||||
<p class="card-header-title" @click="toggle">{{ header }}</p>
|
<p class="card-header-title" @click="toggle">{{ header }}</p>
|
||||||
|
|
||||||
<p v-if="refreshable" class="card-header-icon px-0">
|
<p v-if="refreshable" class="card-header-icon px-0">
|
||||||
<button class="tag button icon is-info" @click="refresh">
|
<button class="tag button icon is-info" @click="refresh">
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
icon="fa-solid fa-arrows-rotate"
|
icon="fa-solid fa-arrows-rotate"
|
||||||
:spin="is_open && !ready"
|
:spin="is_open && !ready && !failed"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button class="card-header-icon" @click="toggle">
|
<button class="card-header-icon" @click="toggle">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
|
@ -20,10 +22,15 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<template v-if="is_open">
|
<template v-if="is_open">
|
||||||
<slot v-if="ready" name="default" />
|
<div v-if="failed" class="card-content has-text-danger has-text-centered">
|
||||||
<div v-else class="card-content">
|
<span class="icon is-large">
|
||||||
|
<font-awesome-icon icon="fa-solid fa-ban" size="3x" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="!ready" class="card-content">
|
||||||
<progress class="progress is-info" max="100" />
|
<progress class="progress is-info" max="100" />
|
||||||
</div>
|
</div>
|
||||||
|
<slot v-else name="default" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -39,6 +46,11 @@ import { Options, Vue } from "vue-class-component";
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
ready: Boolean,
|
ready: Boolean,
|
||||||
|
failed: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
refreshable: {
|
refreshable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
|
@ -50,6 +62,7 @@ import { Options, Vue } from "vue-class-component";
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public header!: string;
|
public header!: string;
|
||||||
public ready!: boolean;
|
public ready!: boolean;
|
||||||
|
public failed!: boolean;
|
||||||
public refreshable!: boolean;
|
public refreshable!: boolean;
|
||||||
|
|
||||||
public is_open = false;
|
public is_open = false;
|
||||||
|
|
Loading…
Reference in a new issue