cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fun with Dashboarding and Strato

henk_stobbe
DynaMight Leader
DynaMight Leader

Hello,

Nice to know (-; you can reuse lots of strato components in your dashboard, so you can start paddling before you start swimming (-;

henk_stobbe_0-1740057865792.png

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:

henk_stobbe_1-1740058001611.png

 

KR Henk

 

3 REPLIES 3

f_selvanadin
Frequent Guest

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
      }
    }
  }
}

  

Good morning,

henk_stobbe_0-1745481557861.png

 

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;
}

Thank you very much Henk

Featured Posts