Skip to content

Commit a5c19ca

Browse files
fix clearly defined properties
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
1 parent 4f31770 commit a5c19ca

4 files changed

Lines changed: 32 additions & 21 deletions

File tree

client/src/app/pages/importer-create-update/components/importer-wizard.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
useAnalysisWizardFormValidationSchema,
3131
} from "./schema";
3232
import { SetConfiguration } from "./set-configuration";
33-
import { SetGeneralInformation } from "./set-general-information";
33+
import { SELECT_ONE, SetGeneralInformation } from "./set-general-information";
3434
import {
3535
getImporterConfigurationFromFormValues,
3636
getImporterTypeAndConfiguration,
@@ -39,8 +39,6 @@ import {
3939
type ImporterType,
4040
} from "./type-utils";
4141

42-
const SELECT_ONE = "select-one";
43-
4442
interface IImporterWizard {
4543
importer: Importer | null;
4644
onClose: () => void;

client/src/app/pages/importer-create-update/components/schema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ export const useConfigurationFormSchema = () => {
7070
v3Signatures: boolean(),
7171
ignoreMissing: boolean(),
7272
fetchRetries: number().min(0),
73-
sizeLimitValue: string(),
73+
sizeLimitValue: string().matches(
74+
/^[0-9]*\.?[0-9]*$/,
75+
"Only numbers and a dot are allowed",
76+
),
7477
sizeLimitUnit: string().required().trim().max(250),
7578
onlyPatterns: array(object({ value: string().required() })),
7679
keys: array(object({ value: string().required().url() })),

client/src/app/pages/importer-create-update/components/set-general-information.tsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import {
66
Button,
77
Card,
88
Form,
9+
FormGroupLabelHelp,
910
FormSelectOption,
1011
InputGroup,
1112
InputGroupItem,
1213
Label,
1314
LabelGroup,
15+
Popover,
1416
Stack,
1517
StackItem,
1618
Switch,
@@ -19,28 +21,19 @@ import {
1921
import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-icon";
2022

2123
import { splitStringAsKeyValue } from "@app/api/model-utils";
24+
import type { Importer } from "@app/client";
2225
import {
2326
HookFormPFGroupController,
2427
HookFormPFSelect,
2528
HookFormPFTextArea,
2629
HookFormPFTextInput,
2730
} from "@app/components/HookFormPFFields";
2831
import { validateLabelString } from "@app/utils/utils";
29-
import type { ImporterWizardFormValues } from "./schema";
30-
import type { Importer } from "@app/client";
3132

32-
const SELECT_ONE = "select-one";
33+
import type { ImporterWizardFormValues } from "./schema";
34+
import { ALL_IMPORTER_TYPES } from "./type-utils";
3335

34-
export const ALL_IMPORTER_TYPES = [
35-
"sbom",
36-
"csaf",
37-
"osv",
38-
"cve",
39-
"clearly_defined",
40-
"clearly_defined_curation",
41-
"cwe",
42-
"quay",
43-
] as const;
36+
export const SELECT_ONE = "select-one";
4437

4538
//
4639

@@ -55,6 +48,8 @@ export const SetGeneralInformation: React.FC<ISetGeneralInformationProps> = ({
5548

5649
const [labelInputTextValue, setLabelInputTextValue] = React.useState("");
5750

51+
const labelsHelpRef = React.useRef(null);
52+
5853
return (
5954
<Form
6055
onSubmit={(event) => {
@@ -111,6 +106,21 @@ export const SetGeneralInformation: React.FC<ISetGeneralInformationProps> = ({
111106
name="labels"
112107
label="Labels"
113108
fieldId="labels"
109+
formGroupProps={{
110+
labelHelp: (
111+
<Popover
112+
triggerRef={labelsHelpRef}
113+
bodyContent={
114+
<div>These labels will be added to each document imported.</div>
115+
}
116+
>
117+
<FormGroupLabelHelp
118+
ref={labelsHelpRef}
119+
aria-label="More info for labels field"
120+
/>
121+
</Popover>
122+
),
123+
}}
114124
renderInput={({ field: { value, onChange } }) => {
115125
const onAddNewLabel = () => {
116126
if (validateLabelString(labelInputTextValue)) {

client/src/app/pages/importer-create-update/components/type-utils.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export const ALL_IMPORTER_TYPES = [
1919
"csaf",
2020
"osv",
2121
"cve",
22-
"clearly_defined",
23-
"clearly_defined_curation",
22+
"clearlyDefined",
23+
"clearlyDefinedCuration",
2424
"cwe",
2525
"quay",
2626
] as const;
@@ -222,7 +222,7 @@ export const getImporterConfigurationFromFormValues = (
222222
};
223223
break;
224224
}
225-
case "clearly_defined": {
225+
case "clearlyDefined": {
226226
configuration = {
227227
clearlyDefined: {
228228
...commonConfigurationFields,
@@ -231,7 +231,7 @@ export const getImporterConfigurationFromFormValues = (
231231
};
232232
break;
233233
}
234-
case "clearly_defined_curation": {
234+
case "clearlyDefinedCuration": {
235235
configuration = {
236236
clearlyDefinedCuration: {
237237
...commonConfigurationFields,

0 commit comments

Comments
 (0)