mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
fix: last eslint errors
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<template>
|
||||
<div class="w-full">
|
||||
<!-- Create article button - only show for admin users -->
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<template>
|
||||
<div
|
||||
class="flex grow flex-col gap-y-5 overflow-y-auto bg-zinc-900 px-6 py-6 ring-1 ring-white/10"
|
||||
|
||||
@ -2,11 +2,12 @@ import type { TaskMessage } from "~/server/internal/tasks";
|
||||
import { WebSocketHandler } from "./ws";
|
||||
|
||||
const websocketHandler = new WebSocketHandler("/api/v1/task");
|
||||
const taskStates: { [key: string]: Ref<TaskMessage | undefined> } = {};
|
||||
// const taskStates: { [key: string]: } = {};
|
||||
const taskStates = new Map<string, Ref<TaskMessage | undefined>>();
|
||||
|
||||
function handleUpdateMessage(msg: TaskMessage) {
|
||||
const taskStates = useTaskStates();
|
||||
const state = taskStates[msg.id];
|
||||
const state = taskStates.get(msg.id);
|
||||
if (!state) return;
|
||||
if (!state.value || msg.reset) {
|
||||
state.value = msg;
|
||||
@ -29,18 +30,22 @@ websocketHandler.listen((message) => {
|
||||
const [action, ...data] = message.split("/");
|
||||
|
||||
switch (action) {
|
||||
case "connect":
|
||||
case "connect": {
|
||||
const taskReady = useTaskReady();
|
||||
taskReady.value = true;
|
||||
break;
|
||||
case "disconnect":
|
||||
}
|
||||
case "disconnect": {
|
||||
const disconnectTaskId = data[0];
|
||||
delete taskStates[disconnectTaskId];
|
||||
taskStates.delete(disconnectTaskId);
|
||||
console.log(`disconnected from ${disconnectTaskId}`);
|
||||
break;
|
||||
case "error":
|
||||
}
|
||||
case "error": {
|
||||
const [taskId, title, description] = data;
|
||||
taskStates[taskId].value ??= {
|
||||
const state = taskStates.get(taskId);
|
||||
if (!state) break;
|
||||
state.value ??= {
|
||||
id: taskId,
|
||||
name: "Unknown task",
|
||||
success: false,
|
||||
@ -48,8 +53,9 @@ websocketHandler.listen((message) => {
|
||||
error: undefined,
|
||||
log: [],
|
||||
};
|
||||
taskStates[taskId].value.error = { title, description };
|
||||
state.value.error = { title, description };
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -61,15 +67,12 @@ export const useTaskReady = () => useState("taskready", () => false);
|
||||
export const useTask = (taskId: string): Ref<TaskMessage | undefined> => {
|
||||
if (import.meta.server) return ref(undefined);
|
||||
const taskStates = useTaskStates();
|
||||
if (
|
||||
taskStates[taskId] &&
|
||||
taskStates[taskId].value &&
|
||||
!taskStates[taskId].value.error
|
||||
)
|
||||
return taskStates[taskId];
|
||||
const task = taskStates.get(taskId);
|
||||
if (task && task.value && !task.value.error) return task;
|
||||
|
||||
taskStates[taskId] = ref(undefined);
|
||||
taskStates.set(taskId, ref(undefined));
|
||||
console.log("connecting to " + taskId);
|
||||
websocketHandler.send(`connect/${taskId}`);
|
||||
return taskStates[taskId];
|
||||
// TODO: this may have changed behavior
|
||||
return taskStates.get(taskId) ?? ref(undefined);
|
||||
};
|
||||
|
||||
@ -30,7 +30,7 @@ export class WebSocketHandler {
|
||||
this.ws.onmessage = (e) => {
|
||||
const message = e.data;
|
||||
switch (message) {
|
||||
case "unauthenticated":
|
||||
case "unauthenticated": {
|
||||
const error = createError({
|
||||
statusCode: 403,
|
||||
statusMessage: "Unable to connect to websocket - unauthenticated",
|
||||
@ -40,6 +40,7 @@ export class WebSocketHandler {
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.listeners.length == 0) {
|
||||
this.inQueue.push(message);
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
import type { NuxtError } from "#app";
|
||||
|
||||
const props = defineProps({
|
||||
error: Object as () => NuxtError,
|
||||
error: {
|
||||
type: Object as () => NuxtError,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
@ -105,7 +108,7 @@ if (import.meta.client) {
|
||||
src="/wallpapers/error-wallpaper.jpg"
|
||||
class="absolute inset-0 h-full w-full object-cover"
|
||||
alt=""
|
||||
>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -152,10 +152,6 @@ import { ref, type Component } from "vue";
|
||||
import {
|
||||
Dialog,
|
||||
DialogPanel,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuItem,
|
||||
MenuItems,
|
||||
TransitionChild,
|
||||
TransitionRoot,
|
||||
} from "@headlessui/vue";
|
||||
@ -163,10 +159,7 @@ import {
|
||||
Bars3Icon,
|
||||
ServerStackIcon,
|
||||
HomeIcon,
|
||||
LockClosedIcon,
|
||||
Cog6ToothIcon,
|
||||
FlagIcon,
|
||||
BellIcon,
|
||||
DocumentIcon,
|
||||
UserGroupIcon,
|
||||
} from "@heroicons/vue/24/outline";
|
||||
@ -209,10 +202,10 @@ const navigation: Array<NavigationItem & { icon: Component }> = [
|
||||
},
|
||||
];
|
||||
|
||||
const notifications = useNotifications();
|
||||
const unreadNotifications = computed(() =>
|
||||
notifications.value.filter((e) => !e.read)
|
||||
);
|
||||
// const notifications = useNotifications();
|
||||
// const unreadNotifications = computed(() =>
|
||||
// notifications.value.filter((e) => !e.read)
|
||||
// );
|
||||
|
||||
const currentNavigationIndex = useCurrentNavigationIndex(navigation);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const whitelistedPrefixes = ["/auth", "/api", "/setup"];
|
||||
const requireAdmin = ["/admin"];
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
if (import.meta.server) return;
|
||||
const error = useError();
|
||||
if (error.value !== undefined) return;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import path from "path";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
|
||||
@ -97,16 +97,7 @@ import {
|
||||
TransitionChild,
|
||||
TransitionRoot,
|
||||
} from "@headlessui/vue";
|
||||
import {
|
||||
Bars3Icon,
|
||||
CalendarIcon,
|
||||
ChartPieIcon,
|
||||
DocumentDuplicateIcon,
|
||||
FolderIcon,
|
||||
HomeIcon,
|
||||
UsersIcon,
|
||||
XMarkIcon,
|
||||
} from "@heroicons/vue/24/outline";
|
||||
import { Bars3Icon, XMarkIcon } from "@heroicons/vue/24/outline";
|
||||
|
||||
const router = useRouter();
|
||||
const sidebarOpen = ref(false);
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
import { CheckIcon } from "@heroicons/vue/24/outline";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore pending https://github.com/nitrojs/nitro/issues/2758
|
||||
const clients = ref(await $dropFetch("/api/v1/user/client"));
|
||||
|
||||
@ -114,7 +115,7 @@ function revokeClientWrapper(id: string) {
|
||||
title: "Failed to revoke client",
|
||||
description: `Failed to revoke client: ${e}`,
|
||||
},
|
||||
(_, c) => c()
|
||||
(_, c) => c(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
<template></template>
|
||||
<template><div></div></template>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<template>
|
||||
|
||||
<div></div>
|
||||
</template>
|
||||
@ -1,3 +1,3 @@
|
||||
<template>
|
||||
|
||||
<div></div>
|
||||
</template>
|
||||
@ -1 +1 @@
|
||||
<template></template>
|
||||
<template><div></div></template>
|
||||
|
||||
Reference in New Issue
Block a user