This commit is contained in:
Hein
2025-09-19 14:06:53 +02:00
commit 46dabed765
55 changed files with 9856 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
import { Divider, Stack, TextInput } from '@mantine/core';
import { useLocalStorage } from '@mantine/hooks';
import type { GridlerColumns } from '../components/Column';
import { APIAdaptorGoLangv2 } from '../components/APIAdaptorGoLangv2';
import { Gridler } from '../Gridler';
export const GridlerGoAPIExampleEventlog = () => {
const [apiUrl, setApiUrl] = useLocalStorage({
defaultValue: 'http://localhost:8080/api',
key: 'apiurl',
});
const [apiKey, setApiKey] = useLocalStorage({ defaultValue: '', key: 'apikey' });
const columns: GridlerColumns = [
{
id: 'rid_atevent',
title: 'RID',
width: 100,
},
{
Cell: (_row, _col, _colindex, value) => {
return {
cursor: 'crosshair',
data: value,
displayData: `- ${value}`,
kind: 'text',
};
},
grow: 1,
id: 'changedate',
title: 'Date',
width: 200,
},
{
id: 'changetime',
title: 'Time',
width: 200,
},
{
id: 'changeuser',
title: 'User',
},
{
id: 'actionx',
title: 'Action',
width: 100,
},
];
return (
<Stack h="80vh">
<h2>Demo Using Go API Adaptor</h2>
<TextInput label="API Url" onChange={(e) => setApiUrl(e.target.value)} value={apiUrl} />
<TextInput label="API Key" onChange={(e) => setApiKey(e.target.value)} value={apiKey} />
<Divider />
<Gridler
columns={columns}
getMenuItems={(id, _state, row, col, defaultItems) => {
return [
...(defaultItems ?? []),
{
id: 'test',
label: `Test ${id}`,
onClick: () => {
console.log('Test clicked', row, col);
},
},
];
}}
uniqueid="gridtest"
>
<APIAdaptorGoLangv2 authtoken={apiKey} url={`${apiUrl}/core/atevent`} />
</Gridler>
</Stack>
);
};