Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 205E4183D1 for ; Mon, 15 Feb 2016 18:02:48 +0000 (UTC) Received: (qmail 18558 invoked by uid 500); 15 Feb 2016 18:02:47 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 18508 invoked by uid 500); 15 Feb 2016 18:02:47 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 18499 invoked by uid 99); 15 Feb 2016 18:02:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Feb 2016 18:02:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8E573E08CD; Mon, 15 Feb 2016 18:02:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: benkeen@apache.org To: commits@couchdb.apache.org Message-Id: <2134711ad91446aebc0423c8021da343@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to a62af89 Date: Mon, 15 Feb 2016 18:02:47 +0000 (UTC) Repository: couchdb-fauxton Updated Branches: refs/heads/master 8415f3d11 -> a62af899a Remove compaction addon The compaction and view cleanup functionality stopped no longer works within a cluster setup. This removes the old non-functional addon. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a62af899 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a62af899 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a62af899 Branch: refs/heads/master Commit: a62af899a56c0e148d438c3499496bb0dd83e210 Parents: 8415f3d Author: Ben Keen Authored: Tue Feb 9 13:56:31 2016 -0800 Committer: Ben Keen Committed: Mon Feb 15 10:02:37 2016 -0800 ---------------------------------------------------------------------- app/addons/compaction/actions.js | 123 --------- app/addons/compaction/actiontypes.js | 23 -- .../compaction/assets/less/compaction.less | 24 -- app/addons/compaction/base.js | 32 --- app/addons/compaction/components.react.jsx | 169 ------------- app/addons/compaction/resources.js | 48 ---- app/addons/compaction/routes.js | 90 ------- app/addons/compaction/stores.js | 93 ------- app/addons/compaction/tests/actionsSpec.js | 247 ------------------- .../compaction/tests/componentsSpec.react.jsx | 111 --------- .../nightwatch/compactAndCleanIsPresent.js | 30 --- app/addons/databases/assets/less/databases.less | 4 + app/addons/databases/components.react.jsx | 11 +- .../documents/index-editor/components.react.jsx | 13 - code-layout.md | 7 +- extensions.md | 2 - settings.json.default.json | 1 - 17 files changed, 12 insertions(+), 1016 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/actions.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/actions.js b/app/addons/compaction/actions.js deleted file mode 100644 index 15c50c2..0000000 --- a/app/addons/compaction/actions.js +++ /dev/null @@ -1,123 +0,0 @@ -// 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/compaction/actiontypes', - 'addons/compaction/resources' -], -function (app, FauxtonAPI, ActionTypes, Compaction) { - - return { - setCompactionFor: function (database) { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_SET_UP, - database: database - }); - - }, - - compactionStarted: function () { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_COMPACTION_STARTING - }); - }, - - compactionFinished: function () { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_COMPACTION_FINISHED - }); - }, - - cleaningViewsStarted: function () { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_CLEANUP_STARTED - }); - }, - - cleaningViewsFinished: function () { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_CLEANUP_FINISHED - }); - }, - - compactViewStarted: function () { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_VIEW_STARTED - }); - }, - - compactViewFinished: function () { - FauxtonAPI.dispatch({ - type: ActionTypes.COMPACTION_VIEW_FINISHED - }); - }, - - compactDatabase: function (database) { - this.compactionStarted(); - Compaction.compactDB(database).then(function () { - FauxtonAPI.addNotification({ - type: 'success', - msg: 'Database compaction has started. Visit Active Tasks to view the compaction progress.', - escape: false // beware of possible XSS when the message changes - }); - }, function (xhr, error, reason) { - FauxtonAPI.addNotification({ - type: 'error', - msg: 'Error: ' + JSON.parse(xhr.responseText).reason - }); - }).always(function () { - this.compactionFinished(); - }.bind(this)); - }, - - cleanupViews: function (database) { - this.cleaningViewsStarted(); - Compaction.cleanupViews(database).then(function () { - FauxtonAPI.addNotification({ - type: 'success', - msg: 'View cleanup has started. Visit Active Tasks to view progress.', - escape: false // beware of possible XSS when the message changes - }); - }, function (xhr, error, reason) { - FauxtonAPI.addNotification({ - type: 'error', - msg: 'Error: ' + JSON.parse(xhr.responseText).reason - }); - }).always(function () { - this.cleaningViewsFinished(); - }.bind(this)); - }, - - compactView: function (database, designDoc) { - this.compactViewStarted(); - - Compaction.compactView(database, designDoc).then(function () { - FauxtonAPI.addNotification({ - type: 'success', - msg: 'View compaction has started. Visit Active Tasks to view progress.', - escape: false // beware of possible XSS when the message changes - }); - }, function (xhr, error, reason) { - FauxtonAPI.addNotification({ - type: 'error', - msg: 'Error: ' + JSON.parse(xhr.responseText).reason - }); - }).always(function () { - this.compactViewFinished(); - }.bind(this)); - } - - }; - -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/actiontypes.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/actiontypes.js b/app/addons/compaction/actiontypes.js deleted file mode 100644 index e164f7c..0000000 --- a/app/addons/compaction/actiontypes.js +++ /dev/null @@ -1,23 +0,0 @@ -// 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([], function () { - return { - COMPACTION_SET_UP: 'COMPACTION_SET_UP', - COMPACTION_COMPACTION_STARTING: 'COMPACTION_COMPACTION_STARTING', - COMPACTION_COMPACTION_FINISHED: 'COMPACTION_COMPACTION_FINISHED', - COMPACTION_CLEANUP_STARTED: 'COMPACTION_CLEANUP_STARTED', - COMPACTION_CLEANUP_FINISHED: 'COMPACTION_CLEANUP_FINISHED', - COMPACTION_VIEW_STARTED: 'COMPACTION_VIEW_STARTED', - COMPACTION_VIEW_FINISHED: 'COMPACTION_VIEW_FINISHED' - }; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/assets/less/compaction.less ---------------------------------------------------------------------- diff --git a/app/addons/compaction/assets/less/compaction.less b/app/addons/compaction/assets/less/compaction.less deleted file mode 100644 index 4083c6a..0000000 --- a/app/addons/compaction/assets/less/compaction.less +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -@import "../../../../../assets/less/variables.less"; - -.compaction-option { - background-color: #F7F7F7; - border: 1px solid #DDD; - margin-bottom: 30px; - padding: 10px; -} - -#dashboard-content.flex-layout .compaction-page { - padding: @panelPadding; -} http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/base.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/base.js b/app/addons/compaction/base.js deleted file mode 100644 index 187391c..0000000 --- a/app/addons/compaction/base.js +++ /dev/null @@ -1,32 +0,0 @@ -// 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/compaction/routes" -], - -function (app, FauxtonAPI, Compaction) { - - Compaction.initialize = function () { - FauxtonAPI.registerExtension('docLinks', { - title: "Compact & Clean", - url: "compact", - icon: "icon-cogs" - }); - - FauxtonAPI.registerExtension('view-editor:compaction-button', Compaction.ViewCompactionButton); - }; - - return Compaction; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/compaction/components.react.jsx b/app/addons/compaction/components.react.jsx deleted file mode 100644 index f5b2dab..0000000 --- a/app/addons/compaction/components.react.jsx +++ /dev/null @@ -1,169 +0,0 @@ -// 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', - 'react', - 'addons/compaction/stores', - 'addons/compaction/actions', - 'addons/components/react-components.react' -], - -function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents) { - var compactionStore = Stores.compactionStore; - - var CompactDatabase = React.createClass({ - - run: function (e) { - this.props.compactDatabase(); - }, - - render: function () { - var btnText = 'Run'; - - if (this.props.isCompacting) { - btnText = 'Compacting...'; - } - - return ( -
-
-

