You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2016/05/31 07:58:55 UTC
[27/27] fauxton commit: updated refs/heads/master to 0ca35da
convert all files to use import
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/0ca35da7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/0ca35da7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/0ca35da7
Branch: refs/heads/master
Commit: 0ca35da7c9d5479493d118048f9ccaed31d8a0b5
Parents: 2f22a89
Author: Garren Smith <ga...@gmail.com>
Authored: Mon May 30 15:40:56 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue May 31 09:57:32 2016 +0200
----------------------------------------------------------------------
.babelrc | 3 +-
.eslintrc | 3 +-
app/addons/activetasks/actions.js | 119 +-
app/addons/activetasks/actiontypes.js | 20 +-
app/addons/activetasks/base.js | 21 +-
app/addons/activetasks/components.react.jsx | 1036 ++++---
app/addons/activetasks/resources.js | 59 +-
app/addons/activetasks/routes.js | 69 +-
app/addons/activetasks/stores.js | 405 ++-
.../tests/activetasks.componentsSpec.react.jsx | 191 +-
.../activetasks/tests/activetasks.storesSpec.js | 273 +-
.../activetasks/tests/fakeActiveTaskResponse.js | 218 +-
app/addons/auth/actions.js | 201 +-
app/addons/auth/actiontypes.js | 20 +-
app/addons/auth/base.js | 193 +-
app/addons/auth/components.react.jsx | 577 ++--
app/addons/auth/resources.js | 321 +-
app/addons/auth/routes.js | 177 +-
app/addons/auth/stores.js | 284 +-
.../auth/test/auth.componentsSpec.react.jsx | 252 +-
app/addons/auth/test/auth.storesSpec.js | 208 +-
app/addons/auth/test/baseSpec.js | 143 +-
app/addons/cluster/base.js | 15 +-
app/addons/cluster/cluster.actions.js | 65 +-
app/addons/cluster/cluster.actiontypes.js | 8 +-
app/addons/cluster/cluster.react.jsx | 100 +-
app/addons/cluster/cluster.stores.js | 65 +-
app/addons/cluster/resources.js | 58 +-
app/addons/cluster/routes.js | 57 +-
app/addons/cluster/tests/clusterSpec.react.jsx | 85 +-
app/addons/cluster/tests/resourcesSpec.js | 89 +-
app/addons/components/actions.js | 115 +-
app/addons/components/actiontypes.js | 18 +-
app/addons/components/base.js | 13 +-
.../components/react-components.react.jsx | 2901 +++++++++---------
app/addons/components/stores.js | 208 +-
.../tests/apiBarControllerSpec.react.jsx | 283 +-
.../components/tests/badgesSpec.react.jsx | 69 +-
.../components/tests/beautifySpec.react.jsx | 91 +-
.../tests/codeEditorPanelSpec.react.jsx | 122 +-
.../components/tests/codeEditorSpec.react.jsx | 167 +-
.../tests/confirmButtonSpec.react.jsx | 95 +-
.../tests/deleteDatabaseModalSpec.react.jsx | 100 +-
app/addons/components/tests/docSpec.react.jsx | 316 +-
.../tests/headerTogglebuttonSpec.react.jsx | 47 +-
.../tests/paddedBorderedBoxSpec.react.jsx | 51 +-
.../tests/stringEditModalSpec.react.jsx | 63 +-
.../components/tests/styledSelectSpec.react.jsx | 87 +-
.../components/tests/zenModeSpec.react.jsx | 85 +-
app/addons/config/base.js | 34 +-
app/addons/config/resources.js | 164 +-
app/addons/config/routes.js | 169 +-
app/addons/config/tests/configSpec.js | 233 +-
app/addons/config/views.js | 466 ++-
app/addons/cors/actions.js | 342 +--
app/addons/cors/actiontypes.js | 26 +-
app/addons/cors/base.js | 17 +-
app/addons/cors/components.react.jsx | 641 ++--
app/addons/cors/resources.js | 147 +-
app/addons/cors/stores.js | 347 ++-
app/addons/cors/tests/actionsSpecs.js | 156 +-
app/addons/cors/tests/componentsSpec.react.jsx | 380 ++-
app/addons/cors/tests/resourcesSpec.js | 105 +-
app/addons/cors/tests/storesSpec.js | 118 +-
app/addons/databases/actions.js | 205 +-
app/addons/databases/actiontypes.js | 16 +-
app/addons/databases/base.js | 113 +-
app/addons/databases/components.react.jsx | 716 +++--
app/addons/databases/resources.js | 392 ++-
app/addons/databases/routes.js | 87 +-
app/addons/databases/stores.js | 221 +-
app/addons/databases/tests/actionsSpec.js | 436 ++-
.../databases/tests/componentsSpec.react.jsx | 556 ++--
.../tests/nightwatch/checkDatabaseTooltip.js | 12 +
.../tests/nightwatch/createsDatabase.js | 12 +
.../tests/nightwatch/deletesDatabase.js | 12 +
.../nightwatch/deletesDatabaseSpecialChars.js | 12 +
.../tests/nightwatch/switchDatabase.js | 12 +
.../databases/tests/nightwatch/zeroclipboard.js | 12 +
app/addons/databases/tests/resourcesSpec.js | 81 +-
app/addons/databases/tests/storesSpec.js | 88 +-
app/addons/documentation/base.js | 35 +-
app/addons/documentation/components.react.jsx | 100 +-
app/addons/documentation/resources.js | 7 +-
app/addons/documentation/routes.js | 45 +-
app/addons/documentation/stores.js | 138 +-
.../tests/nightwatch/checksDocsPage.js | 12 +
app/addons/documents/base.js | 315 +-
app/addons/documents/changes/actions.js | 161 +-
app/addons/documents/changes/actiontypes.js | 22 +-
.../documents/changes/components.react.jsx | 815 +++--
app/addons/documents/changes/stores.js | 335 +-
.../tests/changes.componentsSpec.react.jsx | 544 ++--
.../changes/tests/changes.storesSpec.js | 142 +-
app/addons/documents/designdocinfo/actions.js | 76 +-
.../documents/designdocinfo/actiontypes.js | 12 +-
.../designdocinfo/components.react.jsx | 272 +-
app/addons/documents/designdocinfo/stores.js | 133 +-
.../designdocinfo/tests/actionsSpec.js | 55 +-
app/addons/documents/doc-editor/actions.js | 419 ++-
app/addons/documents/doc-editor/actiontypes.js | 36 +-
.../documents/doc-editor/components.react.jsx | 824 +++--
app/addons/documents/doc-editor/stores.js | 383 ++-
.../tests/doc-editor.componentsSpec.react.jsx | 372 ++-
.../doc-editor/tests/doc-editor.storesSpec.js | 113 +-
app/addons/documents/header/header.actions.js | 63 +-
.../documents/header/header.actiontypes.js | 8 +-
app/addons/documents/header/header.react.jsx | 187 +-
app/addons/documents/helpers.js | 189 +-
app/addons/documents/index-editor/actions.js | 499 ++-
.../documents/index-editor/actiontypes.js | 32 +-
.../documents/index-editor/components.react.jsx | 710 +++--
app/addons/documents/index-editor/stores.js | 488 ++-
.../documents/index-editor/tests/actionsSpec.js | 230 +-
.../documents/index-editor/tests/storesSpec.js | 485 ++-
.../tests/viewIndex.componentsSpec.react.jsx | 465 ++-
app/addons/documents/index-results/actions.js | 346 ++-
.../documents/index-results/actiontypes.js | 22 +-
.../index-results.components.react.jsx | 882 +++---
app/addons/documents/index-results/stores.js | 1304 ++++----
.../tests/index-results.actionsSpec.js | 172 +-
.../index-results.componentsSpec.react.jsx | 491 ++-
.../tests/index-results.storesSpec.js | 1105 ++++---
app/addons/documents/jumptodoc.react.jsx | 81 +-
app/addons/documents/mango/mango.actions.js | 202 +-
app/addons/documents/mango/mango.actiontypes.js | 18 +-
.../documents/mango/mango.components.react.jsx | 503 ++-
app/addons/documents/mango/mango.helper.js | 44 +-
app/addons/documents/mango/mango.stores.js | 266 +-
.../mango/tests/mango.componentsSpec.react.jsx | 339 +-
.../documents/mango/tests/mango.storesSpec.js | 146 +-
app/addons/documents/pagination/actions.js | 126 +-
app/addons/documents/pagination/actiontypes.js | 16 +-
.../documents/pagination/pagination.react.jsx | 502 ++-
.../tests/pagination.componentSpec.react.jsx | 171 +-
app/addons/documents/queryoptions/actions.js | 193 +-
.../documents/queryoptions/actiontypes.js | 32 +-
.../queryoptions/queryoptions.react.jsx | 773 +++--
app/addons/documents/queryoptions/stores.js | 488 ++-
.../tests/queryoptions.componentsSpec.react.jsx | 319 +-
.../tests/queryoptions.storesSpec.js | 173 +-
app/addons/documents/resources.js | 933 +++---
.../rev-browser/rev-browser.actions.js | 299 +-
.../rev-browser/rev-browser.actiontypes.js | 14 +-
.../rev-browser.components.react.jsx | 694 ++---
.../documents/rev-browser/rev-browser.stores.js | 161 +-
.../documents/rev-browser/tests/fixtures.js | 109 +-
.../tests/rev-browser.actionsSpec.js | 124 +-
app/addons/documents/routes-doc-editor.js | 252 +-
app/addons/documents/routes-documents.js | 379 ++-
app/addons/documents/routes-index-editor.js | 317 +-
app/addons/documents/routes-mango.js | 291 +-
app/addons/documents/routes.js | 32 +-
app/addons/documents/shared-resources.js | 509 ++-
app/addons/documents/shared-routes.js | 264 +-
app/addons/documents/sidebar/actions.js | 265 +-
app/addons/documents/sidebar/actiontypes.js | 32 +-
app/addons/documents/sidebar/sidebar.react.jsx | 1248 ++++----
app/addons/documents/sidebar/stores.react.jsx | 606 ++--
.../tests/sidebar.componentsSpec.react.jsx | 176 +-
.../sidebar/tests/sidebar.storesSpec.js | 97 +-
.../documents/tests/document-test-helper.js | 52 +-
app/addons/documents/tests/helpersSpec.js | 58 +-
.../documents/tests/nightwatch/bulkDelete.js | 12 +
.../documents/tests/nightwatch/changes.js | 12 +
.../documents/tests/nightwatch/changesFilter.js | 12 +
.../tests/nightwatch/checkSidebarBehavior.js | 12 +
.../tests/nightwatch/createsDocument.js | 12 +
.../nightwatch/createsDocumentWithoutId.js | 12 +
.../tests/nightwatch/deleteDatabaseModal.js | 12 +
.../tests/nightwatch/deletesDocuments.js | 12 +
.../tests/nightwatch/designDocInfoPresent.js | 12 +
.../tests/nightwatch/doubleEmitResults.js | 12 +
.../tests/nightwatch/editDocumentsFromView.js | 12 +
.../tests/nightwatch/fixRegressionTableView.js | 12 +
.../documents/tests/nightwatch/jsonView.js | 1 +
.../documents/tests/nightwatch/lookaheadTray.js | 12 +
.../documents/tests/nightwatch/mangoIndex.js | 12 +
.../documents/tests/nightwatch/mangoQuery.js | 12 +
...AfterEditingDocShouldShowAConfirmationBox.js | 12 +
.../tests/nightwatch/navigateFromNewDoc.js | 12 +
.../tests/nightwatch/navigateToNewView.js | 12 +
.../tests/nightwatch/paginateAllDocs.js | 12 +
.../documents/tests/nightwatch/paginateView.js | 12 +
.../tests/nightwatch/previousButton.js | 12 +
.../documents/tests/nightwatch/queryOptions.js | 12 +
.../tests/nightwatch/queryOptionsCloseBug.js | 12 +
.../documents/tests/nightwatch/revBrowser.js | 12 +
.../tests/nightwatch/selectDocViaTypeahead.js | 12 +
.../switchDatabaseViaLookaheadTray.js | 12 +
.../documents/tests/nightwatch/tableView.js | 12 +
.../tests/nightwatch/tableViewConflicts.js | 12 +
.../tests/nightwatch/uploadAttachment.js | 12 +
.../documents/tests/nightwatch/viewClone.js | 12 +
.../documents/tests/nightwatch/viewCreate.js | 12 +
.../tests/nightwatch/viewCreateBadView.js | 12 +
.../documents/tests/nightwatch/viewDelete.js | 12 +
.../documents/tests/nightwatch/viewEdit.js | 12 +
.../tests/nightwatch/viewQueryOptions.js | 12 +
app/addons/documents/tests/resourcesSpec.js | 725 +++--
app/addons/documents/tests/routeSpec.js | 67 +-
app/addons/documents/views.js | 163 +-
app/addons/fauxton/base.js | 182 +-
app/addons/fauxton/components.js | 1025 +++----
app/addons/fauxton/components.react.jsx | 765 +++--
app/addons/fauxton/navigation/actions.js | 106 +-
app/addons/fauxton/navigation/actiontypes.js | 24 +-
.../fauxton/navigation/components.react.jsx | 302 +-
app/addons/fauxton/navigation/stores.js | 309 +-
.../navigation/tests/componentsSpec.react.jsx | 97 +-
.../fauxton/navigation/tests/storeSpec.js | 381 ++-
app/addons/fauxton/notifications/actions.js | 135 +-
app/addons/fauxton/notifications/actiontypes.js | 24 +-
.../notifications/notifications.react.jsx | 781 +++--
app/addons/fauxton/notifications/stores.js | 306 +-
.../fauxton/notifications/tests/actionsSpec.js | 60 +-
.../tests/componentsSpec.react.jsx | 342 +--
.../fauxton/notifications/tests/storesSpec.js | 128 +-
app/addons/fauxton/tests/baseSpec.js | 128 +-
app/addons/fauxton/tests/breadcrumbsSpec.js | 119 +-
app/addons/fauxton/tests/breadcrumbsViewSpec.js | 137 +-
app/addons/fauxton/tests/componentsSpec.js | 40 +-
.../fauxton/tests/componentsSpec.react.jsx | 416 ++-
.../tests/nightwatch/highlightsidebar.js | 12 +
.../tests/nightwatch/notificationCenter.js | 12 +
.../nightwatch/updatesUrlsSameRouteobject.js | 12 +
app/addons/permissions/actions.js | 116 +-
app/addons/permissions/actiontypes.js | 17 +-
app/addons/permissions/base.js | 17 +-
app/addons/permissions/components.react.jsx | 427 ++-
app/addons/permissions/resources.js | 128 +-
app/addons/permissions/routes.js | 164 +-
app/addons/permissions/stores.js | 179 +-
app/addons/permissions/tests/actionsSpec.js | 171 +-
.../permissions/tests/componentsSpec.react.jsx | 283 +-
app/addons/permissions/tests/resourceSpec.js | 82 +-
app/addons/replication/base.js | 31 +-
app/addons/replication/resources.js | 99 +-
app/addons/replication/route.js | 74 +-
app/addons/replication/tests/replicationSpec.js | 45 +-
app/addons/replication/views.js | 608 ++--
app/addons/setup/base.js | 29 +-
app/addons/setup/resources.js | 59 +-
app/addons/setup/route.js | 90 +-
app/addons/setup/setup.actions.js | 470 ++-
app/addons/setup/setup.actiontypes.js | 27 +-
app/addons/setup/setup.react.jsx | 657 ++--
app/addons/setup/setup.stores.js | 250 +-
.../setup/tests/setupComponentsSpec.react.jsx | 228 +-
app/addons/setup/tests/setupSpec.js | 91 +-
app/addons/styletests/base.js | 31 +-
app/addons/styletests/routes.js | 42 +-
app/addons/styletests/styletests.react.jsx | 903 +++---
app/addons/verifyinstall/actions.js | 174 +-
app/addons/verifyinstall/actiontypes.js | 14 +-
app/addons/verifyinstall/base.js | 31 +-
app/addons/verifyinstall/components.react.jsx | 245 +-
app/addons/verifyinstall/constants.js | 25 +-
app/addons/verifyinstall/resources.js | 289 +-
app/addons/verifyinstall/routes.js | 42 +-
app/addons/verifyinstall/stores.js | 156 +-
app/addons/verifyinstall/tests/actionsSpec.js | 28 +-
.../tests/componentsSpec.react.jsx | 192 +-
.../tests/verifyinstall.storesSpec.js | 52 +-
app/app.js | 215 +-
app/constants.js | 82 +-
app/core/api.js | 168 +-
app/core/auth.js | 76 +-
app/core/base.js | 231 +-
app/core/couchdbSession.js | 90 +-
app/core/layout.js | 152 +-
app/core/routeObject.js | 628 ++--
app/core/router.js | 183 +-
app/core/store.js | 29 +-
app/core/tests/apiSpec.js | 46 +-
app/core/tests/couchdbSessionSpec.js | 52 +-
app/core/tests/layoutSpec.js | 155 +-
app/core/tests/routeObjectSpec.js | 357 ++-
app/core/tests/utilsSpec.js | 126 +-
app/core/utils.js | 210 +-
app/helpers.js | 81 +-
app/initialize.js.underscore | 27 +-
app/load_addons.js.underscore | 18 +-
app/main.js | 79 +-
import.md | 9 +
package.json | 5 +-
test/mocha/testUtils.js | 77 +-
287 files changed, 28608 insertions(+), 29115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/.babelrc
----------------------------------------------------------------------
diff --git a/.babelrc b/.babelrc
index e7bacab..539cd51 100644
--- a/.babelrc
+++ b/.babelrc
@@ -2,5 +2,6 @@
"presets": [
"react",
"es2015"
- ]
+ ],
+ "plugins": ["transform-object-assign"]
}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/.eslintrc
----------------------------------------------------------------------
diff --git a/.eslintrc b/.eslintrc
index 6974475..d94a612 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -2,7 +2,8 @@
"root": true,
"ecmaFeatures": {
- "jsx": true
+ "jsx": true,
+ "modules": true
},
"rules-todo": {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/actions.js b/app/addons/activetasks/actions.js
index c76da48..76032fe 100644
--- a/app/addons/activetasks/actions.js
+++ b/app/addons/activetasks/actions.js
@@ -9,67 +9,64 @@
// 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([
- '../../core/api',
- './actiontypes'
-],
-function (FauxtonAPI, ActionTypes) {
- return {
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
- init: function (activeTasks) {
+export default {
+
+ init: function (activeTasks) {
+ this.fetchAndSetActiveTasks(activeTasks.table, activeTasks);
+ FauxtonAPI.when(activeTasks.fetch()).then(function () {
this.fetchAndSetActiveTasks(activeTasks.table, activeTasks);
- FauxtonAPI.when(activeTasks.fetch()).then(function () {
- this.fetchAndSetActiveTasks(activeTasks.table, activeTasks);
- this.setActiveTaskIsLoading(false);
- }.bind(this));
- },
+ this.setActiveTaskIsLoading(false);
+ }.bind(this));
+ },
- fetchAndSetActiveTasks: function (collection, backboneCollection) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_FETCH_AND_SET,
- options: {
- collectionTable: collection,
- backboneCollection: backboneCollection
- }
- });
- },
- changePollingInterval: function (interval) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL,
- options: interval
- });
- },
- switchTab: function (tab) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_SWITCH_TAB,
- options: tab
- });
- },
- setCollection: function (collection) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_SET_COLLECTION,
- options: collection
- });
- },
- setSearchTerm: function (searchTerm) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM,
- options: searchTerm
- });
- },
- sortByColumnHeader: function (columnName) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER,
- options: {
- columnName: columnName
- }
- });
- },
- setActiveTaskIsLoading: function (boolean) {
- FauxtonAPI.dispatch({
- type: ActionTypes.ACTIVE_TASKS_SET_IS_LOADING,
- options: boolean
- });
- }
- };
-});
+ fetchAndSetActiveTasks: function (collection, backboneCollection) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_FETCH_AND_SET,
+ options: {
+ collectionTable: collection,
+ backboneCollection: backboneCollection
+ }
+ });
+ },
+ changePollingInterval: function (interval) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL,
+ options: interval
+ });
+ },
+ switchTab: function (tab) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_SWITCH_TAB,
+ options: tab
+ });
+ },
+ setCollection: function (collection) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_SET_COLLECTION,
+ options: collection
+ });
+ },
+ setSearchTerm: function (searchTerm) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM,
+ options: searchTerm
+ });
+ },
+ sortByColumnHeader: function (columnName) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER,
+ options: {
+ columnName: columnName
+ }
+ });
+ },
+ setActiveTaskIsLoading: function (boolean) {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.ACTIVE_TASKS_SET_IS_LOADING,
+ options: boolean
+ });
+ }
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/actiontypes.js b/app/addons/activetasks/actiontypes.js
index cdba87d..d934cb8 100644
--- a/app/addons/activetasks/actiontypes.js
+++ b/app/addons/activetasks/actiontypes.js
@@ -9,14 +9,12 @@
// 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([], function () {
- return {
- ACTIVE_TASKS_CHANGE_POLLING_INTERVAL: 'ACTIVE_TASKS_CHANGE_POLLING_INTERVAL',
- ACTIVE_TASKS_SWITCH_TAB: 'ACTIVE_TASKS_SWITCH_TAB',
- ACTIVE_TASKS_SET_COLLECTION: 'ACTIVE_TASKS_SET_COLLECTION',
- ACTIVE_TASKS_SET_SEARCH_TERM: 'ACTIVE_TASKS_SET_SEARCH_TERM',
- ACTIVE_TASKS_SORT_BY_COLUMN_HEADER: 'ACTIVE_TASKS_SORT_BY_COLUMN_HEADER',
- ACTIVE_TASKS_FETCH_AND_SET: 'ACTIVE_TASKS_FETCH_AND_SET',
- ACTIVE_TASKS_SET_IS_LOADING: 'ACTIVE_TASKS_SET_IS_LOADING'
- };
-});
+export default {
+ ACTIVE_TASKS_CHANGE_POLLING_INTERVAL: 'ACTIVE_TASKS_CHANGE_POLLING_INTERVAL',
+ ACTIVE_TASKS_SWITCH_TAB: 'ACTIVE_TASKS_SWITCH_TAB',
+ ACTIVE_TASKS_SET_COLLECTION: 'ACTIVE_TASKS_SET_COLLECTION',
+ ACTIVE_TASKS_SET_SEARCH_TERM: 'ACTIVE_TASKS_SET_SEARCH_TERM',
+ ACTIVE_TASKS_SORT_BY_COLUMN_HEADER: 'ACTIVE_TASKS_SORT_BY_COLUMN_HEADER',
+ ACTIVE_TASKS_FETCH_AND_SET: 'ACTIVE_TASKS_FETCH_AND_SET',
+ ACTIVE_TASKS_SET_IS_LOADING: 'ACTIVE_TASKS_SET_IS_LOADING'
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/base.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/base.js b/app/addons/activetasks/base.js
index aa4b54a..6c99fb0 100644
--- a/app/addons/activetasks/base.js
+++ b/app/addons/activetasks/base.js
@@ -10,18 +10,13 @@
// License for the specific language governing permissions and limitations under
// the License.
-define([
- '../../app',
- '../../core/api',
- './routes',
- './assets/less/activetasks.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Activetasks from "./routes";
+import "./assets/less/activetasks.less";
-function (app, FauxtonAPI, Activetasks) {
+Activetasks.initialize = function () {
+ FauxtonAPI.addHeaderLink({title: 'Active Tasks', icon: 'fonticon-activetasks', href: '#/activetasks'});
+};
- Activetasks.initialize = function () {
- FauxtonAPI.addHeaderLink({title: 'Active Tasks', icon: 'fonticon-activetasks', href: '#/activetasks'});
- };
-
- return Activetasks;
-});
+export default Activetasks;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/components.react.jsx b/app/addons/activetasks/components.react.jsx
index 67cef26..2add311 100644
--- a/app/addons/activetasks/components.react.jsx
+++ b/app/addons/activetasks/components.react.jsx
@@ -10,576 +10,570 @@
// License for the specific language governing permissions and limitations under
// the License.
-define([
- '../../app',
- '../../core/api',
- 'react',
- 'react-dom',
- './stores',
- './resources',
- './actions',
-
- '../components/react-components.react',
- '../fauxton/components.react',
- 'react-addons-css-transition-group'
-], (app, FauxtonAPI, React, ReactDOM, Stores, Resources, Actions,
- Components, ComponentsReact, ReactCSSTransitionGroup) => {
-
- const TabElementWrapper = Components.TabElementWrapper;
- const TabElement = Components.TabElement;
-
- var activeTasksStore = Stores.activeTasksStore;
-
- var ActiveTasksController = React.createClass({
-
- getStoreState: function () {
- return {
- collection: activeTasksStore.getCollection(),
- searchTerm: activeTasksStore.getSearchTerm(),
- selectedRadio: activeTasksStore.getSelectedRadio(),
-
- sortByHeader: activeTasksStore.getSortByHeader(),
- headerIsAscending: activeTasksStore.getHeaderIsAscending(),
-
- setPolling: activeTasksStore.setPolling,
- clearPolling: activeTasksStore.clearPolling
- };
- },
-
- getInitialState: function () {
- return this.getStoreState();
- },
-
- componentDidMount: function () {
- this.state.setPolling();
- activeTasksStore.on('change', this.onChange, this);
- },
-
- componentWillUnmount: function () {
- this.state.clearPolling();
- activeTasksStore.off('change', this.onChange, this);
- },
-
- onChange: function () {
- this.setState(this.getStoreState());
- },
-
- setNewSearchTerm: function (searchTerm) {
- Actions.setSearchTerm(searchTerm);
- },
-
- switchTab: function (newRadioButton) { //tabs buttons
- Actions.switchTab(newRadioButton);
- },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores";
+import Resources from "./resources";
+import Actions from "./actions";
+import Components from "../components/react-components.react";
+import ComponentsReact from "../fauxton/components.react";
+import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+
+const TabElementWrapper = Components.TabElementWrapper;
+const TabElement = Components.TabElement;
+
+var activeTasksStore = Stores.activeTasksStore;
+
+var ActiveTasksController = React.createClass({
+
+ getStoreState: function () {
+ return {
+ collection: activeTasksStore.getCollection(),
+ searchTerm: activeTasksStore.getSearchTerm(),
+ selectedRadio: activeTasksStore.getSelectedRadio(),
+
+ sortByHeader: activeTasksStore.getSortByHeader(),
+ headerIsAscending: activeTasksStore.getHeaderIsAscending(),
+
+ setPolling: activeTasksStore.setPolling,
+ clearPolling: activeTasksStore.clearPolling
+ };
+ },
+
+ getInitialState: function () {
+ return this.getStoreState();
+ },
+
+ componentDidMount: function () {
+ this.state.setPolling();
+ activeTasksStore.on('change', this.onChange, this);
+ },
+
+ componentWillUnmount: function () {
+ this.state.clearPolling();
+ activeTasksStore.off('change', this.onChange, this);
+ },
+
+ onChange: function () {
+ this.setState(this.getStoreState());
+ },
+
+ setNewSearchTerm: function (searchTerm) {
+ Actions.setSearchTerm(searchTerm);
+ },
+
+ switchTab: function (newRadioButton) { //tabs buttons
+ Actions.switchTab(newRadioButton);
+ },
+
+ tableHeaderOnClick: function (headerClicked) {
+ Actions.sortByColumnHeader(headerClicked);
+ },
+
+ render: function () {
+ var collection = this.state.collection;
+ var searchTerm = this.state.searchTerm;
+ var selectedRadio = this.state.selectedRadio;
+ var sortByHeader = this.state.sortByHeader;
+ var headerIsAscending = this.state.headerIsAscending;
+
+ var setSearchTerm = this.setNewSearchTerm;
+ var onTableHeaderClick = this.tableHeaderOnClick;
+
+ return (
+ <div id="active-tasks-page" className="scrollable">
+ <div className="inner">
+ <ActiveTasksFilterTabs
+ searchTerm={searchTerm}
+ selectedRadio={selectedRadio}
+ onSearch={setSearchTerm}
+ onRadioClick={this.switchTab}/>
+ <ActiveTaskTable
+ collection={collection}
+ searchTerm={searchTerm}
+ selectedRadio={selectedRadio}
+ onTableHeaderClick={onTableHeaderClick}
+ sortByHeader={sortByHeader}
+ headerIsAscending={headerIsAscending} />
+ </div>
+ </div>
+ );
+ }
+});
- tableHeaderOnClick: function (headerClicked) {
- Actions.sortByColumnHeader(headerClicked);
- },
+var ActiveTasksFilterTabs = React.createClass({
+ getDefaultProps: function () {
+ return {
+ radioNames : [
+ 'All Tasks',
+ 'Replication',
+ 'Database Compaction',
+ 'Indexer',
+ 'View Compaction'
+ ]
+ };
+ },
+
+ checked: function (radioName) {
+ return this.props.selectedRadio === radioName;
+ },
+
+ onRadioClick: function (e) {
+ var radioName = e.target.value;
+ this.props.onRadioClick(radioName);
+ },
+
+ createFilterTabs: function () {
+ return (
+ this.props.radioNames.map((radioName, i) => {
+ const checked = this.checked(radioName);
- render: function () {
- var collection = this.state.collection;
- var searchTerm = this.state.searchTerm;
- var selectedRadio = this.state.selectedRadio;
- var sortByHeader = this.state.sortByHeader;
- var headerIsAscending = this.state.headerIsAscending;
+ return (
+ <TabElement
+ key={i}
+ selected={checked}
+ text={radioName}
+ onChange={this.onRadioClick} />
+ );
+ })
+ );
+ },
+
+ searchTermChange: function (e) {
+ var searchTerm = e.target.value;
+ this.props.onSearch(searchTerm);
+ },
+
+ render: function () {
+ const filterTabs = this.createFilterTabs();
+ return (
+ <TabElementWrapper>
+ {filterTabs}
+ <li>
+ <input
+ id="active-tasks-search-box"
+ className="searchbox"
+ type="text"
+ name="search"
+ placeholder="Search for databases..."
+ value={this.props.searchTerm}
+ onChange={this.searchTermChange} />
+ </li>
+ </TabElementWrapper>
+ );
+ }
+});
- var setSearchTerm = this.setNewSearchTerm;
- var onTableHeaderClick = this.tableHeaderOnClick;
+var ActiveTaskTable = React.createClass({
+ render: function () {
+ var collection = this.props.collection;
+ var selectedRadio = this.props.selectedRadio;
+ var searchTerm = this.props.searchTerm;
+ var sortByHeader = this.props.sortByHeader;
+ var onTableHeaderClick = this.props.onTableHeaderClick;
+ var headerIsAscending = this.props.headerIsAscending;
+
+ return (
+ <div id="dashboard-lower-content">
+ <table id="active-tasks-table" className="table table-bordered table-striped active-tasks">
+ <ActiveTasksTableHeader
+ onTableHeaderClick={onTableHeaderClick}
+ sortByHeader={sortByHeader}
+ headerIsAscending={headerIsAscending}/>
+ <ActiveTasksTableBody
+ collection={collection}
+ selectedRadio={selectedRadio}
+ searchTerm={searchTerm}/>
+ </table>
+ </div>
+ );
+ }
+});
- return (
- <div id="active-tasks-page" className="scrollable">
- <div className="inner">
- <ActiveTasksFilterTabs
- searchTerm={searchTerm}
- selectedRadio={selectedRadio}
- onSearch={setSearchTerm}
- onRadioClick={this.switchTab}/>
- <ActiveTaskTable
- collection={collection}
- searchTerm={searchTerm}
- selectedRadio={selectedRadio}
- onTableHeaderClick={onTableHeaderClick}
- sortByHeader={sortByHeader}
- headerIsAscending={headerIsAscending} />
- </div>
- </div>
- );
- }
- });
-
- var ActiveTasksFilterTabs = React.createClass({
- getDefaultProps: function () {
- return {
- radioNames : [
- 'All Tasks',
- 'Replication',
- 'Database Compaction',
- 'Indexer',
- 'View Compaction'
- ]
- };
- },
-
- checked: function (radioName) {
- return this.props.selectedRadio === radioName;
- },
-
- onRadioClick: function (e) {
- var radioName = e.target.value;
- this.props.onRadioClick(radioName);
- },
-
- createFilterTabs: function () {
- return (
- this.props.radioNames.map((radioName, i) => {
- const checked = this.checked(radioName);
-
- return (
- <TabElement
- key={i}
- selected={checked}
- text={radioName}
- onChange={this.onRadioClick} />
- );
- })
- );
- },
+var ActiveTasksTableHeader = React.createClass({
+ getDefaultProps: function () {
+ return {
+ headerNames : [
+ ['type', 'Type'],
+ ['database', 'Database'],
+ ['started-on', 'Started on'],
+ ['updated-on', 'Updated on'],
+ ['pid', 'PID'],
+ ['progress', 'Status']
+ ]
+ };
+ },
+
+ createTableHeadingFields: function () {
+ var onTableHeaderClick = this.props.onTableHeaderClick;
+ var sortByHeader = this.props.sortByHeader;
+ var headerIsAscending = this.props.headerIsAscending;
+ return this.props.headerNames.map(function (header) {
+ return <TableHeader
+ headerName={header[0]}
+ displayName={header[1]}
+ key={header[0]}
+ onTableHeaderClick={onTableHeaderClick}
+ sortByHeader={sortByHeader}
+ headerIsAscending={headerIsAscending} />;
+ });
+ },
+
+ render: function () {
+ return (
+ <thead>
+ <tr>{this.createTableHeadingFields()}</tr>
+ </thead>
+ );
+ }
+});
- searchTermChange: function (e) {
- var searchTerm = e.target.value;
- this.props.onSearch(searchTerm);
- },
+var TableHeader = React.createClass({
+ arrow: function () {
+ var sortBy = this.props.sortByHeader;
+ var currentName = this.props.headerName;
+ var headerIsAscending = this.props.headerIsAscending;
+ var arrow = headerIsAscending ? 'icon icon-caret-up' : 'icon icon-caret-down';
- render: function () {
- const filterTabs = this.createFilterTabs();
- return (
- <TabElementWrapper>
- {filterTabs}
- <li>
- <input
- id="active-tasks-search-box"
- className="searchbox"
- type="text"
- name="search"
- placeholder="Search for databases..."
- value={this.props.searchTerm}
- onChange={this.searchTermChange} />
- </li>
- </TabElementWrapper>
- );
+ if (sortBy === currentName) {
+ return <i className={arrow}></i>;
}
- });
-
- var ActiveTaskTable = React.createClass({
- render: function () {
- var collection = this.props.collection;
- var selectedRadio = this.props.selectedRadio;
- var searchTerm = this.props.searchTerm;
- var sortByHeader = this.props.sortByHeader;
- var onTableHeaderClick = this.props.onTableHeaderClick;
- var headerIsAscending = this.props.headerIsAscending;
+ },
+
+ onTableHeaderClick: function (e) {
+ var headerSelected = e.target.value;
+ this.props.onTableHeaderClick(headerSelected);
+ },
+
+ render: function () {
+ var arrow = this.arrow();
+ var th_class = 'header-field ' + this.props.headerName;
+
+ return (
+ <td className={th_class + " tableheader"} value={this.props.headerName}>
+ <input
+ type="radio"
+ name="header-field"
+ id={this.props.headerName}
+ value={this.props.headerName}
+ className="header-field radio"
+ onChange={this.onTableHeaderClick} />
+ <label
+ className="header-field label-text active-tasks-header noselect"
+ htmlFor={this.props.headerName}>
+ {this.props.displayName} {arrow}
+ </label>
+ </td>
+ );
+ }
+});
- return (
- <div id="dashboard-lower-content">
- <table id="active-tasks-table" className="table table-bordered table-striped active-tasks">
- <ActiveTasksTableHeader
- onTableHeaderClick={onTableHeaderClick}
- sortByHeader={sortByHeader}
- headerIsAscending={headerIsAscending}/>
- <ActiveTasksTableBody
- collection={collection}
- selectedRadio={selectedRadio}
- searchTerm={searchTerm}/>
- </table>
- </div>
- );
- }
- });
-
- var ActiveTasksTableHeader = React.createClass({
- getDefaultProps: function () {
- return {
- headerNames : [
- ['type', 'Type'],
- ['database', 'Database'],
- ['started-on', 'Started on'],
- ['updated-on', 'Updated on'],
- ['pid', 'PID'],
- ['progress', 'Status']
- ]
- };
- },
-
- createTableHeadingFields: function () {
- var onTableHeaderClick = this.props.onTableHeaderClick;
- var sortByHeader = this.props.sortByHeader;
- var headerIsAscending = this.props.headerIsAscending;
- return this.props.headerNames.map(function (header) {
- return <TableHeader
- headerName={header[0]}
- displayName={header[1]}
- key={header[0]}
- onTableHeaderClick={onTableHeaderClick}
- sortByHeader={sortByHeader}
- headerIsAscending={headerIsAscending} />;
- });
- },
-
- render: function () {
- return (
- <thead>
- <tr>{this.createTableHeadingFields()}</tr>
- </thead>
- );
- }
- });
+var ActiveTasksTableBody = React.createClass({
- var TableHeader = React.createClass({
- arrow: function () {
- var sortBy = this.props.sortByHeader;
- var currentName = this.props.headerName;
- var headerIsAscending = this.props.headerIsAscending;
- var arrow = headerIsAscending ? 'icon icon-caret-up' : 'icon icon-caret-down';
+ getStoreState: function () {
+ return {
+ filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
+ };
+ },
- if (sortBy === currentName) {
- return <i className={arrow}></i>;
- }
- },
+ getInitialState: function () {
+ return this.getStoreState();
+ },
- onTableHeaderClick: function (e) {
- var headerSelected = e.target.value;
- this.props.onTableHeaderClick(headerSelected);
- },
+ componentWillReceiveProps: function (nextProps) {
+ this.setState({
+ filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
+ });
+ },
- render: function () {
- var arrow = this.arrow();
- var th_class = 'header-field ' + this.props.headerName;
+ createRows: function () {
+ var isThereASearchTerm = this.props.searchTerm.trim() === "";
- return (
- <td className={th_class + " tableheader"} value={this.props.headerName}>
- <input
- type="radio"
- name="header-field"
- id={this.props.headerName}
- value={this.props.headerName}
- className="header-field radio"
- onChange={this.onTableHeaderClick} />
- <label
- className="header-field label-text active-tasks-header noselect"
- htmlFor={this.props.headerName}>
- {this.props.displayName} {arrow}
- </label>
- </td>
- );
+ if (this.state.filteredTable.length === 0) {
+ return isThereASearchTerm ? this.noActiveTasks() : this.noActiveTasksMatchFilter();
}
- });
-
- var ActiveTasksTableBody = React.createClass({
-
- getStoreState: function () {
- return {
- filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
- };
- },
- getInitialState: function () {
- return this.getStoreState();
- },
+ return _.map(this.state.filteredTable, function (item, key) {
+ return <ActiveTaskTableBodyContents key={key} item={item} />;
+ });
+ },
- componentWillReceiveProps: function (nextProps) {
- this.setState({
- filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
- });
- },
-
- createRows: function () {
- var isThereASearchTerm = this.props.searchTerm.trim() === "";
-
- if (this.state.filteredTable.length === 0) {
- return isThereASearchTerm ? this.noActiveTasks() : this.noActiveTasksMatchFilter();
- }
+ noActiveTasks: function () {
+ var type = this.props.selectedRadio;
+ if (type === "All Tasks") {
+ type = "";
+ }
- return _.map(this.state.filteredTable, function (item, key) {
- return <ActiveTaskTableBodyContents key={key} item={item} />;
- });
- },
+ return (
+ <tr className="no-matching-database-on-search">
+ <td colSpan="6">No active {type} tasks.</td>
+ </tr>
+ );
+ },
+
+ noActiveTasksMatchFilter: function () {
+ var type = this.props.selectedRadio;
+ if (type === "All Tasks") {
+ type = "";
+ }
- noActiveTasks: function () {
- var type = this.props.selectedRadio;
- if (type === "All Tasks") {
- type = "";
- }
+ return (
+ <tr className="no-matching-database-on-search">
+ <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
+ </tr>
+ );
+ },
+
+ render: function () {
+ return (
+ <tbody className="js-tasks-go-here">
+ {this.createRows()}
+ </tbody>
+ );
+ }
+});
- return (
- <tr className="no-matching-database-on-search">
- <td colSpan="6">No active {type} tasks.</td>
- </tr>
- );
- },
+var ActiveTaskTableBodyContents = React.createClass({
+ getInfo: function (item) {
+ return {
+ type : item.type,
+ objectField: activeTasksHelpers.getDatabaseFieldMessage(item),
+ started_on: activeTasksHelpers.getTimeInfo(item.started_on),
+ updated_on: activeTasksHelpers.getTimeInfo(item.updated_on),
+ pid: item.pid.replace(/[<>]/g, ''),
+ progress: activeTasksHelpers.getProgressMessage(item),
+ };
+ },
+
+ multilineMessage: function (messageArray, optionalClassName) {
+
+ if (!optionalClassName) {
+ optionalClassName = '';
+ }
+ var cssClasses = 'multiline-active-tasks-message ' + optionalClassName;
+
+ return messageArray.map(function (msgLine, iterator) {
+ return <p key={iterator} className={cssClasses}>{msgLine}</p>;
+ });
+ },
+
+ render: function () {
+ var rowData = this.getInfo(this.props.item);
+ var objectFieldMsg = this.multilineMessage(rowData.objectField, 'to-from-database');
+ var startedOnMsg = this.multilineMessage(rowData.started_on, 'time');
+ var updatedOnMsg = this.multilineMessage(rowData.updated_on, 'time');
+ var progressMsg = this.multilineMessage(rowData.progress);
+
+ return (
+ <tr>
+ <td>{rowData.type}</td>
+ <td>{objectFieldMsg}</td>
+ <td>{startedOnMsg}</td>
+ <td>{updatedOnMsg}</td>
+ <td>{rowData.pid}</td>
+ <td>{progressMsg}<ActiveTasksViewSourceSequence item={this.props.item}/></td>
+ </tr>
+ );
+ }
+});
- noActiveTasksMatchFilter: function () {
- var type = this.props.selectedRadio;
- if (type === "All Tasks") {
- type = "";
+var ActiveTasksViewSourceSequence = React.createClass({
+ onTrayToggle: function (e) {
+ e.preventDefault();
+ this.refs.view_source_sequence_btn.toggle(function (shown) {
+ if (shown) {
+ ReactDOM.findDOMNode(this.refs.view_source_sequence_btn).focus();
}
+ }.bind(this));
+ },
- return (
- <tr className="no-matching-database-on-search">
- <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
- </tr>
- );
- },
+ sequences: function (item) {
+ if (_.isNumber(item) || _.isString(item)) {
+ return <ComponentsReact.ClipboardWithTextField textToCopy={item} uniqueKey={item}/>;
+ }
- render: function () {
- return (
- <tbody className="js-tasks-go-here">
- {this.createRows()}
- </tbody>
- );
+ if (_.isArray(item)) {
+ return _.map(item, function (seq, i) {
+ return <ComponentsReact.ClipboardWithTextField textToCopy={seq} uniqueKey={i + Math.random(100)} key={i}/>;
+ });
}
- });
-
- var ActiveTaskTableBodyContents = React.createClass({
- getInfo: function (item) {
- return {
- type : item.type,
- objectField: activeTasksHelpers.getDatabaseFieldMessage(item),
- started_on: activeTasksHelpers.getTimeInfo(item.started_on),
- updated_on: activeTasksHelpers.getTimeInfo(item.updated_on),
- pid: item.pid.replace(/[<>]/g, ''),
- progress: activeTasksHelpers.getProgressMessage(item),
- };
- },
-
- multilineMessage: function (messageArray, optionalClassName) {
-
- if (!optionalClassName) {
- optionalClassName = '';
- }
- var cssClasses = 'multiline-active-tasks-message ' + optionalClassName;
- return messageArray.map(function (msgLine, iterator) {
- return <p key={iterator} className={cssClasses}>{msgLine}</p>;
- });
- },
+ return <ComponentsReact.ClipboardWithTextField textToCopy="???" uniqueKey='unknownRevision'/>;
+ },
- render: function () {
- var rowData = this.getInfo(this.props.item);
- var objectFieldMsg = this.multilineMessage(rowData.objectField, 'to-from-database');
- var startedOnMsg = this.multilineMessage(rowData.started_on, 'time');
- var updatedOnMsg = this.multilineMessage(rowData.updated_on, 'time');
- var progressMsg = this.multilineMessage(rowData.progress);
+ render: function () {
+ if (_.has(this.props.item, 'source_seq')) {
+ var sequences = this.sequences(this.props.item.source_seq);
return (
- <tr>
- <td>{rowData.type}</td>
- <td>{objectFieldMsg}</td>
- <td>{startedOnMsg}</td>
- <td>{updatedOnMsg}</td>
- <td>{rowData.pid}</td>
- <td>{progressMsg}<ActiveTasksViewSourceSequence item={this.props.item}/></td>
- </tr>
+ <div>
+ Current source sequence:
+ <a href="#"
+ className="view-source-sequence-btn"
+ onClick={this.onTrayToggle}
+ data-bypass="true">
+ View
+ </a>
+ <ComponentsReact.Tray ref="view_source_sequence_btn" className="view-source-sequence-tray">
+ <span className="add-on">Source Sequence</span>
+ {sequences}
+ </ComponentsReact.Tray>
+ </div>
);
}
- });
-
- var ActiveTasksViewSourceSequence = React.createClass({
- onTrayToggle: function (e) {
- e.preventDefault();
- this.refs.view_source_sequence_btn.toggle(function (shown) {
- if (shown) {
- ReactDOM.findDOMNode(this.refs.view_source_sequence_btn).focus();
- }
- }.bind(this));
- },
-
- sequences: function (item) {
- if (_.isNumber(item) || _.isString(item)) {
- return <ComponentsReact.ClipboardWithTextField textToCopy={item} uniqueKey={item}/>;
- }
+ return null;
+ }
+});
- if (_.isArray(item)) {
- return _.map(item, function (seq, i) {
- return <ComponentsReact.ClipboardWithTextField textToCopy={seq} uniqueKey={i + Math.random(100)} key={i}/>;
- });
- }
+var ActiveTasksPollingWidgetController = React.createClass({
- return <ComponentsReact.ClipboardWithTextField textToCopy="???" uniqueKey='unknownRevision'/>;
- },
+ getStoreState: function () {
+ return {
+ pollingInterval: activeTasksStore.getPollingInterval(),
+ isLoading: activeTasksStore.isLoading()
+ };
+ },
- render: function () {
+ getInitialState: function () {
+ return this.getStoreState();
+ },
- if (_.has(this.props.item, 'source_seq')) {
- var sequences = this.sequences(this.props.item.source_seq);
- return (
- <div>
- Current source sequence:
- <a href="#"
- className="view-source-sequence-btn"
- onClick={this.onTrayToggle}
- data-bypass="true">
- View
- </a>
- <ComponentsReact.Tray ref="view_source_sequence_btn" className="view-source-sequence-tray">
- <span className="add-on">Source Sequence</span>
- {sequences}
- </ComponentsReact.Tray>
- </div>
- );
- }
- return null;
- }
- });
-
- var ActiveTasksPollingWidgetController = React.createClass({
+ componentDidMount: function () {
+ activeTasksStore.on('change', this.onChange, this);
+ },
- getStoreState: function () {
- return {
- pollingInterval: activeTasksStore.getPollingInterval(),
- isLoading: activeTasksStore.isLoading()
- };
- },
-
- getInitialState: function () {
- return this.getStoreState();
- },
+ onChange: function () {
+ if (this.isMounted()) {
+ this.setState(this.getStoreState());
+ }
+ },
+
+ pollingIntervalChange: function (event) {
+ Actions.changePollingInterval(event.target.value);
+ },
+
+ getPluralForLabel: function () {
+ return this.state.pollingInterval === "1" ? '' : 's';
+ },
+
+ createPollingWidget: function () {
+ var pollingInterval = this.state.pollingInterval;
+ var s = this.getPluralForLabel();
+ var onChangeHandle = this.pollingIntervalChange;
+
+ return (
+ <ul className="polling-interval-widget">
+ <li className="polling-interval-name">Polling interval
+ <label className="polling-interval-time-label" htmlFor="polling-range">
+ <span>{pollingInterval}</span> second{s}
+ </label>
+ </li>
+ <li>
+ <input
+ id="polling-range"
+ type="range"
+ min="1"
+ max="30"
+ step="1"
+ value={pollingInterval}
+ onChange={onChangeHandle}/>
+ </li>
+ </ul>
+ );
+ },
+
+ render: function () {
+ var pollingWidget = this.createPollingWidget();
+ var loadLines = null;
+
+ if (this.state.isLoading || this.state.pollingInterval === "1") {
+ // show loading lines constantly if the polling interval is
+ // 1 second, so that the lines aren't choppy
+ loadLines = <Components.LoadLines />;
+ }
- componentDidMount: function () {
- activeTasksStore.on('change', this.onChange, this);
- },
+ return (
+ <div className="active-tasks-loading-lines-container">
+ <span className="active-tasks-loading-lines">
+ {loadLines}
+ </span>
+ {pollingWidget}
+ </div>
+ );
+ }
+});
- onChange: function () {
- if (this.isMounted()) {
- this.setState(this.getStoreState());
- }
- },
+var activeTasksHelpers = {
+ getTimeInfo: function (timeStamp) {
+ var timeMessage = [
+ app.helpers.formatDate(timeStamp),
+ app.helpers.getDateFromNow(timeStamp)
+ ];
+ return timeMessage;
+ },
+
+ getDatabaseFieldMessage: function (item) {
+ var type = item.type;
+ var databaseFieldMessage = [];
+
+ if (type === 'replication') {
+ databaseFieldMessage.push('From: ' + item.source);
+ databaseFieldMessage.push('To: ' + item.target);
+ } else if (type === 'indexer') {
+ databaseFieldMessage.push(item.database);
+ databaseFieldMessage.push('(View: ' + item.design_document + ')');
+ } else {
+ databaseFieldMessage.push(item.database);
+ }
- pollingIntervalChange: function (event) {
- Actions.changePollingInterval(event.target.value);
- },
+ return databaseFieldMessage;
+ },
- getPluralForLabel: function () {
- return this.state.pollingInterval === "1" ? '' : 's';
- },
+ getProgressMessage: function (item) {
+ var progressMessage = [];
+ var type = item.type;
- createPollingWidget: function () {
- var pollingInterval = this.state.pollingInterval;
- var s = this.getPluralForLabel();
- var onChangeHandle = this.pollingIntervalChange;
+ if (_.has(item, 'progress')) {
+ progressMessage.push('Progress: ' + item.progress + '%');
+ }
- return (
- <ul className="polling-interval-widget">
- <li className="polling-interval-name">Polling interval
- <label className="polling-interval-time-label" htmlFor="polling-range">
- <span>{pollingInterval}</span> second{s}
- </label>
- </li>
- <li>
- <input
- id="polling-range"
- type="range"
- min="1"
- max="30"
- step="1"
- value={pollingInterval}
- onChange={onChangeHandle}/>
- </li>
- </ul>
+ if (type === 'indexer') {
+ progressMessage.push(
+ 'Processed ' + item.changes_done + ' of ' + item.total_changes + ' changes.'
);
- },
+ } else if (type === 'replication') {
+ progressMessage.push(item.docs_written + ' docs written.');
- render: function () {
- var pollingWidget = this.createPollingWidget();
- var loadLines = null;
-
- if (this.state.isLoading || this.state.pollingInterval === "1") {
- // show loading lines constantly if the polling interval is
- // 1 second, so that the lines aren't choppy
- loadLines = <Components.LoadLines />;
+ if (_.has(item, 'changes_pending')) {
+ progressMessage.push(item.changes_pending + ' pending changes.');
}
-
- return (
- <div className="active-tasks-loading-lines-container">
- <span className="active-tasks-loading-lines">
- {loadLines}
- </span>
- {pollingWidget}
- </div>
- );
}
- });
-
- var activeTasksHelpers = {
- getTimeInfo: function (timeStamp) {
- var timeMessage = [
- app.helpers.formatDate(timeStamp),
- app.helpers.getDateFromNow(timeStamp)
- ];
- return timeMessage;
- },
-
- getDatabaseFieldMessage: function (item) {
- var type = item.type;
- var databaseFieldMessage = [];
-
- if (type === 'replication') {
- databaseFieldMessage.push('From: ' + item.source);
- databaseFieldMessage.push('To: ' + item.target);
- } else if (type === 'indexer') {
- databaseFieldMessage.push(item.database);
- databaseFieldMessage.push('(View: ' + item.design_document + ')');
- } else {
- databaseFieldMessage.push(item.database);
- }
-
- return databaseFieldMessage;
- },
-
- getProgressMessage: function (item) {
- var progressMessage = [];
- var type = item.type;
- if (_.has(item, 'progress')) {
- progressMessage.push('Progress: ' + item.progress + '%');
- }
-
- if (type === 'indexer') {
- progressMessage.push(
- 'Processed ' + item.changes_done + ' of ' + item.total_changes + ' changes.'
- );
- } else if (type === 'replication') {
- progressMessage.push(item.docs_written + ' docs written.');
-
- if (_.has(item, 'changes_pending')) {
- progressMessage.push(item.changes_pending + ' pending changes.');
- }
- }
-
- if (_.has(item, 'changes_done')) {
- progressMessage.push(item.changes_done + ' Changes done.');
- }
-
- return progressMessage;
- },
-
- getSourceSequence: function (item) {
- return item.source_seq;
+ if (_.has(item, 'changes_done')) {
+ progressMessage.push(item.changes_done + ' Changes done.');
}
- };
+ return progressMessage;
+ },
- return {
- ActiveTasksController: ActiveTasksController,
- ActiveTasksFilterTabs: ActiveTasksFilterTabs,
+ getSourceSequence: function (item) {
+ return item.source_seq;
+ }
- ActiveTaskTable: ActiveTaskTable,
- ActiveTasksTableHeader: ActiveTasksTableHeader,
- TableHeader: TableHeader,
- ActiveTasksTableBody: ActiveTasksTableBody,
- ActiveTaskTableBodyContents: ActiveTaskTableBodyContents,
- ActiveTasksViewSourceSequence: ActiveTasksViewSourceSequence,
+};
- ActiveTasksPollingWidgetController: ActiveTasksPollingWidgetController
- };
+export default {
+ ActiveTasksController: ActiveTasksController,
+ ActiveTasksFilterTabs: ActiveTasksFilterTabs,
-});
+ ActiveTaskTable: ActiveTaskTable,
+ ActiveTasksTableHeader: ActiveTasksTableHeader,
+ TableHeader: TableHeader,
+ ActiveTasksTableBody: ActiveTasksTableBody,
+ ActiveTaskTableBodyContents: ActiveTaskTableBodyContents,
+ ActiveTasksViewSourceSequence: ActiveTasksViewSourceSequence,
+
+ ActiveTasksPollingWidgetController: ActiveTasksPollingWidgetController
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/resources.js b/app/addons/activetasks/resources.js
index b70ce39..ea559de 100644
--- a/app/addons/activetasks/resources.js
+++ b/app/addons/activetasks/resources.js
@@ -10,44 +10,39 @@
// License for the specific language governing permissions and limitations under
// the License.
-define([
- '../../app',
- '../../core/api',
- './actions'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Actions from "./actions";
+var Active = {};
-function (app, FauxtonAPI, Actions) {
- var Active = {};
+Active.AllTasks = Backbone.Collection.extend({
- Active.AllTasks = Backbone.Collection.extend({
+ url: function () {
+ return app.host + '/_active_tasks';
+ },
- url: function () {
- return app.host + '/_active_tasks';
- },
+ pollingFetch: function () { //still need this for the polling
+ this.fetch({reset: true, parse: true});
+ Actions.setActiveTaskIsLoading(true);
+ return this;
+ },
- pollingFetch: function () { //still need this for the polling
- this.fetch({reset: true, parse: true});
- Actions.setActiveTaskIsLoading(true);
- return this;
- },
+ parse: function (resp) {
+ //no more backbone models, collection is converted into an array of objects
+ Actions.setActiveTaskIsLoading(false);
+ var collectionTable = [];
- parse: function (resp) {
- //no more backbone models, collection is converted into an array of objects
- Actions.setActiveTaskIsLoading(false);
- var collectionTable = [];
+ _.each(resp, function (item) {
+ collectionTable.push(item);
+ });
- _.each(resp, function (item) {
- collectionTable.push(item);
- });
+ //collection is an array of objects
+ this.table = collectionTable;
+ return resp;
+ },
- //collection is an array of objects
- this.table = collectionTable;
- return resp;
- },
+ table: []
- table: []
-
- });
-
- return Active;
});
+
+export default Active;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/routes.js b/app/addons/activetasks/routes.js
index 951531a..3aed827 100644
--- a/app/addons/activetasks/routes.js
+++ b/app/addons/activetasks/routes.js
@@ -10,43 +10,38 @@
// License for the specific language governing permissions and limitations under
// the License.
-define([
- '../../app',
- '../../core/api',
- './resources',
- './components.react',
- './actions'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ActiveTasksResources from "./resources";
+import ActiveTasksComponents from "./components.react";
+import Actions from "./actions";
-function (app, FauxtonAPI, ActiveTasksResources, ActiveTasksComponents, Actions) {
-
- var ActiveTasksRouteObject = FauxtonAPI.RouteObject.extend({
- selectedHeader: 'Active Tasks',
- layout: 'one_pane',
- disableLoader: true,
- routes: {
- 'activetasks/:id': 'showActiveTasks',
- 'activetasks': 'showActiveTasks'
- },
- crumbs: [
- {'name': 'Active Tasks', 'link': 'activetasks'}
- ],
- apiUrl: function () {
- var apiurl = window.location.origin + '/_active_tasks';
- return [apiurl, FauxtonAPI.constants.DOC_URLS.ACTIVE_TASKS];
- },
- roles: ['_admin'],
- initialize: function () {
- this.allTasks = new ActiveTasksResources.AllTasks();
- },
- showActiveTasks: function () {
- Actions.init(this.allTasks);
- this.setComponent('#dashboard-content', ActiveTasksComponents.ActiveTasksController);
- this.setComponent('#right-header', ActiveTasksComponents.ActiveTasksPollingWidgetController);
- }
- });
+var ActiveTasksRouteObject = FauxtonAPI.RouteObject.extend({
+ selectedHeader: 'Active Tasks',
+ layout: 'one_pane',
+ disableLoader: true,
+ routes: {
+ 'activetasks/:id': 'showActiveTasks',
+ 'activetasks': 'showActiveTasks'
+ },
+ crumbs: [
+ {'name': 'Active Tasks', 'link': 'activetasks'}
+ ],
+ apiUrl: function () {
+ var apiurl = window.location.origin + '/_active_tasks';
+ return [apiurl, FauxtonAPI.constants.DOC_URLS.ACTIVE_TASKS];
+ },
+ roles: ['_admin'],
+ initialize: function () {
+ this.allTasks = new ActiveTasksResources.AllTasks();
+ },
+ showActiveTasks: function () {
+ Actions.init(this.allTasks);
+ this.setComponent('#dashboard-content', ActiveTasksComponents.ActiveTasksController);
+ this.setComponent('#right-header', ActiveTasksComponents.ActiveTasksPollingWidgetController);
+ }
+});
- ActiveTasksResources.RouteObjects = [ActiveTasksRouteObject];
+ActiveTasksResources.RouteObjects = [ActiveTasksRouteObject];
- return ActiveTasksResources;
-});
+export default ActiveTasksResources;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/stores.js b/app/addons/activetasks/stores.js
index f0bd85b..547e8fd 100644
--- a/app/addons/activetasks/stores.js
+++ b/app/addons/activetasks/stores.js
@@ -10,236 +10,233 @@
// License for the specific language governing permissions and limitations under
// the License.
-define([
- '../../app',
- '../../core/api',
- './actiontypes'
-], function (app, FauxtonAPI, ActionTypes) {
-
- var ActiveTasksStore = FauxtonAPI.Store.extend({
-
- initAfterFetching: function (collectionTable, backboneCollection) {
- this._prevSortbyHeader = 'started-on';
- this._headerIsAscending = true;
- this._selectedRadio = 'All Tasks';
- this._sortByHeader = 'started-on';
- this._searchTerm = '';
- this._collection = collectionTable;
- this._pollingIntervalSeconds = 5;
- this.sortCollectionByColumnHeader(this._sortByHeader);
- this._backboneCollection = backboneCollection;
- this.setIsLoading(true, new Date());
- },
-
- isLoading: function () {
- return this._isLoading;
- },
-
- setIsLoading: function (bool, time) {
- if (bool) {
- this._startTimeForLoading = time;
- this._isLoading = true;
- } else {
- var stoptime = time;
- var responseTime = stoptime - this._startTimeForLoading;
- if (responseTime < 800) {
- setTimeout(function () {
- this._isLoading = false;
- this.triggerChange();
- }.bind(this), 800); //stop after 800ms for smooth animation
- } else {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+
+var ActiveTasksStore = FauxtonAPI.Store.extend({
+
+ initAfterFetching: function (collectionTable, backboneCollection) {
+ this._prevSortbyHeader = 'started-on';
+ this._headerIsAscending = true;
+ this._selectedRadio = 'All Tasks';
+ this._sortByHeader = 'started-on';
+ this._searchTerm = '';
+ this._collection = collectionTable;
+ this._pollingIntervalSeconds = 5;
+ this.sortCollectionByColumnHeader(this._sortByHeader);
+ this._backboneCollection = backboneCollection;
+ this.setIsLoading(true, new Date());
+ },
+
+ isLoading: function () {
+ return this._isLoading;
+ },
+
+ setIsLoading: function (bool, time) {
+ if (bool) {
+ this._startTimeForLoading = time;
+ this._isLoading = true;
+ } else {
+ var stoptime = time;
+ var responseTime = stoptime - this._startTimeForLoading;
+ if (responseTime < 800) {
+ setTimeout(function () {
this._isLoading = false;
- }
+ this.triggerChange();
+ }.bind(this), 800); //stop after 800ms for smooth animation
+ } else {
+ this._isLoading = false;
}
- },
-
- getSelectedRadio: function () {
- return this._selectedRadio;
- },
-
- setSelectedRadio: function (selectedRadio) {
- this._selectedRadio = selectedRadio;
- },
-
- getPollingInterval: function () {
- return this._pollingIntervalSeconds;
- },
-
- setPollingInterval: function (pollingInterval) {
- this._pollingIntervalSeconds = pollingInterval;
- },
-
- setPolling: function () {
- this.clearPolling();
- var id = setInterval(function () {
- this._backboneCollection.pollingFetch();
- this.setCollection(this._backboneCollection.table);
- this.sortCollectionByColumnHeader(this._prevSortbyHeader, false);
- this.triggerChange();
- }.bind(this), this.getPollingInterval() * 1000);
-
- this.setIntervalID(id);
- },
-
- clearPolling: function () {
- clearInterval(this.getIntervalID());
- },
-
- getIntervalID: function () {
- return this._intervalID;
- },
-
- setIntervalID: function (id) {
- this._intervalID = id;
- },
-
- setCollection: function (collection) {
- this._collection = collection;
- },
-
- getCollection: function () {
- return this._collection;
- },
-
- setSearchTerm: function (searchTerm) {
- this._searchTerm = searchTerm;
- },
-
- getSearchTerm: function () {
- return this._searchTerm;
- },
-
- getSortByHeader: function () {
- return this._sortByHeader;
- },
+ }
+ },
+
+ getSelectedRadio: function () {
+ return this._selectedRadio;
+ },
+
+ setSelectedRadio: function (selectedRadio) {
+ this._selectedRadio = selectedRadio;
+ },
+
+ getPollingInterval: function () {
+ return this._pollingIntervalSeconds;
+ },
+
+ setPollingInterval: function (pollingInterval) {
+ this._pollingIntervalSeconds = pollingInterval;
+ },
+
+ setPolling: function () {
+ this.clearPolling();
+ var id = setInterval(function () {
+ this._backboneCollection.pollingFetch();
+ this.setCollection(this._backboneCollection.table);
+ this.sortCollectionByColumnHeader(this._prevSortbyHeader, false);
+ this.triggerChange();
+ }.bind(this), this.getPollingInterval() * 1000);
+
+ this.setIntervalID(id);
+ },
+
+ clearPolling: function () {
+ clearInterval(this.getIntervalID());
+ },
+
+ getIntervalID: function () {
+ return this._intervalID;
+ },
+
+ setIntervalID: function (id) {
+ this._intervalID = id;
+ },
+
+ setCollection: function (collection) {
+ this._collection = collection;
+ },
+
+ getCollection: function () {
+ return this._collection;
+ },
+
+ setSearchTerm: function (searchTerm) {
+ this._searchTerm = searchTerm;
+ },
+
+ getSearchTerm: function () {
+ return this._searchTerm;
+ },
+
+ getSortByHeader: function () {
+ return this._sortByHeader;
+ },
+
+ setSortByHeader: function (header) {
+ this._sortByHeader = header;
+ },
+
+ getHeaderIsAscending: function () {
+ return this._headerIsAscending;
+ },
+
+ toggleHeaderIsAscending: function () {
+ if (this._prevSortbyHeader === this._sortByHeader) {
+ this._headerIsAscending = !this._headerIsAscending;
+ }
+ },
- setSortByHeader: function (header) {
- this._sortByHeader = header;
- },
+ sortCollectionByColumnHeader: function (colName) {
+ var collectionTable = this._collection;
- getHeaderIsAscending: function () {
- return this._headerIsAscending;
- },
+ var sorted = _.sortBy(collectionTable, function (item) {
+ var variable = colName;
- toggleHeaderIsAscending: function () {
- if (this._prevSortbyHeader === this._sortByHeader) {
- this._headerIsAscending = !this._headerIsAscending;
+ if (_.isUndefined(item[variable])) {
+ variable = 'source';
}
- },
-
- sortCollectionByColumnHeader: function (colName) {
- var collectionTable = this._collection;
+ return item[variable];
+ });
- var sorted = _.sortBy(collectionTable, function (item) {
- var variable = colName;
+ this._prevSortbyHeader = colName;
+ this._collection = sorted;
+ },
- if (_.isUndefined(item[variable])) {
- variable = 'source';
- }
- return item[variable];
- });
+ getFilteredTable: function (collection) {
+ var table = [];
- this._prevSortbyHeader = colName;
- this._collection = sorted;
- },
+ //sort the table here
+ this.sortCollectionByColumnHeader(this._sortByHeader);
- getFilteredTable: function (collection) {
- var table = [];
+ //insert all matches into table
+ this._collection.map(function (item) {
+ var passesRadioFilter = this.passesRadioFilter(item);
+ var passesSearchFilter = this.passesSearchFilter(item);
- //sort the table here
- this.sortCollectionByColumnHeader(this._sortByHeader);
-
- //insert all matches into table
- this._collection.map(function (item) {
- var passesRadioFilter = this.passesRadioFilter(item);
- var passesSearchFilter = this.passesSearchFilter(item);
-
- if (passesRadioFilter && passesSearchFilter) {
- table.push(item);
- }
- }.bind(this));
-
- // reverse if descending
- if (!this._headerIsAscending) {
- table.reverse();
+ if (passesRadioFilter && passesSearchFilter) {
+ table.push(item);
}
+ }.bind(this));
- return table;
- },
+ // reverse if descending
+ if (!this._headerIsAscending) {
+ table.reverse();
+ }
- passesSearchFilter: function (item) {
- var searchTerm = this._searchTerm;
- var regex = new RegExp(searchTerm, 'g');
+ return table;
+ },
- var itemDatabasesTerm = '';
- if (_.has(item, 'database')) {
- itemDatabasesTerm += item.database;
- }
- if (_.has(item, 'source')) {
- itemDatabasesTerm += item.source;
- }
- if (_.has(item, 'target')) {
- itemDatabasesTerm += item.target;
- }
+ passesSearchFilter: function (item) {
+ var searchTerm = this._searchTerm;
+ var regex = new RegExp(searchTerm, 'g');
- return regex.test(itemDatabasesTerm);
- },
+ var itemDatabasesTerm = '';
+ if (_.has(item, 'database')) {
+ itemDatabasesTerm += item.database;
+ }
+ if (_.has(item, 'source')) {
+ itemDatabasesTerm += item.source;
+ }
+ if (_.has(item, 'target')) {
+ itemDatabasesTerm += item.target;
+ }
- passesRadioFilter: function (item) {
- var selectedRadio = this._selectedRadio.toLowerCase().replace(' ', '_');
- return item.type === selectedRadio || selectedRadio === 'all_tasks';
- },
+ return regex.test(itemDatabasesTerm);
+ },
- dispatch: function (action) {
- switch (action.type) {
+ passesRadioFilter: function (item) {
+ var selectedRadio = this._selectedRadio.toLowerCase().replace(' ', '_');
+ return item.type === selectedRadio || selectedRadio === 'all_tasks';
+ },
- case ActionTypes.ACTIVE_TASKS_FETCH_AND_SET:
- this.initAfterFetching(action.options.collectionTable, action.options.backboneCollection);
- break;
+ dispatch: function (action) {
+ switch (action.type) {
- case ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL:
- this.setPollingInterval(action.options);
- this.setPolling();
- this.triggerChange();
- break;
+ case ActionTypes.ACTIVE_TASKS_FETCH_AND_SET:
+ this.initAfterFetching(action.options.collectionTable, action.options.backboneCollection);
+ break;
- case ActionTypes.ACTIVE_TASKS_SWITCH_TAB:
- this.setSelectedRadio(action.options);
- this.triggerChange();
- break;
+ case ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL:
+ this.setPollingInterval(action.options);
+ this.setPolling();
+ this.triggerChange();
+ break;
- case ActionTypes.ACTIVE_TASKS_SET_COLLECTION:
- this.setCollection(action.options);
- this.triggerChange();
- break;
+ case ActionTypes.ACTIVE_TASKS_SWITCH_TAB:
+ this.setSelectedRadio(action.options);
+ this.triggerChange();
+ break;
- case ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM:
- this.setSearchTerm(action.options);
- this.triggerChange();
- break;
+ case ActionTypes.ACTIVE_TASKS_SET_COLLECTION:
+ this.setCollection(action.options);
+ this.triggerChange();
+ break;
- case ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER:
- this.toggleHeaderIsAscending();
- this.setSortByHeader(action.options.columnName);
- this.sortCollectionByColumnHeader(action.options.columnName);
- this.triggerChange();
- break;
+ case ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM:
+ this.setSearchTerm(action.options);
+ this.triggerChange();
+ break;
- case ActionTypes.ACTIVE_TASKS_SET_IS_LOADING:
- this.setIsLoading(action.options, new Date());
- this.triggerChange();
- break;
+ case ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER:
+ this.toggleHeaderIsAscending();
+ this.setSortByHeader(action.options.columnName);
+ this.sortCollectionByColumnHeader(action.options.columnName);
+ this.triggerChange();
+ break;
- default:
- return;
- }
+ case ActionTypes.ACTIVE_TASKS_SET_IS_LOADING:
+ this.setIsLoading(action.options, new Date());
+ this.triggerChange();
+ break;
+
+ default:
+ return;
}
- });
+ }
+});
- var activeTasksStore = new ActiveTasksStore();
- activeTasksStore.dispatchToken = FauxtonAPI.dispatcher.register(activeTasksStore.dispatch.bind(activeTasksStore));
- return {
- activeTasksStore: activeTasksStore
- };
+var activeTasksStore = new ActiveTasksStore();
+activeTasksStore.dispatchToken = FauxtonAPI.dispatcher.register(activeTasksStore.dispatch.bind(activeTasksStore));
-});
+export default {
+ activeTasksStore: activeTasksStore
+};
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx b/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
index 4029e48..8b60af6 100644
--- a/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
+++ b/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
@@ -9,123 +9,120 @@
// 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([
- '../../../core/api',
- '../resources',
- '../components.react',
- '../stores',
- './fakeActiveTaskResponse',
- 'react',
- 'react-dom',
- '../actions',
- '../../../../test/mocha/testUtils',
- 'react-addons-test-utils',
- 'sinon'
-], function (FauxtonAPI, ActiveTasks, Components, Stores, fakedResponse, React, ReactDOM, Actions, utils, TestUtils, sinon) {
- var assert = utils.assert;
- var restore = utils.restore;
- var activeTasksStore = Stores.activeTasksStore;
- var activeTasksCollection = new ActiveTasks.AllTasks({});
- activeTasksCollection.parse(fakedResponse);
-
- describe('Active Tasks -- Components', function () {
-
- describe('Active Tasks Polling (Components)', function () {
- var pollingWidgetDiv, pollingWidget;
-
- beforeEach(function () {
- pollingWidgetDiv = document.createElement('div');
- pollingWidget = TestUtils.renderIntoDocument(
- <Components.ActiveTasksPollingWidgetController />, pollingWidgetDiv
- );
- });
+import FauxtonAPI from "../../../core/api";
+import ActiveTasks from "../resources";
+import Components from "../components.react";
+import Stores from "../stores";
+import fakedResponse from "./fakeActiveTaskResponse";
+import React from "react";
+import ReactDOM from "react-dom";
+import Actions from "../actions";
+import utils from "../../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+var assert = utils.assert;
+var restore = utils.restore;
+var activeTasksStore = Stores.activeTasksStore;
+var activeTasksCollection = new ActiveTasks.AllTasks({});
+activeTasksCollection.parse(fakedResponse);
+
+describe('Active Tasks -- Components', function () {
+
+ describe('Active Tasks Polling (Components)', function () {
+ var pollingWidgetDiv, pollingWidget;
+
+ beforeEach(function () {
+ pollingWidgetDiv = document.createElement('div');
+ pollingWidget = TestUtils.renderIntoDocument(
+ <Components.ActiveTasksPollingWidgetController />, pollingWidgetDiv
+ );
+ });
- afterEach(function () {
- ReactDOM.unmountComponentAtNode(pollingWidgetDiv);
- restore(Actions.changePollingInterval);
- });
+ afterEach(function () {
+ ReactDOM.unmountComponentAtNode(pollingWidgetDiv);
+ restore(Actions.changePollingInterval);
+ });
- it('should trigger update polling interval', function () {
- var spy = sinon.spy(Actions, 'changePollingInterval');
- var rangeNode = TestUtils.findRenderedDOMComponentWithTag(pollingWidget, 'input');
- var time = '9';
+ it('should trigger update polling interval', function () {
+ var spy = sinon.spy(Actions, 'changePollingInterval');
+ var rangeNode = TestUtils.findRenderedDOMComponentWithTag(pollingWidget, 'input');
+ var time = '9';
- TestUtils.Simulate.change(rangeNode, {target: {value: time}});
- assert.ok(spy.calledOnce);
- });
+ TestUtils.Simulate.change(rangeNode, {target: {value: time}});
+ assert.ok(spy.calledOnce);
});
+ });
- describe('Active Tasks Table (Components)', function () {
- var table, tableDiv, spy, filterTab;
+ describe('Active Tasks Table (Components)', function () {
+ var table, tableDiv, spy, filterTab;
- beforeEach(function () {
- tableDiv = document.createElement('div');
- activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
- table = TestUtils.renderIntoDocument(<Components.ActiveTasksController />, tableDiv);
- });
+ beforeEach(function () {
+ tableDiv = document.createElement('div');
+ activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
+ table = TestUtils.renderIntoDocument(<Components.ActiveTasksController />, tableDiv);
+ });
- afterEach(function () {
- ReactDOM.unmountComponentAtNode(tableDiv);
- restore(window.confirm);
- });
+ afterEach(function () {
+ ReactDOM.unmountComponentAtNode(tableDiv);
+ restore(window.confirm);
+ });
- describe('Active Tasks Filter tray', function () {
+ describe('Active Tasks Filter tray', function () {
- afterEach(function () {
- restore(Actions.switchTab);
- restore(Actions.setSearchTerm);
- });
+ afterEach(function () {
+ restore(Actions.switchTab);
+ restore(Actions.setSearchTerm);
+ });
- const radioTexts = [
- 'Replication',
- 'Database Compaction',
- 'Indexer',
- 'View Compaction'
- ];
+ const radioTexts = [
+ 'Replication',
+ 'Database Compaction',
+ 'Indexer',
+ 'View Compaction'
+ ];
- it('should trigger change to radio buttons', () => {
+ it('should trigger change to radio buttons', () => {
- radioTexts.forEach((text) => {
- spy = sinon.spy(Actions, 'switchTab');
+ radioTexts.forEach((text) => {
+ spy = sinon.spy(Actions, 'switchTab');
- const $table = $(ReactDOM.findDOMNode(table));
- const element = $table.find(`input[value="${text}"]`)[0];
+ const $table = $(ReactDOM.findDOMNode(table));
+ const element = $table.find(`input[value="${text}"]`)[0];
- TestUtils.Simulate.change(element);
- assert.ok(spy.calledOnce);
+ TestUtils.Simulate.change(element);
+ assert.ok(spy.calledOnce);
- spy.restore();
- });
+ spy.restore();
});
+ });
- it('should trigger change to search term', function () {
- spy = sinon.spy(Actions, 'setSearchTerm');
- TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('.searchbox')[0], {target: {value: 'searching'}});
- assert.ok(spy.calledOnce);
- });
+ it('should trigger change to search term', function () {
+ spy = sinon.spy(Actions, 'setSearchTerm');
+ TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('.searchbox')[0], {target: {value: 'searching'}});
+ assert.ok(spy.calledOnce);
});
+ });
- describe('Active Tasks Table Headers', function () {
- var headerNames = [
- 'type',
- 'database',
- 'started-on',
- 'updated-on',
- 'pid',
- 'progress'
- ];
-
- afterEach(function () {
- restore(Actions.sortByColumnHeader);
- });
+ describe('Active Tasks Table Headers', function () {
+ var headerNames = [
+ 'type',
+ 'database',
+ 'started-on',
+ 'updated-on',
+ 'pid',
+ 'progress'
+ ];
+
+ afterEach(function () {
+ restore(Actions.sortByColumnHeader);
+ });
- it('should trigger change to which header to sort by', function () {
- _.each(headerNames, function (header) {
- spy = sinon.spy(Actions, 'sortByColumnHeader');
- TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('#' + header)[0]);
- assert.ok(spy.calledOnce);
- spy.restore();
- });
+ it('should trigger change to which header to sort by', function () {
+ _.each(headerNames, function (header) {
+ spy = sinon.spy(Actions, 'sortByColumnHeader');
+ TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('#' + header)[0]);
+ assert.ok(spy.calledOnce);
+ spy.restore();
});
});
});