Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: modal implementation for data ingestion table #1244

Merged
merged 43 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bfede7e
feat: part 1
soleksy-splunk Jun 19, 2024
36a829a
chore: add definition json
sgoral-splunk Jun 20, 2024
b0a37f1
feat: spike for dashboard side panel
soleksy-splunk Jun 20, 2024
03941cc
feat(timerange): added timeframe, new search button and refactor code…
rohanm-crest Aug 16, 2024
dc90b5e
refactor: change the background color for modal timeframe and visuali…
rohanm-crest Aug 20, 2024
ea61259
merge with develop
rohanm-crest Aug 20, 2024
bdc9d6c
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Aug 21, 2024
4d1e511
refactor: added styling to the button in the modal footer
rohanm-crest Aug 29, 2024
5d3c742
update screenshots
srv-rr-github-token Aug 29, 2024
93ee9c5
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Sep 3, 2024
74a4801
feat(modal): added styling to search ingested events button
rohanm-crest Sep 3, 2024
5dd173d
Merge branch 'feat/spike-poc-dashboard-side-panel' of https://github.…
rohanm-crest Sep 3, 2024
a69e6b6
chore: rename the variables
rohanm-crest Sep 3, 2024
04392bd
chore: remove unwanted code
rohanm-crest Sep 3, 2024
38b98ec
fix: fix test case for data ingestion tab
rohanm-crest Sep 4, 2024
1ee66ba
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Sep 4, 2024
a624091
fix(testcase): added support for data ingestion modal definition in e…
rohanm-crest Sep 5, 2024
50f5734
refactor(modal): added the color variables in modal
rohanm-crest Sep 9, 2024
1aafc8e
feat(modal): added dynamic implementation for the modal queries and s…
rohanm-crest Sep 16, 2024
b54847f
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Sep 16, 2024
043307b
feat(modal): change the logic for modal values dynamically and added …
rohanm-crest Sep 20, 2024
4db569a
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Sep 20, 2024
07e4252
feat(dropdown): added custom dropdown in data ingestion modal
rohanm-crest Sep 30, 2024
a38bc12
fix: resolve the globalconfig issue
rohanm-crest Oct 1, 2024
3fb32e6
feat: refactor code for dashboardModal
rohanm-crest Oct 4, 2024
b8df285
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 4, 2024
7d78f6d
refactor: change the code for modular input
rohanm-crest Oct 7, 2024
b7b1a27
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 7, 2024
712cc27
fix: added test case for expected input
rohanm-crest Oct 7, 2024
08362cb
Merge branch 'feat/spike-poc-dashboard-side-panel' of https://github.…
rohanm-crest Oct 7, 2024
6dc9a27
refactor code for data ingestion modal
rohanm-crest Oct 8, 2024
cd37b67
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 8, 2024
9da1b3d
update screenshots
srv-rr-github-token Oct 8, 2024
bc6e7db
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 9, 2024
019d14b
refactor: updated the unit test case for dashboard modal
rohanm-crest Oct 10, 2024
3c758f3
Merge branch 'feat/spike-poc-dashboard-side-panel' of https://github.…
rohanm-crest Oct 10, 2024
fb7b683
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 10, 2024
f6f4101
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 15, 2024
02652f5
refactor: update the logic for dashboard for faster loading
rohanm-crest Oct 15, 2024
a0b8fb4
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 15, 2024
e193da8
chore: added console error for test
rohanm-crest Oct 15, 2024
099cf36
Merge branch 'feat/spike-poc-dashboard-side-panel' of https://github.…
rohanm-crest Oct 15, 2024
1d211b7
Merge branch 'develop' into feat/spike-poc-dashboard-side-panel
rohanm-crest Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions splunk_add_on_ucc_framework/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"data_ingestion_tab": "data_ingestion_tab_definition.json",
"errors_tab": "errors_tab_definition.json",
"resources_tab": "resources_tab_definition.json",
"spike_side_panel_definition": "spike_side_panel_definition.json",
"data_ingestion_modal_definition": "data_ingestion_modal_definition.json",
}

