Skip to content
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

Order Service Form conversion from Angular to React #8911

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jeffibm
Copy link
Member

@jeffibm jeffibm commented Sep 6, 2023

Continuing work started by @GilbertCherrie in #8484

OrderServiceForm

3 Pages have been converted to react using a single component named <Service ..> - 90% completed

  1. The Order Service Form page
  2. The Service dialogs View page
  3. The Request Show page

1. Order Service Form page

  • Create a functional component named Service.
  • Include the component in app/views/shared/dialogs/_dialog_user.html.haml
  • Can be seen in Services / Catalogs / Service Catalogs / Select an items / Order Service
  • Use the API /api/service_dialogs/:id to fetch the information on the page load.
  • Create child components
  • DialogTab
  • DialogGroups
  • DialogFields
  • CheckboxField, DateField, DateTimeField, DropDownField, SimpleDropDown, MultiDropDown, RadioField, TextInput, TextArea, TagField,
  • Handle the form submit and cancel events.
  • Create a new component named RefreshField to render the refresh-button and a loader.
  • Include the RefreshField in the DialogField using component-mapper.
  • Conditionally display a RefreshField near the right side of the field.
  • Show a loader right next to the refresh-button when the refresh action is in progress.
  • Make use of context providers to pass the state data across components within the form.
  • Store thedialogFields to validate the form and data sent to the api.
  • Avoid the usage of react-redux since it updated the entire snapshots.
  • When the refresh button is clicked -
  • Get the next set of fields to be refreshed.
  • Append the field ids to an array.
  • Pick the first item from this array and run an API to refresh the field.
  • Continue this cycle till we don't have any more fields in the array to refresh.
  • Make use of the active-tab from context-provider to stay in the same tab
  • Disable all fields when the refresh action is in progress during a refresh-button click event.
  • Disable all fields when the refresh action is in progress during a drop-down list onChange event.
  • Enable all fields after the refresh action is in progress.
  • Handle the timing problem to enable/disable fields.
  • Handle the onrefresh field getting stuck for the second time problem
  • Check if the fields can be displayed/hidden using entry points (ruby methods used by SPARK)
  • Write Test cases for the Service component for 3 cases (OrderServiceForm, ServiceDialog, Dialog Summary).
  • Remove old angular code.
  • Get this tested from @Fryguy or @agrare to ensure all features have been handled.

Before
image

After
image

2. Service dialogs View page

  • Create a component named ServiceDialog.
  • Include the component in app/views/miq_ae_customization/_dialog_sample.html.haml.
  • Can be seen in Automation / Embedded automate / Customisation / Service Dialogs / Select an item / Sample tab
  • Component would get recordId and from=customization as props.
  • Fetch the data from the API - /api/service_dialogs/${recordId}.
  • Populate the fields with the response from API.
  • Disable the refresh-button.
  • Build components by reusing the code from OrderServiceForm
  • Do not render the form submit, reset, cancel buttons.
  • Make the field readOnly and change events are not needed.
  • Remove the old codes
  • Write Test cases

Before
image

After
image

3. Request Show page

  • Reuse component Service.
  • Include the component in app/views/miq_request/_st_prov_show.html.haml.
  • Can be seen after ordering a service in the Service / Request / Click on the list item / Dialog Options.
  • Component would get dialogId, from=request, initialValues as props.
  • fields are readable and cannot be changed.
  • populate the values in the field.
  • refresh-buttons are disabled.
  • Remove old codes.
  • Write test cases.

Before
image

After
image
image

@jeffibm jeffibm requested a review from a team as a code owner September 6, 2023 05:52
@jeffibm jeffibm changed the title Order Service Form conversion from Angular to React [WIP] Order Service Form conversion from Angular to React Sep 6, 2023
@miq-bot miq-bot added the wip label Sep 6, 2023
@jeffibm jeffibm mentioned this pull request Sep 6, 2023
10 tasks
@jeffibm jeffibm force-pushed the order-service-form-conversion branch 3 times, most recently from 2aaf016 to 3f7bd2a Compare September 7, 2023 10:04
@jeffibm jeffibm force-pushed the order-service-form-conversion branch 2 times, most recently from bdae559 to c1b944d Compare September 11, 2023 05:00
@jeffibm jeffibm requested a review from agrare September 11, 2023 16:50
@jeffibm jeffibm force-pushed the order-service-form-conversion branch from aa19d2b to 23c6a0a Compare September 12, 2023 06:08
@jeffibm jeffibm force-pushed the order-service-form-conversion branch 2 times, most recently from 1054bc7 to 02345fc Compare September 12, 2023 06:51
@jeffibm
Copy link
Member Author

