Prevent multiple home screen assignment for the same role by changing role on existing screens
This commit is contained in:
parent
942d6eab5f
commit
e94eba9619
|
@ -69,14 +69,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update screen object in store
|
// Update screen object in store
|
||||||
store.update(state => {
|
// If there are 2 home screens after this change, remove this screen as a
|
||||||
setWith(get(selectedScreen), key.split("."), value, Object)
|
// home screen
|
||||||
return state
|
const screen = get(selectedScreen)
|
||||||
|
setWith(screen, key.split("."), value, Object)
|
||||||
|
const roleId = screen.routing.roleId
|
||||||
|
const homeScreens = get(store).screens.filter(screen => {
|
||||||
|
return screen.routing.roleId === roleId && screen.routing.homeScreen
|
||||||
})
|
})
|
||||||
|
if (homeScreens.length > 1) {
|
||||||
|
screen.routing.homeScreen = false
|
||||||
|
}
|
||||||
|
|
||||||
// Save new definition
|
// Save new definition
|
||||||
try {
|
try {
|
||||||
store.actions.preview.saveSelected()
|
store.actions.screens.save(screen)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error saving screen settings")
|
notifications.error("Error saving screen settings")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue