mirror of
https://github.com/unraid/api.git
synced 2026-01-06 08:39:54 -06:00
feat: add manage account link to all versions of upc dropdown
This commit is contained in:
@@ -6,25 +6,25 @@ import {
|
||||
BellAlertIcon,
|
||||
CogIcon,
|
||||
KeyIcon,
|
||||
UserIcon,
|
||||
} from '@heroicons/vue/24/solid';
|
||||
|
||||
import {
|
||||
ACCOUNT,
|
||||
CONNECT_DASHBOARD,
|
||||
WEBGUI_CONNECT_SETTINGS,
|
||||
WEBGUI_TOOLS_REGISTRATION,
|
||||
} from '~/helpers/urls';
|
||||
import { useAccountStore } from '~/store/account';
|
||||
import { useErrorsStore } from '~/store/errors';
|
||||
import { useServerStore } from '~/store/server';
|
||||
import { useUpdateOsStore } from '~/store/updateOs';
|
||||
import { useUpdateOsActionsStore } from '~/store/updateOsActions';
|
||||
import type { UserProfileLink } from '~/types/userProfile';
|
||||
|
||||
const props = defineProps<{ t: any; }>();
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
const errorsStore = useErrorsStore();
|
||||
const updateOsStore = useUpdateOsStore();
|
||||
const updateOsActionsStore = useUpdateOsActionsStore();
|
||||
|
||||
const { errors } = storeToRefs(errorsStore);
|
||||
const {
|
||||
@@ -45,6 +45,16 @@ const signOutAction = computed(() => stateData.value.actions?.filter((act: { nam
|
||||
*/
|
||||
const filteredKeyActions = computed(() => keyActions.value?.filter(action => !['renew'].includes(action.name)));
|
||||
|
||||
const manageUnraidNetAccount = computed(() => {
|
||||
return {
|
||||
external: true,
|
||||
click: () => { accountStore.manage(); },
|
||||
icon: UserIcon,
|
||||
text: props.t('Manage Unraid.net Account'),
|
||||
title: props.t('Manage Unraid.net Account in new tab'),
|
||||
};
|
||||
});
|
||||
|
||||
const links = computed(():UserProfileLink[] => {
|
||||
return [
|
||||
...(regUpdatesExpired.value
|
||||
@@ -90,13 +100,7 @@ const links = computed(():UserProfileLink[] => {
|
||||
text: props.t('Go to Connect'),
|
||||
title: props.t('Opens Connect in new tab'),
|
||||
},
|
||||
{
|
||||
external: true,
|
||||
href: ACCOUNT.toString(),
|
||||
icon: ArrowTopRightOnSquareIcon,
|
||||
text: props.t('Manage Unraid.net Account'),
|
||||
title: props.t('Manage Unraid.net Account in new tab'),
|
||||
},
|
||||
...([manageUnraidNetAccount.value]),
|
||||
{
|
||||
href: WEBGUI_CONNECT_SETTINGS.toString(),
|
||||
icon: CogIcon,
|
||||
@@ -105,7 +109,9 @@ const links = computed(():UserProfileLink[] => {
|
||||
},
|
||||
...(signOutAction.value),
|
||||
]
|
||||
: []
|
||||
: [
|
||||
...([manageUnraidNetAccount.value]),
|
||||
]
|
||||
),
|
||||
];
|
||||
});
|
||||
|
||||
@@ -72,6 +72,18 @@ export const useAccountStore = defineStore('account', () => {
|
||||
const accountActionType = computed(() => accountAction.value?.type);
|
||||
|
||||
// Actions
|
||||
const manage = () => {
|
||||
callbackStore.send(
|
||||
ACCOUNT_CALLBACK.toString(),
|
||||
[{
|
||||
server: {
|
||||
...serverAccountPayload.value,
|
||||
},
|
||||
type: 'manage',
|
||||
}],
|
||||
inIframe.value ? 'newTab' : undefined,
|
||||
);
|
||||
};
|
||||
const recover = () => {
|
||||
callbackStore.send(
|
||||
ACCOUNT_CALLBACK.toString(),
|
||||
@@ -255,6 +267,7 @@ export const useAccountStore = defineStore('account', () => {
|
||||
// Getters
|
||||
accountActionType,
|
||||
// Actions
|
||||
manage,
|
||||
recover,
|
||||
replace,
|
||||
signIn,
|
||||
|
||||
@@ -23,7 +23,8 @@ export type Redeem = 'redeem';
|
||||
export type Renew = 'renew';
|
||||
export type Upgrade = 'upgrade';
|
||||
export type UpdateOs = 'updateOs';
|
||||
export type AccountActionTypes = Troubleshoot | SignIn | SignOut | OemSignOut;
|
||||
export type Manage = 'manage';
|
||||
export type AccountActionTypes = Troubleshoot | SignIn | SignOut | OemSignOut | Manage;
|
||||
export type AccountKeyActionTypes = Recover | Replace | TrialExtend | TrialStart | UpdateOs;
|
||||
export type PurchaseActionTypes = Purchase | Redeem | Renew | Upgrade;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user