Return allowed run from table
This commit is contained in:
parent
b6aebd67a8
commit
349637733e
|
@ -63,13 +63,15 @@
|
|||
$: rowActions.refreshRowActions(id)
|
||||
|
||||
const makeRowActionButtons = actions => {
|
||||
return (actions || []).map(action => ({
|
||||
text: action.name,
|
||||
onClick: async row => {
|
||||
await rowActions.trigger(id, action.id, row._id)
|
||||
notifications.success("Row action triggered successfully")
|
||||
},
|
||||
}))
|
||||
return (actions || [])
|
||||
.filter(action => action.allowedSources?.includes(id))
|
||||
.map(action => ({
|
||||
text: action.name,
|
||||
onClick: async row => {
|
||||
await rowActions.trigger(id, action.id, row._id)
|
||||
notifications.success("Row action triggered successfully")
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
const relationshipSupport = datasource => {
|
||||
|
|
|
@ -131,11 +131,12 @@ const derivedStore = derived(store, $store => {
|
|||
Object.keys($store || {}).forEach(tableId => {
|
||||
map[tableId] = $store[tableId]
|
||||
for (let action of $store[tableId]) {
|
||||
for (let viewId of action.allowedSources || []) {
|
||||
if (!map[viewId]) {
|
||||
map[viewId] = []
|
||||
}
|
||||
map[viewId].push(action)
|
||||
const otherSources = (action.allowedSources || []).filter(
|
||||
sourceId => sourceId !== tableId
|
||||
)
|
||||
for (let source of otherSources) {
|
||||
map[source] ??= []
|
||||
map[source].push(action)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue