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 isTimeSeries = metric.metricType === TIMESERIES;
const isTable = metric.metricType === TABLE;
const drillDownFilter = dashboardStore.drillDownFilter;
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 });
}
// 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;
return (
@ -57,7 +46,7 @@ function WidgetPreview(props: Props) {
className="my-3"
primary
icons={true}
onSelect={ chagneViewType }
onSelect={ changeViewType }
value={{ value: metric.viewType }}
list={ [
{ value: 'lineChart', name: 'Chart', icon: 'graph-up-arrow' },
@ -75,7 +64,7 @@ function WidgetPreview(props: Props) {
className="my-3"
primary={true}
icons={true}
onSelect={ chagneViewType }
onSelect={ changeViewType }
value={{ value: metric.viewType }}
list={[
{ 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]);
return (
<div className={cn(className, "bg-white p-3 pb-0 rounded border")}>
<div className="flex items-center justify-between">
<div className="flex items-baseline">
<h2 className="text-xl">{metricStore.clickMapSearch ? 'Clicks' : 'Sessions'}</h2>
<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{' '}
<span className="font-medium color-gray-darkest">{endTime}</span>{' '}
</div>

View file

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