1
0
Fork 0
mirror of synced 2024-09-11 23:16:00 +12:00

Commit for enhancement #7604

Added a checkbox to allow the user to disable the default notifications to the following button actions:
* Save row
* Duplicate row
* Trigger automation
* Execute query
* Delete row
Also adjusted buttonActions.js to reflect the behaviour of that checkbox being ticked.
This commit is contained in:
FlaminWrap 2022-11-13 17:08:23 +00:00
parent 2332bedb13
commit e190f932d8
6 changed files with 31 additions and 11 deletions

View file

@ -27,6 +27,8 @@
/>
<Label small />
<Checkbox text="Do not display default notification" bind:value={parameters.notificationOverride} />
<br>
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}

View file

@ -95,6 +95,8 @@
/>
<Label small />
<Checkbox text="Do not display default notification" bind:value={parameters.notificationOverride} />
<br>
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}

View file

@ -44,7 +44,8 @@
getOptionLabel={query => query.name}
getOptionValue={query => query._id}
/>
<Checkbox text="Do not display default notification" bind:value={parameters.notificationOverride} />
<br>
{#if parameters.queryId}
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />

View file

@ -95,6 +95,8 @@
/>
<Label small />
<Checkbox text="Do not display default notification" bind:value={parameters.notificationOverride} />
<br>
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}

View file

@ -93,6 +93,8 @@
{/if}
<Label small />
<Checkbox text="Do not display default notification" bind:value={parameters.notificationOverride} />
<br>
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}

View file

@ -17,7 +17,7 @@ import { enrichDataBindings } from "./enrichDataBinding"
import { Helpers } from "@budibase/bbui"
const saveRowHandler = async (action, context) => {
const { fields, providerId, tableId } = action.parameters
const { fields, providerId, tableId, notificationOverride } = action.parameters
let payload
if (providerId) {
payload = { ...context[providerId] }
@ -34,7 +34,10 @@ const saveRowHandler = async (action, context) => {
}
try {
const row = await API.saveRow(payload)
notificationStore.actions.success("Row saved")
if (!notificationOverride){
notificationStore.actions.success("Row saved")
}
// Refresh related datasources
await dataSourceStore.actions.invalidateDataSource(row.tableId, {
@ -49,7 +52,7 @@ const saveRowHandler = async (action, context) => {
}
const duplicateRowHandler = async (action, context) => {
const { fields, providerId, tableId } = action.parameters
const { fields, providerId, tableId, notificationOverride } = action.parameters
if (providerId) {
let payload = { ...context[providerId] }
if (fields) {
@ -64,7 +67,9 @@ const duplicateRowHandler = async (action, context) => {
delete payload._rev
try {
const row = await API.saveRow(payload)
notificationStore.actions.success("Row saved")
if (!notificationOverride){
notificationStore.actions.success("Row saved")
}
// Refresh related datasources
await dataSourceStore.actions.invalidateDataSource(row.tableId, {
@ -80,11 +85,13 @@ const duplicateRowHandler = async (action, context) => {
}
const deleteRowHandler = async action => {
const { tableId, revId, rowId } = action.parameters
const { tableId, revId, rowId, notificationOverride } = action.parameters
if (tableId && rowId) {
try {
await API.deleteRow({ tableId, rowId, revId })
notificationStore.actions.success("Row deleted")
if (!notificationOverride){
notificationStore.actions.success("Row deleted")
}
// Refresh related datasources
await dataSourceStore.actions.invalidateDataSource(tableId, {
@ -98,14 +105,16 @@ const deleteRowHandler = async action => {
}
const triggerAutomationHandler = async action => {
const { fields } = action.parameters
const { fields, notificationOverride } = action.parameters
if (fields) {
try {
await API.triggerAutomation({
automationId: action.parameters.automationId,
fields,
})
notificationStore.actions.success("Automation triggered")
if (!notificationOverride){
notificationStore.actions.success("Automation triggered")
}
} catch (error) {
// Abort next actions
return false
@ -119,7 +128,7 @@ const navigationHandler = action => {
}
const queryExecutionHandler = async action => {
const { datasourceId, queryId, queryParams } = action.parameters
const { datasourceId, queryId, queryParams, notificationOverride } = action.parameters
try {
const query = await API.fetchQueryDefinition(queryId)
if (query?.datasourceId == null) {
@ -135,7 +144,9 @@ const queryExecutionHandler = async action => {
// Trigger a notification and invalidate the datasource as long as this
// was not a readable query
if (!query.readable) {
notificationStore.actions.success("Query executed successfully")
if (!notificationOverride){
notificationStore.actions.success("Query executed successfully")
}
await dataSourceStore.actions.invalidateDataSource(query.datasourceId)
}