From commits-return-1870-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Mon Nov 26 19:44:50 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8758E180647 for ; Mon, 26 Nov 2018 19:44:49 +0100 (CET) Received: (qmail 74590 invoked by uid 500); 26 Nov 2018 18:44:48 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 74581 invoked by uid 99); 26 Nov 2018 18:44:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Nov 2018 18:44:48 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 338EF851A6; Mon, 26 Nov 2018 18:44:48 +0000 (UTC) Date: Mon, 26 Nov 2018 18:44:48 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: [bugfix] Display raw value in addition to ERROR (#6417) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154325788788.10789.14769039587188582934@gitbox.apache.org> From: graceguo@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 7eb46843cb4c29fc58fdbb87a66e371299867791 X-Git-Newrev: 3c6e882d282515315a8bc9bb0346ac3d21ff61a7 X-Git-Rev: 3c6e882d282515315a8bc9bb0346ac3d21ff61a7 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. graceguo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new 3c6e882 [bugfix] Display raw value in addition to ERROR (#6417) 3c6e882 is described below commit 3c6e882d282515315a8bc9bb0346ac3d21ff61a7 Author: Krist Wongsuphasawat AuthorDate: Mon Nov 26 10:44:42 2018 -0800 [bugfix] Display raw value in addition to ERROR (#6417) * Display raw value in addition to ERROR * update unit test --- superset/assets/spec/javascripts/modules/utils_spec.jsx | 4 ++-- superset/assets/src/modules/utils.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/superset/assets/spec/javascripts/modules/utils_spec.jsx b/superset/assets/spec/javascripts/modules/utils_spec.jsx index 0faaf31..0970c8c 100644 --- a/superset/assets/spec/javascripts/modules/utils_spec.jsx +++ b/superset/assets/spec/javascripts/modules/utils_spec.jsx @@ -29,7 +29,7 @@ describe('utils', () => { expect(d3format('.3s', 1234)).toBe('1.23k'); expect(d3format('.3s', 1237)).toBe('1.24k'); expect(d3format('', 1237)).toBe('1.24k'); - expect(d3format('.2efd2.ef.2.e', 1237)).toBe('ERROR'); + expect(d3format('.2efd2.ef.2.e', 1237)).toBe('1237 (Invalid format: .2efd2.ef.2.e)'); }); }); @@ -48,7 +48,7 @@ describe('utils', () => { }); it('returns a working formatter', () => { expect(d3FormatPreset('smart_date')(0)).toBe('1970'); - expect(d3FormatPreset('%%GIBBERISH')(0)).toBe('ERROR'); + expect(d3FormatPreset('%%GIBBERISH')(0)).toBe('0 (Invalid format: %%GIBBERISH)'); }); }); diff --git a/superset/assets/src/modules/utils.js b/superset/assets/src/modules/utils.js index 201d528..a7f6232 100644 --- a/superset/assets/src/modules/utils.js +++ b/superset/assets/src/modules/utils.js @@ -6,7 +6,6 @@ import { timeFormat as d3TimeFormat } from 'd3-time-format'; import { formatDate, UTC } from './dates'; const siFormatter = d3Format('.3s'); -const ERROR_STRING = 'ERROR'; export function defaultNumberFormatter(n) { let si = siFormatter(n); @@ -28,7 +27,7 @@ export function d3FormatPreset(format) { } catch (e) { // eslint-disable-next-line no-console console.warn(e); - return () => ERROR_STRING; + return value => `${value} (Invalid format: ${format})`; } } return defaultNumberFormatter; @@ -57,13 +56,13 @@ export function d3format(format, number) { } catch (e) { // eslint-disable-next-line no-console console.warn(e); - return ERROR_STRING; + return `${number} (Invalid format: ${format})`; } } try { return formatters[format](number); } catch (e) { - return ERROR_STRING; + return `${number} (Invalid format: ${format})`; } }