web: edit report and edit dashboard

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-12-17 13:44:45 +01:00
parent 5ae8decbc0
commit fdb9b912d7
12 changed files with 284 additions and 22 deletions

View File

@@ -19,7 +19,7 @@ type InitialState = IChartInput & {
// First approach: define the initial state using that type
const initialState: InitialState = {
dirty: false,
name: 'screen_view',
name: 'Untitled',
chartType: 'linear',
interval: 'day',
breakdowns: [],
@@ -30,7 +30,7 @@ const initialState: InitialState = {
};
export const reportSlice = createSlice({
name: 'counter',
name: 'report',
initialState,
reducers: {
resetDirty(state) {
@@ -50,6 +50,10 @@ export const reportSlice = createSlice({
dirty: false,
};
},
setName(state, action: PayloadAction<string>) {
state.dirty = true;
state.name = action.payload;
},
// Events
addEvent: (state, action: PayloadAction<Omit<IChartEvent, 'id'>>) => {
state.dirty = true;
@@ -162,6 +166,7 @@ export const reportSlice = createSlice({
export const {
reset,
setReport,
setName,
addEvent,
removeEvent,
changeEvent,