From 8b5ba1aa979924c9d864fa934d66019cd86544c8 Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Mon, 11 Sep 2023 18:23:29 -0700 Subject: [PATCH] wip: update os via upc --- web/components/UserProfile.ce.vue | 3 + .../UserProfile/DropdownContent.vue | 12 +- web/helpers/urls.ts | 3 + web/locales/en_US.json | 3 +- web/nuxt.config.ts | 13 +- web/package-lock.json | 903 ++---------------- web/package.json | 1 + web/store/callback.ts | 10 +- web/store/callbackActions.ts | 7 + web/store/server.ts | 1 + web/store/updateOs.ts | 111 +++ web/types/server.ts | 2 +- 12 files changed, 230 insertions(+), 839 deletions(-) create mode 100644 web/store/updateOs.ts diff --git a/web/components/UserProfile.ce.vue b/web/components/UserProfile.ce.vue index f512aa848..9b8bca468 100644 --- a/web/components/UserProfile.ce.vue +++ b/web/components/UserProfile.ce.vue @@ -7,6 +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 type { Server } from '~/types/server'; import 'tailwindcss/tailwind.css'; import '~/assets/main.css'; @@ -21,6 +22,7 @@ const { t } = useI18n(); const callbackStore = useCallbackStore(); const dropdownStore = useDropdownStore(); const serverStore = useServerStore(); +const updateOsStore = useUpdateOsStore(); const { dropdownVisible } = storeToRefs(dropdownStore); const { name, description, lanIp, state, connectPluginInstalled } = storeToRefs(serverStore); @@ -73,6 +75,7 @@ onBeforeMount(() => { } callbackStore.watcher(); + updateOsStore.checkForOsUpdate(); }); diff --git a/web/components/UserProfile/DropdownContent.vue b/web/components/UserProfile/DropdownContent.vue index 66ec4d073..1754c8369 100644 --- a/web/components/UserProfile/DropdownContent.vue +++ b/web/components/UserProfile/DropdownContent.vue @@ -6,6 +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 type { UserProfileLink } from '~/types/userProfile'; const props = defineProps<{ t: any; }>(); @@ -13,8 +14,9 @@ const props = defineProps<{ t: any; }>(); const errorsStore = useErrorsStore(); // const promoStore = usePromoStore(); -const { keyActions, connectPluginInstalled, registered, stateData } = storeToRefs(useServerStore()); const { errors } = storeToRefs(errorsStore); +const { keyActions, connectPluginInstalled, registered, stateData } = storeToRefs(useServerStore()); +const { updateAvailable, initUpdateOsCallback } = storeToRefs(useUpdateOsStore()); 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') ?? []); @@ -24,7 +26,7 @@ const links = computed(():UserProfileLink[] => { ...(registered.value && connectPluginInstalled.value ? [ { - emphasize: true, + emphasize: !updateAvailable.value, // only emphasize when we don't have an update available external: true, href: CONNECT_DASHBOARD.toString(), icon: ArrowTopRightOnSquareIcon, @@ -91,6 +93,12 @@ const showKeyline = computed(() => showConnectStatus.value && (keyActions.value? + +