diff --git a/webapp/src/domain/reports/TableReportConfigPage.tsx b/webapp/src/domain/reports/TableReportConfigPage.tsx index ae0edcccc..6e0b58b0b 100644 --- a/webapp/src/domain/reports/TableReportConfigPage.tsx +++ b/webapp/src/domain/reports/TableReportConfigPage.tsx @@ -272,7 +272,7 @@ export default function TableReportConfigPage() { owner: "", access: 0, notificationsEnabled: false, - views: [], + //views: [], }, }) }} diff --git a/webapp/src/domain/tests/General.tsx b/webapp/src/domain/tests/General.tsx index 45e7dcf57..69bef0f1a 100644 --- a/webapp/src/domain/tests/General.tsx +++ b/webapp/src/domain/tests/General.tsx @@ -51,7 +51,7 @@ export default function General({ test, onTestIdChange, onModified, funcsRef }: name, folder, description, - views: [], // automatically insert default view in backend + //views: [], // automatically insert default view in backend compareUrl: compareUrl || undefined, // when empty set to undefined notificationsEnabled, fingerprintLabels: [], diff --git a/webapp/src/domain/tests/Test.tsx b/webapp/src/domain/tests/Test.tsx index f625a0a5a..0999e62e2 100644 --- a/webapp/src/domain/tests/Test.tsx +++ b/webapp/src/domain/tests/Test.tsx @@ -36,6 +36,7 @@ import Access from "./Access" import Subscriptions from "./Subscriptions" import Transformers from "./Transformers" import MissingDataNotifications from "./MissingDataNotifications" +import Api from "../../api" type Params = { testId: string @@ -147,7 +148,7 @@ export default function Test() { > string @@ -54,6 +55,12 @@ export interface UpdateTestWatchAction { byId: Map } +export interface GetViewsAction { + type: typeof actionTypes.GET_VIEWS + testId: number + views: View[] +} + export interface UpdateViewAction { type: typeof actionTypes.UPDATE_VIEW testId: number @@ -125,6 +132,7 @@ export type TestAction = | DeleteAction | UpdateAccessAction | UpdateTestWatchAction + | GetViewsAction | UpdateViewAction | DeleteViewAction | UpdateActionAction @@ -182,9 +190,10 @@ export const reducer = (state = new TestsState(), action: TestAction) => { { const test = state.byId?.get(action.testId) if (test) { + let loadedViews : View[] = getViews(test.id); let views - if (test.views.some(v => v.id === action.view.id)) { - views = test.views.map(v => (v.id === action.view.id ? action.view : v)) + if (loadedViews.some(v => v.id === action.view.id)) { + views = loadedViews.map(v => (v.id === action.view.id ? action.view : v)) } else { views = [...test.views, action.view] }