couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benk...@apache.org
Subject fauxton commit: updated refs/heads/master to 2e89462
Date Fri, 15 Apr 2016 17:40:16 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master d44aa93a9 -> 2e894627d


More minor fixes

- minor style fix for view attachments dropdown
- autofocus for delete db panel input field
- changes clipboard item to show notification when copied to
clipboard
- Now the API Bar tray only closes once you click outside of
it (not within it)


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/2e894627
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/2e894627
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/2e894627

Branch: refs/heads/master
Commit: 2e894627d031247d9213fc746cdd6f54e93c9f01
Parents: d44aa93
Author: Ben Keen <ben.keen@gmail.com>
Authored: Tue Apr 5 14:16:49 2016 -0700
Committer: Ben Keen <ben.keen@gmail.com>
Committed: Fri Apr 15 10:03:47 2016 -0700

----------------------------------------------------------------------
 .../components/react-components.react.jsx       | 10 ++++----
 .../documents/assets/less/doc-editor.less       |  5 ++++
 .../documents/changes/components.react.jsx      | 25 ++++++++++++++++++--
 app/addons/documents/changes/stores.js          | 22 ++++++++++++-----
 .../tests/changes.componentsSpec.react.jsx      |  8 +++++++
 .../documents/doc-editor/components.react.jsx   |  3 ++-
 6 files changed, 60 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e894627/app/addons/components/react-components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/react-components.react.jsx b/app/addons/components/react-components.react.jsx
