-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Vis: Default editor] EUIficate Panel Setting tab #42828
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7113847
EUIficate pointe-series and grid
maryia-lapata aa3ec42
Merge branch 'master' into point-series
maryia-lapata 950f4d5
Apply TS
maryia-lapata d120cb3
Show grid on a panel
maryia-lapata 5c02bda
Remove extra space
maryia-lapata 2815308
Merge branch 'master' into point-series
maryia-lapata b5296a1
Add TS
maryia-lapata 7c04623
Use BasicOptions
maryia-lapata 581d200
Adjust func test
maryia-lapata 79cac99
Add dataTestSubj prop to SelectOption
maryia-lapata 6f27b2d
Merge branch 'master' into point-series
maryia-lapata 44f061d
Use id instead of data-sest-subj
maryia-lapata 162b5cd
Disable show x-axis lines when there is histogram agg
maryia-lapata a9ac07b
Merge branch 'master' into point-series
maryia-lapata b4ec159
Add tooltip for disabled 'Show x-axis lines' config
maryia-lapata 74372e4
Remove extra space
maryia-lapata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.html
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.js
This file was deleted.
Oops, something went wrong.
97 changes: 97 additions & 0 deletions
97
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. 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. | ||
*/ | ||
import React, { useMemo, useEffect } from 'react'; | ||
import { EuiPanel, EuiTitle } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
import { VisOptionsProps } from 'ui/vis/editors/default'; | ||
import { SwitchOption } from '../switch'; | ||
import { SelectOption } from '../select'; | ||
import { BasicVislibParams, ValueAxis } from '../../types'; | ||
|
||
function GridOptions({ | ||
stateParams, | ||
setValue, | ||
hasHistogramAgg, | ||
}: VisOptionsProps<BasicVislibParams>) { | ||
const setGrid = <T extends keyof BasicVislibParams['grid']>( | ||
paramName: T, | ||
value: BasicVislibParams['grid'][T] | ||
) => setValue('grid', { ...stateParams.grid, [paramName]: value }); | ||
|
||
const options = useMemo( | ||
() => [ | ||
...stateParams.valueAxes.map(({ id, name }: ValueAxis) => ({ | ||
text: name, | ||
value: id, | ||
})), | ||
{ | ||
text: i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.dontShowLabel', { | ||
defaultMessage: "Don't show", | ||
}), | ||
value: '', | ||
}, | ||
], | ||
[stateParams.valueAxes.map(({ id }: ValueAxis) => id)] | ||
); | ||
|
||
useEffect(() => { | ||
if (hasHistogramAgg) { | ||
setGrid('categoryLines', false); | ||
} | ||
}, [hasHistogramAgg]); | ||
|
||
return ( | ||
<EuiPanel paddingSize="s"> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
<FormattedMessage | ||
id="kbnVislibVisTypes.controls.pointSeries.gridAxis.gridText" | ||
defaultMessage="Grid" | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
|
||
<SwitchOption | ||
disabled={hasHistogramAgg} | ||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.xAxisLinesLabel', { | ||
defaultMessage: 'Show x-axis lines', | ||
})} | ||
paramName="categoryLines" | ||
value={stateParams.grid.categoryLines} | ||
setValue={setGrid} | ||
dataTestSubj="showCategoryLines" | ||
/> | ||
|
||
<SelectOption | ||
id="gridAxis" | ||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.yAxisLinesLabel', { | ||
defaultMessage: 'Y-axis lines', | ||
})} | ||
options={options} | ||
paramName="valueAxis" | ||
value={stateParams.grid.valueAxis || ''} | ||
setValue={setGrid} | ||
/> | ||
</EuiPanel> | ||
); | ||
} | ||
|
||
export { GridOptions }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,3 @@ | |
import './value_axes.js'; | ||
import './category_axis.js'; | ||
import './series.js'; | ||
import './grid.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 0 additions & 82 deletions
82
src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it then also possible to add a tooltip saying such? Like
tip={hasHistogramAgg ? 'X axis lines can't show for histograms' : undefined}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Added.