-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP ui: externalize form builder #2859
WIP ui: externalize form builder #2859
Conversation
f5cf0f9
to
cdef0af
Compare
878b0e3
to
b69760f
Compare
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
b69760f
to
8e022c4
Compare
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
beeead6
to
707edb6
Compare
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
@@ -76,7 +76,9 @@ const Files = ({ | |||
return choices[value]; | |||
}; | |||
|
|||
return renderList.map(item => getContentFromProps(item)); | |||
return renderList.map(item => ( | |||
<div key={item}>{getContentFromProps(item)}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add key
inside getContentFromProps
. also lets not use object as key (e.g. item
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using item as key should be fine in this case, as it's just a string (one of files|repositories|title
)
@@ -14,7 +14,7 @@ const JSONSchemaPreviewer = ({ | |||
}) => { | |||
return ( | |||
schema && ( | |||
<Form | |||
<FormuleForm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not import(export from formule) as Form
? do we need the Formule
part?
{isAdmin && <Route path={CMS} component={AdminPage} />} | ||
<Route path={HOME} component={requireAuth(IndexPage)} /> | ||
</Switch> | ||
<FormuleContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this to wrap the whole app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the reason is that we need to have access to the Formule context both from the admin pages and from the draft page, and having two FormuleContext
s might be problematic. I think there was another important reason but I can't remember it now.
@@ -27,16 +26,14 @@ import { configSchema } from "../utils/schemaSettings"; | |||
import CodeViewer from "../../utils/CodeViewer"; | |||
import { json } from "@codemirror/lang-json"; | |||
import CodeDiffViewer from "../../utils/CodeDiffViewer"; | |||
import { FormuleForm } from "react-formule"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should export as Form
from the formule package (makes more sense). we can import as as FormuleForm
here if we want
import { schema, uiSchema } from "../utils"; | ||
import { DeleteOutlined } from "@ant-design/icons"; | ||
import { FormuleForm } from "react-formule"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
import { canEdit } from "../../utils/permissions"; | ||
import { debounce } from "lodash-es"; | ||
import { FormuleForm } from "react-formule"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
}, | ||
}, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add customFiteldTypes for CERNUsers
, schemaPathSuggester
components?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need it as they're not used in the form editor. schemaPathSuggester
is only used for notifications and, actually, CERNUsers
is not used anywhere, do we need it?
import { ReactComponent as AtlasIcon } from "../img/atlas.svg"; | ||
import { ReactComponent as CmsIcon } from "../img/cms.svg"; | ||
import { ReactComponent as LHCbLogo } from "../img/lhcb-logo.svg"; | ||
import AliceIcon from "../img/alice.svg?react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syntax has changed with the latest versions of vite-plugin-svgr
please rebase also |
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
048a3e3
to
4e4ce52
Compare
Signed-off-by: Miguel Garcia Garcia <miguel.garcia.garcia@cern.ch>
Superseded by ##2878 which incorporates all these changes in a squashed commit |
DO NOT MERGE
Part of #2844
Removes all the form builder code and does some refactoring to be able to import the components from https://github.com/miguelgrc/cap-moses. To test locally, go to
ui/cap-react/package.json
and change the uri for thecap-moses
dependency to the location of thecap-moses
project in your machine, and link it like this: