-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Row action name cleanup #14849
Merged
adrinr
merged 14 commits into
v3-ui
from
BUDI-8770/row-action-automation-names-are-not-updated-in-automation
Oct 23, 2024
Merged
Row action name cleanup #14849
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
713500f
Add sdk.automation.find
adrinr 1f01277
Clean code
adrinr 076f211
Remove unnecessary row action update endpoint
adrinr 7781e75
Simplify row action permissions response
adrinr 015854f
Dont persist row action name
adrinr dab3826
Allow renaming row actions
adrinr 2868c84
Remove duplicated modals
adrinr 022ec12
Clean
adrinr 8f99072
Reuse
adrinr b4a979e
Fix get names
adrinr 1fef783
Check names properly
adrinr 732d701
Remove row action update tests
adrinr 46a7f15
Fix name checks
adrinr 63daa6b
Remove obsolete test
adrinr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
packages/builder/src/components/automation/AutomationPanel/UpdateRowActionModal.svelte
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ import { | |
CreateRowActionRequest, | ||
Ctx, | ||
RowActionPermissions, | ||
RowActionPermissionsResponse, | ||
RowActionResponse, | ||
RowActionsResponse, | ||
UpdateRowActionRequest, | ||
} from "@budibase/types" | ||
import sdk from "../../../sdk" | ||
|
||
|
@@ -30,14 +30,15 @@ export async function find(ctx: Ctx<void, RowActionsResponse>) { | |
} | ||
|
||
const { actions } = rowActions | ||
const automationNames = await sdk.rowActions.getNames(rowActions) | ||
const result: RowActionsResponse = { | ||
actions: Object.entries(actions).reduce<Record<string, RowActionResponse>>( | ||
(acc, [key, action]) => ({ | ||
...acc, | ||
[key]: { | ||
id: key, | ||
tableId, | ||
name: action.name, | ||
name: automationNames[action.automationId], | ||
automationId: action.automationId, | ||
allowedSources: flattenAllowedSources(tableId, action.permissions), | ||
}, | ||
|
@@ -68,26 +69,6 @@ export async function create( | |
ctx.status = 201 | ||
} | ||
|
||
export async function update( | ||
ctx: Ctx<UpdateRowActionRequest, RowActionResponse> | ||
) { | ||
const table = await getTable(ctx) | ||
const tableId = table._id! | ||
const { actionId } = ctx.params | ||
|
||
const action = await sdk.rowActions.update(tableId, actionId, { | ||
name: ctx.request.body.name, | ||
}) | ||
|
||
ctx.body = { | ||
tableId, | ||
id: action.id, | ||
name: action.name, | ||
automationId: action.automationId, | ||
allowedSources: flattenAllowedSources(tableId, action.permissions), | ||
} | ||
} | ||
|
||
export async function remove(ctx: Ctx<void, void>) { | ||
const table = await getTable(ctx) | ||
const { actionId } = ctx.params | ||
|
@@ -96,38 +77,36 @@ export async function remove(ctx: Ctx<void, void>) { | |
ctx.status = 204 | ||
} | ||
|
||
export async function setTablePermission(ctx: Ctx<void, RowActionResponse>) { | ||
export async function setTablePermission( | ||
ctx: Ctx<void, RowActionPermissionsResponse> | ||
) { | ||
const table = await getTable(ctx) | ||
const tableId = table._id! | ||
const { actionId } = ctx.params | ||
|
||
const action = await sdk.rowActions.setTablePermission(tableId, actionId) | ||
ctx.body = { | ||
tableId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This data is not actually required, and it would require fetching the automation names. Instead of adding the extra call, we can just simplify the responses |
||
id: action.id, | ||
name: action.name, | ||
automationId: action.automationId, | ||
allowedSources: flattenAllowedSources(tableId, action.permissions), | ||
} | ||
} | ||
|
||
export async function unsetTablePermission(ctx: Ctx<void, RowActionResponse>) { | ||
export async function unsetTablePermission( | ||
ctx: Ctx<void, RowActionPermissionsResponse> | ||
) { | ||
const table = await getTable(ctx) | ||
const tableId = table._id! | ||
const { actionId } = ctx.params | ||
|
||
const action = await sdk.rowActions.unsetTablePermission(tableId, actionId) | ||
|
||
ctx.body = { | ||
tableId, | ||
id: action.id, | ||
name: action.name, | ||
automationId: action.automationId, | ||
allowedSources: flattenAllowedSources(tableId, action.permissions), | ||
} | ||
} | ||
|
||
export async function setViewPermission(ctx: Ctx<void, RowActionResponse>) { | ||
export async function setViewPermission( | ||
ctx: Ctx<void, RowActionPermissionsResponse> | ||
) { | ||
const table = await getTable(ctx) | ||
const tableId = table._id! | ||
const { actionId, viewId } = ctx.params | ||
|
@@ -138,15 +117,13 @@ export async function setViewPermission(ctx: Ctx<void, RowActionResponse>) { | |
viewId | ||
) | ||
ctx.body = { | ||
tableId, | ||
id: action.id, | ||
name: action.name, | ||
automationId: action.automationId, | ||
allowedSources: flattenAllowedSources(tableId, action.permissions), | ||
} | ||
} | ||
|
||
export async function unsetViewPermission(ctx: Ctx<void, RowActionResponse>) { | ||
export async function unsetViewPermission( | ||
ctx: Ctx<void, RowActionPermissionsResponse> | ||
) { | ||
const table = await getTable(ctx) | ||
const tableId = table._id! | ||
const { actionId, viewId } = ctx.params | ||
|
@@ -158,10 +135,6 @@ export async function unsetViewPermission(ctx: Ctx<void, RowActionResponse>) { | |
) | ||
|
||
ctx.body = { | ||
tableId, | ||
id: action.id, | ||
name: action.name, | ||
automationId: action.automationId, | ||
allowedSources: flattenAllowedSources(tableId, action.permissions), | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic has not been moved to the automation screen, so this is not needed anymore