[Status Page] Fix migration and unpin incident

This commit is contained in:
Louis Lam 2022-03-18 14:14:22 +08:00
parent 220e46bc83
commit 8d981c8f0b
3 changed files with 26 additions and 6 deletions

View File

@ -231,15 +231,28 @@ class Database {
} }
let statusPage = R.dispense("status_page"); let statusPage = R.dispense("status_page");
statusPage.slug = ""; statusPage.slug = "default";
statusPage.title = title; statusPage.title = title;
statusPage.description = await setting("description"); statusPage.description = await setting("description");
statusPage.icon = await setting("icon"); statusPage.icon = await setting("icon");
statusPage.theme = await setting("statusPageTheme"); statusPage.theme = await setting("statusPageTheme");
statusPage.published = await setting("statusPagePublished"); statusPage.published = !!await setting("statusPagePublished");
statusPage.search_engine_index = await setting("searchEngineIndex"); statusPage.search_engine_index = !!await setting("searchEngineIndex");
statusPage.show_tags = await setting("statusPageTags"); statusPage.show_tags = !!await setting("statusPageTags");
statusPage.password = null; statusPage.password = null;
if (!statusPage.title) {
statusPage.title = "My Status Page";
}
if (!statusPage.icon) {
statusPage.icon = "";
}
if (!statusPage.theme) {
statusPage.theme = "light";
}
let id = await R.store(statusPage); let id = await R.store(statusPage);
await R.exec("UPDATE incident SET status_page_id = ? WHERE status_page_id IS NULL", [ await R.exec("UPDATE incident SET status_page_id = ? WHERE status_page_id IS NULL", [
@ -252,6 +265,13 @@ class Database {
await R.exec("DELETE FROM setting WHERE type = 'statusPage'"); await R.exec("DELETE FROM setting WHERE type = 'statusPage'");
// Migrate Entry Page if it is status page
let entryPage = await setting("entryPage");
if (entryPage === "statusPage") {
await setSetting("entryPage", "statusPage-default", "general");
}
console.log("Migrating Status Page - Done"); console.log("Migrating Status Page - Done");
} }

View File

@ -18,7 +18,7 @@
</a> </a>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="nav-item me-2"> <li v-if="$root.loggedIn" class="nav-item me-2">
<router-link to="/manage-status-page" class="nav-link"> <router-link to="/manage-status-page" class="nav-link">
<font-awesome-icon icon="stream" /> {{ $t("Status Pages") }} <font-awesome-icon icon="stream" /> {{ $t("Status Pages") }}
</router-link> </router-link>

View File

@ -643,7 +643,7 @@ export default {
}, },
unpinIncident() { unpinIncident() {
this.$root.getSocket().emit("unpinIncident", () => { this.$root.getSocket().emit("unpinIncident", this.slug, () => {
this.incident = null; this.incident = null;
}); });
}, },