Settings > Application Settings > Replication tab enhancements#9388
Settings > Application Settings > Replication tab enhancements#9388elsamaryv wants to merge 1 commit intoManageIQ:masterfrom
Conversation
56e0cc4 to
f026475
Compare
10d350f to
84156ea
Compare
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
cypress/e2e/ui/Settings/Application-Settings/settings_replication_tab.cy.js
Outdated
Show resolved
Hide resolved
|
Also, the cypress tests are consistently failing, we need to get them passing some what consistently or we can't merge this |
e8709bb to
7356151
Compare
|
@elsamaryv Is this ready to go? @GilbertCherrie can you review? |
Not yet, the PR needs to be reviewed again. |
7356151 to
a119af0
Compare
a119af0 to
d6f2982
Compare
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
app/javascript/components/settings-replication-form/settings-replication-form.schema.js
Outdated
Show resolved
Hide resolved
cypress/e2e/ui/Settings/Application-Settings/settings_replication_tab.cy.js
Outdated
Show resolved
Hide resolved
Fryguy
left a comment
There was a problem hiding this comment.
Overall, this looks great - awesome work. I think there's a little cleanup here, but overall I'm good. @asirvadAbrahamVarghese can you please also review, particularly the cypress tests as I didn't dig deep into those.
app/javascript/components/settings-replication-form/subscriptions-table.jsx
Outdated
Show resolved
Hide resolved
| <div className="subscriptions-button" style={{ display: 'flex', flexDirection: 'row-reverse' }}> | ||
| <Button | ||
| kind="primary" | ||
| className="subscription-add bx--btn bx--btn--primary pull-right" |
There was a problem hiding this comment.
Could you also remove the Carbon v10 classes (bx--) and the pull-right class as well? - that shouldn’t have any impact and isn't necessary since we’re already aligning that using flex (also, that’s a mix of Bootstrap and Carbon)
app/javascript/components/settings-replication-form/subscriptions-table.jsx
Outdated
Show resolved
Hide resolved
| onCancel={onCancel} | ||
| canReset | ||
| buttonsLabels={{ | ||
| submitLabel: __('Save'), |
There was a problem hiding this comment.
Initially, the dropdown shows 'None', and the Save button is disabled because no replication role has been selected yet. However, if the user changes the replication type and later decides to set it back to 'None', that action should still be allowed.
| <MiqFormRenderer | ||
| schema={createSubscriptionSchema()} | ||
| componentMapper={componentMapper} | ||
| initialValues={selectedSubscription || {}} |
| onCancel={handleModalClose} | ||
| canReset | ||
| buttonsLabels={{ | ||
| submitLabel: __('Accept'), |
There was a problem hiding this comment.
The modal’s submit button should have its text as “Accept” or “Add.” I’ve seen “Add” more often, but I’m not entirely sure
There was a problem hiding this comment.
"Accept" button doesn't doesn't trigger any API calls. In the angular code, it only stores the subscription data to the local array. Would it make sense to rename it to "Save" in the subscription modal?
There was a problem hiding this comment.
Previous workflow -
Replication.workflow.with.angular.code.mov
There was a problem hiding this comment.
I don't really have a preference. If we're moving to a modal, it makes sense to match the pattern of other modal's, which sounds like Add is the better choice. I don't like Save in the modal because it doesn't actually save anywhere until the entire form is saved, so Add is better.
| @@ -0,0 +1,281 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
Not sure about Jest, do we actually need it? I thought the idea was to eventually remove Jest completely and move fully to Cypress(including component testing).
There was a problem hiding this comment.
Jest is convenient for running unit tests, whereas Cypress is more for integration tests - the former is fast and easier to run locally, particularly for small functions - the latter is better for testing across boundaries, particularly without the mocking hitting the real API and Rails backend
They both have their place and I'm ok with both kinds of tests where appropriate.
There was a problem hiding this comment.
Yeah we should still have both Jest and Cypress tests as part of our react conversion
There was a problem hiding this comment.
Alright, makes sense. In that case we’ll probably hit Enzyme as a blocker soon, especially with the React upgrade since it likely won’t support React 18+. We’ll need to move to RTL
cypress/e2e/ui/Settings/Application-Settings/settings_replication_tab.cy.js
Outdated
Show resolved
Hide resolved
| cy.get(`input[name="${PASSWORD_INPUT_NAME}"]`).type(TEST_PASSWORD); | ||
| cy.get(`input[name="${PORT_INPUT_NAME}"]`).type(TEST_PORT); | ||
|
|
||
| cy.contains(`${MODAL_SELECTOR} button`, ACCEPT_BUTTON_TEXT).should('not.be.disabled').click(); |
There was a problem hiding this comment.
Could we usecy.getFormButtonByTypeWithText here?
There was a problem hiding this comment.
Actually, that might end up selecting buttons from the main form, right?
cypress/e2e/ui/Settings/Application-Settings/settings_replication_tab.cy.js
Outdated
Show resolved
Hide resolved
cypress/e2e/ui/Settings/Application-Settings/settings_replication_tab.cy.js
Outdated
Show resolved
Hide resolved
cypress/e2e/ui/Settings/Application-Settings/settings_replication_tab.cy.js
Outdated
Show resolved
Hide resolved
|
|
||
| it('Validate reset functionality', () => { | ||
| cy.get(`select[name="${REPLICATION_TYPE_SELECT_NAME}"]`).select(REPLICATION_TYPE_REMOTE); | ||
| cy.contains('button', RESET_BUTTON_TEXT).click(); |
There was a problem hiding this comment.
May be we can use cy.getFormButtonByTypeWithText here
| }); | ||
|
|
||
| it('Validate update subscription', () => { | ||
| addSubscription(); |
There was a problem hiding this comment.
Just a thought, if you feel adding data through the UI isn’t necessary everywhere, using factories can be a big help.
| .should('be.visible') | ||
| .click(); | ||
|
|
||
| cy.get(SUBSCRIPTIONS_TABLE_SELECTOR) |
There was a problem hiding this comment.
We also have a command for table data assertions: cy.gtlGetRows. It can return data from the table based on the column index which can make this easier.
2c8b671 to
14bc598
Compare
| componentMapper={componentMapper} | ||
| onSubmit={onSave} | ||
| onCancel={onCancel} | ||
| canReset |
There was a problem hiding this comment.
Reset should go to what it was before any changes were made. If the table had data already, then it should restore the original data. Code-wise a reset could just be implemented as a reload of the component.
asirvadAbrahamVarghese
left a comment
There was a problem hiding this comment.
Thanks, this looks great now, lit work - just one small question here
- @GilbertCherrie I believe you already reviewed this before Carbon11 migration, could you take another quick look?
- @Fryguy could you also check the comment about the modal button name here?
|
Thanks - I replied above. |
|
@elsamaryv looks good. The cypress test failures are sporatic and unrelated. The only 2 minor issues I found in the PR:
|
|
Reset should reset back to whatever is saved in the database. If the table had data at the start it should reset back to that. |
0daaaa7 to
045f67f
Compare
045f67f to
a2993cd
Compare
|
Checked commit elsamaryv@a2993cd with ruby 3.3.10, rubocop 1.56.3, haml-lint 0.72.0, and yamllint 1.37.1 |
The Cancel button has been removed, and the Reset button is now functioning as expected—it restores the values to what’s currently saved in the database. Please review, @GilbertCherrie |










Converts Settings > Replication tab to React. Also includes jest and cypress tests.
Before
Add subscription

Validation failure

After
Add subscription modal

Subscription table

Validation failure

Edit subscription
