You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wi...@apache.org on 2020/01/07 15:37:36 UTC

[couchdb-fauxton] branch mango_warning_server created (now 5ed6b4e)

This is an automated email from the ASF dual-hosted git repository.

willholley pushed a change to branch mango_warning_server
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git.


      at 5ed6b4e  Mango: support multiple server-side warnings

This branch includes the following new commits:

     new 5ed6b4e  Mango: support multiple server-side warnings

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb-fauxton] 01/01: Mango: support multiple server-side warnings

Posted by wi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

willholley pushed a commit to branch mango_warning_server
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git

commit 5ed6b4e31a647f1791a5a72ab6c7b41679d6a579
Author: Will Holley <wi...@gmail.com>
AuthorDate: Tue Jan 7 15:36:14 2020 +0000

    Mango: support multiple server-side warnings
    
    Changes the handling of mango warnings to support multiple warnings
    delimited by a newline, as added in https://github.com/apache/couchdb/pull/2410
---
 .../documents/mango/components/ExecutionStats.js       | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/app/addons/documents/mango/components/ExecutionStats.js b/app/addons/documents/mango/components/ExecutionStats.js
index 789a886..e857219 100644
--- a/app/addons/documents/mango/components/ExecutionStats.js
+++ b/app/addons/documents/mango/components/ExecutionStats.js
@@ -13,8 +13,6 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import { Popover, OverlayTrigger } from 'react-bootstrap';
 
-const TOO_MANY_DOCS_SCANNED_WARNING = "The number of documents examined is high in proportion to the number of results returned. Consider adding an index to improve this.";
-
 export default class ExecutionStats extends React.Component {
   constructor (props) {
     super(props);
@@ -37,18 +35,10 @@ export default class ExecutionStats extends React.Component {
     return [minutes, ' ', minuteText, ', ', seconds, ' ', secondsText].join('');
   }
 
-  getWarning(executionStats, warning) {
-    if (!executionStats) { return warning; }
-
-    // warn if many documents scanned in relation to results returned
-    if (!warning && executionStats.results_returned) {
-      const docsExamined = executionStats.total_docs_examined || executionStats.total_quorum_docs_examined;
-      if (docsExamined / executionStats.results_returned > 10) {
-        return TOO_MANY_DOCS_SCANNED_WARNING;
-      }
+  getWarning(warning) {
+    if(warning) {
+      return warning.split('\n').join('<br>');
     }
-
-    return warning;
   }
 
   warningPopupComponent(warningText) {
@@ -95,7 +85,7 @@ export default class ExecutionStats extends React.Component {
       warning
     } = this.props;
 
-    const warningText = this.getWarning(executionStats, warning);
+    const warningText = this.getWarning(warning);
 
     let warningComponent = null;
     if (warningText) {