Repository: couchdb-fauxton Updated Branches: refs/heads/master 0e1333bf9 -> a45d28014
prepare React 14 update updates `this.getDOMNode()` or `this.refs.foo.getDOMNode()` calls inside of `React.createClass` to `findDOMNode` PR: #563 PR-URL: https://github.com/apache/couchdb-fauxton/pull/563 Reviewed-By: Benjamin Keen <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a45d2801 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a45d2801 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a45d2801 Branch: refs/heads/master Commit: a45d280141515781dfa60ce66c26fc0cb3d3b606 Parents: 0e1333b Author: Robert Kowalski <[email protected]> Authored: Wed Oct 21 11:44:21 2015 +0200 Committer: Robert Kowalski <[email protected]> Committed: Wed Oct 28 15:13:55 2015 +0100 ---------------------------------------------------------------------- app/addons/activetasks/components.react.jsx | 2 +- app/addons/auth/components.react.jsx | 10 +++++----- .../components/react-components.react.jsx | 18 +++++++++--------- app/addons/databases/components.react.jsx | 10 +++++----- .../documents/changes/components.react.jsx | 4 ++-- .../documents/doc-editor/components.react.jsx | 20 ++++++++++---------- .../queryoptions/queryoptions.react.jsx | 4 ++-- app/addons/documents/sidebar/sidebar.react.jsx | 6 +++--- app/addons/fauxton/components.react.jsx | 12 ++++++------ .../notifications/notifications.react.jsx | 6 +++--- .../fauxton/tests/componentsSpec.react.jsx | 2 +- 11 files changed, 47 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/activetasks/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/activetasks/components.react.jsx b/app/addons/activetasks/components.react.jsx index 2be4acf..40ce138 100644 --- a/app/addons/activetasks/components.react.jsx +++ b/app/addons/activetasks/components.react.jsx @@ -396,7 +396,7 @@ define([ e.preventDefault(); this.refs.view_source_sequence_btn.toggle(function (shown) { if (shown) { - this.refs.view_source_sequence_btn.getDOMNode().focus(); + React.findDOMNode(this.refs.view_source_sequence_btn).focus(); } }.bind(this)); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/auth/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/auth/components.react.jsx b/app/addons/auth/components.react.jsx index 5fe87ca..d4d1abb 100644 --- a/app/addons/auth/components.react.jsx +++ b/app/addons/auth/components.react.jsx @@ -64,8 +64,8 @@ define([ if (this.state.username !== '' || this.state.password !== '') { return false; } - var username = (this.props.testBlankUsername) ? this.props.testBlankUsername : this.refs.username.getDOMNode().value; - var password = (this.props.testBlankPassword) ? this.props.testBlankPassword : this.refs.password.getDOMNode().value; + var username = (this.props.testBlankUsername) ? this.props.testBlankUsername : React.findDOMNode(this.refs.username).value; + var password = (this.props.testBlankPassword) ? this.props.testBlankPassword : React.findDOMNode(this.refs.password).value; this.setState({ username: username, password: password }); // doesn't set immediately, hence separate login() call this.login(username, password); @@ -77,7 +77,7 @@ define([ }, componentDidMount: function () { - this.refs.username.getDOMNode().focus(); + React.findDOMNode(this.refs.username).focus(); }, render: function () { @@ -128,7 +128,7 @@ define([ }, componentDidMount: function () { - this.refs.password.getDOMNode().focus(); + React.findDOMNode(this.refs.password).focus(); changePasswordStore.on('change', this.onChange, this); }, @@ -203,7 +203,7 @@ define([ }, componentDidMount: function () { - this.refs.username.getDOMNode().focus(); + React.findDOMNode(this.refs.username).focus(); createAdminStore.on('change', this.onChange, this); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/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 a909647..8e62a9e 100644 --- a/app/addons/components/react-components.react.jsx +++ b/app/addons/components/react-components.react.jsx @@ -370,7 +370,7 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper }, setupAce: function (props, shouldUpdateCode) { - this.editor = ace.edit(this.refs.ace.getDOMNode()); + this.editor = ace.edit(React.findDOMNode(this.refs.ace)); // suppresses an Ace editor error this.editor.$blockScrolling = Infinity; @@ -675,9 +675,9 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper componentDidUpdate: function () { var params = (this.props.visible) ? { show: true, backdrop: 'static', keyboard: true } : 'hide'; - $(this.getDOMNode()).modal(params); + $(React.findDOMNode(this)).modal(params); - $(this.getDOMNode()).on('shown.bs.modal', function () { + $(React.findDOMNode(this)).on('shown.bs.modal', function () { this.editor.focus(); // re-opening the modal to edit a second string doesn't update the content. This forces the editor to redraw @@ -689,11 +689,11 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper // ensure that if the user clicks ESC to close the window, the store gets wind of it componentDidMount: function () { - $(this.getDOMNode()).on('hidden.bs.modal', function () { + $(React.findDOMNode(this)).on('hidden.bs.modal', function () { this.props.onClose(); }.bind(this)); - this.editor = ace.edit(this.refs.stringEditor.getDOMNode()); + this.editor = ace.edit(React.findDOMNode(this.refs.stringEditor)); // suppresses an Ace editor error this.editor.$blockScrolling = Infinity; @@ -710,7 +710,7 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper }, componentWillUnmount: function () { - $(this.getDOMNode()).off('hidden.bs.modal shown.bs.modal'); + $(React.findDOMNode(this)).off('hidden.bs.modal shown.bs.modal'); }, closeModal: function () { @@ -786,8 +786,8 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper }, componentDidMount: function () { - $(this.refs.exit.getDOMNode()).tooltip({ placement: 'left' }); - $(this.refs.theme.getDOMNode()).tooltip({ placement: 'left' }); + $(React.findDOMNode(this.refs.exit)).tooltip({ placement: 'left' }); + $(React.findDOMNode(this.refs.theme)).tooltip({ placement: 'left' }); }, exitZenMode: function () { @@ -1164,7 +1164,7 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper closeIfOpen: function (e) { if (!this.state.trayVisible) { return; } - var trayEl = $(this.getDOMNode()); + var trayEl = $(React.findDOMNode(this)); if (!trayEl.is(e.target) && trayEl.has(e.target).length === 0) { this.toggleTray(); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/databases/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/databases/components.react.jsx b/app/addons/databases/components.react.jsx index 998c805..20110ef 100644 --- a/app/addons/databases/components.react.jsx +++ b/app/addons/databases/components.react.jsx @@ -170,7 +170,7 @@ define([ var GraveyardInfo = React.createClass({ componentDidMount: function () { - $(this.refs.myself.getDOMNode()).tooltip(); + $(React.findDOMNode(this.refs.myself)).tooltip(); }, render: function () { @@ -204,7 +204,7 @@ define([ this.refs.newDbTray.toggle(function (shown) { if (shown) { - this.refs.newDbName.getDOMNode().focus(); + React.findDOMNode(this.refs.newDbName).focus(); } }.bind(this)); }, @@ -222,7 +222,7 @@ define([ }, onAddDatabase: function () { - var databaseName = this.refs.newDbName.getDOMNode().value; + var databaseName = React.findDOMNode(this.refs.newDbName).value; Actions.createNewDatabase(databaseName); }, @@ -265,7 +265,7 @@ define([ }, componentDidUpdate: function () { - $(this.refs.searchDbName.getDOMNode()).typeahead({ + $(React.findDOMNode(this.refs.searchDbName)).typeahead({ source: this.state.databaseNames, updater: function (item) { this.jumpToDb(item); @@ -282,7 +282,7 @@ define([ }, jumpToDb: function (databaseName) { - databaseName = databaseName || this.refs.searchDbName.getDOMNode().value; + databaseName = databaseName || React.findDOMNode(this.refs.searchDbName).value; Actions.jumpToDatabase(databaseName); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/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 c440e71..6917b98 100644 --- a/app/addons/documents/changes/components.react.jsx +++ b/app/addons/documents/changes/components.react.jsx @@ -213,7 +213,7 @@ define([ }, focusFilterField: function () { - this.refs.addItem.getDOMNode().focus(); + React.findDOMNode(this.refs.addItem).focus(); }, onChangeFilter: function (e) { @@ -250,7 +250,7 @@ define([ var FilterTooltip = React.createClass({ componentDidMount: function () { if (this.props.tooltip) { - $(this.refs.tooltip.getDOMNode()).tooltip(); + $(React.findDOMNode(this.refs.tooltip)).tooltip(); } }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/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 90f6c24..bff69eb 100644 --- a/app/addons/documents/doc-editor/components.react.jsx +++ b/app/addons/documents/doc-editor/components.react.jsx @@ -281,18 +281,18 @@ define([ componentDidUpdate: function () { var params = (this.props.visible) ? { show: true, backdrop: 'static', keyboard: true } : 'hide'; - $(this.getDOMNode()).modal(params); + $(React.findDOMNode(this)).modal(params); }, // ensure that if the user clicks ESC to close the window, the store gets wind of it componentDidMount: function () { - $(this.getDOMNode()).on('hidden.bs.modal', function () { + $(React.findDOMNode(this)).on('hidden.bs.modal', function () { Actions.hideUploadModal(); }); }, componentWillUnmount: function () { - $(this.getDOMNode()).off('hidden.bs.modal'); + $(React.findDOMNode(this)).off('hidden.bs.modal'); }, closeModal: function () { @@ -305,7 +305,7 @@ define([ // as it closes, which looks bad setTimeout(function () { Actions.resetUploadModal(); - this.refs.uploadForm.getDOMNode().reset(); + React.findDOMNode(this.refs.uploadForm).reset(); }.bind(this), 1000); }, @@ -313,7 +313,7 @@ define([ Actions.uploadAttachment({ doc: this.props.doc, rev: this.props.doc.get('_rev'), - files: $(this.refs.attachments.getDOMNode())[0].files + files: $(React.findDOMNode(this.refs.attachments))[0].files }); }, @@ -394,21 +394,21 @@ define([ } var params = (this.props.visible) ? { show: true, backdrop: 'static', keyboard: true } : 'hide'; - $(this.getDOMNode()).modal(params); + $(React.findDOMNode(this)).modal(params); this.clearEvents(); // ensure that if the user clicks ESC to close the window, the store gets wind of it - $(this.getDOMNode()).on('hidden.bs.modal', function () { + $(React.findDOMNode(this)).on('hidden.bs.modal', function () { Actions.hideCloneDocModal(); }); - $(this.getDOMNode()).on('shown.bs.modal', function () { + $(React.findDOMNode(this)).on('shown.bs.modal', function () { this.focus(); }.bind(this)); }, focus: function () { - $(this.refs.newDocId.getDOMNode()).focus(); + $(React.findDOMNode(this.refs.newDocId)).focus(); }, componentWillUnmount: function () { @@ -417,7 +417,7 @@ define([ clearEvents: function () { if (this.refs.newDocId) { - $(this.refs.newDocId.getDOMNode()).off('shown.bs.modal hidden.bs.modal'); + $(React.findDOMNode(this.refs.newDocId)).off('shown.bs.modal hidden.bs.modal'); } }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/documents/queryoptions/queryoptions.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/queryoptions/queryoptions.react.jsx b/app/addons/documents/queryoptions/queryoptions.react.jsx index 02ee208..1f4aaf9 100644 --- a/app/addons/documents/queryoptions/queryoptions.react.jsx +++ b/app/addons/documents/queryoptions/queryoptions.react.jsx @@ -113,8 +113,8 @@ function (app, FauxtonAPI, React, Stores, Actions, Components) { updateBetweenKeys: function () { this.props.updateBetweenKeys({ - startkey: this.refs.startkey.getDOMNode().value, - endkey: this.refs.endkey.getDOMNode().value, + startkey: React.findDOMNode(this.refs.startkey).value, + endkey: React.findDOMNode(this.refs.endkey).value, include: this.props.betweenKeys.include }); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/documents/sidebar/sidebar.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/sidebar/sidebar.react.jsx b/app/addons/documents/sidebar/sidebar.react.jsx index 014daf1..6a52217 100644 --- a/app/addons/documents/sidebar/sidebar.react.jsx +++ b/app/addons/documents/sidebar/sidebar.react.jsx @@ -171,7 +171,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, DocumentViews) { e.preventDefault(); var newToggleState = !this.props.contentVisible; var state = newToggleState ? 'show' : 'hide'; - $(this.getDOMNode()).find('.accordion-body').collapse(state); + $(React.findDOMNode(this)).find('.accordion-body').collapse(state); this.props.toggle(this.props.designDocName, this.props.title); }, @@ -233,7 +233,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, DocumentViews) { e.preventDefault(); var newToggleState = !this.props.contentVisible; var state = newToggleState ? 'show' : 'hide'; - $(this.getDOMNode()).find('#' + this.props.designDocName).collapse(state); + $(React.findDOMNode(this)).find('#' + this.props.designDocName).collapse(state); this.props.toggle(this.props.designDocName); }, @@ -335,7 +335,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, DocumentViews) { this.dbModal = new DeleteDBModal({ database: this.props.database, isSystemDatabase: (/^_/).test(this.props.database.id), - el: this.getDOMNode() + el: React.findDOMNode(this) }); this.dbModal.render(); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/fauxton/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.react.jsx b/app/addons/fauxton/components.react.jsx index 789413a..b8bad67 100644 --- a/app/addons/fauxton/components.react.jsx +++ b/app/addons/fauxton/components.react.jsx @@ -59,7 +59,7 @@ function (app, FauxtonAPI, React, ZeroClipboard) { }, componentDidMount: function () { - var el = this.getDOMNode(); + var el = React.findDOMNode(this); this.clipboard = new ZeroClipboard(el); this.clipboard.on('load', function () { this.clipboard.on('mouseup', function () { @@ -87,7 +87,7 @@ function (app, FauxtonAPI, React, ZeroClipboard) { }, componentDidMount: function () { - var el = this.refs["copy-text-" + this.props.uniqueKey].getDOMNode(); + var el = React.findDOMNode(this.refs["copy-text-" + this.props.uniqueKey]); this.clipboard = new ZeroClipboard(el); this.clipboard.on('load', function () { this.clipboard.on('mouseup', function () { @@ -208,7 +208,7 @@ function (app, FauxtonAPI, React, ZeroClipboard) { show: function (done) { this.setState({show: true}); - $(this.refs.myself.getDOMNode()).velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () { + $(React.findDOMNode(this.refs.myself)).velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () { if (done) { done(true); } @@ -216,7 +216,7 @@ function (app, FauxtonAPI, React, ZeroClipboard) { }, hide: function (done) { - $(this.refs.myself.getDOMNode()).velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () { + $(React.findDOMNode(this.refs.myself)).velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () { this.setState({show: false}); if (done) { done(false); @@ -326,9 +326,9 @@ function (app, FauxtonAPI, React, ZeroClipboard) { componentDidUpdate: function () { var params = (this.props.visible) ? { show: true, backdrop: 'static', keyboard: true } : 'hide'; - $(this.getDOMNode()).modal(params); + $(React.findDOMNode(this)).modal(params); - $(this.getDOMNode()).on('hidden.bs.modal', function () { + $(React.findDOMNode(this)).on('hidden.bs.modal', function () { this.props.onClose(); }.bind(this)); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/fauxton/notifications/notifications.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/notifications/notifications.react.jsx b/app/addons/fauxton/notifications/notifications.react.jsx index f05841a..443e687 100644 --- a/app/addons/fauxton/notifications/notifications.react.jsx +++ b/app/addons/fauxton/notifications/notifications.react.jsx @@ -197,18 +197,18 @@ function (app, FauxtonAPI, React, Actions, Stores, Components) { show = this.props.item.type === this.props.filter; } if (show) { - $(this.getDOMNode()).velocity({ opacity: 1, height: this.state.elementHeight }, this.props.transitionSpeed); + $(React.findDOMNode(this)).velocity({ opacity: 1, height: this.state.elementHeight }, this.props.transitionSpeed); return; } this.hide(); }, getHeight: function () { - return $(this.getDOMNode()).outerHeight(true); + return $(React.findDOMNode(this)).outerHeight(true); }, hide: function (onHidden) { - $(this.getDOMNode()).velocity({ opacity: 0, height: 0 }, this.props.transitionSpeed, function () { + $(React.findDOMNode(this)).velocity({ opacity: 0, height: 0 }, this.props.transitionSpeed, function () { if (onHidden) { onHidden(); } http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a45d2801/app/addons/fauxton/tests/componentsSpec.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/tests/componentsSpec.react.jsx b/app/addons/fauxton/tests/componentsSpec.react.jsx index 9c05f36..c478c78 100644 --- a/app/addons/fauxton/tests/componentsSpec.react.jsx +++ b/app/addons/fauxton/tests/componentsSpec.react.jsx @@ -94,7 +94,7 @@ define([ var trayEl = this.refs.tray; var externalEl = this.refs.externalElement; trayEl.show(function () { - TestUtils.Simulate.click(externalEl.getDOMNode()); + TestUtils.Simulate.click(React.findDOMNode(externalEl)); assert.ok(spy.calledOnce); }); },
