Skip to content

Commit

Permalink
[Vis Builder] Update vislib params and misc fixes (#2610)
Browse files Browse the repository at this point in the history
* Updates bar, line, area visbuilder config

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* Misc fixes from functional testing

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* Adds Changelog entry

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
  • Loading branch information
ashwin-pc authored Oct 19, 2022
1 parent e3e7605 commit 33aed0a
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* [Vis Builder] Fixes auto bounds for timeseries bar chart visualization ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
* [Vis Builder] Fixes visualization shift when editing agg ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
* [Vis Builder] Renames "Histogram" to "Bar" in vis type picker ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
* [Vis Builder] Update vislib params and misc fixes ([2610](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2610))
* [MD] Add data source param to low-level search call in Discover ([#2431](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2431))
* [Multi DataSource] Skip data source view in index pattern step when pick default ([#2574](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2574))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import './disabled_visualization.scss';

export function DisabledVisualization({ title }: { title: string }) {
return (
<div className="vbDisabledVisualization">
<div className="vbDisabledVisualization" data-test-subj="disabledVisBuilderVis">
<EuiIcon type="beaker" size="xl" />
<div>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from '../../../data/public';
import { validateSchemaState } from '../application/utils/validate_schema_state';
import { getExpressionLoader, getTypeService } from '../plugin_services';
import { PersistedState } from '../../../visualizations/public';

// Apparently this needs to match the saved object type for the clone and replace panel actions to work
export const WIZARD_EMBEDDABLE = WIZARD_SAVED_OBJECT;
Expand Down Expand Up @@ -65,6 +66,7 @@ export class WizardEmbeddable extends Embeddable<SavedObjectEmbeddableInput, Wiz
private node?: HTMLElement;
private savedWizard?: WizardSavedObjectAttributes;
private serializedState?: { visualization: string; style: string };
private uiState?: PersistedState;

constructor(
timefilter: TimefilterContract,
Expand All @@ -90,6 +92,7 @@ export class WizardEmbeddable extends Embeddable<SavedObjectEmbeddableInput, Wiz
);

this.savedWizard = savedWizard;
this.uiState = new PersistedState();

this.autoRefreshFetchSubscription = timefilter
.getAutoRefreshFetch$()
Expand Down Expand Up @@ -226,6 +229,7 @@ export class WizardEmbeddable extends Embeddable<SavedObjectEmbeddableInput, Wiz
query: this.input.query,
filters: this.input.filters,
},
uiState: this.uiState,
};
if (this.abortController) {
this.abortController.abort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ export class WizardEmbeddableFactoryDefinition
): Promise<WizardEmbeddable | ErrorEmbeddable | DisabledEmbeddable> {
try {
const savedWizard = await getSavedWizardLoader().get(savedObjectId);

const editPath = `${EDIT_PATH}/${savedObjectId}`;

const editUrl = getHttp().basePath.prepend(`/app/${PLUGIN_ID}${editPath}`);

const isLabsEnabled = getUISettings().get<boolean>(VISUALIZE_ENABLE_LABS_SETTING);

if (!isLabsEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ export const createAreaConfig = (): VisualizationTypeOptions<AreaOptionsDefaults
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter', '!filters'],
defaults: { aggTypes: ['date_histogram', 'terms'] },
},
{
group: AggGroupNames.Buckets,
name: 'group',
title: i18n.translate('visTypeVislib.area.groupTitle', {
defaultMessage: 'Split series',
}),
min: 0,
max: 3,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
defaults: { aggTypes: ['terms'] },
},
{
group: AggGroupNames.Buckets,
name: 'split',
title: i18n.translate('visTypeVislib.area.splitTitle', {
defaultMessage: 'Split chart',
}),
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
defaults: { aggTypes: ['terms'] },
},
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ export const createHistogramConfig = (): VisualizationTypeOptions<HistogramOptio
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter', '!filters'],
defaults: { aggTypes: ['date_histogram', 'terms'] },
},
{
group: AggGroupNames.Buckets,
name: 'group',
title: i18n.translate('visTypeVislib.histogram.groupTitle', {
defaultMessage: 'Split series',
}),
min: 0,
max: 3,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
defaults: { aggTypes: ['terms'] },
},
{
group: AggGroupNames.Buckets,
name: 'split',
title: i18n.translate('visTypeVislib.histogram.splitTitle', {
defaultMessage: 'Split chart',
}),
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
defaults: { aggTypes: ['terms'] },
},
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ export const createLineConfig = (): VisualizationTypeOptions<LineOptionsDefaults
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter', '!filters'],
defaults: { aggTypes: ['date_histogram', 'terms'] },
},
{
group: AggGroupNames.Buckets,
name: 'group',
title: i18n.translate('visTypeVislib.line.groupTitle', {
defaultMessage: 'Split series',
}),
min: 0,
max: 3,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
defaults: { aggTypes: ['terms'] },
},
{
group: AggGroupNames.Buckets,
name: 'split',
title: i18n.translate('visTypeVislib.line.splitTitle', {
defaultMessage: 'Split chart',
}),
min: 0,
max: 1,
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
defaults: { aggTypes: ['terms'] },
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ export const VisualizeListing = () => {
.then(({ total, hits }: { total: number; hits: object[] }) => ({
total,
hits: hits.filter(
(result: any) => isLabsEnabled || result.type?.stage !== 'experimental'
(result: any) =>
isLabsEnabled ||
(result.type?.stage !== 'experimental' && result.stage !== 'experimental')
),
}));
},
Expand Down

0 comments on commit 33aed0a

Please sign in to comment.