fix drilldown in tsvb (#78005) (#78393)

This commit is contained in:
Joe Reuter 2020-09-24 13:35:19 +02:00 committed by GitHub
parent e581a756ed
commit f73a549647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -20,6 +20,7 @@
import _, { isArray, last, get } from 'lodash';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { RedirectAppLinks } from '../../../../../../kibana_react/public';
import { createTickFormatter } from '../../lib/tick_formatter';
import { calculateLabel } from '../../../../../../../plugins/vis_type_timeseries/common/calculate_label';
import { isSortable } from './is_sortable';
@ -27,7 +28,7 @@ import { EuiToolTip, EuiIcon } from '@elastic/eui';
import { replaceVars } from '../../lib/replace_vars';
import { fieldFormats } from '../../../../../../../plugins/data/public';
import { FormattedMessage } from '@kbn/i18n/react';
import { getFieldFormats } from '../../../../services';
import { getFieldFormats, getCoreStart } from '../../../../services';
import { METRIC_TYPES } from '../../../../../../../plugins/vis_type_timeseries/common/metric_types';
@ -231,12 +232,16 @@ export class TableVis extends Component {
);
}
return (
<div className="tvbVis" data-test-subj="tableView">
<RedirectAppLinks
application={getCoreStart().application}
className="tvbVis"
data-test-subj="tableView"
>
<table className="table">
<thead>{header}</thead>
<tbody>{rows}</tbody>
</table>
</div>
</RedirectAppLinks>
);
}
}

View file

@ -17,6 +17,7 @@
* under the License.
*/
import { getCoreStart } from '../../../../services';
import { createTickFormatter } from '../../lib/tick_formatter';
import { TopN } from '../../../visualizations/views/top_n';
import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';
@ -89,7 +90,8 @@ export function TopNVisualization(props) {
if (model.drilldown_url) {
params.onClick = (item) => {
window.location = replaceVars(model.drilldown_url, {}, { key: item.label });
const url = replaceVars(model.drilldown_url, {}, { key: item.label });
getCoreStart().application.navigateToUrl(url);
};
}