Skip to content

Commit

Permalink
UI: fix replication nav 1.15.x (#26349)
Browse files Browse the repository at this point in the history
* Update test selectors specific to 1.15.x

* calculate attrs based on replication-mode service instead of cluster model getter
  • Loading branch information
hashishaw authored and akshya96 committed Apr 11, 2024
1 parent 214e670 commit a1db99e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions ui/lib/core/addon/components/replication-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ export default Component.extend({
layout,
store: service(),
router: service(),
rm: service('replication-mode'),
reindexingDetails: null,
didReceiveAttrs() {
this._super(arguments);
this.getReplicationModeStatus.perform();
},
replicationMode: computed('rm.mode', function () {
return this.rm.getMode();
}),
getReplicationModeStatus: task(function* () {
let resp;
const { replicationMode } = this.model;
const { replicationMode } = this;

if (this.isSummaryDashboard) {
// the summary dashboard is not mode specific and will error
Expand All @@ -66,13 +70,13 @@ export default Component.extend({
}
return '';
}),
formattedReplicationMode: computed('model.replicationMode', 'isSummaryDashboard', function () {
formattedReplicationMode: computed('replicationMode', 'isSummaryDashboard', function () {
// dr or performance 🤯
const { isSummaryDashboard } = this;
if (isSummaryDashboard) {
return 'Disaster Recovery & Performance';
}
const mode = this.model.replicationMode;
const mode = this.replicationMode;
return MODE[mode];
}),
clusterMode: computed('model.replicationAttrs', 'isSummaryDashboard', function () {
Expand Down Expand Up @@ -119,14 +123,14 @@ export default Component.extend({
}
return {};
}),
replicationDetails: computed('model.replicationMode', 'isSummaryDashboard', function () {
replicationDetails: computed('replicationMode', 'isSummaryDashboard', function () {
const { model } = this;
const { isSummaryDashboard } = this;
if (isSummaryDashboard) {
// Cannot return null
return {};
}
const replicationMode = model.replicationMode;
const { replicationMode } = this;
return model[replicationMode];
}),
isDisabled: computed('replicationDetails.mode', function () {
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/acceptance/replication-nav-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const SELECTORS = {
title: '[data-test-replication-title]',
primaryCluster: '[data-test-value-div="primary_cluster_addr"]',
replicationSet: '[data-test-row-value="Replication set"]',
knownSecondariesTitle: '.known-secondaries-card h3',
knownSecondariesTitle: '.secondaries h3',
};
module('Acceptance | Enterprise | replication navigation', function (hooks) {
setupApplicationTest(hooks);
Expand All @@ -36,7 +36,7 @@ module('Acceptance | Enterprise | replication navigation', function (hooks) {

test('navigate between replication types updates page', async function (assert) {
await click(SELECTORS.navReplication);
assert.dom(SELECTORS.title).hasText('Disaster Recovery & Performance primary');
assert.dom('[data-test-replication-header] h1').hasText('Disaster Recovery & Performance primary');
await click(SELECTORS.navPerformance);

// Ensure data is expected for performance
Expand Down

0 comments on commit a1db99e

Please sign in to comment.