Skip to content

Commit f04df3e

Browse files
committed
Fix for incorrect import in ui
1 parent 1f49238 commit f04df3e

File tree

5 files changed

+24
-26
lines changed

5 files changed

+24
-26
lines changed

ui/ui-app/src/app/components/modals/EditMetaDataModal.tsx

+23-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
TextArea,
1111
TextInput
1212
} from "@patternfly/react-core";
13-
import { ArtifactLabel, LabelsFormGroup, labelsToList, listToLabels } from "@app/components";
1413
import { If } from "@apicurio/common-ui-components";
14+
import { ArtifactLabel, LabelsFormGroup } from "@app/components";
1515

1616

1717
export type MetaData = {
@@ -21,6 +21,28 @@ export type MetaData = {
2121
}
2222

2323

24+
function labelsToList(labels: { [key: string]: string|undefined }): ArtifactLabel[] {
25+
return Object.keys(labels).filter((key) => key !== undefined).map(key => {
26+
return {
27+
name: key,
28+
value: labels[key],
29+
nameValidated: "default",
30+
valueValidated: "default"
31+
};
32+
});
33+
}
34+
35+
function listToLabels(labels: ArtifactLabel[]): { [key: string]: string|undefined } {
36+
const rval: { [key: string]: string|undefined } = {};
37+
labels.forEach(label => {
38+
if (label.name) {
39+
rval[label.name] = label.value;
40+
}
41+
});
42+
return rval;
43+
}
44+
45+
2446
/**
2547
* Labels
2648
*/

ui/ui-app/src/app/components/modals/LabelsFormGroup.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type ArtifactLabel = {
99
valueValidated: "success" | "warning" | "error" | "default";
1010
}
1111

12+
1213
/**
1314
* Labels
1415
*/

ui/ui-app/src/app/components/modals/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ export * from "./CreateVersionModal";
77
export * from "./EditMetaDataModal";
88
export * from "./InvalidContentModal";
99
export * from "./LabelsFormGroup";
10-
export * from "./labelsToList.function";
11-
export * from "./listToLabels.function";

ui/ui-app/src/app/components/modals/labelsToList.function.ts

-12
This file was deleted.

ui/ui-app/src/app/components/modals/listToLabels.function.ts

-11
This file was deleted.

0 commit comments

Comments
 (0)