feat(web): registration page array status messaging

This commit is contained in:
Zack Spear
2024-05-01 10:29:44 -07:00
committed by Zack Spear
parent a95fc5ed07
commit 31a5413643
3 changed files with 21 additions and 4 deletions

View File

@@ -40,7 +40,8 @@ const { t } = useI18n();
const replaceRenewCheckStore = useReplaceRenewStore();
const serverStore = useServerStore();
const {
array,
computedArray,
arrayWarning,
authAction,
dateTimeFormat,
deviceCount,
@@ -108,10 +109,11 @@ const showFilteredKeyActions = computed((): boolean => !!(keyActions.value && ke
const items = computed((): RegistrationItemProps[] => {
return [
...(array.value
...(computedArray.value
? [{
label: t('Array status'),
text: array.value.state,
text: computedArray.value,
warning: arrayWarning.value,
}]
: []),
...(regTy.value
@@ -194,6 +196,7 @@ const items = computed((): RegistrationItemProps[] => {
componentProps: { t },
}]
: []),
...(showFilteredKeyActions.value
? [{
component: KeyActions,

View File

@@ -72,6 +72,17 @@ export const useServerStore = defineStore('server', () => {
});
const apiVersion = ref<string>('');
const array = ref<ServerStateArray | undefined>();
// helps to display warning next to array status
const arrayWarning = computed(() => !!(stateDataError.value || serverConfigError.value));
const computedArray = computed(() => {
if (arrayWarning.value) {
if (array.value?.state === 'Stopped') {
return 'Stopped. The Array will not start until the above issue is resolved.';
}
return 'Started. If stopped, the Array will not restart until the above issue is resolved.';
}
return array.value?.state;
});
const avatar = ref<string>(''); // @todo potentially move to a user store
const caseModel = ref<string>('');
const cloud = ref<PartialCloudFragment | undefined>();
@@ -860,6 +871,7 @@ export const useServerStore = defineStore('server', () => {
cloudError.value,
].filter(Boolean);
});
/**
* Actions
*/
@@ -1137,6 +1149,8 @@ export const useServerStore = defineStore('server', () => {
serverErrors,
tooManyDevices,
serverConfigError,
arrayWarning,
computedArray,
// actions
setServer,
setUpdateOsResponse,

View File

@@ -61,7 +61,7 @@ export interface ServerUpdateOsResponse {
}
export interface ServerStateArray {
state: 'Stopped' | 'Running' | 'Stopped. The Array will not start until the above issue is resolved.' | 'Running. If stopped, the Array will not restart until the above issue is resolved.';
state: 'Stopped' | 'Started' | 'Starting' | 'Stopping';
progress: string;
}