mirror of
https://github.com/unraid/api.git
synced 2026-01-01 22:20:05 -06:00
feat: array state on registration page
This commit is contained in:
@@ -236,6 +236,10 @@ class ServerState
|
||||
public function getServerState()
|
||||
{
|
||||
$serverState = [
|
||||
"array" => [
|
||||
"state" => @$this->getWebguiGlobal('var', 'fsState'),
|
||||
"progress" => @$this->getWebguiGlobal('var', 'fsProgress'),
|
||||
],
|
||||
"apiKey" => $this->apiKey,
|
||||
"apiVersion" => $this->apiVersion,
|
||||
"avatar" => $this->avatar,
|
||||
|
||||
@@ -39,6 +39,7 @@ const { t } = useI18n();
|
||||
const replaceRenewCheckStore = useReplaceRenewStore();
|
||||
const serverStore = useServerStore();
|
||||
const {
|
||||
array,
|
||||
authAction,
|
||||
dateTimeFormat,
|
||||
deviceCount,
|
||||
@@ -87,6 +88,12 @@ const showFilteredKeyActions = computed((): boolean => !!(keyActions.value && ke
|
||||
|
||||
const items = computed((): RegistrationItemProps[] => {
|
||||
return [
|
||||
...(array.value
|
||||
? [{
|
||||
label: t('Array status'),
|
||||
text: array.value.state,
|
||||
}]
|
||||
: []),
|
||||
...(regTy.value
|
||||
? [{
|
||||
label: t('License key type'),
|
||||
|
||||
@@ -25,9 +25,9 @@ const evenBgColor = computed(() => {
|
||||
error && 'text-white bg-unraid-red',
|
||||
warning && 'text-black bg-yellow-100',
|
||||
]"
|
||||
class="text-16px p-12px grid grid-cols-1 gap-4px sm:px-20px sm:grid-cols-5 sm:gap-16px items-start rounded"
|
||||
class="text-16px p-12px grid grid-cols-1 gap-4px sm:px-20px sm:grid-cols-5 sm:gap-16px items-baseline rounded"
|
||||
>
|
||||
<dt v-if="label" class="font-semibold sm:col-span-2 flex flex-row sm:justify-end sm:text-right items-center gap-x-8px">
|
||||
<dt v-if="label" class="font-semibold leading-normal sm:col-span-2 flex flex-row sm:justify-end sm:text-right items-center gap-x-8px">
|
||||
<ShieldExclamationIcon v-if="error" class="w-16px h-16px fill-current" />
|
||||
<span v-html="label" />
|
||||
</dt>
|
||||
|
||||
@@ -41,6 +41,7 @@ import type {
|
||||
ServerconnectPluginInstalled,
|
||||
ServerDateTimeFormat,
|
||||
ServerStateDataKeyActions,
|
||||
ServerStateArray,
|
||||
ServerOsVersionBranch,
|
||||
ServerUpdateOsResponse,
|
||||
} from '~/types/server';
|
||||
@@ -70,6 +71,7 @@ export const useServerStore = defineStore('server', () => {
|
||||
}
|
||||
});
|
||||
const apiVersion = ref<string>('');
|
||||
const array = ref<ServerStateArray | undefined>();
|
||||
const avatar = ref<string>(''); // @todo potentially move to a user store
|
||||
const caseModel = ref<string>('');
|
||||
const cloud = ref<PartialCloudFragment | undefined>();
|
||||
@@ -170,6 +172,7 @@ export const useServerStore = defineStore('server', () => {
|
||||
return {
|
||||
apiKey: apiKey.value,
|
||||
apiVersion: apiVersion.value,
|
||||
array: array.value,
|
||||
avatar: avatar.value,
|
||||
connectPluginVersion: connectPluginVersion.value,
|
||||
connectPluginInstalled: connectPluginInstalled.value,
|
||||
@@ -863,6 +866,7 @@ export const useServerStore = defineStore('server', () => {
|
||||
const setServer = (data: Server) => {
|
||||
console.debug('[setServer]', data);
|
||||
if (typeof data?.apiKey !== 'undefined') { apiKey.value = data.apiKey; }
|
||||
if (typeof data?.array !== 'undefined') { array.value = data.array; }
|
||||
if (typeof data?.apiVersion !== 'undefined') { apiVersion.value = data.apiVersion; }
|
||||
if (typeof data?.avatar !== 'undefined') { avatar.value = data.avatar; }
|
||||
if (typeof data?.caseModel !== 'undefined') { caseModel.value = data.caseModel; }
|
||||
@@ -1074,6 +1078,7 @@ export const useServerStore = defineStore('server', () => {
|
||||
return {
|
||||
// state
|
||||
apiKey,
|
||||
array,
|
||||
avatar,
|
||||
cloud,
|
||||
config,
|
||||
|
||||
@@ -60,9 +60,15 @@ export interface ServerUpdateOsResponse {
|
||||
sha256: string | null;
|
||||
}
|
||||
|
||||
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.';
|
||||
progress: string;
|
||||
}
|
||||
|
||||
export interface Server {
|
||||
apiKey?: string;
|
||||
apiVersion?: string;
|
||||
array?: ServerStateArray;
|
||||
avatar?: string;
|
||||
caseModel?: string;
|
||||
cloud?: PartialCloudFragment | undefined;
|
||||
|
||||
Reference in New Issue
Block a user