mirror of
https://github.com/unraid/api.git
synced 2026-04-25 00:39:09 -05:00
fix: update configValid state to ineligible in var.ini and adjust rel… (#1268)
…ated tests - Changed `configValid` value from "yes" to "ineligible" in `var.ini`. - Updated tests in `emhttp.test.ts` and `var.test.ts` to reflect the new state. - Refactored `var.ts` to handle the new `configErrorState` logic based on `configValid`. - Adjusted `config.resolver.ts` to return the correct error state. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced configuration status reporting to indicate when settings are ineligible, improving clarity on configuration validity. - **Chores** - Updated recorded download times to maintain accurate logging. - Refined the installation process with streamlined dependency linkage and improved script readability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Zack Spear <hi@zackspear.com>
This commit is contained in:
@@ -87,7 +87,7 @@ shareAvahiSMBModel="Xserve"
|
|||||||
shfs_logging="1"
|
shfs_logging="1"
|
||||||
safeMode="no"
|
safeMode="no"
|
||||||
startMode="Normal"
|
startMode="Normal"
|
||||||
configValid="yes"
|
configValid="ineligible"
|
||||||
joinStatus="Not joined"
|
joinStatus="Not joined"
|
||||||
deviceCount="4"
|
deviceCount="4"
|
||||||
flashGUID="0000-0000-0000-000000000000"
|
flashGUID="0000-0000-0000-000000000000"
|
||||||
|
|||||||
@@ -954,8 +954,8 @@ test('After init returns values from cfg file for all fields', async () => {
|
|||||||
"cacheNumDevices": NaN,
|
"cacheNumDevices": NaN,
|
||||||
"cacheSbNumDisks": NaN,
|
"cacheSbNumDisks": NaN,
|
||||||
"comment": "Dev Server",
|
"comment": "Dev Server",
|
||||||
"configState": "yes",
|
"configErrorState": "INELIGIBLE",
|
||||||
"configValid": true,
|
"configValid": false,
|
||||||
"csrfToken": "0000000000000000",
|
"csrfToken": "0000000000000000",
|
||||||
"defaultFsType": "xfs",
|
"defaultFsType": "xfs",
|
||||||
"deviceCount": 4,
|
"deviceCount": 4,
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ test('Returns parsed state file', async () => {
|
|||||||
"cacheNumDevices": NaN,
|
"cacheNumDevices": NaN,
|
||||||
"cacheSbNumDisks": NaN,
|
"cacheSbNumDisks": NaN,
|
||||||
"comment": "Dev Server",
|
"comment": "Dev Server",
|
||||||
"configState": "yes",
|
"configErrorState": "INELIGIBLE",
|
||||||
"configValid": true,
|
"configValid": false,
|
||||||
"csrfToken": "0000000000000000",
|
"csrfToken": "0000000000000000",
|
||||||
"defaultFsType": "xfs",
|
"defaultFsType": "xfs",
|
||||||
"deviceCount": 4,
|
"deviceCount": 4,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {
|
import type {
|
||||||
type ArrayState,
|
ArrayState,
|
||||||
type DiskFsType,
|
DiskFsType,
|
||||||
type RegistrationState,
|
RegistrationState,
|
||||||
type registrationType,
|
registrationType,
|
||||||
} from '@app/graphql/generated/api/types.js';
|
} from '@app/graphql/generated/api/types.js';
|
||||||
|
import { ConfigErrorState } from '@app/graphql/generated/api/types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global vars
|
* Global vars
|
||||||
@@ -17,7 +18,7 @@ export type Var = {
|
|||||||
/** Is the array's config valid. */
|
/** Is the array's config valid. */
|
||||||
configValid: boolean;
|
configValid: boolean;
|
||||||
/** @internal used to hold the value for config.error */
|
/** @internal used to hold the value for config.error */
|
||||||
configState: string;
|
configErrorState: ConfigErrorState | null;
|
||||||
/** Current CSRF token for HTTP requests with emhttpd. */
|
/** Current CSRF token for HTTP requests with emhttpd. */
|
||||||
csrfToken: string;
|
csrfToken: string;
|
||||||
defaultFormat: string;
|
defaultFormat: string;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { type IniStringBoolean, type IniStringBooleanOrAuto } from '@app/core/ty
|
|||||||
import { toNumber } from '@app/core/utils/index.js';
|
import { toNumber } from '@app/core/utils/index.js';
|
||||||
import {
|
import {
|
||||||
ArrayState,
|
ArrayState,
|
||||||
|
ConfigErrorState,
|
||||||
DiskFsType,
|
DiskFsType,
|
||||||
RegistrationState,
|
RegistrationState,
|
||||||
registrationType,
|
registrationType,
|
||||||
@@ -23,7 +24,7 @@ export type VarIni = {
|
|||||||
cacheSbNumDisks: string;
|
cacheSbNumDisks: string;
|
||||||
comment: string;
|
comment: string;
|
||||||
configValid: string;
|
configValid: string;
|
||||||
configState: string;
|
configErrorState: string;
|
||||||
csrfToken: string;
|
csrfToken: string;
|
||||||
defaultFormat: string;
|
defaultFormat: string;
|
||||||
defaultFsType: string;
|
defaultFsType: string;
|
||||||
@@ -200,6 +201,10 @@ const safeParseMdState = (mdState: string | undefined): ArrayState => {
|
|||||||
return attemptedParse;
|
return attemptedParse;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const convertconfigErrorStateToEnum = (configErrorState: string): ConfigErrorState => {
|
||||||
|
return ConfigErrorState[configErrorState.toUpperCase()];
|
||||||
|
};
|
||||||
|
|
||||||
export const parse: StateFileToIniParserMap['var'] = (iniFile) => {
|
export const parse: StateFileToIniParserMap['var'] = (iniFile) => {
|
||||||
return {
|
return {
|
||||||
...iniFile,
|
...iniFile,
|
||||||
@@ -209,7 +214,9 @@ export const parse: StateFileToIniParserMap['var'] = (iniFile) => {
|
|||||||
cacheNumDevices: toNumber(iniFile.cacheNumDevices),
|
cacheNumDevices: toNumber(iniFile.cacheNumDevices),
|
||||||
cacheSbNumDisks: toNumber(iniFile.cacheSbNumDisks),
|
cacheSbNumDisks: toNumber(iniFile.cacheSbNumDisks),
|
||||||
configValid: iniBooleanToJsBoolean(iniFile.configValid, false),
|
configValid: iniBooleanToJsBoolean(iniFile.configValid, false),
|
||||||
configState: iniFile.configValid,
|
configErrorState: iniBooleanToJsBoolean(iniFile.configValid, false)
|
||||||
|
? null
|
||||||
|
: convertconfigErrorStateToEnum(iniFile.configValid),
|
||||||
deviceCount: toNumber(iniFile.deviceCount),
|
deviceCount: toNumber(iniFile.deviceCount),
|
||||||
fsCopyPrcnt: toNumber(iniFile.fsCopyPrcnt),
|
fsCopyPrcnt: toNumber(iniFile.fsCopyPrcnt),
|
||||||
fsNumMounted: toNumber(iniFile.fsNumMounted),
|
fsNumMounted: toNumber(iniFile.fsNumMounted),
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ export class ConfigResolver {
|
|||||||
return {
|
return {
|
||||||
id: 'config',
|
id: 'config',
|
||||||
valid: emhttp.var.configValid,
|
valid: emhttp.var.configValid,
|
||||||
error: emhttp.var.configValid
|
error: emhttp.var.configValid ? null : emhttp.var.configErrorState,
|
||||||
? null
|
|
||||||
: (ConfigErrorState[emhttp.var.configState] ?? ConfigErrorState.UNKNOWN_ERROR),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1741960696861
|
1742838682466
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1741960696132
|
1742838681735
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1741960696408
|
1742838682135
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1741960697108
|
1742838682936
|
||||||
@@ -500,6 +500,7 @@ CFG_OLD=/boot/config/plugins/Unraid.net
|
|||||||
CFG_NEW=/boot/config/plugins/dynamix.my.servers
|
CFG_NEW=/boot/config/plugins/dynamix.my.servers
|
||||||
[[ -d "$CFG_OLD" ]] && [[ ! -d "$CFG_NEW" ]] && mv "$CFG_OLD" "$CFG_NEW"
|
[[ -d "$CFG_OLD" ]] && [[ ! -d "$CFG_NEW" ]] && mv "$CFG_OLD" "$CFG_NEW"
|
||||||
|
|
||||||
|
|
||||||
# relax restrictions on built-in Firefox so it can sign in to Unraid Connect
|
# relax restrictions on built-in Firefox so it can sign in to Unraid Connect
|
||||||
# brings older versions of Unraid in sync with 6.12.0
|
# brings older versions of Unraid in sync with 6.12.0
|
||||||
# no need to restore original file on uninstall
|
# no need to restore original file on uninstall
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ import { useServerStore } from '~/store/server';
|
|||||||
import { useThemeStore } from '~/store/theme';
|
import { useThemeStore } from '~/store/theme';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
label: string;
|
label?: string;
|
||||||
t: ComposerTranslation;
|
t: ComposerTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user