aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-02-02 11:41:55 -0800
committerAnton Tananaev <anton@traccar.org>2023-02-02 11:41:55 -0800
commitcdfa3e5a8fca1b3b8ed59881adcaa8c3d686de50 (patch)
treebffb269cfcbd2b6ebc75bddf700bcd92648bf912 /modern/src/store
parentac45c888702bb5ca2d12d974875d101d3e60dd49 (diff)
downloadtrackermap-web-cdfa3e5a8fca1b3b8ed59881adcaa8c3d686de50.tar.gz
trackermap-web-cdfa3e5a8fca1b3b8ed59881adcaa8c3d686de50.tar.bz2
trackermap-web-cdfa3e5a8fca1b3b8ed59881adcaa8c3d686de50.zip
Unified device selection
Diffstat (limited to 'modern/src/store')
-rw-r--r--modern/src/store/devices.js9
-rw-r--r--modern/src/store/reports.js8
2 files changed, 9 insertions, 8 deletions
diff --git a/modern/src/store/devices.js b/modern/src/store/devices.js
index 9cfde0a8..1bae6d91 100644
--- a/modern/src/store/devices.js
+++ b/modern/src/store/devices.js
@@ -5,6 +5,7 @@ const { reducer, actions } = createSlice({
initialState: {
items: {},
selectedId: null,
+ selectedIds: [],
},
reducers: {
refresh(state, action) {
@@ -17,6 +18,14 @@ const { reducer, actions } = createSlice({
select(state, action) {
state.selectedId = action.payload;
},
+ selectId(state, action) {
+ state.selectedId = action.payload;
+ state.selectedIds = [state.selectedId];
+ },
+ selectIds(state, action) {
+ state.selectedIds = action.payload;
+ [state.selectedId] = state.selectedIds;
+ },
remove(state, action) {
delete state.items[action.payload];
},
diff --git a/modern/src/store/reports.js b/modern/src/store/reports.js
index 540c4d4e..870a0420 100644
--- a/modern/src/store/reports.js
+++ b/modern/src/store/reports.js
@@ -4,8 +4,6 @@ import moment from 'moment';
const { reducer, actions } = createSlice({
name: 'reports',
initialState: {
- deviceId: null,
- deviceIds: [],
groupIds: [],
period: 'today',
from: moment().subtract(1, 'hour').locale('en').format(moment.HTML5_FMT.DATETIME_LOCAL),
@@ -13,12 +11,6 @@ const { reducer, actions } = createSlice({
button: 'json',
},
reducers: {
- updateDeviceId(state, action) {
- state.deviceId = action.payload;
- },
- updateDeviceIds(state, action) {
- state.deviceIds = action.payload;
- },
updateGroupIds(state, action) {
state.groupIds = action.payload;
},