20 Feb 2025 01:27 PM - edited 20 Feb 2025 01:36 PM
Hello,
Nice to know (-; you can reuse lots of strato components in your dashboard, so you can start paddling before you start swimming (-;
In your Dashboard code:
import type { TableColumn } from '@dynatrace/strato-components-preview/tables';
import { DataTable } from '@dynatrace/strato-components-preview/tables';
export default async function () {
const sampleColumns: TableColumn[] = [
{
header: 'Host',
accessor: 'host',
ratioWidth: 1,
},
{
header: 'Traffic',
accessor: 'traffic',
ratioWidth: 1,
( . . .)
resulting dashboard:
KR Henk
23 Apr 2025 06:05 PM
Hello Henk,
I've just tried to create code tile that is running a strato component code.
But I get this error.
Do you know can I fix it?
Thank you
Best regards
Freddy
{
  "error": {
    "code": 541,
    "message": "Execution crashed.",
    "details": {
      "logs": null,
      "type": "BAD_REQUEST",
      "message": "Parse error: Expected '>', got 'columns' at file:///script.ts:76:21\n\n    return <DataTable columns={columns} data={data} />;\n                      ~~~~~~~",
      "details": {
        "sourceLine": "  return <DataTable columns={columns} data={data} />;",
        "lineNumber": 76,
        "startColumn": 21
      }
    }
  }
}
24 Apr 2025 09:01 AM
Good morning,
The error is basically, you can not use JSX in a dashboard. I have completed the example so this should make it clear.
Have fun!
/*
* This function will run in the DYNATRACE JavaScript runtime.
* For information visit https://dt-url.net/functions-help
*/
import type { TableColumn } from '@dynatrace/strato-components-preview/tables';
import { DataTable } from '@dynatrace/strato-components-preview/tables';
export default async function () {
const sampleColumns: TableColumn[] = [
{
header: 'Host',
accessor: 'host',
ratioWidth: 1,
},
{
header: 'Traffic',
accessor: 'traffic',
ratioWidth: 1,
}]
return sampleColumns;
}
24 Apr 2025 01:02 PM
Thank you very much Henk