Skip to content

Commit

Permalink
feat(dashboard): add globalconfig configuration for custom dashboard …
Browse files Browse the repository at this point in the history
…tab name (#1239)
  • Loading branch information
sgoral-splunk authored Jun 18, 2024
1 parent c7771ab commit fce1df4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
24 changes: 23 additions & 1 deletion docs/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,32 @@ Next, you have to add the **custom** panel to your dashboard page in globalConfi
}
```

By default, the custom dashboard will be added as an additional tab under the overview section.
By default, the custom dashboard will be added as an additional tab under the overview section called `Custom`.

![img.png](images/custom_dashboard.png)

If you would like to change the tab name from **Custom** to any other value, you can do it in the `globalConfig.json`.
Global config, from UCC version **v5.47.0**, has an additional `settings` parameter for the dashboard section. To change the name of a custom tab, add the `custom_tab_name` attribute in the `settings`.

```json
{
...
"dashboard": {
"panels": [
{
"name": "custom"
}
],
"settings": {
"custom_tab_name": "My custom tab name"
}
},
...
}
```

![img.png](images/dashboard_custom_tab_name.png)

It is possible to enable only a custom panel. To do this, remove the "default" element from globalConfig.json.

```json
Expand Down
Binary file added docs/images/dashboard_custom_tab_name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions splunk_add_on_ucc_framework/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,16 @@
"type": "string",
"description": "Link to external TA documentation used for redirection on error dashboard page",
"format": "uri"
},
"settings": {
"type": "object",
"description": "Additional settings for monitoring dashboard.",
"properties": {
"custom_tab_name": {
"type": "string"
}
},
"additionalProperties": false
}
},
"required": ["panels"],
Expand Down
11 changes: 10 additions & 1 deletion ui/src/pages/Dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ResourceDashboard } from './Resource';
import { CustomDashboard } from './Custom';
import './dashboardStyle.css';
import { getBuildDirPath } from '../../util/script';
import { getUnifiedConfigs } from '../../util/util';

/**
*
Expand Down Expand Up @@ -52,6 +53,8 @@ function DashboardPage() {
};
}, []);

const globalConfig = getUnifiedConfigs();

return (
<ErrorBoundary>
<div>
Expand Down Expand Up @@ -84,7 +87,13 @@ function DashboardPage() {
</TabLayout.Panel>
)}
{customDef && (
<TabLayout.Panel label="Custom" panelId="customTabPanel">
<TabLayout.Panel
label={
globalConfig.pages.dashboard?.settings?.custom_tab_name ||
'Custom'
}
panelId="customTabPanel"
>
<CustomDashboard dashboardDefinition={customDef} />
</TabLayout.Panel>
)}
Expand Down
1 change: 1 addition & 0 deletions ui/src/types/globalConfig/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const pages = z.object({
.object({
panels: z.array(z.object({ name: z.string() })).min(1),
troubleshooting_url: z.string().optional(),
settings: z.object({ custom_tab_name: z.string().optional() }).optional(),
})
.optional(),
});

0 comments on commit fce1df4

Please sign in to comment.