index 0ad9b85..8baffe1 100644
--- a/app/addons/components/react-components.react.jsx
+++ b/app/addons/components/react-components.react.jsx
@@ -1381,8 +1381,10 @@ define([
     },
 
     componentDidMount: function () {
-      $('body').on('click.APIBar', function () {
-        Actions.toggleApiBarVisibility(false);
+      $('body').on('click.APIBar', function (e) {
+        if ($(e.target).closest('.api-bar-tray,.control-toggle-api-url').length === 0) {
+          Actions.toggleApiBarVisibility(false);
+        }
       }.bind(this));
     },
 
@@ -1516,8 +1518,8 @@ define([
               type="text"
               className="input-block-level"
               onKeyUp={this.onInputKeypress}
-              onChange={this.onInputChange} />
-
+              onChange={this.onInputChange}
+              autoFocus={true} />
           </Modal.Body>
           <Modal.Footer>
             <a

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e894627/app/addons/documents/assets/less/doc-editor.less
----------------------------------------------------------------------
diff --git a/app/addons/documents/assets/less/doc-editor.less b/app/addons/documents/assets/less/doc-editor.less
index ab0cc4a..82ef9d2 100644
--- a/app/addons/documents/assets/less/doc-editor.less
+++ b/app/addons/documents/assets/less/doc-editor.less
@@ -181,3 +181,8 @@
   height: inherit;
   max-height: 600px;
 }
+
+.attachment-delimiter {
+  color: #999999;
+  margin: 0 4px;
+}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e894627/app/addons/documents/changes/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/components.react.jsx b/app/addons/documents/changes/components.react.jsx
index 960077a..9c6f90e 100644
--- a/app/addons/documents/changes/components.react.jsx
+++ b/app/addons/documents/changes/components.react.jsx
@@ -273,6 +273,7 @@ define([
     getStoreState: function () {
       return {
         changes: changesStore.getChanges(),
+        loaded: changesStore.isLoaded(),
         databaseName: changesStore.getDatabaseName(),
         isShowingSubset: changesStore.isShowingSubset()
       };
@@ -300,6 +301,14 @@ define([
     },
 
     getRows: function () {
+      if (!this.state.changes.length && this.state.loaded) {
+        return (
+          <p>
+            No document changes have occurred in this database.
+          </p>
+        );
+      }
+
       return _.map(this.state.changes, function (change) {
         var key = change.id + '-' + change.seq;
         return <ChangeRow change={change} key={key} databaseName={this.state.databaseName}
/>;
@@ -351,6 +360,18 @@ define([
       };
     },
 
+    onClipboardClick: function (target) {
+      var msg = 'The document ID has been copied to your clipboard.';
+      if (target === 'seq') {
+        msg = 'The document seq number has been copied to your clipboard.';
+      }
+      FauxtonAPI.addNotification({
+        msg: msg,
+        type: 'info',
+        clear: true
+      });
+    },
+
     render: function () {
       var jsonBtnClasses = 'btn btn-small' + (this.state.codeVisible ? ' btn-secondary' :
' btn-primary');
       var wrapperClass = 'change-wrapper' + (this.props.change.isNew ? ' new-change-row'
: '');
@@ -362,7 +383,7 @@ define([
               <div className="span2">seq</div>
               <div className="span8 change-sequence">{this.props.change.seq}</div>
               <div className="span2 text-right">
-                <Components.Clipboard text={this.props.change.seq} />
+                <Components.Clipboard text={this.props.change.seq} onClipboardClick={()
=> this.onClipboardClick('seq')} />
               </div>
             </div>
 
@@ -372,7 +393,7 @@ define([
                 <ChangeID id={this.props.change.id} deleted={this.props.change.deleted}
databaseName={this.props.databaseName} />
               </div>
               <div className="span2 text-right">
-                <Components.Clipboard text={this.props.change.id} />
+                <Components.Clipboard text={this.props.change.id} onClipboardClick={()
=> this.onClipboardClick('id')} />
               </div>
             </div>
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e894627/app/addons/documents/changes/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/stores.js b/app/addons/documents/changes/stores.js
index 49e40f2..4730ed9 100644
--- a/app/addons/documents/changes/stores.js
+++ b/app/addons/documents/changes/stores.js
@@ -23,6 +23,7 @@ define([
     },
 
     reset: function () {
+      this._isLoaded = false;
       this._tabVisible = false;
       this._filters = [];
       this._changes = [];
@@ -38,6 +39,10 @@ define([
       this._databaseName = options.databaseName;
     },
 
+    isLoaded: function () {
+      return this._isLoaded;
+    },
+
     updateChanges: function (seqNum, changes) {
 
       // make a note of the most recent sequence number. This is used for a point of reference
for polling for new changes
@@ -64,6 +69,7 @@ define([
 
       // add the new changes to the start of the list
       this._changes = newChanges.concat(this._changes);
+      this._isLoaded = true;
     },
 
     getChanges: function () {
@@ -143,29 +149,33 @@ define([
       switch (action.type) {
         case ActionTypes.INIT_CHANGES:
           this.initChanges(action.options);
-          this.triggerChange();
         break;
+
         case ActionTypes.UPDATE_CHANGES:
           this.updateChanges(action.seqNum, action.changes);
-          this.triggerChange();
         break;
+
         case ActionTypes.TOGGLE_CHANGES_TAB_VISIBILITY:
           this.toggleTabVisibility();
-          this.triggerChange();
         break;
+
         case ActionTypes.ADD_CHANGES_FILTER_ITEM:
           this.addFilter(action.filter);
-          this.triggerChange();
         break;
+
         case ActionTypes.REMOVE_CHANGES_FILTER_ITEM:
           this.removeFilter(action.filter);
-          this.triggerChange();
         break;
+
         case ActionTypes.TOGGLE_CHANGES_POLLING:
           this.togglePolling();
-          this.triggerChange();
         break;
+
+        default:
+          return;
       }
+
+      this.triggerChange();
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e894627/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx b/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
index 0178a43..b77e262 100644
--- a/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
+++ b/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
@@ -280,6 +280,13 @@ define([
       assert.equal(1, $changesEl.find('.change-box').length);
       assert.equal('doc_5', $($changesEl.find('.js-doc-id').get(0)).html());
     });
+
+    it('shows a No Docs Found message if no docs', function () {
+      Stores.changesStore.reset();
+      Actions.updateChanges({ last_seq: 124, results: [] });
+      assert.ok(/No\sdocument\schanges\shave\soccurred/.test($changesEl[0].outerHTML));
+    });
+
   });
 
 
@@ -288,6 +295,7 @@ define([
     var container;
     var maxChanges = 10;
 
+
     beforeEach(function () {
       container = document.createElement('div');
       var changes = [];

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e894627/app/addons/documents/doc-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/components.react.jsx b/app/addons/documents/doc-editor/components.react.jsx
index c901a13..af211b9 100644
--- a/app/addons/documents/doc-editor/components.react.jsx
+++ b/app/addons/documents/doc-editor/components.react.jsx
@@ -205,7 +205,8 @@ define([
         var url = FauxtonAPI.urls('document', 'attachment', db, doc, app.utils.safeURLName(filename));
         return (
           <li key={filename}>
-            <a href={url} target="_blank" data-bypass="true"> <strong>{filename}</strong>
-
+            <a href={url} target="_blank" data-bypass="true"> <strong>{filename}</strong>
+              <span className="attachment-delimiter">-</span>
               <span>{item.content_type}, {Helpers.formatSize(item.length)}</span>
             </a>
           </li>


Mime
View raw message