aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/maintenance
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-02-21 16:36:42 +0100
committerGitHub <noreply@github.com>2018-02-21 16:36:42 +0100
commite353cd6f2bd37ea143d5806e9ee85323cddd1f97 (patch)
treebaed6993aa339baa41e32e653b457a9f66ee1a24 /server/sonar-web/src/main/js/apps/maintenance
parenta90637886c930df4d6da31e48e72b90707374730 (diff)
downloadsonarqube-e353cd6f2bd37ea143d5806e9ee85323cddd1f97.tar.gz
sonarqube-e353cd6f2bd37ea143d5806e9ee85323cddd1f97.zip
create and use Button component (#3087)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/maintenance')
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/components/App.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap5
3 files changed, 7 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx
index 3bc5e06b616..8f19a13856e 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx
@@ -22,6 +22,7 @@ import * as classNames from 'classnames';
import { getMigrationStatus, getSystemStatus, migrateDatabase } from '../../../api/system';
import DateFromNow from '../../../components/intl/DateFromNow';
import TimeFormatter from '../../../components/intl/TimeFormatter';
+import { Button } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/urls';
import '../styles.css';
@@ -113,9 +114,7 @@ export default class App extends React.PureComponent<Props, State> {
}, 2500);
};
- handleMigrateClick = (event: React.SyntheticEvent<HTMLButtonElement>) => {
- event.preventDefault();
- event.currentTarget.blur();
+ handleMigrateClick = () => {
migrateDatabase().then(
({ message, startedAt, state }) => {
if (this.mounted) {
@@ -221,9 +220,9 @@ export default class App extends React.PureComponent<Props, State> {
<p className="maintenance-text">{translate('maintenance.upgrade_database.2')}</p>
<p className="maintenance-text">{translate('maintenance.upgrade_database.3')}</p>
<div className="maintenance-spinner">
- <button id="start-migration" onClick={this.handleMigrateClick} type="button">
+ <Button id="start-migration" onClick={this.handleMigrateClick}>
{translate('maintenance.upgrade')}
- </button>
+ </Button>
</div>
</>
)}
diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
index 8d4511d09e7..93a6d4ab930 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
@@ -120,7 +120,7 @@ describe('Setup Page', () => {
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
- click(wrapper.find('button'));
+ click(wrapper.find('Button'));
expect(migrateDatabase).toBeCalled();
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap
index 784a8eb1969..d054e906e8c 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap
@@ -340,13 +340,12 @@ exports[`Setup Page should start migration 1`] = `
<div
className="maintenance-spinner"
>
- <button
+ <Button
id="start-migration"
onClick={[Function]}
- type="button"
>
maintenance.upgrade
- </button>
+ </Button>
</div>
</React.Fragment>
</div>