You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by am...@apache.org on 2022/08/16 17:14:47 UTC
[couchdb-fauxton] branch main updated: Use radion buttons in create db panel for choosing the type of db (#1363)
This is an automated email from the ASF dual-hosted git repository.
amaranhao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/main by this push:
new fe8149cc Use radion buttons in create db panel for choosing the type of db (#1363)
fe8149cc is described below
commit fe8149ccd656384cc62a291a472647d5f669c7f6
Author: Margaret Harrigan <39...@users.noreply.github.com>
AuthorDate: Tue Aug 16 13:14:40 2022 -0400
Use radion buttons in create db panel for choosing the type of db (#1363)
---
app/addons/databases/__tests__/components.test.js | 8 ++++++
app/addons/databases/components.js | 32 ++++++++++++++++------
.../tests/nightwatch/createsDatabasePartitioned.js | 6 +++-
3 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/app/addons/databases/__tests__/components.test.js b/app/addons/databases/__tests__/components.test.js
index 6522e5d7..d149a0d8 100644
--- a/app/addons/databases/__tests__/components.test.js
+++ b/app/addons/databases/__tests__/components.test.js
@@ -1,3 +1,4 @@
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
@@ -37,6 +38,13 @@ describe('AddDatabaseWidget', () => {
sinon.assert.calledWith(Actions.createNewDatabase, 'my-db');
});
+ it('creates a non-partitioned database', () => {
+ const el = mount(<Views.AddDatabaseWidget showPartitionedOption={true}/>);
+ el.setState({databaseName: 'my-db', partitionedSelected: false});
+ el.instance().onAddDatabase();
+ sinon.assert.calledWith(Actions.createNewDatabase, 'my-db', false);
+ });
+
it('creates a partitioned database', () => {
const el = mount(<Views.AddDatabaseWidget showPartitionedOption={true}/>);
el.setState({databaseName: 'my-db', partitionedSelected: true});
diff --git a/app/addons/databases/components.js b/app/addons/databases/components.js
index ba831575..2be8bc5a 100644
--- a/app/addons/databases/components.js
+++ b/app/addons/databases/components.js
@@ -312,7 +312,7 @@ class AddDatabaseWidget extends React.Component {
this.state = {
isPromptVisible: false,
databaseName: '',
- partitionedSelected: undefined
+ partitionedSelected: false
};
this.onTrayToggle = this.onTrayToggle.bind(this);
@@ -374,7 +374,7 @@ class AddDatabaseWidget extends React.Component {
}
const partitionedDbHelp = this.props.partitionedDbHelpText ? (
<Accordion className='partitioned-db-help'>
- <AccordionItem title='What is a Partitioned Database?'>
+ <AccordionItem title='Which should I chose?'>
<p dangerouslySetInnerHTML={{__html: this.props.partitionedDbHelpText}} />
</AccordionItem>
</Accordion>
@@ -385,13 +385,26 @@ class AddDatabaseWidget extends React.Component {
Partitioning
</label>
<div className='partitioned-db-options'>
- <input
- id="partitioned-db"
- type="checkbox"
- checked={this.state.partitionedSelected === true}
- onChange={this.onTogglePartitioned}
- />
- <label htmlFor="partitioned-db">Partitioned</label>
+ <form>
+ <label htmlFor="non-partitioned-option">
+ <input
+ id="non-partitioned-option"
+ type="radio"
+ checked={this.state.partitionedSelected === false}
+ onChange={this.onTogglePartitioned}
+ />
+ Non-partitioned - recommended for most workloads
+ </label>
+ <label htmlFor="partitioned-option">
+ <input
+ id="partitioned-option"
+ type="radio"
+ checked={this.state.partitionedSelected === true}
+ onChange={this.onTogglePartitioned}
+ />
+ Partitioned
+ </label>
+ </form>
</div>
{partitionedDbHelp}
</div>
@@ -561,3 +574,4 @@ export default {
JumpToDatabaseWidget: JumpToDatabaseWidget,
DatabasePagination: DatabasePagination
};
+
diff --git a/app/addons/databases/tests/nightwatch/createsDatabasePartitioned.js b/app/addons/databases/tests/nightwatch/createsDatabasePartitioned.js
index 2b6f6845..a4a5b702 100644
--- a/app/addons/databases/tests/nightwatch/createsDatabasePartitioned.js
+++ b/app/addons/databases/tests/nightwatch/createsDatabasePartitioned.js
@@ -1,3 +1,4 @@
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
@@ -51,10 +52,11 @@ module.exports = {
.clickWhenVisible('.add-new-database-btn')
.waitForElementVisible('#js-new-database-name', waitTime, false)
.setValue('#js-new-database-name', [newDatabaseName])
+ .clickWhenVisible('#partitioned-option', waitTime, false)
.clickWhenVisible('#js-create-database', waitTime, false)
.waitForElementNotPresent('.new-database-tray', waitTime, false)
.checkForDatabaseCreated(newDatabaseName, waitTime)
- .url(baseUrl + '/#/_all_dbs')
+ .url(baseUrl + '/_all_dbs')
.waitForElementVisible('html', waitTime, false)
.getText('html', function (result) {
var data = result.value,
@@ -80,6 +82,7 @@ module.exports = {
.clickWhenVisible('.add-new-database-btn')
.waitForElementVisible('#js-new-database-name', waitTime, false)
.setValue('#js-new-database-name', [invalidDatabaseName])
+ .clickWhenVisible('#partitioned-option', waitTime, false)
.clickWhenVisible('#js-create-database', waitTime, false)
.waitForElementVisible('.Toastify__toast-container .Toastify__toast--error', waitTime, false)
.url(baseUrl + '/_all_dbs')
@@ -94,3 +97,4 @@ module.exports = {
.end();
}
};
+