Skip to content

Commit dbe1f18

Browse files
authored
Merge pull request #244 from neo4j-labs/feature/load-dashboard-error-message
Added functionality to load debug reports in recovery-mode
2 parents 2530cdb + a339b2e commit dbe1f18

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/dashboard/DashboardThunks.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,19 @@ export const loadDashboardThunk = (text) => (dispatch: any, getState: any) => {
6666
dispatch(resetDashboardState());
6767
return
6868
}
69-
const dashboard = JSON.parse(text);
69+
var dashboard = JSON.parse(text);
70+
71+
// If we load a debug report, take out the 'dashboard' value and set it to safe values.
72+
if (dashboard["_persist"] && dashboard["application"] && dashboard["dashboard"]) {
73+
dispatch(createNotificationThunk("Loaded a Debug Report", "Recovery-mode active. All report types were set to 'table'."));
74+
dashboard['dashboard']['pages'].map(p => {
75+
p['reports'].map(r => {
76+
r['type'] = 'table';
77+
})
78+
});
79+
dashboard = dashboard['dashboard'];
80+
}
81+
7082

7183
// Attempt upgrade if dashboard version is outdated.
7284
if (dashboard["version"] == "1.1") {

0 commit comments

Comments
 (0)