jeffibm commented Sep 21, 2023

Screen.Recording.2023-09-21.at.11.38.00.AM.mov

@jeffibm jeffibm force-pushed the order-service-form-conversion branch 3 times, most recently from c787208 to d94c5c1 Compare October 18, 2023 09:07
@jeffibm jeffibm force-pushed the order-service-form-conversion branch 3 times, most recently from f26a618 to 4e72c17 Compare October 23, 2023 04:07
@jeffibm jeffibm force-pushed the order-service-form-conversion branch from 6a9ee7b to 55e99f2 Compare June 29, 2024 09:43
@jeffbonson
Copy link
Contributor

jeffbonson commented Jul 2, 2024

Comparing fields to be sent to the api during submit action.

Before
image

After [WIP]
image

@jeffibm jeffibm force-pushed the order-service-form-conversion branch from d06f9dd to e2000d9 Compare July 2, 2024 13:59
@jeffbonson
Copy link
Contributor

Used in -

  1. Dialog summary
  2. Order service Form
  3. Service Request Dialog
Screen.Recording.2024-07-03.at.7.37.59.PM.mov

@jeffbonson
Copy link
Contributor

Update on July 4th, 2024

Screen.Recording.2024-07-04.at.2.48.01.PM.mov

@jeffibm jeffibm force-pushed the order-service-form-conversion branch 5 times, most recently from 0b6abdc to 1131752 Compare July 11, 2024 10:03
@jeffibm jeffibm force-pushed the order-service-form-conversion branch 2 times, most recently from 6161da0 to 38ada32 Compare July 11, 2024 11:36
@jeffbonson jeffbonson changed the title [WIP] Order Service Form conversion from Angular to React Order Service Form conversion from Angular to React Jul 11, 2024
@miq-bot miq-bot removed the wip label Jul 11, 2024
@jeffbonson
Copy link
Contributor

jeffbonson commented Jul 11, 2024

Hey @GilbertCherrie , @Fryguy , @agrare , When you find time, could you please review this PR?

I rebased with master since it's been open for a while now.

I went through a lot of conditions and I guess I have handled all known features to me.

But, am unsure if I missed any combinations of the field options we set in the dialog editor.

Also, I am not sure of the status @DavidResende0 's PR on reconfigure form conversion. That can be handled in another PR.

@jeffibm jeffibm force-pushed the order-service-form-conversion branch from 38ada32 to b09af1d Compare July 11, 2024 12:29
@jeffbonson jeffbonson changed the title Order Service Form conversion from Angular to React [WIP] Order Service Form conversion from Angular to React Jul 11, 2024
@miq-bot miq-bot added the wip label Jul 11, 2024
@jeffibm jeffibm force-pushed the order-service-form-conversion branch from cc6fc74 to 2009602 Compare July 12, 2024 14:48
@jeffbonson jeffbonson changed the title [WIP] Order Service Form conversion from Angular to React Order Service Form conversion from Angular to React Jul 12, 2024
@miq-bot miq-bot removed the wip label Jul 12, 2024
@jeffibm jeffibm force-pushed the order-service-form-conversion branch from 72a9200 to 80e710e Compare July 15, 2024 07:35
@jeffibm jeffibm force-pushed the order-service-form-conversion branch from 0fa4952 to c9d4bee Compare July 15, 2024 13:18
@miq-bot
Copy link
Member

miq-bot commented Jul 15, 2024

Checked commit jeffbonson@c9d4bee with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
8 files checked, 10 offenses detected

app/helpers/miq_request_helper.rb

app/views/miq_ae_customization/_dialog_sample.html.haml

  • ⚠️ - Line 2 - Avoid using instance variables in partials views
  • ⚠️ - Line 2 - Line is too long. [94/80]

app/views/miq_request/_st_prov_show.html.haml

  • ⚠️ - Line 11 - Avoid using instance variables in partials views
  • ⚠️ - Line 11 - Line is too long. [122/80]

@miq-bot
Copy link
Member

miq-bot commented Jul 25, 2024

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Nov 4, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

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.

5 participants