-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Vis: Default editor] EUIficate pie chart options tab (#41901)
* EUIficate pie chart options tab * Fix tests * Size titles down to xs * Use FormattedMessage
- Loading branch information
Showing
14 changed files
with
310 additions
and
115 deletions.
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
51 changes: 51 additions & 0 deletions
51
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/basic_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,51 @@ | ||
/* | ||
* 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 from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { VisOptionsProps } from 'ui/vis/editors/default'; | ||
import { SwitchOption } from './switch'; | ||
import { SelectOption } from './select'; | ||
|
||
function BasicOptions({ stateParams, setValue, vis }: VisOptionsProps) { | ||
return ( | ||
<> | ||
<SelectOption | ||
label={i18n.translate('kbnVislibVisTypes.controls.vislibBasicOptions.legendPositionLabel', { | ||
defaultMessage: 'Legend position', | ||
})} | ||
options={vis.type.editorConfig.collections.legendPositions} | ||
paramName="legendPosition" | ||
value={stateParams.legendPosition} | ||
setValue={setValue} | ||
/> | ||
<SwitchOption | ||
label={i18n.translate('kbnVislibVisTypes.controls.vislibBasicOptions.showTooltipLabel', { | ||
defaultMessage: 'Show tooltip', | ||
})} | ||
paramName="addTooltip" | ||
value={stateParams.addTooltip} | ||
setValue={setValue} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
export { BasicOptions }; |
45 changes: 45 additions & 0 deletions
45
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.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,45 @@ | ||
/* | ||
* 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 from 'react'; | ||
import { EuiFormRow, EuiSelect } from '@elastic/eui'; | ||
import { VisOptionsSetValue } from 'ui/vis/editors/default'; | ||
|
||
interface SelectOptionProps { | ||
label: string; | ||
options: Array<{ value: string; text: string }>; | ||
paramName: string; | ||
value: string; | ||
setValue: VisOptionsSetValue; | ||
} | ||
|
||
function SelectOption({ label, options, paramName, value, setValue }: SelectOptionProps) { | ||
return ( | ||
<EuiFormRow label={label} fullWidth={true} compressed> | ||
<EuiSelect | ||
options={options} | ||
value={value} | ||
onChange={ev => setValue(paramName, ev.target.value)} | ||
fullWidth={true} | ||
/> | ||
</EuiFormRow> | ||
); | ||
} | ||
|
||
export { SelectOption }; |
59 changes: 59 additions & 0 deletions
59
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/switch.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,59 @@ | ||
/* | ||
* 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 from 'react'; | ||
|
||
import { EuiFormRow, EuiSwitch, EuiToolTip } from '@elastic/eui'; | ||
import { VisOptionsSetValue } from 'ui/vis/editors/default'; | ||
|
||
interface SwitchOptionProps { | ||
dataTestSubj?: string; | ||
label?: string; | ||
tooltip?: string; | ||
disabled?: boolean; | ||
value?: boolean; | ||
paramName: string; | ||
setValue: VisOptionsSetValue; | ||
} | ||
|
||
function SwitchOption({ | ||
dataTestSubj, | ||
tooltip, | ||
label, | ||
disabled, | ||
paramName, | ||
value = false, | ||
setValue, | ||
}: SwitchOptionProps) { | ||
return ( | ||
<EuiFormRow fullWidth={true} compressed> | ||
<EuiToolTip content={tooltip} delay="long" position="right"> | ||
<EuiSwitch | ||
label={label} | ||
checked={value} | ||
disabled={disabled} | ||
data-test-subj={dataTestSubj} | ||
onChange={ev => setValue(paramName, ev.target.checked)} | ||
/> | ||
</EuiToolTip> | ||
</EuiFormRow> | ||
); | ||
} | ||
|
||
export { SwitchOption }; |
47 changes: 47 additions & 0 deletions
47
src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/truncate_labels.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,47 @@ | ||
/* | ||
* 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, { ChangeEvent } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiFormRow, EuiFieldNumber } from '@elastic/eui'; | ||
import { VisOptionsSetValue } from 'ui/vis/editors/default'; | ||
|
||
interface TruncateLabelsOptionProps { | ||
value: number | null; | ||
setValue: VisOptionsSetValue; | ||
} | ||
|
||
function TruncateLabelsOption({ value, setValue }: TruncateLabelsOptionProps) { | ||
const onChange = (ev: ChangeEvent<HTMLInputElement>) => | ||
setValue('truncate', ev.target.value === '' ? null : parseFloat(ev.target.value)); | ||
|
||
return ( | ||
<EuiFormRow | ||
label={i18n.translate('kbnVislibVisTypes.controls.truncateLabel', { | ||
defaultMessage: 'Truncate', | ||
})} | ||
fullWidth={true} | ||
compressed | ||
> | ||
<EuiFieldNumber value={value === null ? '' : value} onChange={onChange} fullWidth={true} /> | ||
</EuiFormRow> | ||
); | ||
} | ||
|
||
export { TruncateLabelsOption }; |
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
92 changes: 0 additions & 92 deletions
92
src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/pie.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.