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 <[email protected]>
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) {

Reply via email to