new: [app] Added clear notifications
This commit is contained in:
parent
851da1fd97
commit
ac28be543f
8 changed files with 808 additions and 785 deletions
778
dist/assets/index-BXZ9p_KP.js
vendored
Normal file
778
dist/assets/index-BXZ9p_KP.js
vendored
Normal file
File diff suppressed because one or more lines are too long
778
dist/assets/index-B_FVsdp6.js
vendored
778
dist/assets/index-B_FVsdp6.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
dist/index.html
vendored
4
dist/index.html
vendored
|
@ -5,8 +5,8 @@
|
|||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
<script type="module" crossorigin src="/assets/index-B_FVsdp6.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CCNhbikk.css">
|
||||
<script type="module" crossorigin src="/assets/index-BXZ9p_KP.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CvXX7jiP.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
@ -20,6 +20,10 @@ def get_notifications() -> list[dict]:
|
|||
return list(db.NOTIFICATION_MESSAGES)
|
||||
|
||||
|
||||
def reset_notifications():
|
||||
db.NOTIFICATION_MESSAGES = []
|
||||
|
||||
|
||||
def record_notification(notification: dict):
|
||||
db.NOTIFICATION_MESSAGES.appendleft(notification)
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@ def mark_task_incomplete(sid, payload):
|
|||
def reset_all_exercise_progress(sid):
|
||||
return exercise_model.resetAllExerciseProgress()
|
||||
|
||||
@sio.event
|
||||
def reset_notifications(sid):
|
||||
return notification_model.reset_notifications()
|
||||
|
||||
@sio.event
|
||||
def get_diagnostic(sid):
|
||||
return getDiagnostic()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { exercises, selected_exercises, diagnostic, resetAllExerciseProgress, changeExerciseSelection, fetchDiagnostic } from "@/socket";
|
||||
import { exercises, selected_exercises, diagnostic, resetAllExerciseProgress, resetLiveLoggs, changeExerciseSelection, fetchDiagnostic } from "@/socket";
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
||||
import { faScrewdriverWrench, faTrash, faSuitcaseMedical, faGraduationCap } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faScrewdriverWrench, faTrash, faSuitcaseMedical, faGraduationCap, faBan } from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
const admin_modal = ref(null)
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
<dialog ref="admin_modal" class="modal">
|
||||
<div class="modal-box w-11/12 max-w-6xl top-24 absolute bg-slate-200 dark:bg-slate-600 text-slate-700 dark:text-slate-200">
|
||||
<h2 class="text-2xl font-bold">
|
||||
<FontAwesomeIcon :icon="faScrewdriverWrench" class="mr-1"></FontAwesomeIcon>
|
||||
<FontAwesomeIcon :icon="faScrewdriverWrench" class=""></FontAwesomeIcon>
|
||||
Admin panel
|
||||
</h2>
|
||||
<div class="modal-action">
|
||||
|
@ -43,7 +43,7 @@
|
|||
</div>
|
||||
<div>
|
||||
|
||||
<div class="flex mb-5">
|
||||
<div class="flex mb-5 gap-1">
|
||||
<button
|
||||
@click="resetAllExerciseProgress()"
|
||||
class="h-10 min-h-10 px-2 py-1 font-semibold bg-red-600 text-slate-200 hover:bg-red-700 btn btn-sm"
|
||||
|
@ -51,6 +51,13 @@
|
|||
<FontAwesomeIcon :icon="faTrash" class="mr-1"></FontAwesomeIcon>
|
||||
Reset All Exercises
|
||||
</button>
|
||||
<button
|
||||
@click="resetLiveLoggs()"
|
||||
class="h-10 min-h-10 px-2 py-1 font-semibold bg-amber-600 text-slate-200 hover:bg-amber-700 btn btn-sm"
|
||||
>
|
||||
<FontAwesomeIcon :icon="faBan" class=""></FontAwesomeIcon>
|
||||
Reset All Exercises
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<h3 class="text-lg font-semibold">
|
||||
|
|
|
@ -79,6 +79,14 @@ export function resetAllExerciseProgress() {
|
|||
})
|
||||
}
|
||||
|
||||
export function resetLiveLoggs() {
|
||||
socket.emit("reset_notifications", () => {
|
||||
socket.emit("get_notifications", (all_notifications) => {
|
||||
state.notificationEvents = all_notifications
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function changeExerciseSelection(exec_uuid, state_enabled) {
|
||||
const payload = {
|
||||
exercise_uuid: exec_uuid,
|
||||
|
|
Loading…
Reference in a new issue