1
0
Fork 0
mirror of synced 2024-07-05 22:40:39 +12:00

Merge branch 'develop' of github.com:Budibase/budibase into dnd

This commit is contained in:
Andrew Kingston 2021-09-17 12:53:06 +01:00
commit f0b7188db3
33 changed files with 173 additions and 101 deletions

View file

@ -68,4 +68,3 @@ jobs:
charts_dir: docs
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

View file

@ -1,5 +1,5 @@
{
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"npmClient": "yarn",
"packages": [
"packages/*"

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/auth",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js",
"author": "Budibase",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"license": "AGPL-3.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"license": "AGPL-3.0",
"private": true,
"scripts": {
@ -65,10 +65,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^0.9.125-alpha.12",
"@budibase/client": "^0.9.125-alpha.12",
"@budibase/bbui": "^0.9.125-alpha.14",
"@budibase/client": "^0.9.125-alpha.14",
"@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^0.9.125-alpha.12",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View file

@ -45,21 +45,24 @@ const automationActions = store => ({
return state
})
},
save: async ({ automation }) => {
save: async automation => {
const UPDATE_AUTOMATION_URL = `/api/automations`
const response = await api.put(UPDATE_AUTOMATION_URL, automation)
const json = await response.json()
store.update(state => {
const newAutomation = json.automation
const existingIdx = state.automations.findIndex(
existing => existing._id === automation._id
)
state.automations.splice(existingIdx, 1, json.automation)
state.automations = state.automations
store.actions.select(json.automation)
if (existingIdx !== -1) {
state.automations.splice(existingIdx, 1, newAutomation)
state.automations = [...state.automations]
store.actions.select(newAutomation)
return state
}
})
},
delete: async ({ automation }) => {
delete: async automation => {
const { _id, _rev } = automation
const DELETE_AUTOMATION_URL = `/api/automations/${_id}/${_rev}`
await api.delete(DELETE_AUTOMATION_URL)
@ -69,17 +72,17 @@ const automationActions = store => ({
existing => existing._id === _id
)
state.automations.splice(existingIdx, 1)
state.automations = state.automations
state.automations = [...state.automations]
state.selectedAutomation = null
state.selectedBlock = null
return state
})
},
trigger: async ({ automation }) => {
trigger: async automation => {
const { _id } = automation
return await api.post(`/api/automations/${_id}/trigger`)
},
test: async ({ automation }, testData) => {
test: async (automation, testData) => {
const { _id } = automation
const response = await api.post(`/api/automations/${_id}/test`, testData)
const json = await response.json()

View file

@ -38,10 +38,9 @@
actionVal
)
automationStore.actions.addBlockToAutomation(newBlock)
await automationStore.actions.save({
instanceId,
automation: $automationStore.selectedAutomation?.automation,
})
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
}
</script>

View file

@ -32,16 +32,15 @@
}
async function deleteAutomation() {
await automationStore.actions.delete({
instanceId,
automation: $automationStore.selectedAutomation?.automation,
})
await automationStore.actions.delete(
$automationStore.selectedAutomation?.automation
)
}
async function testAutomation() {
const result = await automationStore.actions.trigger({
automation: $automationStore.selectedAutomation.automation,
})
const result = await automationStore.actions.trigger(
$automationStore.selectedAutomation.automation
)
if (result.status === 200) {
notifications.success(
`Automation ${$automationStore.selectedAutomation.automation.name} triggered successfully.`

View file

@ -52,10 +52,9 @@
async function deleteStep() {
automationStore.actions.deleteAutomationBlock(block)
await automationStore.actions.save({
instanceId,
automation: $automationStore.selectedAutomation?.automation,
})
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
}
</script>

View file

@ -42,7 +42,10 @@
disabled={isError}
onConfirm={() => {
automationStore.actions.addTestDataToAutomation(testData)
automationStore.actions.test($automationStore.selectedAutomation, testData)
automationStore.actions.test(
$automationStore.selectedAutomation?.automation,
testData
)
}}
cancelText="Cancel"
>

View file

@ -29,10 +29,9 @@
webhookModal.show
}
await automationStore.actions.save({
instanceId,
automation: $automationStore.selectedAutomation?.automation,
})
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
notifications.success(`Automation ${name} created.`)

View file

@ -1,20 +1,17 @@
<script>
import { goto } from "@roxi/routify"
import { automationStore } from "builderStore"
import { database } from "stores/backend"
import { ActionMenu, MenuItem, notifications, Icon } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import UpdateAutomationModal from "components/automation/AutomationPanel/UpdateAutomationModal.svelte"
export let automation
let confirmDeleteDialog
$: instanceId = $database._id
let updateAutomationDialog
async function deleteAutomation() {
await automationStore.actions.delete({
instanceId,
automation,
})
await automationStore.actions.delete(automation)
notifications.success("Automation deleted.")
$goto("../automate")
}
@ -24,9 +21,8 @@
<div slot="control" class="icon">
<Icon s hoverable name="MoreSmallList" />
</div>
<MenuItem noClose icon="Delete" on:click={confirmDeleteDialog.show}>
Delete
</MenuItem>
<MenuItem icon="Edit" on:click={updateAutomationDialog.show}>Edit</MenuItem>
<MenuItem icon="Delete" on:click={confirmDeleteDialog.show}>Delete</MenuItem>
</ActionMenu>
<ConfirmDialog
@ -39,6 +35,7 @@
<i>{automation.name}?</i>
This action cannot be undone.
</ConfirmDialog>
<UpdateAutomationModal {automation} bind:this={updateAutomationDialog} />
<style>
div.icon {

View file

@ -0,0 +1,76 @@
<script>
import { automationStore } from "builderStore"
import { notifications } from "@budibase/bbui"
import { Icon, Input, ModalContent, Modal } from "@budibase/bbui"
import analytics from "analytics"
let name
let error = ""
let modal
export let automation
export let onCancel = undefined
export const show = () => {
name = automation?.name
modal.show()
}
export const hide = () => {
modal.hide()
}
async function saveAutomation() {
const updatedAutomation = {
...automation,
name,
}
await automationStore.actions.save(updatedAutomation)
notifications.success(`Automation ${name} updated successfully.`)
analytics.captureEvent("Automation Saved", { name })
hide()
}
function checkValid(evt) {
name = evt.target.value
if (!name) {
error = "Name is required"
return
}
error = ""
}
</script>
<Modal bind:this={modal} on:hide={onCancel}>
<ModalContent
title="Edit Automation"
confirmText="Save"
size="L"
onConfirm={saveAutomation}
disabled={error}
>
<Input bind:value={name} label="Name" on:input={checkValid} {error} />
<a
slot="footer"
target="_blank"
href="https://docs.budibase.com/automate/introduction-to-automate"
>
<Icon name="InfoOutline" />
<span>Learn about automations</span>
</a>
</ModalContent>
</Modal>
<style>
a {
color: var(--ink);
font-size: 14px;
vertical-align: middle;
display: flex;
align-items: center;
text-decoration: none;
}
a span {
text-decoration: underline;
margin-left: var(--spectrum-alias-item-padding-s);
}
</style>

View file

@ -56,10 +56,9 @@
testData[key] = e.detail
} else {
block.inputs[key] = e.detail
await automationStore.actions.save({
instanceId,
automation: $automationStore.selectedAutomation?.automation,
})
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
}
},
isTestModal ? 0 : 800

View file

@ -18,10 +18,7 @@
onMount(async () => {
if (!automation?.definition?.trigger?.inputs.schemaUrl) {
// save the automation initially
await automationStore.actions.save({
instanceId,
automation,
})
await automationStore.actions.save(automation)
}
interval = setInterval(async () => {
await automationStore.actions.fetch()

View file

@ -46,7 +46,9 @@
}
automationStore.actions.addBlockToAutomation(newBlock)
await automationStore.actions.save($automationStore.selectedAutomation)
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
parameters.automationId = $automationStore.selectedAutomation.automation._id
delete parameters.newAutomationName
}

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "^0.9.125-alpha.12",
"@budibase/bbui": "^0.9.125-alpha.14",
"@budibase/standard-components": "^0.9.124",
"@budibase/string-templates": "^0.9.125-alpha.12",
"@budibase/string-templates": "^0.9.125-alpha.14",
"regexparam": "^1.3.0",
"shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5"

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"description": "Budibase Web Server",
"main": "src/index.js",
"repository": {
@ -64,9 +64,9 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.125-alpha.12",
"@budibase/client": "^0.9.125-alpha.12",
"@budibase/string-templates": "^0.9.125-alpha.12",
"@budibase/auth": "^0.9.125-alpha.14",
"@budibase/client": "^0.9.125-alpha.14",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "0.9.125-alpha.12",
"version": "0.9.125-alpha.14",
"description": "Budibase background service",
"main": "src/index.js",
"repository": {
@ -25,8 +25,8 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.125-alpha.12",
"@budibase/string-templates": "^0.9.125-alpha.12",
"@budibase/auth": "^0.9.125-alpha.14",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@koa/router": "^8.0.0",
"@techpass/passport-openidconnect": "^0.3.0",
"aws-sdk": "^2.811.0",