Move errors route into get_reminders route. Add database migration.

This commit is contained in:
jude
2023-09-03 15:01:42 +01:00
parent b6b5e6d2b2
commit ee89cb40c5
15 changed files with 172 additions and 85 deletions

View File

@ -688,6 +688,44 @@ li.highlight {
/* END */
div.reminderError {
margin: 10px;
padding: 14px;
background-color: #f5f5f5;
border-radius: 8px;
}
div.reminderError .errorHead {
display: flex;
flex-direction: row;
}
div.reminderError .errorIcon {
padding: 8px;
border-radius: 4px;
margin-right: 12px;
}
div.reminderError .errorIcon.deleted {
background-color: #e7e5e4;
}
div.reminderError .errorIcon.success {
background-color: #d9f99d;
}
div.reminderError .errorIcon.errored {
background-color: #fecaca;
}
div.reminderError .errorHead .reminderName {
font-size: 1rem;
display: flex;
flex-direction: column;
justify-content: center;
color: rgb(54, 54, 54);
}
/* other stuff */
.half-rem {

View File

@ -57,7 +57,7 @@ function switch_pane(selector) {
el.classList.add("is-hidden");
});
document.getElementById(selector).classList.remove("is-hidden");
document.querySelector(`*[data-name=${selector}]`).classList.remove("is-hidden");
}
function update_select(sel) {
@ -735,16 +735,19 @@ document.addEventListener("DOMContentLoaded", async () => {
});
}
const matches = window.location.href.match(/dashboard\/(\d+)/);
const matches = window.location.href.match(
/dashboard\/(\d+)(\/)?([a-zA-Z\-]+)?/
);
if (matches) {
let id = matches[1];
let kind = matches[3];
let name = guildNames[id];
const event = new CustomEvent("guildSwitched", {
detail: {
guild_name: name,
guild_id: id,
pane: "guild",
pane: kind,
},
});

View File

@ -1,16 +1,18 @@
function loadErrors() {
return fetch(`/dashboard/api/guild/${guildId()}/errors`).then((response) =>
response.json()
);
return fetch(
`/dashboard/api/guild/${guildId()}/reminders?status=deleted,sent,error`
).then((response) => response.json());
}
document.addEventListener("paneLoad", (ev) => {
if (ev.detail.pane !== "reminder-errors") {
if (ev.detail.pane !== "errors") {
return;
}
// Load errors
loadErrors().then((res) => {});
loadErrors().then((res) => {
console.log(res);
});
$loader.classList.add("is-hidden");
});