mirror of
https://github.com/unraid/api.git
synced 2026-01-06 08:39:54 -06:00
refactor: genericized updateOs store to be shared with other repos
This commit is contained in:
@@ -7,7 +7,7 @@ import { useCallbackStore } from '~/store/callbackActions';
|
||||
import { useDropdownStore } from '~/store/dropdown';
|
||||
import { useServerStore } from '~/store/server';
|
||||
import { useThemeStore } from '~/store/theme';
|
||||
import { useUpdateOsStore } from '~/store/updateOs';
|
||||
import { useUpdateOsStore } from '~/store/updateOsActions';
|
||||
import type { Server } from '~/types/server';
|
||||
import 'tailwindcss/tailwind.css';
|
||||
import '~/assets/main.css';
|
||||
@@ -25,7 +25,16 @@ const serverStore = useServerStore();
|
||||
const updateOsStore = useUpdateOsStore();
|
||||
|
||||
const { dropdownVisible } = storeToRefs(dropdownStore);
|
||||
const { name, description, lanIp, state, connectPluginInstalled } = storeToRefs(serverStore);
|
||||
const {
|
||||
name,
|
||||
description,
|
||||
guid,
|
||||
keyfile,
|
||||
lanIp,
|
||||
osVersion,
|
||||
state,
|
||||
connectPluginInstalled,
|
||||
} = storeToRefs(serverStore);
|
||||
const { bannerGradient, theme } = storeToRefs(useThemeStore());
|
||||
|
||||
const hideDropdown = computed(() => state.value === 'PRO' && !connectPluginInstalled.value);
|
||||
@@ -75,7 +84,12 @@ onBeforeMount(() => {
|
||||
}
|
||||
|
||||
callbackStore.watcher();
|
||||
updateOsStore.checkForOsUpdate();
|
||||
updateOsStore.checkForUpdate({
|
||||
cache: true,
|
||||
guid: guid.value,
|
||||
keyfile: keyfile.value,
|
||||
osVersion: osVersion.value,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { useCallbackActionsStore } from '~/store/callbackActions';
|
||||
import { useInstallKeyStore } from '~/store/installKey';
|
||||
// import { usePromoStore } from '~/store/promo';
|
||||
import { useServerStore } from '~/store/server';
|
||||
import { useUpdateOsStore } from '~/store/updateOs';
|
||||
import { useUpdateOsActionsStore } from '~/store/updateOsActions';
|
||||
|
||||
export interface Props {
|
||||
open?: boolean;
|
||||
@@ -28,7 +28,7 @@ const callbackActionsStore = useCallbackActionsStore();
|
||||
const installKeyStore = useInstallKeyStore();
|
||||
// const promoStore = usePromoStore();
|
||||
const serverStore = useServerStore();
|
||||
const updateOsStore = useUpdateOsStore();
|
||||
const updateOsActionStore = useUpdateOsActionsStore();
|
||||
|
||||
const {
|
||||
accountAction,
|
||||
@@ -54,7 +54,7 @@ const {
|
||||
const {
|
||||
status: updateOsStatus,
|
||||
callbackUpdateRelease,
|
||||
} = storeToRefs(updateOsStore);
|
||||
} = storeToRefs(updateOsActionStore);
|
||||
/**
|
||||
* Post sign in success state:
|
||||
* If we're on the Connect settings page in the webGUI
|
||||
@@ -111,7 +111,7 @@ const close = () => {
|
||||
};
|
||||
|
||||
const cancelUpdateOs = () => {
|
||||
updateOsStore.setStatus('ready');
|
||||
updateOsActionStore.setStatus('ready');
|
||||
callbackActionsStore.setCallbackStatus('ready')
|
||||
};
|
||||
|
||||
@@ -317,7 +317,7 @@ const { copy, copied, isSupported } = useClipboard({ source: keyUrl.value });
|
||||
/>
|
||||
<BrandButton
|
||||
:text="t('Confirm and start update')"
|
||||
@click="updateOsStore.installOsUpdate()"
|
||||
@click="updateOsActionStore.installOsUpdate()"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ACCOUNT, CONNECT_DASHBOARD, PLUGIN_SETTINGS } from '~/helpers/urls';
|
||||
import { useErrorsStore } from '~/store/errors';
|
||||
// import { usePromoStore } from '~/store/promo';
|
||||
import { useServerStore } from '~/store/server';
|
||||
import { useUpdateOsStore } from '~/store/updateOs';
|
||||
import { useUpdateOsStore, useUpdateOsActionsStore } from '~/store/updateOsActions';
|
||||
import type { UserProfileLink } from '~/types/userProfile';
|
||||
|
||||
const props = defineProps<{ t: any; }>();
|
||||
@@ -16,7 +16,8 @@ const errorsStore = useErrorsStore();
|
||||
|
||||
const { errors } = storeToRefs(errorsStore);
|
||||
const { keyActions, connectPluginInstalled, registered, stateData } = storeToRefs(useServerStore());
|
||||
const { updateAvailable, initUpdateOsCallback } = storeToRefs(useUpdateOsStore());
|
||||
const { available: osUpdateAvailable } = storeToRefs(useUpdateOsStore());
|
||||
const { initUpdateOsCallback } = storeToRefs(useUpdateOsActionsStore());
|
||||
|
||||
const signInAction = computed(() => stateData.value.actions?.filter((act: { name: string; }) => act.name === 'signIn') ?? []);
|
||||
const signOutAction = computed(() => stateData.value.actions?.filter((act: { name: string; }) => act.name === 'signOut') ?? []);
|
||||
@@ -26,7 +27,7 @@ const links = computed(():UserProfileLink[] => {
|
||||
...(registered.value && connectPluginInstalled.value
|
||||
? [
|
||||
{
|
||||
emphasize: !updateAvailable.value, // only emphasize when we don't have an update available
|
||||
emphasize: !osUpdateAvailable.value, // only emphasize when we don't have an update available
|
||||
external: true,
|
||||
href: CONNECT_DASHBOARD.toString(),
|
||||
icon: ArrowTopRightOnSquareIcon,
|
||||
@@ -93,7 +94,7 @@ const showKeyline = computed(() => showConnectStatus.value && (keyActions.value?
|
||||
<UpcKeyline />
|
||||
</li>
|
||||
|
||||
<template v-if="updateAvailable">
|
||||
<template v-if="osUpdateAvailable">
|
||||
<li>
|
||||
<UpcDropdownItem :item="initUpdateOsCallback" :t="t" />
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user