Commit 1f4cff25 authored by Pierre Marchand's avatar Pierre Marchand

[client/timeserie] CSV link

parent 4165b160
......@@ -30,7 +30,8 @@ import tr from '../../locale';
import buttonFactory, { ButtonComponent } from '../button';
import { divTooltipBottom } from '../tooltip';
import { renderFilter } from './filters';
import { some } from 'fp-ts/lib/Option';
import { some } from 'fp-ts/lib/Option';
import { index } from 'fp-ts/lib/Array';
const logger = debug('sdi:table/base');
......@@ -75,6 +76,11 @@ export const baseTable = (queries: TableQuerySet, events: TableEventSet) => {
// const randColor =
// () => Color(Math.round(Math.random() * 0xffffff)).string();
const getWidth = (
widths: Width[],
idx: number,
) => index(idx, widths).getOrElse([12, 'em']);
const renderCell = (types: TableDataType[], widths: Width[], onSelect: (a: number) => void) => (
data: TableDataCell,
idx: number
......@@ -85,7 +91,7 @@ export const baseTable = (queries: TableQuerySet, events: TableEventSet) => {
title: data,
className: `table-cell data-type-${getType(types, idx)}`,
style: {
width: cwString(widths[idx])
width: cwString(getWidth(widths, idx))
// backgroundColor: randColor(),
},
onClick: () => onSelect(idx)
......
import { DIV } from 'sdi/components/elements';
import { DIV, A } from 'sdi/components/elements';
import map from '../map';
import info from '../info';
import table from '../table';
......@@ -7,19 +7,24 @@ import mapLegend from '../legend/map';
import legend from '../legend/table';
import {
renderButtonCSV,
// renderButtonCSV,
renderButtonParams,
renderBackHomeBtn,
renderButtonPlotSmall,
} from '../button';
import { navigateConfig, getConfig } from 'timeserie/src/events/route';
import { navigateConfig, getConfig, encodeConfig } from 'timeserie/src/events/route';
import renderDatesInputBox from '../date-picker';
import { getLevel } from 'timeserie/src/queries/timeserie';
import { getApiUrl } from 'sdi/app';
const renderActions = () =>
DIV(
{ className: 'action' },
renderButtonCSV(() => '')
// renderButtonCSV(() => '')
getConfig().map(config => A({
target: '_blank',
href: getApiUrl(`geodata/water/csv/${encodeConfig(config)}`),
}, 'CSV')),
);
const renderContentFooter = () =>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment