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

Ui/replication/test update #8995

Merged
14 changes: 12 additions & 2 deletions ui/app/styles/core/progress.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.progress {
-webkit-appearance: none;
-moz-appearance: none;
background: $progress-bar-background-color;
box-shadow: inset 0 0 0 1px $ui-gray-200;
border-radius: $radius;
margin-bottom: 0;
&.is-small {
Expand All @@ -13,12 +16,19 @@
}
}

// style the container
// style the container in chrome
.progress[value]::-webkit-progress-bar {
box-shadow: inset 0 0 0 1px $ui-gray-200;
}

// style the progress bar
// style the bar in chrome
.progress[value]::-webkit-progress-value {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we target ::-moz-progress-value as well so there is cross-browser support? Looks like we may need -webkit-appearance: none; on the .progress styles too. Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes, thank you so much for catching this! i often forget to add these additional prefixes. appreciate the link, too!

border-radius: $radius;
transition: width 1s ease-out;
}

// style the bar in firefox
.progress[value]::-moz-progress-bar {
border-radius: $radius;
transition: width 1s ease-out;
}
2 changes: 1 addition & 1 deletion ui/lib/core/addon/components/replication-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default Component.extend({
data: null,
replicationDetails: null,
isSecondary: null,
isSyncing: computed('replicationDetails', 'isSecondary', function() {
isSyncing: computed('replicationDetails.{state}', 'isSecondary', function() {
const { state } = this.replicationDetails;
const isSecondary = this.isSecondary;
return isSecondary && state && clusterStates([state]).isSyncing;
Expand Down
8 changes: 7 additions & 1 deletion ui/lib/core/stories/alert-banner.stories.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import notes from './alert-banner.md';
import { withKnobs, object } from '@storybook/addon-knobs';
import { MESSAGE_TYPES } from '../addon/helpers/message-types.js';

storiesOf('Alerts/AlertBanner/', module)
.addParameters({ options: { showPanel: false } })
.addDecorator(
withKnobs({
escapeHTML: false,
})
)
.add(
'AlertBanner',
() => ({
Expand All @@ -30,7 +36,7 @@ storiesOf('Alerts/AlertBanner/', module)
context: {
type: 'info',
message: 'Here is a message.',
progressBar: { value: 75, max: 100 },
progressBar: object('Progress Bar', { value: 75, max: 100 }),
},
}),
{ notes }
Expand Down
30 changes: 27 additions & 3 deletions ui/tests/integration/components/replication-dashboard-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { assign } from '@ember/polyfills';
import hbs from 'htmlbars-inline-precompile';

const REPLICATION_DETAILS = {
Expand All @@ -27,13 +28,12 @@ module('Integration | Enterprise | Component | replication-dashboard', function(
setupRenderingTest(hooks);

hooks.beforeEach(function() {
this.set('replicationDetails', REPLICATION_DETAILS);
this.set('clusterMode', 'secondary');
this.set('isSecondary', true);
});

test('it renders', async function(assert) {
this.set('replicationDetails', REPLICATION_DETAILS);

await render(hbs`<ReplicationDashboard
@replicationDetails={{replicationDetails}}
@clusterMode={{clusterMode}}
Expand All @@ -47,8 +47,24 @@ module('Integration | Enterprise | Component | replication-dashboard', function(
assert.dom('[data-test-flash-message]').doesNotExist('no flash message is displayed on render');
});

test('it updates the dashboard when the replication mode has changed', async function(assert) {
await render(hbs`<ReplicationDashboard
@replicationDetails={{replicationDetails}}
@clusterMode={{clusterMode}}
@isSecondary={{isSecondary}}
/>`);

assert.dom('[data-test-selectable-card-container="secondary"]').exists();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also check here that [data-test-selectable-card-container="primary"] doesn't exist? And vice versa below

assert.dom('[data-test-selectable-card-container="primary"]').doesNotExist();

this.set('clusterMode', 'primary');
this.set('isSecondary', false);

assert.dom('[data-test-selectable-card-container="primary"]').exists();
assert.dom('[data-test-selectable-card-container="secondary"]').doesNotExist();
});

test('it renders the primary selectable-card-container when the cluster is a primary', async function(assert) {
this.set('replicationDetails', REPLICATION_DETAILS);
this.set('isSecondary', false);

await render(hbs`<ReplicationDashboard
Expand All @@ -58,6 +74,7 @@ module('Integration | Enterprise | Component | replication-dashboard', function(
/>`);

assert.dom('[data-test-selectable-card-container="primary"]').exists();
assert.dom('[data-test-selectable-card-container="secondary"]').doesNotExist();
});

test('it renders an alert banner if the dashboard is syncing', async function(assert) {
Expand Down Expand Up @@ -94,5 +111,12 @@ module('Integration | Enterprise | Component | replication-dashboard', function(
IS_REINDEXING.reindex_building_progress,
'shows the reindexing progress inside the alert banner'
);

const reindexingInProgress = assign({}, IS_REINDEXING, { reindex_building_progress: 27000 });
this.set('replicationDetails', reindexingInProgress);

assert
.dom('.message-title>.progress')
.hasValue(reindexingInProgress.reindex_building_progress, 'updates the reindexing progress');
});
});