import { Button, Checkbox, Divider, Group, Stack, TagsInput, TextInput } from '@mantine/core'; import { useLocalStorage } from '@mantine/hooks'; import { useRef, useState } from 'react'; import type { GridlerColumns } from '../components/Column'; import { GlidlerAPIAdaptorForGoLangv2 } from '../components/adaptors'; import { type GridlerRef } from '../components/GridlerStore'; import { Gridler } from '../Gridler'; export const GridlerGoAPIExampleEventlog = () => { const [apiUrl, setApiUrl] = useLocalStorage({ defaultValue: 'http://localhost:8080/api', key: 'apiurl', }); const ref = useRef(null); const [apiKey, setApiKey] = useLocalStorage({ defaultValue: '', key: 'apikey' }); const [selectRow, setSelectRow] = useState(''); const [values, setValues] = useState>>([]); const [sections, setSections] = useState | undefined>(undefined); const columns: GridlerColumns = [ { Cell: (row) => { const process = `${ row?.cql2?.length > 0 ? '🔖' : row?.cql1?.length > 0 ? '📕' : row?.status === 1 ? '💡' : row?.status === 2 ? '🔒' : '⚙️' } ${String(row?.id_process ?? '0')}`; return { data: process, displayData: process, status: row?.status, } as any; }, id: 'id_process', title: 'RID', width: 100, }, { id: 'process', title: 'Process', tooltip: (buffer) => { return `Process: ${buffer?.process}\nType: ${buffer?.processtype}\nStatus: ${buffer?.status}`; }, width: 200, }, { id: 'processtype', title: 'Type', }, { disableSort: true, id: 'status', title: 'Status', width: 100, }, ]; return (

Demo Using Go API Adaptor

setApiUrl(e.target.value)} value={apiUrl} /> setApiKey(e.target.value)} value={apiKey} /> { // eslint-disable-next-line @typescript-eslint/no-unused-expressions e.target.checked ? setSections({ bottom:
bottom
, left:
L
, right:
R
, top:
top
, }) : setSections(undefined); }} /> { // console.log('GridlerGoAPIExampleEventlog getMenuItems root', id, row, col, defaultItems); // return [ // ...(defaultItems ?? []), // // { // // id: 'test', // // label: `Test -${id}`, // // onClick: () => { // // console.log('Test clicked', row, col); // // }, // // }, // ]; // }} keyField="id_process" onChange={(v) => { //console.log('GridlerGoAPIExampleEventlog onChange', v); setValues(v); }} ref={ref} scrollToRowKey={selectRow ? parseInt(selectRow, 10) : undefined} sections={{ ...sections, rightElementDisabled: false }} selectFirstRowOnMount={true} selectMode="row" title="Go API Example" uniqueid="gridtest" values={values} > { console.log('Form requested', request, data); }} /> setSelectRow(e.target.value)} placeholder="row" value={selectRow} w="90px" /> setValues(str.map((v) => ({ id_process: String(v) })))} placeholder="Values" value={values.map((v) => String(v?.id_process))} /> ;
); };