superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccwilli...@apache.org
Subject [incubator-superset] branch master updated: refer to default color scheme in colorpickercontrol instead of pointing to specific scheme (#6031)
Date Fri, 05 Oct 2018 01:10:32 GMT
This is an automated email from the ASF dual-hosted git repository.

ccwilliams 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 8fe6f12  refer to default color scheme in colorpickercontrol instead of pointing
to specific scheme (#6031)
8fe6f12 is described below

commit 8fe6f126226c9c03161d50c91d4a948309842217
Author: Krist Wongsuphasawat <krist.wongz@gmail.com>
AuthorDate: Thu Oct 4 18:10:22 2018 -0700

    refer to default color scheme in colorpickercontrol instead of pointing to specific scheme
(#6031)
---
 .../spec/javascripts/explore/components/ColorPickerControl_spec.jsx  | 3 +++
 .../assets/src/explore/components/controls/ColorPickerControl.jsx    | 5 ++---
 superset/assets/src/modules/colors.js                                | 4 ----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx
b/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx
index 2285df4..1271d62 100644
--- a/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx
+++ b/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx
@@ -8,6 +8,7 @@ import { SketchPicker } from 'react-color';
 import ColorPickerControl from
   '../../../../src/explore/components/controls/ColorPickerControl';
 import ControlHeader from '../../../../src/explore/components/ControlHeader';
+import { registerScheme } from '../../../../src/modules/ColorSchemeManager';
 
 const defaultProps = {
   value: { },
@@ -17,6 +18,8 @@ describe('ColorPickerControl', () => {
   let wrapper;
   let inst;
   beforeEach(() => {
+    registerScheme('test', ['red', 'green', 'blue'])
+      .setDefaultSchemeName('test');
     wrapper = shallow(<ColorPickerControl {...defaultProps} />);
     inst = wrapper.instance();
   });
diff --git a/superset/assets/src/explore/components/controls/ColorPickerControl.jsx b/superset/assets/src/explore/components/controls/ColorPickerControl.jsx
index ecccc8e..55d7ce4 100644
--- a/superset/assets/src/explore/components/controls/ColorPickerControl.jsx
+++ b/superset/assets/src/explore/components/controls/ColorPickerControl.jsx
@@ -2,9 +2,8 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import { OverlayTrigger, Popover } from 'react-bootstrap';
 import { SketchPicker } from 'react-color';
-
 import ControlHeader from '../ControlHeader';
-import { bnbColors } from '../../../modules/colors';
+import { getScheme } from '../../../modules/ColorSchemeManager';
 
 const propTypes = {
   onChange: PropTypes.func,
@@ -59,7 +58,7 @@ export default class ColorPickerControl extends React.Component {
         <SketchPicker
           color={this.props.value}
           onChange={this.onChange}
-          presetColors={bnbColors.filter((s, i) => i < 7)}
+          presetColors={getScheme().filter((s, i) => i < 7)}
         />
       </Popover>);
   }
diff --git a/superset/assets/src/modules/colors.js b/superset/assets/src/modules/colors.js
index 0c23d40..413239c 100644
--- a/superset/assets/src/modules/colors.js
+++ b/superset/assets/src/modules/colors.js
@@ -1,12 +1,8 @@
 import d3 from 'd3';
 import sequentialSchemes from './colorSchemes/sequential';
-import airbnb from './colorSchemes/airbnb';
-import lyft from './colorSchemes/lyft';
 
 export const brandColor = '#00A699';
 export const colorPrimary = { r: 0, g: 122, b: 135, a: 1 };
-export const bnbColors = airbnb.bnbColors;
-export const lyftColors = lyft.lyftColors;
 
 export function hexToRGB(hex, alpha = 255) {
   if (!hex) {


Mime
View raw message