Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/370#discussion_r28763820
--- Diff: app/addons/databases/actions.js ---
@@ -0,0 +1,105 @@
+// 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
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
under
+// the License.
+define([
+ 'app',
+ 'api',
+ 'addons/databases/stores',
+ 'addons/databases/actiontypes',
+ 'addons/databases/resources'
+],
+function (app, FauxtonAPI, Stores, ActionTypes, Resources) {
+ return {
+ init: function (collection, backboneCollection) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.DATABASES_INIT,
+ options: {
+ collection: collection,
+ backboneCollection: backboneCollection
+ }
+ });
+ },
+
+ setPage: function (_page) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.DATABASES_SETPAGE,
+ options: {
+ page: _page
+ }
+ });
+ },
+
+ setStartLoading: function () {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.DATABASES_STARTLOADING,
+ options: {}
+ });
+ },
+
+ setLoadComplete: function () {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.DATABASES_LOADCOMPLETE,
+ options: {}
+ });
+ },
+
+ createNewDatabase: function (databaseName, nameAccCallback) {
+ databaseName = (databaseName === null ? null : databaseName.trim());
+ if (databaseName === null || databaseName.length === 0) {
+ FauxtonAPI.addNotification({
+ msg: 'Please enter a valid database name',
+ type: 'error',
+ clear: true
+ });
+ return;
+ }
+ // name accepted, make sure prompt can be removed
+ nameAccCallback();
--- End diff --
This doesn't really work, callbacks violate the flux one direction flow.
I think what is better is to have a property on the store that maintains
the state of the prompt. And rather change that which then causes the React
Component to hide the prompt.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---