Skip to content

Conversation

neatbyte-vnobis
Copy link
Collaborator

@neatbyte-vnobis neatbyte-vnobis commented Oct 27, 2023

Changes

Form Methods moved to HCMS:

  • createForm
  • getForm
  • listFormRevisions
  • listForms
  • createFormFrom
  • deleteForm
  • deleteFormRevision
  • publishForm
  • unpublishForm
  • updateForm

Submission Methods moved to HCMS:

  • listSubmissions
  • createSubmission
  • updateSubmission

Skipped Submission Methods: deleteSubmission, getSubmission. They were skipped because they are not used anywhere.

How Has This Been Tested?

Manually.

Documentation

Form Builder - Move backend to HCMS

@neatbyte-vnobis neatbyte-vnobis changed the title Form Builder - Move backend to HCMS [WIP] Form Builder - Move backend to HCMS Nov 8, 2023
@neatbyte-vnobis neatbyte-vnobis force-pushed the neatbyte/form-builder-hcms branch from 6b5be13 to 6e6360c Compare November 8, 2023 12:45
@neatbyte-ivelychko
Copy link

@adrians5j, @SvenAlHamad what should we do about these bugs?

While working on this feature we have found bug that exists for a long time.

  1. When we have a form that has ONLY one revision and after deleting that revision we would see that the form that should have been deleted still being displayed in UI in the list of the forms. But after reloading the page it would not be rendered in the list of forms. I think that happens becuase of caching. Furthemore this bug doesn not appear if we delete a form instead of revision.
2023-11-08.16.36.41.mov
  1. When have created a form submission, opened Submissions tab in Form Builder and clicked on reload submissions we would see that the list of submissions has been updated.
    But Overview stats on the Submissions tab are still the same, so they has not been updated. To see a most recent data for Overview we would need to reload the page.
Знімок екрана 2023-11-08 о 17 17 50
  1. When we choose a form revision that we had chosen previously then that revision won't be re-rendered in the Page Builder Editor Form and it would render the latest chosen revision.
2023-11-08.17.19.49.mov

@neatbyte-vnobis neatbyte-vnobis force-pushed the neatbyte/form-builder-hcms branch from f20f406 to 6e6360c Compare November 8, 2023 15:33
Copy link
Contributor

@leopuleo leopuleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @neatbyte-vnobis and @neatbyte-ivelychko for this Pull Request.

You will find many comments below; most are repetitive, and many others address tiny issues.

There are a couple of issues we need to address before merging:

  • we want to keep the original imported method createFormBuilder. TLDR: we don't want to upgrade some part of user projects.
  • we want to keep the GraphQL schema unchanged: some field types have been changed, some of them are not required anymore and vice-versa. Use the API playground in the admin app to confront the newly generated schema with the previous one.

@neatbyte-vnobis neatbyte-vnobis force-pushed the neatbyte/form-builder-hcms branch 4 times, most recently from 824dfdf to eb371aa Compare November 23, 2023 09:58
Copy link
Contributor

@leopuleo leopuleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neatbyte-vnobis, we are almost there 💪.

I highlighted some minor changes, plus while testing the admin app, I noticed a couple of bugs:

  1. App Form Builder: While trying to create a new version from a previous one, it always keeps the configuration from the latest version instead of the selected one.
  2. App Page Builder: The application crashes while trying to insert a form on a page. It looks like an error on the getPublishedForm query. See the video here below:
CleanShot.2023-12-14.at.07.44.54.mp4

if (!original) {
throw new NotFoundError(`Form "${id}" was not found!`);
} else if (original.locked) {
} else if (original.status === "unpublished") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create a FORM_STATUS enum: you can import this enum from api-headless-cms package and re-export it.

i.e.

if (original.status === CONTENT_ENTRY_STATUS.UNPUBLISHED) {
  ...
}

*/
const revisions = await formBuilder.getFormRevisions(form);
const publishedRevisions = revisions.filter(r => r.published);
const publishedRevisions = revisions.filter(r => r.status === "published");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create a FORM_STATUS enum: you can import this enum from api-headless-cms package and re-export it.

<FormMeta>
<Typography use={"overline"}>{`status: ${
state.data.published ? t`published` : t`draft`
state.data.status === "published" ? t`published` : t`draft`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create an enum with the possible status.

const getIcon = (revision: Pick<FbFormModel, "status">) => {
switch (revision.status) {
case "locked":
case "unpublished":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, let's use an enum with the possible status.

if (!editHandlers.current[handlerKey]) {
editHandlers.current[handlerKey] = async () => {
if (!form.published) {
if (form.status !== "published") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, let's use an enum with the possible status.

@m0nikaza m0nikaza added this to the 5.39.0 milestone Jan 9, 2024
@adrians5j adrians5j modified the milestones: 5.39.0, 5.40.0 Jan 12, 2024
@leopuleo leopuleo modified the milestones: 5.40.0, 5.41.0 Jun 10, 2024
@m0nikaza m0nikaza removed this from the 5.41.0 milestone Oct 4, 2024
@leopuleo
Copy link
Contributor

At the moment, this PR is on hold because of an issue with using HCMS storage operation for the submission entity.

When there is a large number of submissions stored in the database (10,000 submissions), attempting to list even a small subset (20 submissions) results in a 504 Gateway Timeout error.

This is an example of submission record:

{
 "PK": "T#root#L#en-US#CMS#CME#CME#65c668267f15950008b1cb98",
 "SK": "L",
 "createdOn": "2024-02-09T18:00:06.537Z",
 "entryId": "65c668267f15950008b1cb98",
 "GSI1_PK": "T#root#L#en-US#CMS#CME#M#fbSubmission#L",
 "GSI1_SK": "65c668267f15950008b1cb98#0001",
 "id": "65c668267f15950008b1cb98",
 "locale": "en-US",
 "location": {
  "folderId": "root"
 },
 "locked": false,
 "modelId": "fbSubmission",
 "status": "draft",
 "tenant": "root",
 "TYPE": "cms.entry.l",
 "values": {
  "json@data": {
   "demoField": "Submission from Angie Hyatt"
  },
  "json@logs": [
  ],
  "object@form": {
   "object@fields": [
    {
     "json@settings": {
      "defaultValue": null
     },
     "object@options": [
     ],
     "object@validation": [
     ],
     "text@fieldId": "demoField",
     "text@helpText": null,
     "text@label": "Demo field",
     "text@name": "text",
     "text@placeholderText": null,
     "text@type": "text",
     "text@_id": "Ef86jNVJIZ"
    }
   ],
   "object@steps": [
    {
     "json@layout": [
      [
       "Ef86jNVJIZ"
      ]
     ],
     "text@title": "Step 1"
    }
   ],
   "text@id": "65c650d188458c00081fea0f#0001",
   "text@name": "Form 2",
   "text@parent": "65c650d188458c00081fea0f",
   "text@version": 1
  },
  "object@meta": {
   "datetime@submittedOn": "Sun Apr 16 2023 09:22:22 GMT+0200 (Central European Summer Time)",
   "object@url": {
    "json@query": {},
    "text@location": "https://d8t7yvqn5xojf.cloudfront.net/untitled-lseu8t15"
   },
   "text@ip": "200.22.178.28"
  }
 },
 "version": 1,
 "webinyVersion": "5.39.0",
 "_ct": "2024-02-10T15:10:40.797Z",
 "_et": "CmsEntries",
 "_md": "2024-02-10T15:10:40.797Z"
}

Link to private Slack conversation

@adrians5j adrians5j deleted the branch next-v5 October 3, 2025 16:17
@adrians5j adrians5j closed this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants