splunk / timelapse-vis

Timelapse Visualization in Splunk Web with the new Dashboard Framework
Apache License 2.0
6 stars 7 forks source link

Page doesn't render if timezone not set. #10

Closed jberwick-splunk closed 2 years ago

jberwick-splunk commented 2 years ago

If the user doesn't have the timezone set the rangeslider page doesn't render with follow stack.

Uncaught (in promise) RangeError: Invalid time zone specified: at Date.toLocaleString () at SplunkTimeRangeSliderInput.render (Rangeslider.js?42c4:2854:51) at finishClassComponent (react-dom.development.js?4c72:17160:1) at updateClassComponent (react-dom.development.js?4c72:17110:1) at beginWork (react-dom.development.js?4c72:18620:1) at HTMLUnknownElement.callCallback (react-dom.development.js?4c72:188:1) at Object.invokeGuardedCallbackDev (react-dom.development.js?4c72:237:1) at invokeGuardedCallback (react-dom.development.js?4c72:292:1) at beginWork$1 (react-dom.development.js?4c72:23203:1) at performUnitOfWork (react-dom.development.js?4c72:22154:1)

In Dashboardselector.jsx:

.then((data) => { console.log(data.entry[0]['content']); this.setState({ tz: data.entry[0]['content']['tz'] }); this.setState({ realname: data.entry[0]['content']['realname'] }); })

end of data payload:

search_use_advanced_editor: true type: "Splunk" tz: "" username: "admin"

Maybe check tz is populated or add a default like gmt or use something like const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;

Maybe add a warning to let them know a default was used because they haven't set a timezone.

ryanwoconnor commented 2 years ago

Great ideas! Can you possibly share me the URL that was generated for your dashboard? If you can't share the FQDN, at least just the path and query params. I'm just trying to understand if we were able to find a TZ for the user running this or not. That will help me confirm where I need to apply the fix

ryanwoconnor commented 2 years ago
Screen Shot 2022-05-11 at 7 45 42 AM

Adding this message if no TZ is set.

jberwick-splunk commented 2 years ago

rangeslider?dashboardid=test&rangeStart=&rangeEnd=&timeinterval=15min&theme=&timerangetype=relative&relativetime=1h&tz=

It's this endpoint that is returning tz: "".

/splunkd/services/authentication/current-context