Compact Database

-

Compacting a database removes deleted documents and previous revisions. It is an irreversible operation and may take a while to complete for large databases.

- -
-
- ); - } - - }); - - var CleanView = React.createClass({ - - run: function (e) { - this.props.cleanupView(); - }, - - render: function () { - var btnText = 'Run'; - - if (this.props.isCleaningView) { - btnText = 'Cleaning Views...'; - } - return ( -
-
-

Cleanup Views

-

Cleaning up views in a database removes old view files still stored on the filesystem. It is an irreversible operation.

- -
-
- ); - } - - }); - - var CompactionController = React.createClass({ - getStoreState: function () { - return { - database: compactionStore.getDatabase(), - isCompacting: compactionStore.isCompacting(), - isCleaningViews: compactionStore.isCleaningViews() - }; - }, - - getInitialState: function () { - return this.getStoreState(); - }, - - componentDidMount: function () { - compactionStore.on('change', this.onChange, this); - }, - - componentWillUnmount: function () { - compactionStore.off('change', this.onChange); - }, - - onChange: function () { - this.setState(this.getStoreState()); - }, - - compactDatabase: function () { - Actions.compactDatabase(this.state.database); - }, - - cleanupView: function () { - Actions.cleanupViews(this.state.database); - }, - - render: function () { - return ( -
- - -
- ); - } - }); - - var ViewCompactionButton = React.createClass({ - onClick: function (e) { - e.preventDefault(); - Actions.compactView(this.props.database, this.props.designDoc); - }, - - getStoreState: function () { - return { - isCompactingView: compactionStore.isCompactingView() - }; - }, - - getInitialState: function () { - return this.getStoreState(); - }, - - componentDidMount: function () { - compactionStore.on('change', this.onChange, this); - }, - - componentWillUnmount: function () { - compactionStore.off('change', this.onChange); - }, - - onChange: function () { - this.setState(this.getStoreState()); - }, - - render: function () { - var btnMsg = 'Compact View'; - - if (this.state.isCompactingView) { - btnMsg = 'Compacting View'; - } - - return ( - - ); - } - - }); - - return { - CompactDatabase: CompactDatabase, - CleanView: CleanView, - CompactionController: CompactionController, - ViewCompactionButton: ViewCompactionButton - }; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/resources.js b/app/addons/compaction/resources.js deleted file mode 100644 index cd42cce..0000000 --- a/app/addons/compaction/resources.js +++ /dev/null @@ -1,48 +0,0 @@ -// 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" -], - -function (app, FauxtonAPI) { - var Compaction = FauxtonAPI.addon(); - - Compaction.compactDB = function (db) { - return $.ajax({ - url: db.url() + '/_compact', - contentType: 'application/json', - type: 'POST' - }); - }; - - Compaction.cleanupViews = function (db) { - return $.ajax({ - url: db.url() + '/_view_cleanup', - contentType: 'application/json', - type: 'POST' - }); - }; - - - Compaction.compactView = function (db, designDoc) { - // /some_database/_compact/designname - return $.ajax({ - url: db.url() + '/_compact/' + designDoc.replace('_design/', ''), - contentType: 'application/json', - type: 'POST' - }); - }; - - return Compaction; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/routes.js b/app/addons/compaction/routes.js deleted file mode 100644 index f098768..0000000 --- a/app/addons/compaction/routes.js +++ /dev/null @@ -1,90 +0,0 @@ -// 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', - - // Modules - 'addons/compaction/components.react', - 'addons/compaction/actions', - 'addons/databases/resources', - 'addons/documents/shared-routes' -], - -function (app, FauxtonAPI, Compaction, Actions, Databases, BaseRoute) { - - var CompactionRouteObject = BaseRoute.extend({ - routes: { - "database/:database/compact": "compaction" - }, - - initialize: function (route, masterLayout, options) { - this.initViews(options[0]); - this.listenToLookaheadTray(); - }, - - initViews: function (databaseName) { - this.database = new Databases.Model({ id: databaseName }); - this.allDatabases = new Databases.List(); - - this.createDesignDocsCollection(); - this.addLeftHeader(); - this.addSidebar('compact'); - }, - - onSelectDatabase: function (dbName) { - this.cleanup(); - this.initViews(dbName); - FauxtonAPI.navigate('/database/' + app.utils.safeURLName(dbName) + '/compact', { - trigger: true - }); - this.listenToLookaheadTray(); - }, - - listenToLookaheadTray: function () { - this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase); - }, - - compaction: function () { - Actions.setCompactionFor(this.database); - this.pageContent = this.setComponent('#dashboard-content', Compaction.CompactionController); - }, - - establish: function () { - return [ - this.designDocs.fetch({reset: true}), - this.allDatabases.fetchOnce() - ]; - }, - - cleanup: function () { - if (this.pageContent) { - this.removeView('#dashboard-content'); - } - if (this.leftheader) { - this.removeView('#breadcrumbs'); - } - if (this.sidebar) { - this.removeView('#sidebar'); - } - - // we're no longer interested in listening to the lookahead tray event on this route object - this.stopListening(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase); - } - }); - - Compaction.RouteObjects = [CompactionRouteObject]; - - return Compaction; - -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/stores.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/stores.js b/app/addons/compaction/stores.js deleted file mode 100644 index d2c5410..0000000 --- a/app/addons/compaction/stores.js +++ /dev/null @@ -1,93 +0,0 @@ -// 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([ - 'api', - 'addons/compaction/actiontypes' -], - -function (FauxtonAPI, ActionTypes) { - var Stores = {}; - - Stores.CompactionStore = FauxtonAPI.Store.extend({ - - initialize: function () { - this._isCompacting = false; - this._isCleaningView = false; - this._isCompactingView = false; - }, - - isCompacting: function () { - return this._isCompacting; - }, - - isCleaningViews: function () { - return this._isCleaningViews; - }, - - isCompactingView: function () { - return this._isCompactingView; - }, - - setDatabase: function (database) { - this._database = database; - }, - - getDatabase: function () { - return this._database; - }, - - dispatch: function (action) { - switch (action.type) { - case ActionTypes.COMPACTION_SET_UP: - this.setDatabase(action.database); - this.triggerChange(); - break; - case ActionTypes.COMPACTION_COMPACTION_STARTING: - this._isCompacting = true; - this.triggerChange(); - break; - case ActionTypes.COMPACTION_COMPACTION_FINISHED: - this._isCompacting = false; - this.triggerChange(); - break; - case ActionTypes.COMPACTION_CLEANUP_STARTED: - this._isCleaningViews = true; - this.triggerChange(); - break; - case ActionTypes.COMPACTION_CLEANUP_FINISHED: - this._isCleaningViews = false; - this.triggerChange(); - break; - case ActionTypes.COMPACTION_VIEW_STARTED: - this._isCompactingView = true; - this.triggerChange(); - break; - case ActionTypes.COMPACTION_VIEW_FINISHED: - this._isCompactingView = false; - this.triggerChange(); - break; - - default: - return; - // do nothing - } - } - - }); - - Stores.compactionStore = new Stores.CompactionStore(); - - Stores.compactionStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.compactionStore.dispatch); - - return Stores; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/tests/actionsSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/tests/actionsSpec.js b/app/addons/compaction/tests/actionsSpec.js deleted file mode 100644 index 1aff431..0000000 --- a/app/addons/compaction/tests/actionsSpec.js +++ /dev/null @@ -1,247 +0,0 @@ -// 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([ - 'api', - 'addons/compaction/stores', - 'addons/compaction/resources', - 'addons/compaction/actions', - 'testUtils' -], function (FauxtonAPI, Stores, Compaction, Actions, testUtils) { - var assert = testUtils.assert; - var restore = testUtils.restore; - var store = Stores.compactionStore; - - describe('Compaction Actions', function () { - - describe('Compact Database', function () { - var database = {}; - - afterEach(function () { - restore(FauxtonAPI.addNotification); - }); - - it('compacts database', function () { - var spy = false; - var promise = FauxtonAPI.Deferred(); - - Compaction.compactDB = function () { - spy = true; - return promise; - }; - - Actions.compactDatabase(database); - assert.ok(spy); - }); - - it('notifies on success', function () { - var spy = sinon.spy(FauxtonAPI, 'addNotification'); - var promise = FauxtonAPI.Deferred(); - promise.resolve(); - - Compaction.compactDB = function () { - return promise; - }; - - Actions.compactDatabase(database); - assert.ok(spy.calledOnce); - }); - - it('notifies on failure', function () { - var spy = sinon.spy(FauxtonAPI, 'addNotification'); - var promise = FauxtonAPI.Deferred(); - promise.reject({ - responseText: JSON.stringify({reason: 'testing'}) - }); - - Compaction.compactDB = function () { - return promise; - }; - - Actions.compactDatabase(database); - assert.ok(spy.calledOnce); - }); - - it('sets compacting view to true on start', function () { - var promise = FauxtonAPI.Deferred(); - - Compaction.compactDB = function () { - return promise; - }; - - Actions.compactDatabase(database); - assert.ok(store.isCompacting()); - }); - - it('sets compacting view to false on completion of request', function () { - var promise = FauxtonAPI.Deferred(); - promise.resolve(); - - Compaction.compactDB = function () { - return promise; - }; - - Actions.compactDatabase(database); - assert.notOk(store.isCompacting()); - }); - - }); - - describe('Clean Views', function () { - var database = {}; - - afterEach(function () { - restore(FauxtonAPI.addNotification); - }); - - it('cleans views', function () { - var spy = false; - var promise = FauxtonAPI.Deferred(); - - Compaction.cleanupViews = function () { - spy = true; - return promise; - }; - - Actions.cleanupViews(database); - assert.ok(spy); - }); - - it('notifies on success', function () { - var spy = sinon.spy(FauxtonAPI, 'addNotification'); - var promise = FauxtonAPI.Deferred(); - promise.resolve(); - - Compaction.cleanupViews = function () { - return promise; - }; - - Actions.cleanupViews(database); - assert.ok(spy.calledOnce); - }); - - it('notifies on failure', function () { - var spy = sinon.spy(FauxtonAPI, 'addNotification'); - var promise = FauxtonAPI.Deferred(); - promise.reject({ - responseText: JSON.stringify({reason: 'testing'}) - }); - - Compaction.cleanupViews = function () { - return promise; - }; - - Actions.cleanupViews(database); - assert.ok(spy.calledOnce); - }); - - it('sets compacting view to true on start', function () { - var promise = FauxtonAPI.Deferred(); - - Compaction.cleanupViews = function () { - return promise; - }; - - Actions.cleanupViews(database); - assert.ok(store.isCleaningViews()); - }); - - it('sets compacting view to false on completion of request', function () { - var promise = FauxtonAPI.Deferred(); - promise.resolve(); - - Compaction.cleanupViews = function () { - return promise; - }; - - Actions.cleanupViews(database); - assert.notOk(store.isCleaningViews()); - }); - - }); - - describe('Compact View', function () { - var database = {}; - var designDoc = '_design/test-doc'; - - afterEach(function () { - restore(FauxtonAPI.addNotification); - }); - - it('compacts database', function () { - var spy = false; - var promise = FauxtonAPI.Deferred(); - - Compaction.compactView = function () { - spy = true; - return promise; - }; - - Actions.compactView(database, designDoc); - assert.ok(spy); - }); - - it('notifies on success', function () { - var spy = sinon.spy(FauxtonAPI, 'addNotification'); - var promise = FauxtonAPI.Deferred(); - promise.resolve(); - - Compaction.compactView = function () { - return promise; - }; - - Actions.compactView(database, designDoc); - assert.ok(spy.calledOnce); - }); - - it('notifies on failure', function () { - var spy = sinon.spy(FauxtonAPI, 'addNotification'); - var promise = FauxtonAPI.Deferred(); - promise.reject({ - responseText: JSON.stringify({reason: 'testing'}) - }); - - Compaction.compactView = function () { - return promise; - }; - - Actions.compactView(database, designDoc); - assert.ok(spy.calledOnce); - }); - - it('sets compacting view to true on start', function () { - var promise = FauxtonAPI.Deferred(); - - Compaction.compactView = function () { - return promise; - }; - - Actions.compactView(database, designDoc); - assert.ok(store.isCompactingView()); - }); - - it('sets compacting view to false on completion of request', function () { - var promise = FauxtonAPI.Deferred(); - promise.resolve(); - - Compaction.compactView = function () { - return promise; - }; - - Actions.compactView(database, designDoc); - assert.notOk(store.isCompactingView()); - }); - - }); - - }); -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/tests/componentsSpec.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/compaction/tests/componentsSpec.react.jsx b/app/addons/compaction/tests/componentsSpec.react.jsx deleted file mode 100644 index 08fb02e..0000000 --- a/app/addons/compaction/tests/componentsSpec.react.jsx +++ /dev/null @@ -1,111 +0,0 @@ -// 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([ - 'api', - 'addons/compaction/components.react', - 'addons/compaction/actions', - 'testUtils', - 'react', - 'react-dom' -], function (FauxtonAPI, Views, Actions, utils, React, ReactDOM) { - FauxtonAPI.router = new FauxtonAPI.Router([]); - - var assert = utils.assert; - var TestUtils = React.addons.TestUtils; - - describe('Compaction Controller', function () { - var container, controllerEl; - - beforeEach(function () { - Actions.setCompactionFor({ - id: 'my-database' - }); - - container = document.createElement('div'); - controllerEl = TestUtils.renderIntoDocument( - , - container - ); - }); - - afterEach(function () { - ReactDOM.unmountComponentAtNode(container); - }); - - it('triggers compact database action', function () { - var spy = sinon.spy(Actions, 'compactDatabase'); - - controllerEl.compactDatabase(); - assert.ok(spy.calledOnce); - }); - - it('triggers clean up view action', function () { - var spy = sinon.spy(Actions, 'cleanupViews'); - - controllerEl.cleanupView(); - assert.ok(spy.calledOnce); - }); - - }); - - describe('CleanView', function () { - var spy, container, cleanupViewEl; - - beforeEach(function () { - spy = sinon.spy(); - container = document.createElement('div'); - cleanupViewEl = TestUtils.renderIntoDocument( - , - container - ); - }); - - afterEach(function () { - ReactDOM.unmountComponentAtNode(container); - }); - - it('calls cleanupView on button click', function () { - var el = $(ReactDOM.findDOMNode(cleanupViewEl)).find('button')[0]; - TestUtils.Simulate.click(el, {}); - - assert.ok(spy.calledOnce); - - }); - - }); - - describe('CompactDatabase', function () { - var spy, container, compactViewEl; - - beforeEach(function () { - spy = sinon.spy(); - container = document.createElement('div'); - compactViewEl = TestUtils.renderIntoDocument( - , - container - ); - }); - - afterEach(function () { - ReactDOM.unmountComponentAtNode(container); - }); - - it('calls compact database on button click', function () { - var el = $(ReactDOM.findDOMNode(compactViewEl)).find('button')[0]; - TestUtils.Simulate.click(el, {}); - - assert.ok(spy.calledOnce); - - }); - - }); -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/compaction/tests/nightwatch/compactAndCleanIsPresent.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/tests/nightwatch/compactAndCleanIsPresent.js b/app/addons/compaction/tests/nightwatch/compactAndCleanIsPresent.js deleted file mode 100644 index 12f8c16..0000000 --- a/app/addons/compaction/tests/nightwatch/compactAndCleanIsPresent.js +++ /dev/null @@ -1,30 +0,0 @@ -// 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. - -module.exports = { - 'Compact and Clean Menu shows up' : function (client) { - var waitTime = client.globals.maxWaitTime, - newDatabaseName = client.globals.testDatabaseName, - baseUrl = client.globals.test_settings.launch_url; - - client - .loginToGUI() - .url(baseUrl) - - //navigate to 'Compact & Clean' view - .clickWhenVisible('#dashboard-content a[href="#/database/' + newDatabaseName + '/_all_docs"]') - .clickWhenVisible('#compact') - .waitForElementVisible('#compact-db', waitTime, false) - .waitForElementVisible('#cleanup-views', waitTime, false) - .end(); - } -}; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/databases/assets/less/databases.less ---------------------------------------------------------------------- diff --git a/app/addons/databases/assets/less/databases.less b/app/addons/databases/assets/less/databases.less index fbc1ca2..4ada93c 100644 --- a/app/addons/databases/assets/less/databases.less +++ b/app/addons/databases/assets/less/databases.less @@ -71,3 +71,7 @@ color: #999999; height: 49px; } + +.database-actions > * { + margin-right: 4px; +} http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/databases/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/databases/components.react.jsx b/app/addons/databases/components.react.jsx index 0ff6923..a1cb2e4 100644 --- a/app/addons/databases/components.react.jsx +++ b/app/addons/databases/components.react.jsx @@ -185,18 +185,17 @@ define([ {row.status.numDocs()} {this.renderGraveyard(row)} {row.status.updateSeq()} {this.getExtensionColumns(row)} - - + + href={"#/replication/" + encoded} /> + title={"Set permissions for " + name} href={"#/database/" + encoded + "/permissions"} /> + title={'Delete ' + name} data-bypass="true" /> ); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/app/addons/documents/index-editor/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/index-editor/components.react.jsx b/app/addons/documents/index-editor/components.react.jsx index 28f0787..2d9e710 100644 --- a/app/addons/documents/index-editor/components.react.jsx +++ b/app/addons/documents/index-editor/components.react.jsx @@ -348,18 +348,6 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents) Actions.updateMapCode(code); }, - getCompactButton: function () { - var extension = FauxtonAPI.getExtensions('view-editor:compaction-button'); - - if (_.isEmpty(extension)) { - return null; - } else { - var CompactButton = extension[0]; - return ; - } - }, - render: function () { if (this.state.isLoading) { return ( @@ -422,7 +410,6 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents)
- {this.getCompactButton()}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/code-layout.md ---------------------------------------------------------------------- diff --git a/code-layout.md b/code-layout.md index 99bcbaa..9dcefb8 100644 --- a/code-layout.md +++ b/code-layout.md @@ -56,10 +56,9 @@ Read more about [JSX here](https://facebook.github.io/react/docs/jsx-in-depth.ht Each bit of functionality is its own separate module or addon. Addons are located in their own `app/addons/myaddon-name` folder. As noted above, new code is being written in React so please favour React components over backbone views. -A good place to get started is to read through a couple of the existing addons. Two good starting points are -[app/addons/verifyinstall](app/addons/verifyinstall) and [app/addons/compaction](app/addons/compaction). Both of these -are relatively self-contained and map to specific pages in the Fauxton interface so you can see exactly where they appear -and what they do. +A good place to get started is to read through a couple of the existing addons. A good starting point is +[app/addons/verifyinstall](app/addons/verifyinstall). This is relatively self-contained and maps to a specific page in +the Fauxton interface so you can see exactly where it appears and what it does. Each module must have a `base.js` file, this is read and compiled when Fauxton is deployed. A `resources.js` file is usually used for your Backbone.Models and Backbone.Collections, `components.react.jsx` for your React components. http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/extensions.md ---------------------------------------------------------------------- diff --git a/extensions.md b/extensions.md index 13fcf8d..2fa26a6 100644 --- a/extensions.md +++ b/extensions.md @@ -13,5 +13,3 @@ all objects registered for an extension by: // extensions will always be an array The module can then use those extensions to extend its functionality. -An example of extensions in the compaction module (app/addons/compaction/base.js) -and in documents module (app/modules/documents/views line 1003) http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a62af899/settings.json.default.json ---------------------------------------------------------------------- diff --git a/settings.json.default.json b/settings.json.default.json index 5d7c22e..38693b7 100644 --- a/settings.json.default.json +++ b/settings.json.default.json @@ -11,7 +11,6 @@ { "name": "replication" }, { "name": "cors" }, { "name": "permissions" }, - { "name": "compaction" }, { "name": "auth" }, { "name": "verifyinstall" }, { "name": "documentation" }