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

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 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
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
7 changes: 7 additions & 0 deletions splunk_add_on_ucc_framework/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"data_ingestion_tab": "data_ingestion_tab_definition.json",
"errors_tab": "errors_tab_definition.json",
"resources_tab": "resources_tab_definition.json",
"data_ingestion_modal_definition": "data_ingestion_modal_definition.json",
}

data_ingestion = (
Expand Down Expand Up @@ -242,6 +243,12 @@ def generate_dashboard_content(
)
)

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

return content


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"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": {
"data_ingestion_modal_dynamic_input": {
"type": "input.dropdown",
"options": {
"items": [],
"token": "data_ingestion_view_by"
},
"title": "Input"
},
"data_ingestion_modal_time_window": {
"options": {
"defaultValue": "-24h,now",
"token": "data_ingestion_modal_time"
},
"title": "Time Window",
"type": "input.timerange"
}
},
"layout": {
"type": "grid",
"globalInputs": [
"data_ingestion_modal_dynamic_input",
"data_ingestion_modal_time_window"
],
"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
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@
}
},
"count": 10
}
},
"eventHandlers": [
{
"type": "table.click.handler"
}
]
}
},
"dataSources": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"appserver/static/js/build/globalConfig.json created\u001b[0m": "INFO",
"appserver/static/openapi.json created\u001b[0m": "INFO",
"metadata/default.meta created\u001b[0m": "INFO",
"appserver/static/js/build/custom/data_ingestion_modal_definition.json created\u001b[0m": "INFO",
"appserver/static/js/build/custom/data_ingestion_tab_definition.json created\u001b[0m": "INFO",
"appserver/static/js/build/custom/errors_tab_definition.json created\u001b[0m": "INFO",
"appserver/static/js/build/custom/overview_definition.json created\u001b[0m": "INFO",
Expand Down
161 changes: 161 additions & 0 deletions tests/unit/expected_results/data_ingestion_modal_definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"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": {
"data_ingestion_modal_dynamic_input": {
"type": "input.dropdown",
"options": {
"items": [],
"token": "data_ingestion_view_by"
},
"title": "Input"
},
"data_ingestion_modal_time_window": {
"options": {
"defaultValue": "-24h,now",
"token": "data_ingestion_modal_time"
},
"title": "Time Window",
"type": "input.timerange"
}
},
"layout": {
"type": "grid",
"globalInputs": [
"data_ingestion_modal_dynamic_input",
"data_ingestion_modal_time_window"
],
"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
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@
}
},
"count": 10
}
},
"eventHandlers": [
{
"type": "table.click.handler"
}
]
}
},
"dataSources": {
Expand Down
Loading
Loading