chore(web): lint fixes

This commit is contained in:
Zack Spear
2023-09-05 15:36:50 -07:00
parent 470a0eca41
commit 800fb6a79f
4 changed files with 22 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { useClipboard } from '@vueuse/core';
import { ClipboardIcon, CogIcon, InformationCircleIcon } from '@heroicons/vue/24/solid';
import { ClipboardIcon, CogIcon } from '@heroicons/vue/24/solid';
import { storeToRefs } from 'pinia';
import 'tailwindcss/tailwind.css';
import '~/assets/main.css';
@@ -10,7 +10,6 @@ import { useCallbackActionsStore } from '~/store/callbackActions';
import { useInstallKeyStore } from '~/store/installKey';
// import { usePromoStore } from '~/store/promo';
import { useServerStore } from '~/store/server';
import { useUnraidApiStore } from '~/store/unraidApi';
export interface Props {
open?: boolean;
@@ -26,7 +25,6 @@ const callbackActionsStore = useCallbackActionsStore();
const installKeyStore = useInstallKeyStore();
// const promoStore = usePromoStore();
const serverStore = useServerStore();
const unraidApiStore = useUnraidApiStore();
const {
accountAction,
@@ -45,12 +43,9 @@ const {
} = storeToRefs(installKeyStore);
const {
connectPluginInstalled,
registered,
authAction,
refreshServerStateStatus,
username,
} = storeToRefs(serverStore);
const { unraidApiStatus } = storeToRefs(unraidApiStore);
/**
* Post sign in success state:
* If we're on the Connect settings page in the webGUI
@@ -246,7 +241,6 @@ const accountActionStatusCopy = computed((): { text: string; } => {
<template v-if="callbackStatus === 'success'" #footer>
<div class="flex flex-row justify-center gap-16px">
<BrandButton
btn-style="underline"
:text="closeText"

View File

@@ -56,11 +56,11 @@ export const WebguiUnraidApiCommand = async (payload: WebguiUnraidApiCommandPayl
return json;
})
.catch((error) => {
console.error(`[WebguiUnraidApiCommand] catch failed to execute unraid-api`, error, payload);
console.error('[WebguiUnraidApiCommand] catch failed to execute unraid-api', error, payload);
return error;
});
} catch (error) {
console.error(`[WebguiUnraidApiCommand] catch failed to execute unraid-api`, error, payload);
console.error('[WebguiUnraidApiCommand] catch failed to execute unraid-api', error, payload);
return error;
}
};

View File

@@ -266,7 +266,7 @@ export const useServerStore = defineStore('server', () => {
*/
const signInAction = computed((): ServerStateDataAction => {
const disabled = unraidApiStore.unraidApiStatus !== 'online';
let title = disabled ? 'Sign In requires a connection to unraid-api' : '';
const title = disabled ? 'Sign In requires a connection to unraid-api' : '';
return {
click: () => { accountStore.signIn(); },
disabled,
@@ -275,7 +275,7 @@ export const useServerStore = defineStore('server', () => {
name: 'signIn',
text: 'Sign In with Unraid.net Account',
title,
}
};
});
/**
* The Sign Out action is a computed property because it depends on the state of the keyfile & unraid-api being online
@@ -637,10 +637,10 @@ export const useServerStore = defineStore('server', () => {
const cloudError = computed((): Error | undefined => {
// if we're not registered or we're in the process of signing out then the cloud error should be ignored
if (!registered.value
|| !cloud.value?.error
|| accountStore.accountActionType === 'signOut'
|| accountStore.accountActionType === 'oemSignOut'
if (!registered.value ||
!cloud.value?.error ||
accountStore.accountActionType === 'signOut' ||
accountStore.accountActionType === 'oemSignOut'
) {
return;
}
@@ -719,15 +719,18 @@ export const useServerStore = defineStore('server', () => {
const mutateServerStateFromApi = (data: serverStateQuery): Server => {
const mutatedData = {
// if we get an owners obj back and the username is root we don't want to overwrite the values
...(data.owner && data.owner.username !== 'root' ? {
// avatar: data.owner.avatar,
username: data.owner.username,
registered: true,
} : { // handles sign outs
// avatar: data.owner.avatar,
username: '',
registered: false,
}),
...(data.owner && data.owner.username !== 'root'
? {
// avatar: data.owner.avatar,
username: data.owner.username,
registered: true,
}
: { // handles sign outs
// avatar: data.owner.avatar,
username: '',
registered: false,
}
),
name: (data.info && data.info.os) ? data.info.os.hostname : null,
keyfile: (data.registration && data.registration.keyFile) ? data.registration.keyFile.contents : null,
regGen: data.vars ? data.vars.regGen : null,

View File

@@ -91,7 +91,7 @@ export const useUnraidApiStore = defineStore('unraidApi', () => {
if (error.error.message.includes('offline')) {
unraidApiStatus.value = 'offline';
// attempt to automatically restart the unraid-api
if (unraidApiRestartAction) restartUnraidApiClient();
if (unraidApiRestartAction) { restartUnraidApiClient(); }
}
if (error.error.message && error.error.message.includes(ERROR_CORS_403)) {
prioritizeCorsError = true;