[jira] [Commented] (COUCHDB-2787) Merge Diverted Repo Into Mango
[ https://issues.apache.org/jira/browse/COUCHDB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14740248#comment-14740248 ] ASF subversion and git services commented on COUCHDB-2787: -- Commit 97670f3d79b67efb4fac252e6139ce161099ab45 in couchdb-mango's branch refs/heads/2787-modify-testcases from [~tonysun83] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-mango.git;h=97670f3 ] Start couchdb with testuser COUCHDB-2787 > Merge Diverted Repo Into Mango > -- > > Key: COUCHDB-2787 > URL: https://issues.apache.org/jira/browse/COUCHDB-2787 > Project: CouchDB > Issue Type: Task > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (COUCHDB-2787) Merge Diverted Repo Into Mango
[ https://issues.apache.org/jira/browse/COUCHDB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14740294#comment-14740294 ] ASF subversion and git services commented on COUCHDB-2787: -- Commit 06a6b3f52b43f0f49da840faea8e4f4585d187af in couchdb-mango's branch refs/heads/2787-modify-testcases from [~tonysun83] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-mango.git;h=06a6b3f ] Check for text in num_string_test COUCHDB-2787 > Merge Diverted Repo Into Mango > -- > > Key: COUCHDB-2787 > URL: https://issues.apache.org/jira/browse/COUCHDB-2787 > Project: CouchDB > Issue Type: Task > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (COUCHDB-2807) Allow filtering of active tasks by property
Robert Newson created COUCHDB-2807: -- Summary: Allow filtering of active tasks by property Key: COUCHDB-2807 URL: https://issues.apache.org/jira/browse/COUCHDB-2807 Project: CouchDB Issue Type: Improvement Security Level: public (Regular issues) Reporter: Robert Newson extend /_active_tasks to allow some simple filtering. e.g, it would be useful to do /_active_tasks/type/replication to see just the replication tasks. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...
GitHub user rnewson opened a pull request: https://github.com/apache/couchdb-couch/pull/99 Allow filtering of active tasks by property COUCHDB-2807 You can merge this pull request into a Git repository by running: $ git pull https://github.com/cloudant/couchdb-couch 2807-filtered-tasks Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-couch/pull/99.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #99 commit e50f1cf9848bc5545852fbc1552b29a83041496a Author: Robert NewsonDate: 2015-09-11T16:22:01Z Allow filtering of active tasks by property COUCHDB-2807 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (COUCHDB-2806) Cannot search for correctly for numbers when using text
[ https://issues.apache.org/jira/browse/COUCHDB-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14741326#comment-14741326 ] ASF subversion and git services commented on COUCHDB-2806: -- Commit 257a9e8a7c9589b825731576a4590770eced1176 in couchdb-mango's branch refs/heads/2806-numeric-string-field from [~tonysun83] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-mango.git;h=257a9e8 ] Also append quotes for specific numeric string field We appended quotes for numeric_strings for $text. However, we did not do this for specific fields. Note that we don't escape the field value when it's a numeric string because that provides an incorrect string value for clouseau. COUCHDB-2806 > Cannot search for correctly for numbers when using text > --- > > Key: COUCHDB-2806 > URL: https://issues.apache.org/jira/browse/COUCHDB-2806 > Project: CouchDB > Issue Type: Bug > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun >Assignee: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (COUCHDB-2787) Merge Diverted Repo Into Mango
[ https://issues.apache.org/jira/browse/COUCHDB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14741048#comment-14741048 ] ASF subversion and git services commented on COUCHDB-2787: -- Commit 2793b9f50561dd4d9a271ce66aad29d7bfbad942 in couchdb-mango's branch refs/heads/master from [~tonysun83] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-mango.git;h=2793b9f ] Use hypothesis instead of random values for num_string tests COUCHDB-2787 > Merge Diverted Repo Into Mango > -- > > Key: COUCHDB-2787 > URL: https://issues.apache.org/jira/browse/COUCHDB-2787 > Project: CouchDB > Issue Type: Task > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...
Github user rnewson commented on a diff in the pull request: https://github.com/apache/couchdb-couch/pull/99#discussion_r39290001 --- Diff: src/couch_task_status.erl --- @@ -130,6 +143,12 @@ handle_call(all, _, Server) -> ], {reply, All, Server}. +filter_task(Key, Value, TaskProps) -> --- End diff -- not a huge fan of this function but I don't see much option --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...
Github user iilyak commented on a diff in the pull request: https://github.com/apache/couchdb-couch/pull/99#discussion_r39289982 --- Diff: src/couch_task_status.erl --- @@ -122,6 +127,14 @@ handle_call({add_task, TaskProps}, {From, _}, Server) -> [_] -> {reply, {add_task_error, already_registered}, Server} end; +handle_call({filter, Key, Value}, _, Server) -> +All = [ --- End diff -- Use following to avoid doing the same thing in a tight loop ``` handle_call({filter, Key0, Value0}, _, Server) -> Key = couch_util:to_list(Key0), Value = couch_util:to_list(Value0), ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (COUCHDB-2787) Merge Diverted Repo Into Mango
[ https://issues.apache.org/jira/browse/COUCHDB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14741047#comment-14741047 ] ASF subversion and git services commented on COUCHDB-2787: -- Commit ba961dca9858f49e38e17590dc62f512b6630848 in couchdb-mango's branch refs/heads/master from [~tonysun83] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-mango.git;h=ba961dc ] Make testcases skip automatically when no text service COUCHDB-2787 > Merge Diverted Repo Into Mango > -- > > Key: COUCHDB-2787 > URL: https://issues.apache.org/jira/browse/COUCHDB-2787 > Project: CouchDB > Issue Type: Task > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (COUCHDB-2787) Merge Diverted Repo Into Mango
[ https://issues.apache.org/jira/browse/COUCHDB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14741049#comment-14741049 ] ASF subversion and git services commented on COUCHDB-2787: -- Commit 87faac11d7c5c0fd99d5d0eae4d6263ab965d694 in couchdb-mango's branch refs/heads/master from [~tonysun83] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-mango.git;h=87faac1 ] Shorten tests COUCHDB-2787 > Merge Diverted Repo Into Mango > -- > > Key: COUCHDB-2787 > URL: https://issues.apache.org/jira/browse/COUCHDB-2787 > Project: CouchDB > Issue Type: Task > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] couchdb-chttpd pull request: Allow filtering of active tasks by pr...
GitHub user rnewson opened a pull request: https://github.com/apache/couchdb-chttpd/pull/72 Allow filtering of active tasks by property COUCHDB-2807 You can merge this pull request into a Git repository by running: $ git pull https://github.com/cloudant/couchdb-chttpd 2807-filtered-tasks Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-chttpd/pull/72.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #72 commit b4e280db003a6f71dca169a9601f231563843d36 Author: Robert NewsonDate: 2015-09-11T16:22:42Z Allow filtering of active tasks by property COUCHDB-2807 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...
Github user iilyak commented on a diff in the pull request: https://github.com/apache/couchdb-couch/pull/99#discussion_r39290733 --- Diff: src/couch_task_status.erl --- @@ -122,6 +127,14 @@ handle_call({add_task, TaskProps}, {From, _}, Server) -> [_] -> {reply, {add_task_error, already_registered}, Server} end; +handle_call({filter, Key, Value}, _, Server) -> +All = [ +[{pid, ?l2b(pid_to_list(Pid))} | TaskProps] +|| +{Pid, TaskProps} <- ets:tab2list(?MODULE), --- End diff -- Would it be possible to use `ets:foldl(Function, [], ?MODULE)` here? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Allow custom buttons to be added to ...
Github user michellephung commented on the pull request: https://github.com/apache/couchdb-fauxton/pull/521#issuecomment-139657515 +1 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user robertkowalski commented on the pull request: https://github.com/apache/couchdb-fauxton/pull/495#issuecomment-139659781 cool can't wait! i haven't looked in detail yet, but can you add the external dependencies like `papaparse` unminified (for debugging, as we minify during the production build anyway) and as separate commit (as they make reading the code for the review harder) btw: i saw the testsuite is red right now --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Add papaparse.js library
Github user kxepal commented on the pull request: https://github.com/apache/couchdb-fauxton/pull/522#issuecomment-139666396 Need to update NOTICE file about papaparse license. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39322241 --- Diff: app/addons/dataimporter/assets/less/dataimporter.less --- @@ -0,0 +1,406 @@ +// 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/bootstrap/variables.less"; +@import "../../../../../assets/less/variables.less"; +@import "../../../../../assets/less/bootstrap/mixins.less"; + +.dropzone { + border: 1px solid gray; + background-color: #E8E8E8; + height: calc(100% ~"-" 114px); + min-height: 200px; + min-width: 200px; + margin: 50px; + color: @darkRed; + padding-top: 0px !important; + + a { +color: @darkRed; + } + + &.dragging-file-in-background { +border: 1px solid @darkRed; +background-color: #F0DAD9; +z-index: 100; +.icon-file-text-alt { + padding-right: 10px; +} + } + + &.loading-background { +border: 1px solid @darkRed; +.icon-file-text-alt { + padding-right: 10px; +} + } + + .loading-big-file-msg { +color: black; +font-size: 14px; +padding: 10px; + } + + &.limit-info { +background-color: #FFF; +border-color: #FFF; + } + + .file-exceeds-max-msg { +color: black; +font-size: 13px; + } + + .dropzone-msg { +position: relative; +top: 50%; +transform: translateY(-50%); +text-align: center; +vertical-align: middle; + +.icon-file-text-alt { + font-size: 50px; +} + +&.draggingover { + .loading-msg { +position: relative; +top: -10px; + } +} + +.loading-lines { + padding-top: 15px; + padding-left: 10px; + #line1, #line2, #line3, #line4 { +background-color: @darkRed; + } +} + } + + .filetype-txt { +text-align: center; +color: gray; +font-size: 12px !important; +width: 100%; +position: relative; +top: calc(100% ~"-" 114px); +text-align: center; + } + + .file-upload { +position: relative; +overflow: hidden; +margin-left: 10px; +margin-bottom: 3px; +color: white; +background-color: @darkRed; +font-size: 13px !important; +border: none; + +.icon-search { + margin-right: 5px; +} + +&:hover { + background-color: @linkColor; +} + } + + .file-upload input.upload { + position: absolute; + top: 0; + right: 0; + bottom: 2px; + margin: 0; + padding: 0; + font-size: 20px; + cursor: pointer; + opacity: 0; + filter: alpha(opacity=0); + } + + .import-data-limit-info{ +visibility: hidden; +&.shown { + visibility: visible; + background-color: #E8E8E8; +} + } + + &.limit-info { +.dropzone-msg { + height: 90px; +} + } + + .error-window { +overflow: auto; +height: 100%; +color: black; +padding-top: 10px; +padding-bottom: 10px; + +hr { + border: 1px solid #a2a2a2; +} + } +} + +@footerHeight : 120px; +@fakeMargin: 15px solid #f1f1f1; +@footerWidthSingtons : 190px; +@smallMedia : ~"only screen and (max-width: 845px)"; --- End diff -- Bit weird having these vars in the middle of the file. Maybe move to top? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39323064 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user michellephung commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39324540 --- Diff: .gitignore --- @@ -33,3 +35,5 @@ test/nightwatch_tests/selenium/* *.react.js selenium-debug.log npm-debug.log + +assets/js/libs/papaparse.js --- End diff -- i will fix this --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user robertkowalski commented on the pull request: https://github.com/apache/couchdb-fauxton/pull/495#issuecomment-139662408 yes, testsuites can get really annoying if you want to write all tests and fix all existing tests at the very end. i always compare it to lawn mowing: if you keep the grass growing all summer and don't run with the mower in between, the "final cut" can get very hard work. same for css: if i write the whole time css without checking the browser in between the results at the amount of work at the very end that i have to put in my css can get very boring and discouraging :( --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39321970 --- Diff: app/addons/components/react-components.react.jsx --- @@ -1081,6 +1105,114 @@ function (app, FauxtonAPI, React, Components, ace, beautifyHelper) { }); + var ToggleState = React.createClass({ +getDefaultProps: function () { + return { +defaultLeft: 'true' + }; +}, +render: function () { + var config = this.props.toggleConfig, + defaultLeft = false, + defaultRight = false; + + var title = config.title, + leftLabel = config.leftLabel, + rightLabel = config.rightLabel, + leftClick = config.leftClick, + rightClick = config.rightClick, + enclosingID = config.enclosingID; + + if (config.defaultLeft) { +defaultLeft = "checked"; +defaultRight = false; + } else { +defaultRight = "checked"; +defaultLeft = false; + } + + return ( + + {title} + + + +{leftLabel} + + + +{rightLabel} + + + + ); +} + }); + + var SmallDropdown = React.createClass({ +getInitialState: function () { --- End diff -- Could we add a `propTypes` to this class? It's nice to know at a glance exactly what props are being passed into a class so there are no surprises. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39322645 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { --- End diff -- Capital `o` too, for consistency with `dragOver` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39323411 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39324076 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39324323 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39324424 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; --- End diff -- Will this work for bundled environments? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39325012 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; + + var DataImporterStore = FauxtonAPI.Store.extend({ + +init: function (firstTimeHere) { //to reset, call this with true + if (firstTimeHere) { +this._isDataCurrentlyLoading = false; +this._hasDataLoaded = false; +this._hasErrored = false; +this._theData = []; +this._theMetadata = []; +this._smallData = []; +this._showView = 'table'; +this._theFile = { size: 0 }; +this._config = this.getDefaultConfig(); +this._completeFn = this._config.complete; +this._errorFn = this._config.error; +this._fileSize = 0; +this._time = "just started"; +this._repeatTimeID; +this.fetchAllDBs(); +this._chunkedData = []; +this._maxSize = 15000; //in bytes +this._showErrorScreen = false; +this._errorMessageArray = []; +this._loadingInDBInProgress = false; + } // else keeps store as it was when you left the page + this.fetchAllDBs(); + +}, + +fetchAllDBs: function () { + $.ajax({ +method: "GET", +dataType: "json", +url: window.location.origin + "/_all_dbs" + }).then(function (resp) { +this._all_dbs = _.filter(resp, function (dbName) { + return dbName[0] !== '_'; //_all_dbs without _ as first letter +}); +this.triggerChange(); + }.bind(this)); +}, + +getMaxSize: function () { + return this._maxSize; +}, + +getAllDBs: function () { + return this._all_dbs; +}, + +isDataCurrentlyLoading: function () { + return this._isDataCurrentlyLoading; +}, + +dataIsLoading: function () { + this._startTime = app.helpers.moment(); + this._isDataCurrentlyLoading = true; +}, + +hasDataLoaded: function () { + return this._hasDataLoaded; +}, + +dataLoaded: function () { + this._hasDataLoaded = true; + clearInterval(this._repeatTimeID); +}, + +loadData: function (data) { + this._theData = data; +}, + +getFileSize: function () { + return this._theFile.size; +}, + +isThisABigFile: function () { + return this._theFile.size > 75 ? true : false; +}, + +getTimeSinceLoad: function () { + return this._time; +}, + +repeatTime: function () { + this._repeatTimeID = setInterval(function () { +var secondsElapsed = app.helpers.moment().diff(this._startTime); +this._time = app.helpers.getDateFromNow(this._startTime); +if (secondsElapsed < 6) { + this._time = '~' + Math.ceil(secondsElapsed / 1000) + ' seconds ago'; +} +this.triggerChange(); + }.bind(this), 3000); +}, + +loadMeta: function (meta) { + this._theMetadata = meta; +}, + +loadFile: function (file) { + this._theFile = file; + this.repeatTime(); +}, + +getTotalRows: function () { + return this._totalRows; +}, + +getPreviewView: function () { + return this._showView; +}, + +setPreviewView: function (type) { + this._showView = type; +}, + +calcSmallPreviewOfData: function () { + //this is incase the file has large rows + var filesize = this._theFile.size, + rows = this._totalRows, + sizeOfEachRow = filesize / rows, //this is approximate + sizeCap = 80, //in bytes + numberOfRowsToShow;
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39322701 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); --- End diff -- These two lines can be grouped. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39323876 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Add papaparse.js library
GitHub user michellephung opened a pull request: https://github.com/apache/couchdb-fauxton/pull/522 Add papaparse.js library http://papaparse.com/ You can merge this pull request into a Git repository by running: $ git pull https://github.com/michellephung/couchdb-fauxton add-papaparse-library Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-fauxton/pull/522.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #522 commit cd79808edf541b872b5b68082788d8e29614e74f Author: Michelle PhungDate: 2015-09-11T21:04:36Z Add papaparse.js library http://papaparse.com/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Allow custom buttons to be added to ...
Github user asfgit closed the pull request at: https://github.com/apache/couchdb-fauxton/pull/521 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39321825 --- Diff: app/addons/components/react-components.react.jsx --- @@ -1081,6 +1105,114 @@ function (app, FauxtonAPI, React, Components, ace, beautifyHelper) { }); + var ToggleState = React.createClass({ +getDefaultProps: function () { + return { +defaultLeft: 'true' + }; +}, +render: function () { + var config = this.props.toggleConfig, + defaultLeft = false, + defaultRight = false; + + var title = config.title, + leftLabel = config.leftLabel, + rightLabel = config.rightLabel, + leftClick = config.leftClick, + rightClick = config.rightClick, + enclosingID = config.enclosingID; + + if (config.defaultLeft) { +defaultLeft = "checked"; +defaultRight = false; + } else { +defaultRight = "checked"; +defaultLeft = false; + } + + return ( + + {title} + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39322408 --- Diff: app/addons/dataimporter/assets/less/dataimporter.less --- @@ -0,0 +1,406 @@ +// 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/bootstrap/variables.less"; +@import "../../../../../assets/less/variables.less"; +@import "../../../../../assets/less/bootstrap/mixins.less"; + +.dropzone { + border: 1px solid gray; + background-color: #E8E8E8; + height: calc(100% ~"-" 114px); + min-height: 200px; + min-width: 200px; + margin: 50px; + color: @darkRed; + padding-top: 0px !important; + + a { +color: @darkRed; + } + + &.dragging-file-in-background { +border: 1px solid @darkRed; +background-color: #F0DAD9; +z-index: 100; +.icon-file-text-alt { + padding-right: 10px; +} + } + + &.loading-background { +border: 1px solid @darkRed; +.icon-file-text-alt { + padding-right: 10px; +} + } + + .loading-big-file-msg { +color: black; +font-size: 14px; +padding: 10px; + } + + &.limit-info { +background-color: #FFF; +border-color: #FFF; + } + + .file-exceeds-max-msg { +color: black; +font-size: 13px; + } + + .dropzone-msg { +position: relative; +top: 50%; +transform: translateY(-50%); +text-align: center; +vertical-align: middle; + +.icon-file-text-alt { + font-size: 50px; +} + +&.draggingover { + .loading-msg { +position: relative; +top: -10px; + } +} + +.loading-lines { + padding-top: 15px; + padding-left: 10px; + #line1, #line2, #line3, #line4 { +background-color: @darkRed; + } +} + } + + .filetype-txt { +text-align: center; +color: gray; +font-size: 12px !important; +width: 100%; +position: relative; +top: calc(100% ~"-" 114px); +text-align: center; + } + + .file-upload { +position: relative; +overflow: hidden; +margin-left: 10px; +margin-bottom: 3px; +color: white; +background-color: @darkRed; +font-size: 13px !important; +border: none; + +.icon-search { + margin-right: 5px; +} + +&:hover { + background-color: @linkColor; +} + } + + .file-upload input.upload { + position: absolute; + top: 0; + right: 0; + bottom: 2px; + margin: 0; + padding: 0; + font-size: 20px; + cursor: pointer; + opacity: 0; + filter: alpha(opacity=0); + } + + .import-data-limit-info{ +visibility: hidden; +&.shown { + visibility: visible; + background-color: #E8E8E8; +} + } + + &.limit-info { +.dropzone-msg { + height: 90px; +} + } + + .error-window { +overflow: auto; +height: 100%; +color: black; +padding-top: 10px; +padding-bottom: 10px; + +hr { + border: 1px solid #a2a2a2; +} + } +} + +@footerHeight : 120px; +@fakeMargin: 15px solid #f1f1f1; +@footerWidthSingtons : 190px; +@smallMedia : ~"only screen and (max-width: 845px)"; + +.chartSpacing() { + max-width: 150px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + border: 1px solid black; + padding: 15px; +} + +#preview-page { + min-height: 200px; + min-width: 200px; + overflow: auto; + height: calc(100% ~"-" @footerHeight); + width: 100%; + padding-right: 0px !important; + padding-left: 0px !important; + border-left: @fakeMargin; + + #data-import-options { +position: relative; + } + + .top-row { +font-size: 13px; +border-bottom: 2px solid gray; +display: inline-block; +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39324753 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; + + var DataImporterStore = FauxtonAPI.Store.extend({ + +init: function (firstTimeHere) { //to reset, call this with true + if (firstTimeHere) { +this._isDataCurrentlyLoading = false; +this._hasDataLoaded = false; +this._hasErrored = false; +this._theData = []; +this._theMetadata = []; +this._smallData = []; +this._showView = 'table'; +this._theFile = { size: 0 }; +this._config = this.getDefaultConfig(); +this._completeFn = this._config.complete; +this._errorFn = this._config.error; +this._fileSize = 0; +this._time = "just started"; +this._repeatTimeID; +this.fetchAllDBs(); +this._chunkedData = []; +this._maxSize = 15000; //in bytes +this._showErrorScreen = false; +this._errorMessageArray = []; +this._loadingInDBInProgress = false; + } // else keeps store as it was when you left the page + this.fetchAllDBs(); + +}, + +fetchAllDBs: function () { + $.ajax({ +method: "GET", +dataType: "json", +url: window.location.origin + "/_all_dbs" + }).then(function (resp) { +this._all_dbs = _.filter(resp, function (dbName) { + return dbName[0] !== '_'; //_all_dbs without _ as first letter +}); +this.triggerChange(); + }.bind(this)); +}, + +getMaxSize: function () { + return this._maxSize; +}, + +getAllDBs: function () { + return this._all_dbs; +}, + +isDataCurrentlyLoading: function () { + return this._isDataCurrentlyLoading; +}, + +dataIsLoading: function () { + this._startTime = app.helpers.moment(); + this._isDataCurrentlyLoading = true; +}, + +hasDataLoaded: function () { + return this._hasDataLoaded; +}, + +dataLoaded: function () { + this._hasDataLoaded = true; + clearInterval(this._repeatTimeID); +}, + +loadData: function (data) { + this._theData = data; +}, + +getFileSize: function () { + return this._theFile.size; +}, + +isThisABigFile: function () { + return this._theFile.size > 75 ? true : false; --- End diff -- I don't much like all the hardcoded values like this, 6, 3000 and others 'cause I just don't know what they mean. I'd favour having a constants file for stuff like this just so they're in one place and can have meaningful names. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39325052 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; + + var DataImporterStore = FauxtonAPI.Store.extend({ + +init: function (firstTimeHere) { //to reset, call this with true + if (firstTimeHere) { +this._isDataCurrentlyLoading = false; +this._hasDataLoaded = false; +this._hasErrored = false; +this._theData = []; +this._theMetadata = []; +this._smallData = []; +this._showView = 'table'; +this._theFile = { size: 0 }; +this._config = this.getDefaultConfig(); +this._completeFn = this._config.complete; +this._errorFn = this._config.error; +this._fileSize = 0; +this._time = "just started"; +this._repeatTimeID; +this.fetchAllDBs(); +this._chunkedData = []; +this._maxSize = 15000; //in bytes +this._showErrorScreen = false; +this._errorMessageArray = []; +this._loadingInDBInProgress = false; + } // else keeps store as it was when you left the page + this.fetchAllDBs(); + +}, + +fetchAllDBs: function () { + $.ajax({ +method: "GET", +dataType: "json", +url: window.location.origin + "/_all_dbs" + }).then(function (resp) { +this._all_dbs = _.filter(resp, function (dbName) { + return dbName[0] !== '_'; //_all_dbs without _ as first letter +}); +this.triggerChange(); + }.bind(this)); +}, + +getMaxSize: function () { + return this._maxSize; +}, + +getAllDBs: function () { + return this._all_dbs; +}, + +isDataCurrentlyLoading: function () { + return this._isDataCurrentlyLoading; +}, + +dataIsLoading: function () { + this._startTime = app.helpers.moment(); + this._isDataCurrentlyLoading = true; +}, + +hasDataLoaded: function () { + return this._hasDataLoaded; +}, + +dataLoaded: function () { + this._hasDataLoaded = true; + clearInterval(this._repeatTimeID); +}, + +loadData: function (data) { + this._theData = data; +}, + +getFileSize: function () { + return this._theFile.size; +}, + +isThisABigFile: function () { + return this._theFile.size > 75 ? true : false; +}, + +getTimeSinceLoad: function () { + return this._time; +}, + +repeatTime: function () { + this._repeatTimeID = setInterval(function () { +var secondsElapsed = app.helpers.moment().diff(this._startTime); +this._time = app.helpers.getDateFromNow(this._startTime); +if (secondsElapsed < 6) { + this._time = '~' + Math.ceil(secondsElapsed / 1000) + ' seconds ago'; +} +this.triggerChange(); + }.bind(this), 3000); +}, + +loadMeta: function (meta) { + this._theMetadata = meta; +}, + +loadFile: function (file) { + this._theFile = file; + this.repeatTime(); +}, + +getTotalRows: function () { + return this._totalRows; +}, + +getPreviewView: function () { + return this._showView; +}, + +setPreviewView: function (type) { + this._showView = type; +}, + +calcSmallPreviewOfData: function () { + //this is incase the file has large rows + var filesize = this._theFile.size, + rows = this._totalRows, + sizeOfEachRow = filesize / rows, //this is approximate + sizeCap = 80, //in bytes + numberOfRowsToShow;
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39323903 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39324258 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39325110 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; + + var DataImporterStore = FauxtonAPI.Store.extend({ + +init: function (firstTimeHere) { //to reset, call this with true + if (firstTimeHere) { +this._isDataCurrentlyLoading = false; +this._hasDataLoaded = false; +this._hasErrored = false; +this._theData = []; +this._theMetadata = []; +this._smallData = []; +this._showView = 'table'; +this._theFile = { size: 0 }; +this._config = this.getDefaultConfig(); +this._completeFn = this._config.complete; +this._errorFn = this._config.error; +this._fileSize = 0; +this._time = "just started"; +this._repeatTimeID; +this.fetchAllDBs(); +this._chunkedData = []; +this._maxSize = 15000; //in bytes +this._showErrorScreen = false; +this._errorMessageArray = []; +this._loadingInDBInProgress = false; + } // else keeps store as it was when you left the page + this.fetchAllDBs(); + +}, + +fetchAllDBs: function () { + $.ajax({ +method: "GET", +dataType: "json", +url: window.location.origin + "/_all_dbs" + }).then(function (resp) { +this._all_dbs = _.filter(resp, function (dbName) { + return dbName[0] !== '_'; //_all_dbs without _ as first letter +}); +this.triggerChange(); + }.bind(this)); +}, + +getMaxSize: function () { + return this._maxSize; +}, + +getAllDBs: function () { + return this._all_dbs; +}, + +isDataCurrentlyLoading: function () { + return this._isDataCurrentlyLoading; +}, + +dataIsLoading: function () { + this._startTime = app.helpers.moment(); + this._isDataCurrentlyLoading = true; +}, + +hasDataLoaded: function () { + return this._hasDataLoaded; +}, + +dataLoaded: function () { + this._hasDataLoaded = true; + clearInterval(this._repeatTimeID); +}, + +loadData: function (data) { + this._theData = data; +}, + +getFileSize: function () { + return this._theFile.size; +}, + +isThisABigFile: function () { + return this._theFile.size > 75 ? true : false; +}, + +getTimeSinceLoad: function () { + return this._time; +}, + +repeatTime: function () { + this._repeatTimeID = setInterval(function () { +var secondsElapsed = app.helpers.moment().diff(this._startTime); +this._time = app.helpers.getDateFromNow(this._startTime); +if (secondsElapsed < 6) { + this._time = '~' + Math.ceil(secondsElapsed / 1000) + ' seconds ago'; +} +this.triggerChange(); + }.bind(this), 3000); +}, + +loadMeta: function (meta) { + this._theMetadata = meta; +}, + +loadFile: function (file) { + this._theFile = file; + this.repeatTime(); +}, + +getTotalRows: function () { + return this._totalRows; +}, + +getPreviewView: function () { + return this._showView; +}, + +setPreviewView: function (type) { + this._showView = type; +}, + +calcSmallPreviewOfData: function () { + //this is incase the file has large rows + var filesize = this._theFile.size, + rows = this._totalRows, + sizeOfEachRow = filesize / rows, //this is approximate + sizeCap = 80, //in bytes + numberOfRowsToShow;
[GitHub] couchdb-fauxton pull request: Data importer
Github user michellephung commented on the pull request: https://github.com/apache/couchdb-fauxton/pull/495#issuecomment-139690803 todo: add button to cancel upload --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user michellephung commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39332185 --- Diff: app/addons/dataimporter/components.react.jsx --- @@ -0,0 +1,793 @@ +// 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', + 'react', + 'addons/dataimporter/stores', + 'addons/dataimporter/actions', + 'addons/components/react-components.react', + 'helpers' +], function (FauxtonAPI, React, Stores, Actions, Components, Helpers) { + + var dataImporterStore = Stores.dataImporterStore; + + var DataImporterController = React.createClass({ +getStoreState: function () { + return { +isDataCurrentlyLoading: dataImporterStore.isDataCurrentlyLoading(), +hasDataLoaded: dataImporterStore.hasDataLoaded(), +isBigFile: dataImporterStore.isThisABigFile(), +rowShown: dataImporterStore.getRowsShown(), +rowsTotal: dataImporterStore.getTotalRows(), +data: dataImporterStore.getTheData(), +meta: dataImporterStore.getTheMetadata(), +getPreviewView: dataImporterStore.getPreviewView(), +getSmallPreviewOfData: dataImporterStore.getSmallPreviewOfData(), +getHeaderConfig: dataImporterStore.getConfigSetting('header'), +getDelimiterChosen: dataImporterStore.getConfigSetting('delimiter'), +getAllDBs: dataImporterStore.getAllDBs(), +getFileSize: dataImporterStore.getFileSize(), +getTimeSinceLoad: dataImporterStore.getTimeSinceLoad, +getMaxSize: dataImporterStore.getMaxSize(), +showErrorScreen: dataImporterStore.showErrorScreen(), +errorMsg: dataImporterStore.getErrorMsg(), +isloadingInDBInProgress: dataImporterStore.getIsloadingInDBInProgress() + }; +}, + +getInitialState: function () { + return this.getStoreState(); +}, + +componentDidMount: function () { + dataImporterStore.on('change', this.onChange, this); +}, + +componentWillUnmount: function () { + dataImporterStore.off('change', this.onChange, this); +}, + +onChange: function () { + this.setState(this.getStoreState()); +}, + +render: function () { + if (this.state.showErrorScreen) { +return ; + } + + if (this.state.hasDataLoaded) { +return ( + +); + } + + return ( + + ); +} + }); + + var DataImporterDropZone = React.createClass({ +getInitialState: function () { + return { +draggingOver: false, +loading: this.props.isLoading, +showLimitInfo: false, +fileSize: this.props.getFileSize, +timeSinceLoad: this.props.getTimeSinceLoad, +fileTooBig: false + }; +}, + +dragOver: function (e) { + e.preventDefault(); + this.setState({ draggingOver: true }); +}, + +endDragover: function (e) { + e.preventDefault(); + e.stopPropagation(); + this.setState({draggingOver: false}); +}, + +drop: function (e) { + e.preventDefault(); + var file = e.nativeEvent.dataTransfer.files[0]; + this.checkSize(file); +}, + +filechosen: function (e) { + e.preventDefault(); + var file = e.nativeEvent.target.files[0]; + this.checkSize(file); +}, + +checkSize: function (file) { + this.setState({ fileSize: file.size }); + this.setState({ draggingOver: false }); + + if (file.size > this.props.maxSize) { +this.setState({ fileTooBig: true }); + } else { +Actions.loadFile(file); +this.setState({ loading: true }); +Actions.dataIsCurrentlyLoading(); + } +}, + +uploadButton: function () { + return ( + + + + + Choose File + + + + + ); +}, + +
[GitHub] couchdb-fauxton pull request: Data importer
Github user michellephung commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39332369 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; + + var DataImporterStore = FauxtonAPI.Store.extend({ + +init: function (firstTimeHere) { //to reset, call this with true + if (firstTimeHere) { +this._isDataCurrentlyLoading = false; +this._hasDataLoaded = false; +this._hasErrored = false; +this._theData = []; +this._theMetadata = []; +this._smallData = []; +this._showView = 'table'; +this._theFile = { size: 0 }; +this._config = this.getDefaultConfig(); +this._completeFn = this._config.complete; +this._errorFn = this._config.error; +this._fileSize = 0; +this._time = "just started"; +this._repeatTimeID; +this.fetchAllDBs(); +this._chunkedData = []; +this._maxSize = 15000; //in bytes +this._showErrorScreen = false; +this._errorMessageArray = []; +this._loadingInDBInProgress = false; --- End diff -- i like reset(). will do on monday --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Data importer
Github user michellephung commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/495#discussion_r39332384 --- Diff: app/addons/dataimporter/stores.js --- @@ -0,0 +1,369 @@ +// 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/dataimporter/actiontypes', + 'papaparse' +], function (app, FauxtonAPI, ActionTypes, Papa) { + + Papa.SCRIPT_PATH = '../../assets/js/libs/papaparse.min.js'; + + var DataImporterStore = FauxtonAPI.Store.extend({ + +init: function (firstTimeHere) { //to reset, call this with true + if (firstTimeHere) { +this._isDataCurrentlyLoading = false; +this._hasDataLoaded = false; +this._hasErrored = false; +this._theData = []; +this._theMetadata = []; +this._smallData = []; +this._showView = 'table'; +this._theFile = { size: 0 }; +this._config = this.getDefaultConfig(); +this._completeFn = this._config.complete; +this._errorFn = this._config.error; +this._fileSize = 0; +this._time = "just started"; +this._repeatTimeID; +this.fetchAllDBs(); +this._chunkedData = []; +this._maxSize = 15000; //in bytes +this._showErrorScreen = false; +this._errorMessageArray = []; +this._loadingInDBInProgress = false; + } // else keeps store as it was when you left the page + this.fetchAllDBs(); + +}, + +fetchAllDBs: function () { + $.ajax({ +method: "GET", +dataType: "json", +url: window.location.origin + "/_all_dbs" + }).then(function (resp) { +this._all_dbs = _.filter(resp, function (dbName) { + return dbName[0] !== '_'; //_all_dbs without _ as first letter +}); +this.triggerChange(); + }.bind(this)); +}, + +getMaxSize: function () { + return this._maxSize; +}, + +getAllDBs: function () { + return this._all_dbs; +}, + +isDataCurrentlyLoading: function () { + return this._isDataCurrentlyLoading; +}, + +dataIsLoading: function () { + this._startTime = app.helpers.moment(); + this._isDataCurrentlyLoading = true; +}, + +hasDataLoaded: function () { + return this._hasDataLoaded; +}, + +dataLoaded: function () { + this._hasDataLoaded = true; + clearInterval(this._repeatTimeID); +}, + +loadData: function (data) { + this._theData = data; +}, + +getFileSize: function () { + return this._theFile.size; +}, + +isThisABigFile: function () { + return this._theFile.size > 75 ? true : false; +}, + +getTimeSinceLoad: function () { + return this._time; +}, + +repeatTime: function () { + this._repeatTimeID = setInterval(function () { +var secondsElapsed = app.helpers.moment().diff(this._startTime); +this._time = app.helpers.getDateFromNow(this._startTime); +if (secondsElapsed < 6) { + this._time = '~' + Math.ceil(secondsElapsed / 1000) + ' seconds ago'; +} +this.triggerChange(); + }.bind(this), 3000); +}, + +loadMeta: function (meta) { + this._theMetadata = meta; +}, + +loadFile: function (file) { + this._theFile = file; + this.repeatTime(); +}, + +getTotalRows: function () { + return this._totalRows; +}, + +getPreviewView: function () { + return this._showView; +}, + +setPreviewView: function (type) { + this._showView = type; +}, + +calcSmallPreviewOfData: function () { + //this is incase the file has large rows + var filesize = this._theFile.size, + rows = this._totalRows, + sizeOfEachRow = filesize / rows, //this is approximate + sizeCap = 80, //in bytes +
[GitHub] couchdb-chttpd pull request: Implement /db/_bulk_get endpoint
Github user willholley commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/33#issuecomment-139565250 in my tests, bulk_get doesn't return the list of revisions correctly: $ curl http://localhost:15984/willtest -XPUT {"ok":true} $ curl http://localhost:15984/willtest -XPOST -H 'Content-Type:application/json' --data-binary '{"_id":"foo"}' {"ok":true,"id":"foo","rev":"1-967a00dff5e02add41819138abb3284d"} $ curl 'http://localhost:15984/willtest/foo?revs=true {"_id":"foo","_rev":"1-967a00dff5e02add41819138abb3284d","_revisions":{"start":1,"ids":["967a00dff5e02add41819138abb3284d"]}} $ curl http://localhost:15984/willtest -XPOST -H 'Content-Type:application/json' --data-binary '{"_id":"foo","_rev":"1-967a00dff5e02add41819138abb3284d","generation":2}' {"ok":true,"id":"foo","rev":"2-0cb4bbdce165620d03a15eff82d8712a"} $ curl 'http://localhost:15984/willtest/foo?revs=true' {"_id":"foo","_rev":"2-0cb4bbdce165620d03a15eff82d8712a","generation":2,"_revisions":{"start":2,"ids":["0cb4bbdce165620d03a15eff82d8712a","967a00dff5e02add41819138abb3284d"]}} $ curl 'http://localhost:15984/willtest/_bulk_get' -H 'Content-Type:application/json' --data-binary '{"docs":[{"id":"foo","rev":"2-0cb4bbdce165620d03a15eff82d8712a"}],"revs":true}' -H 'Accept: application/json' {"results": [{"id": "foo", "docs": [{"ok":{"_id":"foo","_rev":"2-0cb4bbdce165620d03a15eff82d8712a","generation":2}}]}]} In that last response, I'd expect a "_revisions" field similar to the explicit request for /foo?revs=true. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Closed] (COUCHDB-2787) Merge Diverted Repo Into Mango
[ https://issues.apache.org/jira/browse/COUCHDB-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tony Sun closed COUCHDB-2787. - > Merge Diverted Repo Into Mango > -- > > Key: COUCHDB-2787 > URL: https://issues.apache.org/jira/browse/COUCHDB-2787 > Project: CouchDB > Issue Type: Task > Security Level: public(Regular issues) > Components: Mango >Reporter: Tony Sun > -- This message was sent by Atlassian JIRA (v6.3.4#6332)