Skip to content

Commit

Permalink
shared BigNumber controls file
Browse files Browse the repository at this point in the history
  • Loading branch information
rusackas committed Apr 2, 2020
1 parent 67b1500 commit 90573d1
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 73 deletions.
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ The filter-box configuration references column names (via the `column` key) and
| `color_picker` | _object_ | The **Fixed Color** widget |
| `donut` | _boolean_ | The **Donut** widget |
| `global_opacity` | _number_ | The **Opacity** widget |
| `header_font_size` | _number_ | The **Big Number Font Size** widget (or similar) |
| `label_colors` | _object_ | The **Color Scheme** widget |
| `labels_outside` | _boolean_ | The **Put labels outside** widget |
| `line_interpolation` | _string_ | The **Line Style** widget |
Expand All @@ -1056,7 +1055,6 @@ The filter-box configuration references column names (via the `column` key) and
| `show_brush` | _string_ | The **Show Range Filter** widget |
| `show_legend` | _boolean_ | The **Legend** widget |
| `show_markers` | _string_ | The **Show Markers** widget |
| `subheader_font_size` | _number_ | The **Subheader Font Size** widget |

### X Axis

Expand Down
8 changes: 3 additions & 5 deletions superset-frontend/src/explore/controlPanels/BigNumber.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import { t } from '@superset-ui/translation';
import React from 'react';
import { HeaderFontSize, SubheaderFontSize } from './Shared_BigNumber';

export default {
controlPanelSections: [
Expand Down Expand Up @@ -84,8 +85,8 @@ export default {
expanded: true,
controlSetRows: [
['color_picker', null],
['header_font_size'],
['subheader_font_size'],
[HeaderFontSize],
[SubheaderFontSize],
],
},
{
Expand All @@ -101,9 +102,6 @@ export default {
y_axis_format: {
label: t('Number format'),
},
header_font_size: {
label: t('Big Number Font Size'),
},
},
sectionOverrides: {
druidTimeSeries: {
Expand Down
6 changes: 2 additions & 4 deletions superset-frontend/src/explore/controlPanels/BigNumberTotal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { HeaderFontSize, SubheaderFontSize } from './Shared_BigNumber';

export default {
controlPanelSections: [
Expand Down Expand Up @@ -47,15 +48,12 @@ export default {
{
label: t('Chart Options'),
expanded: true,
controlSetRows: [['header_font_size'], ['subheader_font_size']],
controlSetRows: [[HeaderFontSize], [SubheaderFontSize]],
},
],
controlOverrides: {
y_axis_format: {
label: t('Number format'),
},
header_font_size: {
label: t('Big Number Font Size'),
},
},
};
89 changes: 89 additions & 0 deletions superset-frontend/src/explore/controlPanels/Shared_BigNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

// These are control configurations that are shared ONLY within the BigNumber viz plugin repo.
import { t } from '@superset-ui/translation';

export const HeaderFontSize = {
name: 'header_font_size',
config: {
type: 'SelectControl',
label: t('Big Number Font Size'),
renderTrigger: true,
clearable: false,
default: 0.4,
// Values represent the percentage of space a header should take
options: [
{
label: t('Tiny'),
value: 0.2,
},
{
label: t('Small'),
value: 0.3,
},
{
label: t('Normal'),
value: 0.4,
},
{
label: t('Large'),
value: 0.5,
},
{
label: t('Huge'),
value: 0.6,
},
],
},
};

export const SubheaderFontSize = {
name: 'subheader_font_size',
config: {
type: 'SelectControl',
label: t('Subheader Font Size'),
renderTrigger: true,
clearable: false,
default: 0.15,
// Values represent the percentage of space a subheader should take
options: [
{
label: t('Tiny'),
value: 0.125,
},
{
label: t('Small'),
value: 0.15,
},
{
label: t('Normal'),
value: 0.2,
},
{
label: t('Large'),
value: 0.3,
},
{
label: t('Huge'),
value: 0.4,
},
],
},
};
62 changes: 0 additions & 62 deletions superset-frontend/src/explore/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1128,68 +1128,6 @@ export const controls = {
),
},

header_font_size: {
type: 'SelectControl',
label: t('Header Font Size'),
renderTrigger: true,
clearable: false,
default: 0.4,
// Values represent the percentage of space a header should take
options: [
{
label: t('Tiny'),
value: 0.2,
},
{
label: t('Small'),
value: 0.3,
},
{
label: t('Normal'),
value: 0.4,
},
{
label: t('Large'),
value: 0.5,
},
{
label: t('Huge'),
value: 0.6,
},
],
},

subheader_font_size: {
type: 'SelectControl',
label: t('Subheader Font Size'),
renderTrigger: true,
clearable: false,
default: 0.15,
// Values represent the percentage of space a subheader should take
options: [
{
label: t('Tiny'),
value: 0.125,
},
{
label: t('Small'),
value: 0.15,
},
{
label: t('Normal'),
value: 0.2,
},
{
label: t('Large'),
value: 0.3,
},
{
label: t('Huge'),
value: 0.4,
},
],
},

instant_filtering: {
type: 'CheckboxControl',
label: t('Instant Filtering'),
Expand Down

0 comments on commit 90573d1

Please sign in to comment.