Skip to content

Commit

Permalink
Fix for app analytics crash (#1255)
Browse files Browse the repository at this point in the history
* fix for app analytics crash

Signed-off-by: Eric Wei <[email protected]>

* updated snapshots

Signed-off-by: Eric Wei <[email protected]>

* fix saved object issue and remove config options not in release

Signed-off-by: Eric Wei <[email protected]>

* update snapshots

Signed-off-by: Eric Wei <[email protected]>

Signed-off-by: Eric Wei <[email protected]>
  • Loading branch information
mengweieric authored Nov 4, 2022
1 parent 915fcc9 commit 0bee8e7
Show file tree
Hide file tree
Showing 17 changed files with 7 additions and 1,005 deletions.
2 changes: 1 addition & 1 deletion dashboards-observability/common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export interface IExplorerProps {
appBaseQuery?: string;
callback?: any;
callbackInApp?: any;
queryManager: QueryManager;
queryManager?: QueryManager;
}

export interface SavedQuery {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,6 @@ exports[`Utils helper functions renders displayVisualization function 1`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
],
},
Object {
Expand Down Expand Up @@ -864,13 +857,6 @@ exports[`Utils helper functions renders displayVisualization function 1`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
],
},
Object {
Expand Down Expand Up @@ -1333,13 +1319,6 @@ exports[`Utils helper functions renders displayVisualization function 1`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
],
},
Object {
Expand Down Expand Up @@ -2027,13 +2006,6 @@ exports[`Utils helper functions renders displayVisualization function 2`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
Object {
"defaultState": Array [],
"editor": [Function],
Expand Down Expand Up @@ -2557,13 +2529,6 @@ exports[`Utils helper functions renders displayVisualization function 2`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
Object {
"defaultState": Array [],
"editor": [Function],
Expand Down Expand Up @@ -3101,13 +3066,6 @@ exports[`Utils helper functions renders displayVisualization function 2`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
Object {
"defaultState": Array [],
"editor": [Function],
Expand Down Expand Up @@ -3796,13 +3754,6 @@ exports[`Utils helper functions renders displayVisualization function 3`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
],
},
Object {
Expand Down Expand Up @@ -4258,13 +4209,6 @@ exports[`Utils helper functions renders displayVisualization function 3`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
],
},
Object {
Expand Down Expand Up @@ -4727,13 +4671,6 @@ exports[`Utils helper functions renders displayVisualization function 3`] = `
},
],
},
Object {
"editor": [Function],
"id": "color-theme",
"mapTo": "colorTheme",
"name": "Color theme",
"schemas": Array [],
},
],
},
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ import { Sidebar } from './sidebar';
import { TimechartHeader } from './timechart_header';
import { ExplorerVisualizations } from './visualizations';
import { CountDistribution } from './visualizations/count_distribution';
import { QueryManager } from '../../../../common/query_manager';

const TYPE_TAB_MAPPING = {
[SAVED_QUERY]: TAB_EVENT_ID,
Expand Down Expand Up @@ -132,7 +133,7 @@ export const Explorer = ({
setEndTime,
callback,
callbackInApp,
queryManager,
queryManager = new QueryManager(),
}: IExplorerProps) => {
const dispatch = useDispatch();
const requestParams = { tabId };
Expand Down Expand Up @@ -182,8 +183,6 @@ export const Explorer = ({
const [liveTimestamp, setLiveTimestamp] = useState(DATE_PICKER_FORMAT);
const [triggerAvailability, setTriggerAvailability] = useState(false);
const [viewLogPatterns, setViewLogPatterns] = useState(false);
const [isValidDataConfigOptionSelected, setIsValidDataConfigOptionSelected] =
useState<boolean>(false);
const [spanValue, setSpanValue] = useState(false);
const [subType, setSubType] = useState('visualization');
const [metricMeasure, setMetricMeasure] = useState('');
Expand Down Expand Up @@ -309,8 +308,9 @@ export const Explorer = ({
// fill saved user configs
if (objectData?.type) {
let visConfig = {};
if (!isEmpty(objectData.user_configs) && !isEmpty(objectData.user_configs.series)) {
visConfig = JSON.parse(objectData.user_configs);
const customConfig = objectData.user_configs ? JSON.parse(objectData.user_configs) : {};
if (!isEmpty(customConfig.dataConfig) && !isEmpty(customConfig.dataConfig?.series)) {
visConfig = { ...customConfig };
} else {
const statsTokens = queryManager.queryParser().parse(objectData.query).getStats();
visConfig = { dataConfig: { ...getDefaultVisConfig(statsTokens) } };
Expand Down Expand Up @@ -1350,7 +1350,7 @@ export const Explorer = ({
delayTime: number
) => {
setLiveTailName(name);
setLiveTailTabId(curSelectedTabId.current as unknown as string);
setLiveTailTabId((curSelectedTabId.current as unknown) as string);
setIsLiveTailOn(true);
setToast('Live tail On', 'success');
setIsLiveTailPopoverOpen(false);
Expand Down
Loading

0 comments on commit 0bee8e7

Please sign in to comment.