Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/color-theme-options: Resolved color theme issue #960 #971

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9634,7 +9634,7 @@ exports[`Config panel component Renders config panel with visualization data 1`]
"editor": [Function],
"id": "data-panel",
"mapTo": "dataConfig",
"name": "Data",
"name": "Style",
"sections": Array [
Object {
"editor": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '@elastic/eui';
import { isEmpty } from 'lodash';
import { ADD_BUTTON_TEXT } from '../../../../../../../../common/constants/explorer';
import { NUMERICAL_FIELDS } from '../../../../../../../../common/constants/shared';
import { visChartTypes } from '../../../../../../../../common/constants/shared';

export const ConfigColorTheme = ({
visualizations,
Expand All @@ -27,16 +27,23 @@ export const ConfigColorTheme = ({
handleConfigChange,
sectionName = 'Color theme',
}: any) => {
const { data } = visualizations;
const { data, vis } = visualizations;
const { defaultAxes = {} } = data;
const { data: vizData = {}, metadata: { fields = [] } = {} } = data?.rawVizData;
const { dataConfig = {} } = data?.userConfigs;
const addButtonText = ADD_BUTTON_TEXT;
const getColorThemeRow = () => ({
ctid: htmlIdGenerator('ct')(),
name: '',
color: '#FC0505',
});

const options = fields.map((item) => ({
const options = (dataConfig?.valueOptions?.metrics && dataConfig.valueOptions.metrics.length !== 0
? dataConfig.valueOptions.metrics
: vis.name === visChartTypes.Histogram
? defaultAxes.yaxis ?? []
: fields
).map((item) => ({
...item,
label: item.name,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,66 @@ exports[`Logs View component Renders logs view component 1`] = `
"editor": [Function],
"id": "data-panel",
"mapTo": "dataConfig",
"name": "Data",
"name": "Style",
"sections": Array [
Object {
"editor": [Function],
"id": "tooltip_options",
"mapTo": "tooltipOptions",
"name": "Tooltip options",
"schemas": Array [
Object {
"component": null,
"mapTo": "tooltipMode",
"name": "Tooltip mode",
"props": Object {
"defaultSelections": Array [
Object {
"id": "show",
"name": "Show",
},
],
"options": Array [
Object {
"id": "show",
"name": "Show",
},
Object {
"id": "hidden",
"name": "Hidden",
},
],
},
},
Object {
"component": null,
"mapTo": "tooltipText",
"name": "Tooltip text",
"props": Object {
"defaultSelections": Array [
Object {
"id": "all",
"name": "All",
},
],
"options": Array [
Object {
"id": "all",
"name": "All",
},
Object {
"id": "x",
"name": "Dimension",
},
Object {
"id": "y",
"name": "Metrics",
},
],
},
},
],
},
Object {
"editor": [Function],
"id": "legend",
Expand Down