mirror of
https://github.com/unraid/api.git
synced 2026-01-06 00:30:22 -06:00
refactor(web): lint fixes and transition clean up
This commit is contained in:
@@ -111,23 +111,12 @@ const ariaLablledById = computed((): string|undefined => props.title ? `ModalTit
|
||||
</header>
|
||||
<slot name="main" />
|
||||
|
||||
<TransitionChild
|
||||
appear
|
||||
as="template"
|
||||
enter="duration-300 ease-out"
|
||||
enter-from="opacity-0"
|
||||
enter-to="opacity-100"
|
||||
leave="duration-200 ease-in"
|
||||
leave-from="opacity-100"
|
||||
leave-to="opacity-0"
|
||||
>
|
||||
<footer v-if="$slots['footer']" class="text-14px relative -mx-16px -mb-16px sm:-mx-24px sm:-mb-24px p-4 sm:p-6">
|
||||
<div class="absolute z-0 inset-0 opacity-10 bg-beta" />
|
||||
<div class="relative z-10">
|
||||
<slot name="footer" />
|
||||
</div>
|
||||
</footer>
|
||||
</TransitionChild>
|
||||
<footer v-if="$slots['footer']" class="text-14px relative -mx-16px -mb-16px sm:-mx-24px sm:-mb-24px p-4 sm:p-6">
|
||||
<div class="absolute z-0 inset-0 opacity-10 bg-beta" />
|
||||
<div class="relative z-10">
|
||||
<slot name="footer" />
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</TransitionChild>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,6 @@ const useInstallPlugin = () => {
|
||||
|
||||
// @ts-ignore – `openPlugin` will be included in 6.10.4+ DefaultPageLayout
|
||||
if (typeof openPlugin === 'function') {
|
||||
|
||||
// @ts-ignore
|
||||
openPlugin(
|
||||
`plugin ${payload.update ? 'update' : 'install'} ${file}`,
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useCallbackStore } from '~/store/callbackActions';
|
||||
import { useErrorsStore } from '~/store/errors';
|
||||
import { useServerStore } from '~/store/server';
|
||||
import { useUnraidApiStore } from '~/store/unraidApi';
|
||||
import { WebguiUpdate } from '~/composables/services/webgui';
|
||||
import { ACCOUNT_CALLBACK } from '~/helpers/urls';
|
||||
import type { ExternalSignIn, ExternalSignOut } from '~/store/callback';
|
||||
/**
|
||||
@@ -60,8 +59,6 @@ export const useAccountStore = defineStore('account', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const username = ref<string>('');
|
||||
|
||||
// Getters
|
||||
const accountActionType = computed(() => accountAction.value?.type);
|
||||
|
||||
@@ -140,15 +137,15 @@ export const useAccountStore = defineStore('account', () => {
|
||||
};
|
||||
|
||||
const connectSignInMutation = async () => {
|
||||
if (!connectSignInPayload.value
|
||||
|| (connectSignInPayload.value && (!connectSignInPayload.value.apiKey || !connectSignInPayload.value.email || !connectSignInPayload.value.preferred_username))
|
||||
if (!connectSignInPayload.value ||
|
||||
(connectSignInPayload.value && (!connectSignInPayload.value.apiKey || !connectSignInPayload.value.email || !connectSignInPayload.value.preferred_username))
|
||||
) {
|
||||
accountActionStatus.value = 'failed';
|
||||
return;
|
||||
}
|
||||
|
||||
accountActionStatus.value = 'updating';
|
||||
const { mutate: signInMutation, onDone, onError } = useMutation(CONNECT_SIGN_IN, {
|
||||
const { mutate: signInMutation, onDone, onError } = await useMutation(CONNECT_SIGN_IN, {
|
||||
variables: {
|
||||
input: {
|
||||
apiKey: connectSignInPayload.value.apiKey,
|
||||
@@ -178,7 +175,7 @@ export const useAccountStore = defineStore('account', () => {
|
||||
});
|
||||
});
|
||||
|
||||
onError(error => {
|
||||
onError((error) => {
|
||||
logErrorMessages(error);
|
||||
accountActionStatus.value = 'failed';
|
||||
errorsStore.setError({
|
||||
@@ -200,7 +197,7 @@ export const useAccountStore = defineStore('account', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const { mutate: signOutMutation, onDone, onError } = useMutation(CONNECT_SIGN_OUT);
|
||||
const { mutate: signOutMutation, onDone, onError } = await useMutation(CONNECT_SIGN_OUT);
|
||||
|
||||
signOutMutation();
|
||||
|
||||
@@ -210,7 +207,7 @@ export const useAccountStore = defineStore('account', () => {
|
||||
setQueueConnectSignOut(false); // reset
|
||||
});
|
||||
|
||||
onError(error => {
|
||||
onError((error) => {
|
||||
logErrorMessages(error);
|
||||
accountActionStatus.value = 'failed';
|
||||
errorsStore.setError({
|
||||
|
||||
@@ -123,7 +123,7 @@ export const useCallbackStoreGeneric = (
|
||||
) =>
|
||||
defineStore('callback', () => {
|
||||
const callbackActions = useCallbackActions();
|
||||
const send = (url: string, payload: SendPayloads, newTab: boolean = false) => {
|
||||
const send = (url: string, payload: SendPayloads, newTab = false) => {
|
||||
console.debug('[callback.send]');
|
||||
const stringifiedData = JSON.stringify({
|
||||
actions: [...payload],
|
||||
|
||||
@@ -20,7 +20,7 @@ export const useDropdownStore = defineStore('dropdown', () => {
|
||||
* Automatically open the user dropdown on first page load when ENOKEYFILE aka a new server
|
||||
*/
|
||||
const serverStateEnokeyfile = computed(() => serverStore.state === 'ENOKEYFILE');
|
||||
watch(serverStateEnokeyfile, (newVal, oldVal) => {
|
||||
watch(serverStateEnokeyfile, (newVal) => {
|
||||
const autoOpenSessionStorage = `unraid_${serverStore.guid.slice(-12) ?? 'NO_GUID'}_ENOKEYFILE`;
|
||||
if (newVal && !sessionStorage.getItem(autoOpenSessionStorage)) {
|
||||
sessionStorage.setItem(autoOpenSessionStorage, 'true');
|
||||
|
||||
@@ -12,7 +12,6 @@ import { UserProfileLink } from 'types/userProfile';
|
||||
|
||||
import { WebguiUnraidApiCommand } from '~/composables/services/webgui';
|
||||
import { GRAPHQL } from '~/helpers/urls';
|
||||
import { useAccountStore } from '~/store/account';
|
||||
// import { useErrorsStore } from '~/store/errors';
|
||||
import { useServerStore } from '~/store/server';
|
||||
|
||||
@@ -29,12 +28,11 @@ const httpEndpoint = GRAPHQL;
|
||||
const wsEndpoint = new URL(GRAPHQL.toString().replace('http', 'ws'));
|
||||
|
||||
export const useUnraidApiStore = defineStore('unraidApi', () => {
|
||||
const accountStore = useAccountStore();
|
||||
// const errorsStore = useErrorsStore();
|
||||
const serverStore = useServerStore();
|
||||
|
||||
const unraidApiClient = ref<ApolloClient<any>>();
|
||||
watch(unraidApiClient, (newVal, oldVal) => {
|
||||
watch(unraidApiClient, (newVal) => {
|
||||
if (newVal) {
|
||||
const apiResponse = serverStore.fetchServerFromApi();
|
||||
if (apiResponse) {
|
||||
@@ -170,7 +168,7 @@ export const useUnraidApiStore = defineStore('unraidApi', () => {
|
||||
|
||||
const restartUnraidApiClient = async () => {
|
||||
unraidApiStatus.value = 'restarting';
|
||||
const response = await WebguiUnraidApiCommand({
|
||||
await WebguiUnraidApiCommand({
|
||||
csrf_token: serverStore.csrf,
|
||||
command: 'start',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user