);
- let dragHandle;
- if (!props.disableDelete) {
- dragHandle = (
-
- )}
- >
-
-
-
- );
- }
-
return (
-
- { dragHandle }
+
-
{ body }
);
@@ -217,19 +187,15 @@ GaugeSeriesUi.propTypes = {
onChange: PropTypes.func,
onClone: PropTypes.func,
onDelete: PropTypes.func,
- onMouseDown: PropTypes.func,
- onSortableItemMount: PropTypes.func,
- onSortableItemReadyToMove: PropTypes.func,
- onTouchStart: PropTypes.func,
model: PropTypes.object,
panel: PropTypes.object,
selectedTab: PropTypes.string,
- sortData: PropTypes.string,
style: PropTypes.object,
switchTab: PropTypes.func,
toggleVisible: PropTypes.func,
visible: PropTypes.bool,
uiRestrictions: PropTypes.object,
+ dragHandleProps: PropTypes.object,
};
const GaugeSeries = injectI18n(GaugeSeriesUi);
diff --git a/src/legacy/core_plugins/metrics/public/components/vis_types/markdown/series.js b/src/legacy/core_plugins/metrics/public/components/vis_types/markdown/series.js
index 1f103ac6f0ae..81cde2e75241 100644
--- a/src/legacy/core_plugins/metrics/public/components/vis_types/markdown/series.js
+++ b/src/legacy/core_plugins/metrics/public/components/vis_types/markdown/series.js
@@ -21,12 +21,12 @@ import PropTypes from 'prop-types';
import React from 'react';
import AddDeleteButtons from '../../add_delete_buttons';
import { SeriesConfig } from '../../series_config';
-import Sortable from 'react-anything-sortable';
import Split from '../../split';
-import createAggRowRender from '../../lib/create_agg_row_render';
import createTextHandler from '../../lib/create_text_handler';
import { EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { Aggs } from '../../aggs/aggs';
+import { SeriesDragHandler } from '../../series_drag_handler';
function MarkdownSeriesUi(props) {
const {
@@ -40,6 +40,7 @@ function MarkdownSeriesUi(props) {
selectedTab,
visible,
intl,
+ name,
uiRestrictions
} = props;
@@ -47,7 +48,6 @@ function MarkdownSeriesUi(props) {
const model = { ...defaults, ...props.model };
const handleChange = createTextHandler(onChange);
- const aggs = model.metrics.map(createAggRowRender(props));
let caretIcon = 'arrowDown';
if (!visible) caretIcon = 'arrowRight';
@@ -56,21 +56,17 @@ function MarkdownSeriesUi(props) {
if (visible) {
let seriesBody;
if (selectedTab === 'metrics') {
- const handleSort = (data) => {
- const metrics = data.map(id => model.metrics.find(m => m.id === id));
- props.onChange({ metrics });
- };
seriesBody = (
-
- { aggs }
-
+
@@ -155,6 +149,8 @@ function MarkdownSeriesUi(props) {
/>
+
+
-
{ body }
);
-
}
MarkdownSeriesUi.propTypes = {
@@ -187,19 +181,15 @@ MarkdownSeriesUi.propTypes = {
onChange: PropTypes.func,
onClone: PropTypes.func,
onDelete: PropTypes.func,
- onMouseDown: PropTypes.func,
- onSortableItemMount: PropTypes.func,
- onSortableItemReadyToMove: PropTypes.func,
- onTouchStart: PropTypes.func,
model: PropTypes.object,
panel: PropTypes.object,
selectedTab: PropTypes.string,
- sortData: PropTypes.string,
style: PropTypes.object,
switchTab: PropTypes.func,
toggleVisible: PropTypes.func,
visible: PropTypes.bool,
uiRestrictions: PropTypes.object,
+ dragHandleProps: PropTypes.object,
};
const MarkdownSeries = injectI18n(MarkdownSeriesUi);
diff --git a/src/legacy/core_plugins/metrics/public/components/vis_types/metric/series.js b/src/legacy/core_plugins/metrics/public/components/vis_types/metric/series.js
index 0df8136a81c3..e05ff8cf6a54 100644
--- a/src/legacy/core_plugins/metrics/public/components/vis_types/metric/series.js
+++ b/src/legacy/core_plugins/metrics/public/components/vis_types/metric/series.js
@@ -22,18 +22,18 @@ import React from 'react';
import ColorPicker from '../../color_picker';
import AddDeleteButtons from '../../add_delete_buttons';
import { SeriesConfig } from '../../series_config';
-import Sortable from 'react-anything-sortable';
import Split from '../../split';
-import { EuiToolTip, EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
-import createAggRowRender from '../../lib/create_agg_row_render';
+import { SeriesDragHandler } from '../../series_drag_handler';
+import { EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
import createTextHandler from '../../lib/create_text_handler';
-import { createUpDownHandler } from '../../lib/sort_keyhandler';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { Aggs } from '../../aggs/aggs';
function MetricSeriesUi(props) {
const {
panel,
fields,
+ name,
onAdd,
onChange,
onDelete,
@@ -49,7 +49,6 @@ function MetricSeriesUi(props) {
const model = { ...defaults, ...props.model };
const handleChange = createTextHandler(onChange);
- const aggs = model.metrics.map(createAggRowRender(props));
let caretIcon = 'arrowDown';
if (!visible) caretIcon = 'arrowRight';
@@ -58,21 +57,17 @@ function MetricSeriesUi(props) {
if (visible) {
let seriesBody;
if (selectedTab === 'metrics') {
- const handleSort = (data) => {
- const metrics = data.map(id => model.metrics.find(m => m.id === id));
- props.onChange({ metrics });
- };
seriesBody = (
-
- { aggs }
-
+
- )}
- >
-
-
-
- );
- }
-
return (
@@ -185,7 +157,7 @@ function MetricSeriesUi(props) {
/>
- { dragHandle }
+
-
{ body }
);
@@ -221,20 +192,16 @@ MetricSeriesUi.propTypes = {
onChange: PropTypes.func,
onClone: PropTypes.func,
onDelete: PropTypes.func,
- onMouseDown: PropTypes.func,
- onSortableItemMount: PropTypes.func,
- onSortableItemReadyToMove: PropTypes.func,
- onTouchStart: PropTypes.func,
model: PropTypes.object,
panel: PropTypes.object,
selectedTab: PropTypes.string,
- sortData: PropTypes.string,
style: PropTypes.object,
switchTab: PropTypes.func,
toggleVisible: PropTypes.func,
visible: PropTypes.bool,
togglePanelActivation: PropTypes.func,
uiRestrictions: PropTypes.object,
+ dragHandleProps: PropTypes.object,
};
const MetricSeries = injectI18n(MetricSeriesUi);
diff --git a/src/legacy/core_plugins/metrics/public/components/vis_types/table/is_sortable.js b/src/legacy/core_plugins/metrics/public/components/vis_types/table/is_sortable.js
index 3f7e20a8df35..e308d3ce93af 100644
--- a/src/legacy/core_plugins/metrics/public/components/vis_types/table/is_sortable.js
+++ b/src/legacy/core_plugins/metrics/public/components/vis_types/table/is_sortable.js
@@ -18,6 +18,7 @@
*/
import basicAggs from '../../../../common/basic_aggs';
+
export function isSortable(metric) {
return basicAggs.includes(metric.type);
}
diff --git a/src/legacy/core_plugins/metrics/public/components/vis_types/table/series.js b/src/legacy/core_plugins/metrics/public/components/vis_types/table/series.js
index d253be8608eb..e3f7d438d122 100644
--- a/src/legacy/core_plugins/metrics/public/components/vis_types/table/series.js
+++ b/src/legacy/core_plugins/metrics/public/components/vis_types/table/series.js
@@ -21,28 +21,30 @@ import React from 'react';
import PropTypes from 'prop-types';
import AddDeleteButtons from '../../add_delete_buttons';
import SeriesConfig from './config';
-import Sortable from 'react-anything-sortable';
-import { EuiToolTip, EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
+import { SeriesDragHandler } from '../../series_drag_handler';
+import { EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
import createTextHandler from '../../lib/create_text_handler';
-import createAggRowRender from '../../lib/create_agg_row_render';
-import { createUpDownHandler } from '../../lib/sort_keyhandler';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
+import { Aggs } from '../../aggs/aggs';
function TableSeries(props) {
const {
model,
onAdd,
+ name,
+ fields,
+ panel,
onChange,
onDelete,
disableDelete,
disableAdd,
selectedTab,
visible,
- intl
+ intl,
+ uiRestrictions,
} = props;
const handleChange = createTextHandler(onChange);
- const aggs = model.metrics.map(createAggRowRender(props));
let caretIcon = 'arrowDown';
if (!visible) caretIcon = 'arrowRight';
@@ -51,21 +53,17 @@ function TableSeries(props) {
if (visible) {
let seriesBody;
if (selectedTab === 'metrics') {
- const handleSort = (data) => {
- const metrics = data.map(id => model.metrics.find(m => m.id === id));
- props.onChange({ metrics });
- };
seriesBody = (
);
} else {
@@ -106,33 +104,10 @@ function TableSeries(props) {
);
}
- let dragHandle;
- if (!props.disableDelete) {
- dragHandle = (
-
- )}
- >
-
-
-
- );
- }
-
return (
@@ -155,7 +130,7 @@ function TableSeries(props) {
/>
- { dragHandle }
+
{
- const metrics = data.map(id => model.metrics.find(m => m.id === id));
- props.onChange({ metrics });
- };
seriesBody = (
-
- { aggs }
-
+
);
- let dragHandle;
- if (!props.disableDelete) {
- dragHandle = (
-
- )}
- >
-
-
-
- );
- }
-
return (
@@ -188,7 +158,7 @@ const TimeseriesSeries = injectI18n(function (props) {
/>
- { dragHandle }
+
-
{ body }
);
@@ -224,21 +193,16 @@ TimeseriesSeries.propTypes = {
onChange: PropTypes.func,
onClone: PropTypes.func,
onDelete: PropTypes.func,
- onMouseDown: PropTypes.func,
- onShouldSortItem: PropTypes.func.isRequired,
- onSortableItemMount: PropTypes.func,
- onSortableItemReadyToMove: PropTypes.func,
- onTouchStart: PropTypes.func,
model: PropTypes.object,
panel: PropTypes.object,
selectedTab: PropTypes.string,
- sortData: PropTypes.string,
style: PropTypes.object,
switchTab: PropTypes.func,
toggleVisible: PropTypes.func,
visible: PropTypes.bool,
togglePanelActivation: PropTypes.func,
uiRestrictions: PropTypes.object,
+ dragHandleProps: PropTypes.object,
};
export default injectI18n(TimeseriesSeries);
diff --git a/src/legacy/core_plugins/metrics/public/components/vis_types/top_n/series.js b/src/legacy/core_plugins/metrics/public/components/vis_types/top_n/series.js
index 8d095a024b0d..c73f54284d2e 100644
--- a/src/legacy/core_plugins/metrics/public/components/vis_types/top_n/series.js
+++ b/src/legacy/core_plugins/metrics/public/components/vis_types/top_n/series.js
@@ -22,18 +22,18 @@ import React from 'react';
import ColorPicker from '../../color_picker';
import AddDeleteButtons from '../../add_delete_buttons';
import { SeriesConfig } from '../../series_config';
-import Sortable from 'react-anything-sortable';
import Split from '../../split';
-import { EuiToolTip, EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
+import { SeriesDragHandler } from '../../series_drag_handler';
+import { EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic/eui';
import createTextHandler from '../../lib/create_text_handler';
-import createAggRowRender from '../../lib/create_agg_row_render';
-import { createUpDownHandler } from '../../lib/sort_keyhandler';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
+import { Aggs } from '../../aggs/aggs';
const TopNSeries = injectI18n(function (props) {
const {
panel,
model,
+ name,
fields,
onAdd,
onChange,
@@ -47,7 +47,6 @@ const TopNSeries = injectI18n(function (props) {
} = props;
const handleChange = createTextHandler(onChange);
- const aggs = model.metrics.map(createAggRowRender(props));
let caretIcon = 'arrowDown';
if (!visible) caretIcon = 'arrowRight';
@@ -56,21 +55,17 @@ const TopNSeries = injectI18n(function (props) {
if (visible) {
let seriesBody;
if (selectedTab === 'metrics') {
- const handleSort = data => {
- const metrics = data.map(id => model.metrics.find(m => m.id === id));
- props.onChange({ metrics });
- };
seriesBody = (
-
- { aggs }
-
+
);
- let dragHandle;
- if (!props.disableDelete) {
- dragHandle = (
-
- )}
- >
-
-
-
- );
- }
-
return (
@@ -180,7 +152,7 @@ const TopNSeries = injectI18n(function (props) {
/>
- { dragHandle }
+