data_ingestion = (
Expand Down Expand Up @@ -236,7 +236,7 @@ def generate_dashboard_content(

if (
definition_json_name
== default_definition_json_filename["spike_side_panel_definition"]
== default_definition_json_filename["data_ingestion_modal_definition"]
):
content = utils.get_j2_env().get_template(definition_json_name).render()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"visualizations": {
"data_ingestion_modal_timerange_label_start_viz": {
"type": "splunk.singlevalue",
"options": {
"majorFontSize": 12,
"backgroundColor": "transparent",
"majorColor": "#9fa4af"
},
"dataSources": {
"primary": "data_ingestion_modal_data_time_label_start_ds"
}
},
"data_ingestion_modal_timerange_label_end_viz": {
"type": "splunk.singlevalue",
"options": {
"majorFontSize": 12,
"backgroundColor": "transparent",
"majorColor": "#9fa4af"
},
"dataSources": {
"primary": "data_ingestion_modal_data_time_label_end_ds"
}
},
"data_ingestion_modal_data_volume_viz": {
"type": "splunk.line",
"options": {
"xAxisVisibility": "hide",
"seriesColors": ["#A870EF"],
"yAxisTitleText": "Volume (bytes)",
"xAxisTitleText": "Time"
},
"title": "Data volume",
"dataSources": {
"primary": "data_ingestion_modal_data_volume_ds"
}
},
"data_ingestion_modal_events_count_viz": {
"type": "splunk.line",
"options": {
"xAxisVisibility": "hide",
"xAxisTitleText": "Time",
"seriesColors": ["#A870EF"],
"yAxisTitleText": "Number of events"
},
"title": "Number of events",
"dataSources": {
"primary": "ds_search_1"
}
}
},
"dataSources": {
"data_ingestion_modal_data_time_label_start_ds": {
"type": "ds.search",
"options": {
"query": "| makeresults | addinfo | eval StartDate = strftime(info_min_time, \"%e %b %Y %I:%M%p\") | table StartDate",
"queryParameters": {
"earliest": "$data_ingestion_modal_time.earliest$",
"latest": "$data_ingestion_modal_time.latest$"
}
}
},
"data_ingestion_modal_data_time_label_end_ds": {
"type": "ds.search",
"options": {
"query": "| makeresults | addinfo | eval EndDate = strftime(info_max_time, \"%e %b %Y %I:%M%p\") | table EndDate",
"queryParameters": {
"earliest": "$data_ingestion_modal_time.earliest$",
"latest": "$data_ingestion_modal_time.latest$"
}
}
},
"data_ingestion_modal_data_volume_ds": {
"type": "ds.search",
"options": {
"query": "| inputlookup firewall_example.csv \n| search host=host8 OR host=host18\n| eval host=case(host=\"host8\", \"spend\", host=\"host18\", \"score\", 1=1, host)\n| eval myTime=strftime(timestamp,\"%H:%M\") \n| chart count over myTime by host\n| eval score=score*2\n| eval spend=spend*1500\n| fields myTime spend score\n| rename score as \"Security Score\", spend as \"Security Spend\"",
"queryParameters": {
"earliest": "$data_ingestion_modal_time.earliest$",
"latest": "$data_ingestion_modal_time.latest$"
}
}
},
"ds_search_1": {
"type": "ds.search",
"options": {
"query": "| inputlookup firewall_example.csv \n| search host=host8 OR host=host18\n| eval host=case(host=\"host8\", \"spend\", host=\"host18\", \"score\", 1=1, host)\n| eval myTime=strftime(timestamp,\"%H:%M\") \n| chart count over myTime by host\n| eval score=score*2\n| eval spend=spend*1500\n| fields myTime spend score\n| rename score as \"Security Score\", spend as \"Security Spend\"",
"queryParameters": {
"earliest": "$data_ingestion_modal_time.earliest$",
"latest": "$data_ingestion_modal_time.latest$"
}
},
"name": "Security Score vs Spend"
}
},
"defaults": {},
"inputs": {
"input1": {
"type": "input.dropdown",
"options": {
"items": [
{
"label": "Source type",
"value": "Source type"
},
{
"label": "Source",
"value": "Source"
},
{
"label": "Host",
"value": "Host"
}
],
"defaultValue": "Source type",
"token": "data_ingestion_view_by"
},
"title": "Input"
},
"data_ingestion_modal_input": {
"options": {
"defaultValue": "-24h,now",
"token": "data_ingestion_modal_time"
},
"title": "Time Window",
"type": "input.timerange"
}
},
"layout": {
"type": "grid",
"globalInputs": ["input1", "data_ingestion_modal_input"],
"structure": [
{
"item": "data_ingestion_modal_timerange_label_start_viz",
"position": {
"x": 0,
"y": 50,
"w": 100,
"h": 20
}
},
{
"item": "data_ingestion_modal_timerange_label_end_viz",
"position": {
"x": 100,
"y": 50,
"w": 100,
"h": 20
}
},
{
"item": "data_ingestion_modal_data_volume_viz",
"position": {
"x": 0,
"y": 80,
"w": 300,
"h": 400
}
},
{
"item": "data_ingestion_modal_events_count_viz",
"position": {
"x": 0,
"y": 500,
"w": 300,
"h": 400
}
}
]
}
}
117 changes: 0 additions & 117 deletions splunk_add_on_ucc_framework/templates/spike_side_panel_definition.json

This file was deleted.

44 changes: 21 additions & 23 deletions ui/src/components/table/CustomTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,29 +254,27 @@ const CustomTable: React.FC<CustomTableProps> = ({
<Table.Body>
{data &&
data.length &&
data.map((row) => {
console.log('row,row', row);
return (
<CustomTableRow // nosemgrep: typescript.react.best-practice.react-props-spreading.react-props-spreading
key={row.id}
row={row}
columns={columns}
rowActions={actions}
headerMapping={headerMapping}
{...{
handleEditActionClick,
handleCloneActionClick,
handleDeleteActionClick,
}}
handleToggleActionClick={handleToggleActionClick}
{...(moreInfo
? {
expansionRow: getExpansionRow(columns.length, row, moreInfo),
}
: {})}
/>
);
})}
data.map((row) => (
<CustomTableRow // nosemgrep: typescript.react.best-practice.react-props-spreading.react-props-spreading
key={row.name || row.id}
row={row}
columns={columns}
rowActions={actions}
headerMapping={headerMapping}
readonly={isReadonlyRow(readonlyFieldId, row)}
{...{
handleEditActionClick,
handleCloneActionClick,
handleDeleteActionClick,
}}
handleToggleActionClick={handleToggleActionClick}
{...(moreInfo
? {
expansionRow: getExpansionRow(columns.length, row, moreInfo),
}
: {})}
/>
))}
</Table.Body>
);

Expand Down
2 changes: 0 additions & 2 deletions ui/src/components/table/TableExpansionRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export function getExpansionRow(colSpan, row, moreInfo) {
? inputs.table.customRow
: inputs.services.find((service) => service.name === row.serviceName).table?.customRow;

console.log('row getExpansionRow', { row, moreInfo });

return (
<Table.Row key={`${row.id}-expansion`} style={{ wordBreak: 'break-word' }}>
<TableCellWrapper colSpan={colSpan}>
Expand Down
7 changes: 6 additions & 1 deletion ui/src/pages/Dashboard/Custom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import { DashboardCore } from '@splunk/dashboard-core';
import { DashboardContextProvider } from '@splunk/dashboard-context';
import EnterpriseViewOnlyPreset from '@splunk/dashboard-presets/EnterpriseViewOnlyPreset';
import { getActionButtons } from './utils';

/**
* @param {object} props
Expand All @@ -18,6 +19,10 @@ export const CustomDashboard = ({
preset={EnterpriseViewOnlyPreset}
initialDefinition={dashboardDefinition}
>
<DashboardCore width="100%" height="auto" />
<DashboardCore
width="100%"
height="auto"
actionMenus={getActionButtons('data_ingestion')}
/>
rohanm-crest marked this conversation as resolved.
Show resolved Hide resolved
</DashboardContextProvider>
) : null;
Loading
Loading