feat(ui) - funnels - issue details

This commit is contained in:
Shekar Siri 2022-06-13 17:35:31 +02:00
parent 44d735d0a5
commit bea34112c9
2 changed files with 8 additions and 34 deletions

View file

@ -26,14 +26,14 @@ const getColumns = (metric) => {
interface Props {
metric?: any,
data: any;
onClick?: (filters) => void;
onClick?: (filters: any) => void;
isTemplate?: boolean;
}
function CustomMetriTable(props: Props) {
function CustomMetricTable(props: Props) {
const { metric = {}, data = { values: [] }, onClick = () => null, isTemplate } = props;
const rows = List(data.values);
const onClickHandler = (event, data) => {
const onClickHandler = (event: any, data: any) => {
const filters = Array<any>();
let filter = { ...filtersMap[metric.metricOf] }
filter.value = [data.name]
@ -64,4 +64,4 @@ function CustomMetriTable(props: Props) {
)
}
export default CustomMetriTable;
export default CustomMetricTable;

View file

@ -29,7 +29,6 @@ interface Props {
metric: any;
// loading?: boolean;
data?: any;
showSync?: boolean;
compare?: boolean;
period?: any;
onClickEdit: (e) => void;
@ -37,50 +36,26 @@ interface Props {
setShowAlerts: (showAlerts) => void;
setAlertMetricId: (id) => void;
onAlertClick: (e) => void;
init: (metric) => void;
init: (metric: any) => void;
edit: (setDefault?) => void;
setActiveWidget: (widget) => void;
updateActiveState: (metricId, state) => void;
isTemplate?: boolean;
}
function CustomMetricWidget(props: Props) {
const { metric, showSync, compare, period, isTemplate } = props;
const { metric, period, isTemplate } = props;
const [loading, setLoading] = useState(false)
const [data, setData] = useState<any>([]);
const [seriesMap, setSeriesMap] = useState<any>([]);
// const [seriesMap, setSeriesMap] = useState<any>([]);
const colors = Styles.customMetricColors;
const params = customParams(period.rangeName)
const metricParams = { ...params, metricId: metric.metricId, viewType: 'lineChart', startDate: period.start, endDate: period.end }
// const metricParams = { ...params, metricId: metric.metricId, viewType: 'lineChart', startDate: period.start, endDate: period.end }
const isLineChart = metric.viewType === 'lineChart';
const isProgress = metric.viewType === 'progress';
const isTable = metric.viewType === 'table';
const isPieChart = metric.viewType === 'pieChart';
// useEffect(() => {
// new APIClient()['post'](`/custom_metrics/${metricParams.metricId}/chart`, { ...metricParams, q: metric.name })
// .then(response => response.json())
// .then(({ errors, data }) => {
// if (errors) {
// console.log('err', errors)
// } else {
// const namesMap = data
// .map(i => Object.keys(i))
// .flat()
// .filter(i => i !== 'time' && i !== 'timestamp')
// .reduce((unique: any, item: any) => {
// if (!unique.includes(item)) {
// unique.push(item);
// }
// return unique;
// }, []);
// setSeriesMap(namesMap);
// setData(getChartFormatter(period)(data));
// }
// }).finally(() => setLoading(false));
// }, [period])
const clickHandlerTable = (filters) => {
const activeWidget = {
widget: metric,
@ -147,7 +122,6 @@ function CustomMetricWidget(props: Props) {
<CustomMetricPieChart
metric={metric}
data={ data[0] }
params={ params }
colors={ colors }
onClick={ clickHandlerTable }
/>