change(ui): fix labels, small refactoring

This commit is contained in:
sylenien 2022-12-26 15:14:21 +01:00 committed by Shekar Siri
parent 6771c227be
commit 0beaeec5fe
3 changed files with 5 additions and 18 deletions

View file

@ -22,23 +22,12 @@ function WidgetPreview(props: Props) {
const metric: any = metricStore.instance; const metric: any = metricStore.instance;
const isTimeSeries = metric.metricType === TIMESERIES; const isTimeSeries = metric.metricType === TIMESERIES;
const isTable = metric.metricType === TABLE; const isTable = metric.metricType === TABLE;
const drillDownFilter = dashboardStore.drillDownFilter;
const disableVisualization = metric.metricOf === FilterKey.SESSIONS || metric.metricOf === FilterKey.ERRORS; const disableVisualization = metric.metricOf === FilterKey.SESSIONS || metric.metricOf === FilterKey.ERRORS;
// const period = dashboardStore.drillDownPeriod;
const chagneViewType = (e, { name, value }: any) => { const changeViewType = (_, { name, value }: any) => {
metric.update({ [ name ]: value }); metric.update({ [ name ]: value });
} }
// const onChangePeriod = (period: any) => {
// dashboardStore.setDrillDownPeriod(period);
// const periodTimestamps = period.toTimestamps();
// drillDownFilter.merge({
// startTimestamp: periodTimestamps.startTimestamp,
// endTimestamp: periodTimestamps.endTimestamp,
// })
// }
const canAddToDashboard = metric.exists() && dashboards.length > 0; const canAddToDashboard = metric.exists() && dashboards.length > 0;
return ( return (
@ -57,7 +46,7 @@ function WidgetPreview(props: Props) {
className="my-3" className="my-3"
primary primary
icons={true} icons={true}
onSelect={ chagneViewType } onSelect={ changeViewType }
value={{ value: metric.viewType }} value={{ value: metric.viewType }}
list={ [ list={ [
{ value: 'lineChart', name: 'Chart', icon: 'graph-up-arrow' }, { value: 'lineChart', name: 'Chart', icon: 'graph-up-arrow' },
@ -75,7 +64,7 @@ function WidgetPreview(props: Props) {
className="my-3" className="my-3"
primary={true} primary={true}
icons={true} icons={true}
onSelect={ chagneViewType } onSelect={ changeViewType }
value={{ value: metric.viewType }} value={{ value: metric.viewType }}
list={[ list={[
{ value: 'table', name: 'Table', icon: 'table' }, { value: 'table', name: 'Table', icon: 'table' },

View file

@ -90,15 +90,13 @@ function WidgetSessions(props: Props) {
} }
}, [filter.startTimestamp, filter.endTimestamp, filter.filters, depsString, metricStore.sessionsPage, metricStore.clickMapSearch]); }, [filter.startTimestamp, filter.endTimestamp, filter.filters, depsString, metricStore.sessionsPage, metricStore.clickMapSearch]);
return ( return (
<div className={cn(className, "bg-white p-3 pb-0 rounded border")}> <div className={cn(className, "bg-white p-3 pb-0 rounded border")}>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-baseline"> <div className="flex items-baseline">
<h2 className="text-xl">{metricStore.clickMapSearch ? 'Clicks' : 'Sessions'}</h2> <h2 className="text-xl">{metricStore.clickMapSearch ? 'Clicks' : 'Sessions'}</h2>
<div className="ml-2 color-gray-medium"> <div className="ml-2 color-gray-medium">
{metricStore.clickMapLabel ? `"${metricStore.clickMapLabel}" ` : null} {metricStore.clickMapLabel ? `on "${metricStore.clickMapLabel}" ` : null}
between <span className="font-medium color-gray-darkest">{startTime}</span> and{' '} between <span className="font-medium color-gray-darkest">{startTime}</span> and{' '}
<span className="font-medium color-gray-darkest">{endTime}</span>{' '} <span className="font-medium color-gray-darkest">{endTime}</span>{' '}
</div> </div>

View file

@ -132,7 +132,7 @@ export function fetchTenants() {
export const fetchUserInfo = () => ({ export const fetchUserInfo = () => ({
types: FETCH_ACCOUNT.toArray(), types: FETCH_ACCOUNT.toArray(),
call: client => client.get('/account'), call: client => client.get('/account'),
}); });
export function logout() { export function logout() {
return { return {