fix(striker-ui): make optimize for OS required

main
Tsu-ba-me 3 years ago
parent befe5ec4b5
commit 75606eb9a0
  1. 31
      striker-ui/components/ProvisionServerDialog.tsx
  2. 2
      striker-ui/lib/test_input/testNotBlank.ts
  3. 2
      striker-ui/lib/test_input/testRange.ts
  4. 2
      striker-ui/types/TestInputFunction.ts

@ -1031,6 +1031,9 @@ const ProvisionServerDialog = ({
const [inputOptimizeForOSValue, setInputOptimizeForOSValue] =
useState<OSAutoCompleteOption | null>(null);
const [inputOptimizeForOSMessage, setInputOptimizeForOSMessage] = useState<
InputMessage | undefined
>();
const [includeAnvilUUIDs, setIncludeAnvilUUIDs] = useState<string[]>([]);
const [includeFileUUIDs, setIncludeFileUUIDs] = useState<string[]>([]);
@ -1139,11 +1142,7 @@ const ProvisionServerDialog = ({
},
value: inputInstallISOFileUUID,
},
tests: [
{
test: testNotBlank,
},
],
tests: [{ test: testNotBlank }],
},
anvil: {
defaults: {
@ -1154,11 +1153,18 @@ const ProvisionServerDialog = ({
},
value: inputAnvilValue,
},
tests: [
{
test: testNotBlank,
tests: [{ test: testNotBlank }],
},
],
optimizeForOS: {
defaults: {
max: 0,
min: 0,
onSuccess: () => {
setInputOptimizeForOSMessage(undefined);
},
value: inputOptimizeForOSValue?.key,
},
tests: [{ test: testNotBlank }],
},
};
virtualDisks.inputSizeMessages.forEach((message, vdIndex) => {
@ -1208,11 +1214,7 @@ const ProvisionServerDialog = ({
onFinishBatch: () => {
setVirtualDisks({ ...virtualDisks });
},
tests: [
{
test: testNotBlank,
},
],
tests: [{ test: testNotBlank }],
};
});
@ -1577,6 +1579,7 @@ const ProvisionServerDialog = ({
inputLabelProps.isNotifyRequired = inputOptimizeForOSValue === null;
}}
label="Optimize for OS"
messageBoxProps={inputOptimizeForOSMessage}
noOptionsText="No matching OS"
onChange={(event, value) => {
setInputOptimizeForOSValue(value);

@ -1,6 +1,6 @@
import { InputTestArgs } from '../../types/TestInputFunction';
const testNotBlank: (args: InputTestArgs) => boolean = ({ value }) =>
value !== '';
value ? String(value).length > 0 : false;
export default testNotBlank;

@ -1,6 +1,6 @@
import { InputTestArgs } from '../../types/TestInputFunction';
const testRange: (args: InputTestArgs) => boolean = ({ max, min, value }) =>
value >= min && value <= max;
value ? value >= min && value <= max : false;
export default testRange;

@ -1,7 +1,7 @@
export type InputTestArgs = {
max: bigint | number;
min: bigint | number;
value: bigint | number | string;
value?: bigint | number | null | string;
};
export type InputTest = {

Loading…
Cancel
Save