Start to think about how to display errors
This commit is contained in:
		@@ -310,7 +310,7 @@ WHERE
 | 
				
			|||||||
            reminders
 | 
					            reminders
 | 
				
			||||||
        WHERE
 | 
					        WHERE
 | 
				
			||||||
            reminders.`utc_time` <= NOW() AND
 | 
					            reminders.`utc_time` <= NOW() AND
 | 
				
			||||||
            reminders.`channel_id` NOT NULL AND
 | 
					            reminders.`channel_id` IS NOT NULL AND
 | 
				
			||||||
            `status` = 'pending' AND
 | 
					            `status` = 'pending' AND
 | 
				
			||||||
            (
 | 
					            (
 | 
				
			||||||
                reminders.`interval_seconds` IS NOT NULL
 | 
					                reminders.`interval_seconds` IS NOT NULL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -624,7 +624,7 @@ pub async fn get_reminder_errors(
 | 
				
			|||||||
         reminders.channel_id AS channel
 | 
					         reminders.channel_id AS channel
 | 
				
			||||||
        FROM reminders
 | 
					        FROM reminders
 | 
				
			||||||
        LEFT JOIN channels ON channels.id = reminders.channel_id
 | 
					        LEFT JOIN channels ON channels.id = reminders.channel_id
 | 
				
			||||||
        WHERE (`status` != 'pending' OR reminders.channel_id IS NULL) AND reminders.guild_id = (SELECT id FROM guilds WHERE guild = ?)",
 | 
					        WHERE (`status` = 'failed' OR reminders.channel_id IS NULL) AND reminders.guild_id = (SELECT id FROM guilds WHERE guild = ?)",
 | 
				
			||||||
        id
 | 
					        id
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    .fetch_all(pool.inner())
 | 
					    .fetch_all(pool.inner())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ const $downloader = document.querySelector("a#downloader");
 | 
				
			|||||||
const $uploader = document.querySelector("input#uploader");
 | 
					const $uploader = document.querySelector("input#uploader");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let channels = [];
 | 
					let channels = [];
 | 
				
			||||||
 | 
					let reminderErrors = [];
 | 
				
			||||||
let guildNames = {};
 | 
					let guildNames = {};
 | 
				
			||||||
let roles = [];
 | 
					let roles = [];
 | 
				
			||||||
let templates = {};
 | 
					let templates = {};
 | 
				
			||||||
@@ -36,6 +37,12 @@ function guildId() {
 | 
				
			|||||||
    return document.querySelector(".guildList a.is-active").dataset["guild"];
 | 
					    return document.querySelector(".guildList a.is-active").dataset["guild"];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function loadErrors() {
 | 
				
			||||||
 | 
					    return fetch(`/dashboard/api/guild/${guildId()}/errors`).then((response) =>
 | 
				
			||||||
 | 
					        response.json()
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function colorToInt(r, g, b) {
 | 
					function colorToInt(r, g, b) {
 | 
				
			||||||
    return (r << 16) + (g << 8) + b;
 | 
					    return (r << 16) + (g << 8) + b;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -476,6 +483,9 @@ document.addEventListener("guildSwitched", async (e) => {
 | 
				
			|||||||
        fetch_roles(e.detail.guild_id);
 | 
					        fetch_roles(e.detail.guild_id);
 | 
				
			||||||
        fetch_templates(e.detail.guild_id);
 | 
					        fetch_templates(e.detail.guild_id);
 | 
				
			||||||
        fetch_reminders(e.detail.guild_id);
 | 
					        fetch_reminders(e.detail.guild_id);
 | 
				
			||||||
 | 
					        loadErrors().then((res) => {
 | 
				
			||||||
 | 
					            console.log(res);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        document.querySelectorAll("p.pageTitle").forEach((el) => {
 | 
					        document.querySelectorAll("p.pageTitle").forEach((el) => {
 | 
				
			||||||
            el.textContent = `${e.detail.guild_name} Reminders`;
 | 
					            el.textContent = `${e.detail.guild_name} Reminders`;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +0,0 @@
 | 
				
			|||||||
let _reminderErrors = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const reminderErrors = () => {
 | 
					 | 
				
			||||||
    return _reminderErrors;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const guildId = () => {
 | 
					 | 
				
			||||||
    let selected = document.querySelector(".guildList a.is-active");
 | 
					 | 
				
			||||||
    return selected.dataset["guild"];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function loadErrors() {
 | 
					 | 
				
			||||||
    fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
document.addEventListener('DOMContentLoaded', () => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
@@ -1,19 +0,0 @@
 | 
				
			|||||||
let _reminderErrors = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const reminderErrors = () => {
 | 
					 | 
				
			||||||
    return _reminderErrors;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const guildId = () => {
 | 
					 | 
				
			||||||
    let selected: HTMLElement = document.querySelector(".guildList a.is-active");
 | 
					 | 
				
			||||||
    return selected.dataset["guild"];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function loadErrors() {
 | 
					 | 
				
			||||||
    fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
document.addEventListener('DOMContentLoaded', () => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
@@ -385,6 +385,10 @@
 | 
				
			|||||||
    {% include "reminder_dashboard/guild_reminder" %}
 | 
					    {% include "reminder_dashboard/guild_reminder" %}
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<template id="guildError">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script src="/static/js/iro.js"></script>
 | 
					<script src="/static/js/iro.js"></script>
 | 
				
			||||||
<script src="/static/js/dtsel.js"></script>
 | 
					<script src="/static/js/dtsel.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,6 +46,10 @@
 | 
				
			|||||||
    <div id="guildReminders">
 | 
					    <div id="guildReminders">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <div id="guildErrors">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script src="/static/js/sort.js"></script>
 | 
					<script src="/static/js/sort.js"></script>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user