Skip to content

Commit

Permalink
ui: pass transformSchema to the form builder lib
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
  • Loading branch information
miguelgrc committed Nov 14, 2023
1 parent 8a8a3e2 commit 8e022c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ui/cap-react/src/antd/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { MosesContext } from "cap-moses";
import { PRIMARY_COLOR } from "../utils/theme";
import { customFieldTypes, customFields } from "../forms/mosesConfig";
import { isEmpty } from "lodash-es";
import { transformSchema } from "../partials/Utils/schema";

const AdminPage = lazy(() => import("../admin"));

Expand Down Expand Up @@ -94,6 +95,7 @@ const App = ({
}}
customFieldTypes={customFieldTypes}
customFields={customFields}
transformSchema={transformSchema}
>
<Switch>
<Route
Expand Down
5 changes: 3 additions & 2 deletions ui/cap-react/src/antd/partials/Utils/schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { omit } from "lodash-es";

export const transformSchema = schema => {
const schemaFieldsToRemove = [
"_access",
Expand All @@ -16,12 +17,12 @@ export const transformSchema = schema => {
"_review",
];

schema.properties = omit(schema.properties, schemaFieldsToRemove);
schema = {
type: schema.type,
properties: schema.properties,
properties: omit(schema.properties, schemaFieldsToRemove),
dependencies: schema.dependencies,
required: schema.required,
};

return schema;
};

0 comments on commit 8e022c4

Please sign in to comment.