Merge pull request #8667 from FlaminWrap/Flaminwrap-Enhancement-7604
Allow user to disable hard coded notifications for button actions #7604
This commit is contained in:
commit
554f8b83da
|
@ -27,6 +27,11 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Label small />
|
<Label small />
|
||||||
|
<Checkbox
|
||||||
|
text="Do not display default notification"
|
||||||
|
bind:value={parameters.notificationOverride}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
||||||
|
|
||||||
{#if parameters.confirm}
|
{#if parameters.confirm}
|
||||||
|
|
|
@ -95,6 +95,11 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Label small />
|
<Label small />
|
||||||
|
<Checkbox
|
||||||
|
text="Do not display default notification"
|
||||||
|
bind:value={parameters.notificationOverride}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
||||||
|
|
||||||
{#if parameters.confirm}
|
{#if parameters.confirm}
|
||||||
|
|
|
@ -48,7 +48,11 @@
|
||||||
getOptionLabel={query => query.name}
|
getOptionLabel={query => query.name}
|
||||||
getOptionValue={query => query._id}
|
getOptionValue={query => query._id}
|
||||||
/>
|
/>
|
||||||
|
<Checkbox
|
||||||
|
text="Do not display default notification"
|
||||||
|
bind:value={parameters.notificationOverride}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
{#if parameters.queryId}
|
{#if parameters.queryId}
|
||||||
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,11 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Label small />
|
<Label small />
|
||||||
|
<Checkbox
|
||||||
|
text="Do not display default notification"
|
||||||
|
bind:value={parameters.notificationOverride}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
||||||
|
|
||||||
{#if parameters.confirm}
|
{#if parameters.confirm}
|
||||||
|
|
|
@ -93,6 +93,11 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Label small />
|
<Label small />
|
||||||
|
<Checkbox
|
||||||
|
text="Do not display default notification"
|
||||||
|
bind:value={parameters.notificationOverride}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
|
||||||
|
|
||||||
{#if parameters.confirm}
|
{#if parameters.confirm}
|
||||||
|
|
|
@ -18,7 +18,8 @@ import { enrichDataBindings } from "./enrichDataBinding"
|
||||||
import { Helpers } from "@budibase/bbui"
|
import { Helpers } from "@budibase/bbui"
|
||||||
|
|
||||||
const saveRowHandler = async (action, context) => {
|
const saveRowHandler = async (action, context) => {
|
||||||
const { fields, providerId, tableId } = action.parameters
|
const { fields, providerId, tableId, notificationOverride } =
|
||||||
|
action.parameters
|
||||||
let payload
|
let payload
|
||||||
if (providerId) {
|
if (providerId) {
|
||||||
payload = { ...context[providerId] }
|
payload = { ...context[providerId] }
|
||||||
|
@ -35,7 +36,10 @@ const saveRowHandler = async (action, context) => {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const row = await API.saveRow(payload)
|
const row = await API.saveRow(payload)
|
||||||
|
|
||||||
|
if (!notificationOverride) {
|
||||||
notificationStore.actions.success("Row saved")
|
notificationStore.actions.success("Row saved")
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh related datasources
|
// Refresh related datasources
|
||||||
await dataSourceStore.actions.invalidateDataSource(row.tableId, {
|
await dataSourceStore.actions.invalidateDataSource(row.tableId, {
|
||||||
|
@ -50,7 +54,8 @@ const saveRowHandler = async (action, context) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const duplicateRowHandler = async (action, context) => {
|
const duplicateRowHandler = async (action, context) => {
|
||||||
const { fields, providerId, tableId } = action.parameters
|
const { fields, providerId, tableId, notificationOverride } =
|
||||||
|
action.parameters
|
||||||
if (providerId) {
|
if (providerId) {
|
||||||
let payload = { ...context[providerId] }
|
let payload = { ...context[providerId] }
|
||||||
if (fields) {
|
if (fields) {
|
||||||
|
@ -65,7 +70,9 @@ const duplicateRowHandler = async (action, context) => {
|
||||||
delete payload._rev
|
delete payload._rev
|
||||||
try {
|
try {
|
||||||
const row = await API.saveRow(payload)
|
const row = await API.saveRow(payload)
|
||||||
|
if (!notificationOverride) {
|
||||||
notificationStore.actions.success("Row saved")
|
notificationStore.actions.success("Row saved")
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh related datasources
|
// Refresh related datasources
|
||||||
await dataSourceStore.actions.invalidateDataSource(row.tableId, {
|
await dataSourceStore.actions.invalidateDataSource(row.tableId, {
|
||||||
|
@ -81,11 +88,13 @@ const duplicateRowHandler = async (action, context) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteRowHandler = async action => {
|
const deleteRowHandler = async action => {
|
||||||
const { tableId, revId, rowId } = action.parameters
|
const { tableId, revId, rowId, notificationOverride } = action.parameters
|
||||||
if (tableId && rowId) {
|
if (tableId && rowId) {
|
||||||
try {
|
try {
|
||||||
await API.deleteRow({ tableId, rowId, revId })
|
await API.deleteRow({ tableId, rowId, revId })
|
||||||
|
if (!notificationOverride) {
|
||||||
notificationStore.actions.success("Row deleted")
|
notificationStore.actions.success("Row deleted")
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh related datasources
|
// Refresh related datasources
|
||||||
await dataSourceStore.actions.invalidateDataSource(tableId, {
|
await dataSourceStore.actions.invalidateDataSource(tableId, {
|
||||||
|
@ -99,14 +108,16 @@ const deleteRowHandler = async action => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const triggerAutomationHandler = async action => {
|
const triggerAutomationHandler = async action => {
|
||||||
const { fields } = action.parameters
|
const { fields, notificationOverride } = action.parameters
|
||||||
if (fields) {
|
if (fields) {
|
||||||
try {
|
try {
|
||||||
await API.triggerAutomation({
|
await API.triggerAutomation({
|
||||||
automationId: action.parameters.automationId,
|
automationId: action.parameters.automationId,
|
||||||
fields,
|
fields,
|
||||||
})
|
})
|
||||||
|
if (!notificationOverride) {
|
||||||
notificationStore.actions.success("Automation triggered")
|
notificationStore.actions.success("Automation triggered")
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Abort next actions
|
// Abort next actions
|
||||||
return false
|
return false
|
||||||
|
@ -120,7 +131,8 @@ const navigationHandler = action => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryExecutionHandler = async action => {
|
const queryExecutionHandler = async action => {
|
||||||
const { datasourceId, queryId, queryParams } = action.parameters
|
const { datasourceId, queryId, queryParams, notificationOverride } =
|
||||||
|
action.parameters
|
||||||
try {
|
try {
|
||||||
const query = await API.fetchQueryDefinition(queryId)
|
const query = await API.fetchQueryDefinition(queryId)
|
||||||
if (query?.datasourceId == null) {
|
if (query?.datasourceId == null) {
|
||||||
|
@ -136,7 +148,9 @@ const queryExecutionHandler = async action => {
|
||||||
// Trigger a notification and invalidate the datasource as long as this
|
// Trigger a notification and invalidate the datasource as long as this
|
||||||
// was not a readable query
|
// was not a readable query
|
||||||
if (!query.readable) {
|
if (!query.readable) {
|
||||||
|
if (!notificationOverride) {
|
||||||
notificationStore.actions.success("Query executed successfully")
|
notificationStore.actions.success("Query executed successfully")
|
||||||
|
}
|
||||||
await dataSourceStore.actions.invalidateDataSource(query.datasourceId)
|
await dataSourceStore.actions.invalidateDataSource(query.datasourceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue