Skip to content

Commit

Permalink
Add wildcards property to VoyagerConfig (vega#792)
Browse files Browse the repository at this point in the history
Set default to InitiallyShown for related-views


Refactor wildcards voyager config
  • Loading branch information
ssharif6 authored and kanitw committed Apr 17, 2018
1 parent 826bdf1 commit 511e021
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/data-pane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class DataPaneBase extends React.PureComponent<DataPanelProps, {}> {
public render() {
const {name} = this.props.data;
const fieldCount = this.props.data.schema.fieldSchemas.length;
const {showDataSourceSelector, relatedViews} = this.props.config;
const {showDataSourceSelector, wildcards} = this.props.config;

const fields = fieldCount > 0 ? (
<div styleName="data-pane-section">
<h3>Fields</h3>
<FieldList/>
</div>) : null;

const wildcardFields = relatedViews !== 'disabled' && fieldCount > 0 && (
const wildcardFields = wildcards !== 'disabled' && fieldCount > 0 && (
<div styleName="data-pane-section">
<h3>Wildcard Fields</h3>
<PresetWildcardFieldList/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/encoding-pane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class EncodingPanelBase extends React.PureComponent<EncodingPanelProps, {}> {

public render() {
const {specPreview, spec} = this.props;
const {relatedViews} = this.props.config;
const {wildcards} = this.props.config;
const {anyEncodings} = specPreview || spec;

const positionShelves = ['x', 'y'].map(this.encodingShelf, this);
const facetShelves = ['row', 'column'].map(this.encodingShelf, this);
const nonPositionShelves = ['size', 'color', 'shape', 'detail', 'text'].map(this.encodingShelf, this);
const wildcardShelvesGroup = relatedViews !== 'disabled' && (
const wildcardShelvesGroup = wildcards !== 'disabled' && (
<div styleName="shelf-group">
<h3>Wildcard Shelves</h3>
{[...anyEncodings.map((_, i) => i),
Expand Down
6 changes: 4 additions & 2 deletions src/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ export interface VoyagerConfig {
serverUrl?: string | null;
hideHeader?: boolean;
hideFooter?: boolean;
relatedViews?: 'disabled' | 'initiallyCollapsed' | 'initiallyShown';
relatedViews?: 'initiallyCollapsed' | 'initiallyShown' | 'disabled';
wildcards?: 'enabled' | 'disabled';
};

export const DEFAULT_VOYAGER_CONFIG: VoyagerConfig = {
showDataSourceSelector: true,
serverUrl: null,
hideHeader: false,
hideFooter: false,
relatedViews: 'initiallyShown'
relatedViews: 'initiallyShown',
wildcards: 'enabled'
};

0 comments on commit 511e021

Please sign in to comment.