remove the link from navigation bar when removing the screen
This commit is contained in:
parent
c91e5ea39c
commit
9aecdedbfc
|
@ -215,6 +215,13 @@ export const getFrontendStore = () => {
|
|||
if (screenToDelete._id === state.selectedScreenId) {
|
||||
state.selectedScreenId = null
|
||||
}
|
||||
//remove the link for this screen
|
||||
screenDeletePromises.push(
|
||||
store.actions.components.links.delete(
|
||||
screenToDelete.routing.route,
|
||||
screenToDelete.props._instanceName
|
||||
)
|
||||
)
|
||||
}
|
||||
return state
|
||||
})
|
||||
|
@ -646,6 +653,36 @@ export const getFrontendStore = () => {
|
|||
// Save layout
|
||||
await store.actions.layouts.save(layout)
|
||||
},
|
||||
delete: async (url, title) => {
|
||||
const layout = get(mainLayout)
|
||||
if (!layout) {
|
||||
return
|
||||
}
|
||||
|
||||
// Add link setting to main layout
|
||||
if (layout.props._component.endsWith("layout")) {
|
||||
// If using a new SDK, add to the layout component settings
|
||||
layout.props.links = layout.props.links.filter(
|
||||
link => !(link.text === title && link.url === url)
|
||||
)
|
||||
} else {
|
||||
// If using an old SDK, add to the navigation component
|
||||
// TODO: remove this when we can assume everyone has updated
|
||||
const nav = findComponentType(
|
||||
layout.props,
|
||||
"@budibase/standard-components/navigation"
|
||||
)
|
||||
if (!nav) {
|
||||
return
|
||||
}
|
||||
|
||||
nav._children = nav._children.filter(
|
||||
child => !(child.url === url && child.text === title)
|
||||
)
|
||||
}
|
||||
// Save layout
|
||||
await store.actions.layouts.save(layout)
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue