Merge branch 'develop' of github.com:Budibase/budibase into dnd
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/auth",
|
"name": "@budibase/auth",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"description": "Authentication middlewares for budibase builder and apps",
|
"description": "Authentication middlewares for budibase builder and apps",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -6,8 +6,10 @@ const EXPIRY_SECONDS = 3600
|
||||||
/**
|
/**
|
||||||
* The default populate user function
|
* The default populate user function
|
||||||
*/
|
*/
|
||||||
const populateFromDB = (userId, tenantId) => {
|
const populateFromDB = async (userId, tenantId) => {
|
||||||
return getGlobalDB(tenantId).get(userId)
|
const user = await getGlobalDB(tenantId).get(userId)
|
||||||
|
user.budibaseAccess = true
|
||||||
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/bbui",
|
"name": "@budibase/bbui",
|
||||||
"description": "A UI solution used in the different Budibase projects.",
|
"description": "A UI solution used in the different Budibase projects.",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
export let dataCy = null
|
export let dataCy = null
|
||||||
export let size = "M"
|
export let size = "M"
|
||||||
export let active = false
|
export let active = false
|
||||||
|
export let fullWidth = false
|
||||||
|
|
||||||
function longPress(element) {
|
function longPress(element) {
|
||||||
if (!longPressable) return
|
if (!longPressable) return
|
||||||
|
@ -40,6 +41,7 @@
|
||||||
class:spectrum-ActionButton--quiet={quiet}
|
class:spectrum-ActionButton--quiet={quiet}
|
||||||
class:spectrum-ActionButton--emphasized={emphasized}
|
class:spectrum-ActionButton--emphasized={emphasized}
|
||||||
class:is-selected={selected}
|
class:is-selected={selected}
|
||||||
|
class:fullWidth
|
||||||
class="spectrum-ActionButton spectrum-ActionButton--size{size}"
|
class="spectrum-ActionButton spectrum-ActionButton--size{size}"
|
||||||
class:active
|
class:active
|
||||||
{disabled}
|
{disabled}
|
||||||
|
@ -71,6 +73,9 @@
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.fullWidth {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
.active,
|
.active,
|
||||||
.active svg {
|
.active svg {
|
||||||
color: var(--spectrum-global-color-blue-600);
|
color: var(--spectrum-global-color-blue-600);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
export let orange = false
|
export let orange = false
|
||||||
export let yellow = false
|
export let yellow = false
|
||||||
export let seafoam = false
|
export let seafoam = false
|
||||||
|
export let green = false
|
||||||
export let active = false
|
export let active = false
|
||||||
export let inactive = false
|
export let inactive = false
|
||||||
</script>
|
</script>
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
class:spectrum-Label--large={size === "L"}
|
class:spectrum-Label--large={size === "L"}
|
||||||
class:spectrum-Label--grey={grey}
|
class:spectrum-Label--grey={grey}
|
||||||
class:spectrum-Label--red={red}
|
class:spectrum-Label--red={red}
|
||||||
|
class:spectrum-Label--green={green}
|
||||||
class:spectrum-Label--orange={orange}
|
class:spectrum-Label--orange={orange}
|
||||||
class:spectrum-Label--yellow={yellow}
|
class:spectrum-Label--yellow={yellow}
|
||||||
class:spectrum-Label--seafoam={seafoam}
|
class:spectrum-Label--seafoam={seafoam}
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
import Heading from "../Typography/Heading.svelte"
|
import Heading from "../Typography/Heading.svelte"
|
||||||
|
|
||||||
export let title
|
export let title
|
||||||
|
export let fillWidth
|
||||||
let visible = false
|
let visible = false
|
||||||
|
|
||||||
export function show() {
|
export function show() {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
return
|
return
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
|
|
||||||
{#if visible}
|
{#if visible}
|
||||||
<Portal>
|
<Portal>
|
||||||
<section class="drawer" transition:slide>
|
<section class:fillWidth class="drawer" transition:slide>
|
||||||
<header>
|
<header>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<Heading size="XS">{title}</Heading>
|
<Heading size="XS">{title}</Heading>
|
||||||
|
@ -63,6 +62,10 @@
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fillWidth {
|
||||||
|
width: calc(100% - 260px) !important;
|
||||||
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
@ -21,8 +21,5 @@
|
||||||
.wide {
|
.wide {
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: var(--spacing-xl) calc(var(--spacing-xl) * 2)
|
|
||||||
calc(var(--spacing-xl) * 2) calc(var(--spacing-xl) * 2);
|
|
||||||
min-height: calc(100% - var(--spacing-xl) * 3);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -46,8 +46,10 @@
|
||||||
<h1
|
<h1
|
||||||
class="spectrum-Dialog-heading spectrum-Dialog-heading--noHeader"
|
class="spectrum-Dialog-heading spectrum-Dialog-heading--noHeader"
|
||||||
class:noDivider={!showDivider}
|
class:noDivider={!showDivider}
|
||||||
|
class:header-spacing={$$slots.header}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
|
<slot name="header" />
|
||||||
</h1>
|
</h1>
|
||||||
{#if showDivider}
|
{#if showDivider}
|
||||||
<Divider size="M" />
|
<Divider size="M" />
|
||||||
|
@ -120,4 +122,9 @@
|
||||||
.close-icon :global(svg) {
|
.close-icon :global(svg) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-spacing {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
class="spectrum-SideNav-item"
|
class="spectrum-SideNav-item"
|
||||||
class:is-selected={selected}
|
class:is-selected={selected}
|
||||||
class:is-disabled={disabled}
|
class:is-disabled={disabled}
|
||||||
|
on:click
|
||||||
>
|
>
|
||||||
{#if heading}
|
{#if heading}
|
||||||
<h2 class="spectrum-SideNav-heading" id="nav-heading-{heading}">
|
<h2 class="spectrum-SideNav-heading" id="nav-heading-{heading}">
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<svg width="71" height="55" viewBox="0 0 71 55" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0)">
|
||||||
|
<path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z" fill="#5865F2"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0">
|
||||||
|
<rect width="71" height="55" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.0 KiB |
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 25.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 132 132" style="enable-background:new 0 0 132 132;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#E01E5A;}
|
||||||
|
.st1{fill:#36C5F0;}
|
||||||
|
.st2{fill:#2EB67D;}
|
||||||
|
.st3{fill:#ECB22E;}
|
||||||
|
</style>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M30.4,82.2c0,7.1-5.8,12.9-12.9,12.9S4.6,89.3,4.6,82.2c0-7.1,5.8-12.9,12.9-12.9h12.9V82.2z"/>
|
||||||
|
<path class="st0" d="M36.9,82.2c0-7.1,5.8-12.9,12.9-12.9s12.9,5.8,12.9,12.9v32.3c0,7.1-5.8,12.9-12.9,12.9s-12.9-5.8-12.9-12.9
|
||||||
|
C36.9,114.5,36.9,82.2,36.9,82.2z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st1" d="M49.8,30.4c-7.1,0-12.9-5.8-12.9-12.9S42.7,4.6,49.8,4.6s12.9,5.8,12.9,12.9v12.9H49.8z"/>
|
||||||
|
<path class="st1" d="M49.8,36.9c7.1,0,12.9,5.8,12.9,12.9s-5.8,12.9-12.9,12.9H17.5c-7.1,0-12.9-5.8-12.9-12.9s5.8-12.9,12.9-12.9
|
||||||
|
C17.5,36.9,49.8,36.9,49.8,36.9z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st2" d="M101.6,49.8c0-7.1,5.8-12.9,12.9-12.9c7.1,0,12.9,5.8,12.9,12.9s-5.8,12.9-12.9,12.9h-12.9V49.8z"/>
|
||||||
|
<path class="st2" d="M95.1,49.8c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9V17.5c0-7.1,5.8-12.9,12.9-12.9
|
||||||
|
c7.1,0,12.9,5.8,12.9,12.9V49.8z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st3" d="M82.2,101.6c7.1,0,12.9,5.8,12.9,12.9c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9v-12.9H82.2z"/>
|
||||||
|
<path class="st3" d="M82.2,95.1c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9h32.3c7.1,0,12.9,5.8,12.9,12.9
|
||||||
|
c0,7.1-5.8,12.9-12.9,12.9H82.2z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 12 KiB |
|
@ -7,26 +7,42 @@ context("Create a automation", () => {
|
||||||
// https://on.cypress.io/interacting-with-elements
|
// https://on.cypress.io/interacting-with-elements
|
||||||
it("should create a automation", () => {
|
it("should create a automation", () => {
|
||||||
cy.createTestTableWithData()
|
cy.createTestTableWithData()
|
||||||
|
cy.wait(2000)
|
||||||
cy.contains("Automate").click()
|
cy.contains("Automate").click()
|
||||||
cy.get("[data-cy='new-screen'] > .spectrum-Icon").click()
|
cy.get("[data-cy='new-screen'] > .spectrum-Icon").click()
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".modal-inner-wrapper").within(() => {
|
||||||
cy.get("input").type("Add Row")
|
cy.get("input").type("Add Row")
|
||||||
|
cy.contains("Row Created").click()
|
||||||
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Button--cta").click()
|
cy.get(".spectrum-Button--cta").click()
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add trigger
|
// Setup trigger
|
||||||
cy.contains("Trigger").click()
|
cy.contains("Setup").click()
|
||||||
cy.contains("Row Created").click()
|
cy.get(".spectrum-Picker-label").click()
|
||||||
cy.get(".setup").within(() => {
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Picker-label").click()
|
cy.contains("dog").click()
|
||||||
cy.contains("dog").click()
|
|
||||||
})
|
|
||||||
|
|
||||||
// Create action
|
// Create action
|
||||||
cy.contains("Internal").click()
|
cy.contains("Add Action").click()
|
||||||
cy.contains("Create Row").click()
|
cy.get(".modal-inner-wrapper").within(() => {
|
||||||
cy.get(".setup").within(() => {
|
cy.wait(1000)
|
||||||
|
cy.contains("Create Row").trigger('mouseover').click().click()
|
||||||
|
cy.get(".spectrum-Button--cta").click()
|
||||||
|
})
|
||||||
|
cy.contains("Setup").click()
|
||||||
|
cy.get(".spectrum-Picker-label").click()
|
||||||
|
cy.contains("dog").click()
|
||||||
|
cy.get(".spectrum-Textfield-input")
|
||||||
|
.first()
|
||||||
|
.type("goodboy")
|
||||||
|
cy.get(".spectrum-Textfield-input")
|
||||||
|
.eq(1)
|
||||||
|
.type("11")
|
||||||
|
|
||||||
|
cy.contains("Run test").click()
|
||||||
|
cy.get(".modal-inner-wrapper").within(() => {
|
||||||
|
cy.wait(1000)
|
||||||
cy.get(".spectrum-Picker-label").click()
|
cy.get(".spectrum-Picker-label").click()
|
||||||
cy.contains("dog").click()
|
cy.contains("dog").click()
|
||||||
cy.get(".spectrum-Textfield-input")
|
cy.get(".spectrum-Textfield-input")
|
||||||
|
@ -35,19 +51,12 @@ context("Create a automation", () => {
|
||||||
cy.get(".spectrum-Textfield-input")
|
cy.get(".spectrum-Textfield-input")
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.type("11")
|
.type("11")
|
||||||
|
cy.get(".spectrum-Textfield-input")
|
||||||
|
.eq(2)
|
||||||
|
.type("123456")
|
||||||
|
cy.get(".spectrum-Textfield-input")
|
||||||
|
.eq(3)
|
||||||
|
.type("123456")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Save
|
|
||||||
cy.contains("Save Automation").click()
|
|
||||||
|
|
||||||
// Activate Automation
|
|
||||||
cy.get("[data-cy=activate-automation]").click()
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should add row when a new row is added", () => {
|
|
||||||
cy.contains("Data").click()
|
|
||||||
cy.addRow(["Rover", 15])
|
|
||||||
cy.reload()
|
|
||||||
cy.contains("goodboy").should("have.text", "goodboy")
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -34,12 +34,11 @@ Cypress.Commands.add("createApp", name => {
|
||||||
cy.get(".spectrum-Modal")
|
cy.get(".spectrum-Modal")
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
||||||
cy.contains("Create app").click()
|
cy.get(".spectrum-ButtonGroup").contains("Create app").click()
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.get(".selected > .content", {
|
cy.expandBudibaseConnection()
|
||||||
timeout: 20000,
|
cy.get(".nav-item.selected > .content").should("be.visible")
|
||||||
}).should("be.visible")
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -83,6 +82,7 @@ Cypress.Commands.add("createTable", tableName => {
|
||||||
|
|
||||||
Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
|
Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
|
||||||
// Select Table
|
// Select Table
|
||||||
|
cy.selectTable(tableName)
|
||||||
cy.contains(".nav-item", tableName).click()
|
cy.contains(".nav-item", tableName).click()
|
||||||
cy.contains("Create column").click()
|
cy.contains("Create column").click()
|
||||||
|
|
||||||
|
@ -161,3 +161,15 @@ Cypress.Commands.add("createScreen", (screenName, route) => {
|
||||||
cy.get(".spectrum-Button--cta").click()
|
cy.get(".spectrum-Button--cta").click()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.add("expandBudibaseConnection", () => {
|
||||||
|
if (Cypress.$(".nav-item > .content > .opened").length === 0) {
|
||||||
|
// expand the Budibase DB connection string
|
||||||
|
cy.get(".icon.arrow").eq(0).click()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.add("selectTable", tableName => {
|
||||||
|
cy.expandBudibaseConnection()
|
||||||
|
cy.contains(".nav-item", tableName).click()
|
||||||
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.125-alpha.7",
|
"@budibase/bbui": "^0.9.125-alpha.12",
|
||||||
"@budibase/client": "^0.9.125-alpha.7",
|
"@budibase/client": "^0.9.125-alpha.12",
|
||||||
"@budibase/colorpicker": "1.1.2",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.7",
|
"@budibase/string-templates": "^0.9.125-alpha.12",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -13,6 +13,10 @@ export default class Automation {
|
||||||
return this.automation.definition.trigger
|
return this.automation.definition.trigger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addTestData(data) {
|
||||||
|
this.automation.testData = data
|
||||||
|
}
|
||||||
|
|
||||||
addBlock(block) {
|
addBlock(block) {
|
||||||
// Make sure to add trigger if doesn't exist
|
// Make sure to add trigger if doesn't exist
|
||||||
if (!this.hasTrigger() && block.type === "TRIGGER") {
|
if (!this.hasTrigger() && block.type === "TRIGGER") {
|
||||||
|
|
|
@ -17,7 +17,6 @@ const automationActions = store => ({
|
||||||
state.blockDefinitions = {
|
state.blockDefinitions = {
|
||||||
TRIGGER: jsonResponses[1].trigger,
|
TRIGGER: jsonResponses[1].trigger,
|
||||||
ACTION: jsonResponses[1].action,
|
ACTION: jsonResponses[1].action,
|
||||||
LOGIC: jsonResponses[1].logic,
|
|
||||||
}
|
}
|
||||||
// if previously selected find the new obj and select it
|
// if previously selected find the new obj and select it
|
||||||
if (selected) {
|
if (selected) {
|
||||||
|
@ -80,9 +79,14 @@ const automationActions = store => ({
|
||||||
const { _id } = automation
|
const { _id } = automation
|
||||||
return await api.post(`/api/automations/${_id}/trigger`)
|
return await api.post(`/api/automations/${_id}/trigger`)
|
||||||
},
|
},
|
||||||
test: async ({ automation }) => {
|
test: async ({ automation }, testData) => {
|
||||||
const { _id } = automation
|
const { _id } = automation
|
||||||
return await api.post(`/api/automations/${_id}/test`)
|
const response = await api.post(`/api/automations/${_id}/test`, testData)
|
||||||
|
const json = await response.json()
|
||||||
|
store.update(state => {
|
||||||
|
state.selectedAutomation.testResults = json
|
||||||
|
return state
|
||||||
|
})
|
||||||
},
|
},
|
||||||
select: automation => {
|
select: automation => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
|
@ -91,6 +95,12 @@ const automationActions = store => ({
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
addTestDataToAutomation: data => {
|
||||||
|
store.update(state => {
|
||||||
|
state.selectedAutomation.addTestData(data)
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
},
|
||||||
addBlockToAutomation: block => {
|
addBlockToAutomation: block => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
const newBlock = state.selectedAutomation.addBlock(cloneDeep(block))
|
const newBlock = state.selectedAutomation.addBlock(cloneDeep(block))
|
||||||
|
@ -132,7 +142,6 @@ export const getAutomationStore = () => {
|
||||||
blockDefinitions: {
|
blockDefinitions: {
|
||||||
TRIGGER: [],
|
TRIGGER: [],
|
||||||
ACTION: [],
|
ACTION: [],
|
||||||
LOGIC: [],
|
|
||||||
},
|
},
|
||||||
selectedAutomation: null,
|
selectedAutomation: null,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
import Flowchart from "./FlowChart/FlowChart.svelte"
|
import Flowchart from "./FlowChart/FlowChart.svelte"
|
||||||
import BlockList from "./BlockList.svelte"
|
|
||||||
|
|
||||||
$: automation = $automationStore.selectedAutomation?.automation
|
$: automation = $automationStore.selectedAutomation?.automation
|
||||||
|
|
||||||
function onSelect(block) {
|
function onSelect(block) {
|
||||||
automationStore.update(state => {
|
automationStore.update(state => {
|
||||||
state.selectedBlock = block
|
state.selectedBlock = block
|
||||||
|
@ -14,6 +12,5 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if automation}
|
{#if automation}
|
||||||
<BlockList />
|
|
||||||
<Flowchart {automation} {onSelect} />
|
<Flowchart {automation} {onSelect} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
<script>
|
|
||||||
import { sortBy } from "lodash/fp"
|
|
||||||
import { automationStore } from "builderStore"
|
|
||||||
import { ActionButton, Popover, Modal } from "@budibase/bbui"
|
|
||||||
import { DropdownContainer, DropdownItem } from "components/common/Dropdowns"
|
|
||||||
import CreateWebhookModal from "../Shared/CreateWebhookModal.svelte"
|
|
||||||
|
|
||||||
$: hasTrigger = $automationStore.selectedAutomation.hasTrigger()
|
|
||||||
$: tabs = [
|
|
||||||
{
|
|
||||||
label: "Trigger",
|
|
||||||
value: "TRIGGER",
|
|
||||||
icon: "Algorithm",
|
|
||||||
disabled: hasTrigger,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Internal",
|
|
||||||
value: "ACTION",
|
|
||||||
internal: true,
|
|
||||||
icon: "Actions",
|
|
||||||
disabled: !hasTrigger,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "External",
|
|
||||||
value: "ACTION",
|
|
||||||
internal: false,
|
|
||||||
icon: "Extension",
|
|
||||||
disabled: !hasTrigger,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
let selectedIndex
|
|
||||||
let anchors = []
|
|
||||||
let popover
|
|
||||||
let webhookModal
|
|
||||||
$: selectedTab = selectedIndex == null ? null : tabs[selectedIndex].value
|
|
||||||
$: selectedInternal =
|
|
||||||
selectedIndex == null ? null : tabs[selectedIndex].internal
|
|
||||||
$: anchor = selectedIndex === -1 ? null : anchors[selectedIndex]
|
|
||||||
$: blocks = sortBy(entry => entry[1].name)(
|
|
||||||
Object.entries($automationStore.blockDefinitions[selectedTab] ?? {})
|
|
||||||
).filter(
|
|
||||||
entry => selectedInternal == null || entry[1].internal === selectedInternal
|
|
||||||
)
|
|
||||||
|
|
||||||
function onChangeTab(idx) {
|
|
||||||
selectedIndex = idx
|
|
||||||
popover.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
function closePopover() {
|
|
||||||
selectedIndex = null
|
|
||||||
popover.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
function addBlockToAutomation(stepId, blockDefinition) {
|
|
||||||
const newBlock = $automationStore.selectedAutomation.constructBlock(
|
|
||||||
selectedTab,
|
|
||||||
stepId,
|
|
||||||
blockDefinition
|
|
||||||
)
|
|
||||||
automationStore.actions.addBlockToAutomation(newBlock)
|
|
||||||
closePopover()
|
|
||||||
if (stepId === "WEBHOOK") {
|
|
||||||
webhookModal.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="tab-container">
|
|
||||||
{#each tabs as tab, idx}
|
|
||||||
<div bind:this={anchors[idx]}>
|
|
||||||
<ActionButton
|
|
||||||
quiet
|
|
||||||
size="S"
|
|
||||||
icon={tab.icon}
|
|
||||||
disabled={tab.disabled}
|
|
||||||
on:click={tab.disabled ? null : () => onChangeTab(idx)}
|
|
||||||
>
|
|
||||||
{tab.label}
|
|
||||||
</ActionButton>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
<Popover
|
|
||||||
on:close={() => (selectedIndex = null)}
|
|
||||||
bind:this={popover}
|
|
||||||
{anchor}
|
|
||||||
align="left"
|
|
||||||
>
|
|
||||||
<DropdownContainer>
|
|
||||||
{#each blocks as [stepId, blockDefinition]}
|
|
||||||
<DropdownItem
|
|
||||||
icon={blockDefinition.icon}
|
|
||||||
title={blockDefinition.name}
|
|
||||||
subtitle={blockDefinition.description}
|
|
||||||
on:click={() => addBlockToAutomation(stepId, blockDefinition)}
|
|
||||||
/>
|
|
||||||
{/each}
|
|
||||||
</DropdownContainer>
|
|
||||||
</Popover>
|
|
||||||
<Modal bind:this={webhookModal} width="30%">
|
|
||||||
<CreateWebhookModal />
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.tab-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 24px;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
<script>
|
||||||
|
import { ModalContent, Layout, Detail, Body, Icon } from "@budibase/bbui"
|
||||||
|
import { automationStore } from "builderStore"
|
||||||
|
import { database } from "stores/backend"
|
||||||
|
import { externalActions } from "./ExternalActions"
|
||||||
|
$: instanceId = $database._id
|
||||||
|
|
||||||
|
let selectedAction
|
||||||
|
let actionVal
|
||||||
|
let actions = Object.entries($automationStore.blockDefinitions.ACTION)
|
||||||
|
export let blockComplete
|
||||||
|
|
||||||
|
const external = actions.reduce((acc, elm) => {
|
||||||
|
const [k, v] = elm
|
||||||
|
if (!v.internal) {
|
||||||
|
acc[k] = v
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
const internal = actions.reduce((acc, elm) => {
|
||||||
|
const [k, v] = elm
|
||||||
|
if (v.internal) {
|
||||||
|
acc[k] = v
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
const selectAction = action => {
|
||||||
|
actionVal = action
|
||||||
|
selectedAction = action.name
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addBlockToAutomation() {
|
||||||
|
const newBlock = $automationStore.selectedAutomation.constructBlock(
|
||||||
|
"ACTION",
|
||||||
|
actionVal.stepId,
|
||||||
|
actionVal
|
||||||
|
)
|
||||||
|
automationStore.actions.addBlockToAutomation(newBlock)
|
||||||
|
await automationStore.actions.save({
|
||||||
|
instanceId,
|
||||||
|
automation: $automationStore.selectedAutomation?.automation,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ModalContent
|
||||||
|
title="Create Automation"
|
||||||
|
confirmText="Save"
|
||||||
|
size="M"
|
||||||
|
disabled={!selectedAction}
|
||||||
|
onConfirm={() => {
|
||||||
|
blockComplete = true
|
||||||
|
addBlockToAutomation()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Body size="XS">Select an app or event.</Body>
|
||||||
|
<Layout noPadding>
|
||||||
|
<Body size="S">Apps</Body>
|
||||||
|
|
||||||
|
<div class="item-list">
|
||||||
|
{#each Object.entries(external) as [idx, action]}
|
||||||
|
<div
|
||||||
|
class="item"
|
||||||
|
class:selected={selectedAction === action.name}
|
||||||
|
on:click={() => selectAction(action)}
|
||||||
|
>
|
||||||
|
<div class="item-body">
|
||||||
|
<img
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
src={externalActions[action.stepId].icon}
|
||||||
|
alt="zapier"
|
||||||
|
/>
|
||||||
|
<span class="icon-spacing">
|
||||||
|
<Body size="XS">{idx.charAt(0).toUpperCase() + idx.slice(1)}</Body
|
||||||
|
></span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Detail size="S">Actions</Detail>
|
||||||
|
|
||||||
|
<div class="item-list">
|
||||||
|
{#each Object.entries(internal) as [idx, action]}
|
||||||
|
<div
|
||||||
|
class="item"
|
||||||
|
class:selected={selectedAction === action.name}
|
||||||
|
on:click={() => selectAction(action)}
|
||||||
|
>
|
||||||
|
<div class="item-body">
|
||||||
|
<Icon name={action.icon} />
|
||||||
|
<span class="icon-spacing">
|
||||||
|
<Body size="XS">{action.name}</Body></span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
</ModalContent>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.icon-spacing {
|
||||||
|
margin-left: var(--spacing-m);
|
||||||
|
}
|
||||||
|
.item-body {
|
||||||
|
display: flex;
|
||||||
|
margin-left: var(--spacing-m);
|
||||||
|
}
|
||||||
|
.item-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||||
|
grid-gap: var(--spectrum-alias-grid-baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
cursor: pointer;
|
||||||
|
display: grid;
|
||||||
|
grid-gap: var(--spectrum-alias-grid-margin-xsmall);
|
||||||
|
padding: var(--spectrum-alias-item-padding-s);
|
||||||
|
background: var(--spectrum-alias-background-color-secondary);
|
||||||
|
transition: 0.3s all;
|
||||||
|
border: solid #3b3d3c;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
.item:hover,
|
||||||
|
.selected {
|
||||||
|
background: var(--spectrum-alias-background-color-tertiary);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -6,6 +6,7 @@
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
|
stroke-dasharray="5,5"
|
||||||
d="M5.0625 70H9L4.5 75L0 70H3.9375V65H5.0625V70Z"
|
d="M5.0625 70H9L4.5 75L0 70H3.9375V65H5.0625V70Z"
|
||||||
fill="var(--grey-5)"
|
fill="var(--grey-5)"
|
||||||
/>
|
/>
|
||||||
|
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 353 B |
|
@ -0,0 +1,11 @@
|
||||||
|
import DiscordLogo from "assets/discord.svg"
|
||||||
|
import ZapierLogo from "assets/zapier.png"
|
||||||
|
import IntegromatLogo from "assets/integromat.png"
|
||||||
|
import SlackLogo from "assets/slack.svg"
|
||||||
|
|
||||||
|
export const externalActions = {
|
||||||
|
zapier: { name: "zapier", icon: ZapierLogo },
|
||||||
|
discord: { name: "discord", icon: DiscordLogo },
|
||||||
|
slack: { name: "slack", icon: SlackLogo },
|
||||||
|
integromat: { name: "integromat", icon: IntegromatLogo },
|
||||||
|
}
|
|
@ -1,12 +1,25 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { automationStore } from "builderStore"
|
||||||
|
|
||||||
import FlowItem from "./FlowItem.svelte"
|
import FlowItem from "./FlowItem.svelte"
|
||||||
import Arrow from "./Arrow.svelte"
|
import TestDataModal from "./TestDataModal.svelte"
|
||||||
|
|
||||||
import { flip } from "svelte/animate"
|
import { flip } from "svelte/animate"
|
||||||
import { fade, fly } from "svelte/transition"
|
import { fade, fly } from "svelte/transition"
|
||||||
|
import {
|
||||||
|
Detail,
|
||||||
|
Icon,
|
||||||
|
ActionButton,
|
||||||
|
notifications,
|
||||||
|
Modal,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
import { database } from "stores/backend"
|
||||||
|
|
||||||
export let automation
|
export let automation
|
||||||
export let onSelect
|
export let onSelect
|
||||||
|
let testDataModal
|
||||||
let blocks
|
let blocks
|
||||||
|
$: instanceId = $database._id
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
blocks = []
|
blocks = []
|
||||||
|
@ -17,37 +30,91 @@
|
||||||
blocks = blocks.concat(automation.definition.steps || [])
|
blocks = blocks.concat(automation.definition.steps || [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deleteAutomation() {
|
||||||
|
await automationStore.actions.delete({
|
||||||
|
instanceId,
|
||||||
|
automation: $automationStore.selectedAutomation?.automation,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testAutomation() {
|
||||||
|
const result = await automationStore.actions.trigger({
|
||||||
|
automation: $automationStore.selectedAutomation.automation,
|
||||||
|
})
|
||||||
|
if (result.status === 200) {
|
||||||
|
notifications.success(
|
||||||
|
`Automation ${$automationStore.selectedAutomation.automation.name} triggered successfully.`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
notifications.error(
|
||||||
|
`Failed to trigger automation ${$automationStore.selectedAutomation.automation.name}.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !blocks.length}<i>Add a trigger to your automation to get started</i>{/if}
|
<div class="canvas">
|
||||||
<section class="canvas">
|
<div class="content">
|
||||||
{#each blocks as block, idx (block.id)}
|
<div class="title">
|
||||||
<div
|
<div class="subtitle">
|
||||||
class="block"
|
<Detail size="L">{automation.name}</Detail>
|
||||||
animate:flip={{ duration: 600 }}
|
<div
|
||||||
in:fade|local
|
style="display:flex;
|
||||||
out:fly|local={{ x: 100 }}
|
color: var(--spectrum-global-color-gray-400);"
|
||||||
>
|
>
|
||||||
<FlowItem {onSelect} {block} />
|
<span on:click={() => deleteAutomation()} class="iconPadding">
|
||||||
{#if idx !== blocks.length - 1}
|
<Icon name="DeleteOutline" />
|
||||||
<Arrow />
|
</span>
|
||||||
{/if}
|
<ActionButton
|
||||||
|
on:click={() => {
|
||||||
|
testDataModal.show()
|
||||||
|
}}
|
||||||
|
icon="MultipleCheck"
|
||||||
|
size="S">Run test</ActionButton
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{#each blocks as block, idx (block.id)}
|
||||||
</section>
|
<div
|
||||||
|
class="block"
|
||||||
|
animate:flip={{ duration: 800 }}
|
||||||
|
in:fade|local
|
||||||
|
out:fly|local={{ x: 500 }}
|
||||||
|
>
|
||||||
|
<FlowItem {testDataModal} {testAutomation} {onSelect} {block} />
|
||||||
|
{#if idx !== blocks.length - 1}
|
||||||
|
<div class="separator" />
|
||||||
|
<Icon name="AddCircle" size="S" />
|
||||||
|
<div class="separator" />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
<Modal bind:this={testDataModal} width="30%">
|
||||||
|
<TestDataModal {testAutomation} />
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
section {
|
.separator {
|
||||||
|
width: 1px;
|
||||||
|
height: 25px;
|
||||||
|
border-left: 1px dashed var(--grey-4);
|
||||||
|
color: var(--grey-4);
|
||||||
|
/* center horizontally */
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
.canvas {
|
||||||
margin: 0 -40px calc(-1 * var(--spacing-l)) -40px;
|
margin: 0 -40px calc(-1 * var(--spacing-l)) -40px;
|
||||||
padding: var(--spacing-l) 40px 0 40px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
flex: 1 1 auto;
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
/* Fix for firefox not respecting bottom padding in scrolling containers */
|
/* Fix for firefox not respecting bottom padding in scrolling containers */
|
||||||
section > *:last-child {
|
.canvas > *:last-child {
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +125,24 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
i {
|
.content {
|
||||||
font-size: var(--font-size-m);
|
display: inline-block;
|
||||||
color: var(--grey-5);
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
padding-bottom: var(--spacing-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
padding-bottom: var(--spacing-xl);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconPadding {
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
padding-right: var(--spacing-m);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,86 +1,204 @@
|
||||||
<script>
|
<script>
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
import AutomationBlockTagline from "./AutomationBlockTagline.svelte"
|
import {
|
||||||
import { Icon } from "@budibase/bbui"
|
Icon,
|
||||||
|
Divider,
|
||||||
|
Layout,
|
||||||
|
Body,
|
||||||
|
Detail,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
|
StatusLight,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
|
||||||
|
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
|
||||||
|
import ResultsModal from "./ResultsModal.svelte"
|
||||||
|
import ActionModal from "./ActionModal.svelte"
|
||||||
|
import { database } from "stores/backend"
|
||||||
|
import { externalActions } from "./ExternalActions"
|
||||||
|
|
||||||
export let onSelect
|
export let onSelect
|
||||||
export let block
|
export let block
|
||||||
|
export let testDataModal
|
||||||
let selected
|
let selected
|
||||||
|
let webhookModal
|
||||||
|
let actionModal
|
||||||
|
let resultsModal
|
||||||
|
let setupToggled
|
||||||
|
let blockComplete
|
||||||
|
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter(
|
||||||
|
step => step.stepId === block.stepId
|
||||||
|
)
|
||||||
|
$: instanceId = $database._id
|
||||||
|
|
||||||
|
$: isTrigger = block.type === "TRIGGER"
|
||||||
|
|
||||||
$: selected = $automationStore.selectedBlock?.id === block.id
|
$: selected = $automationStore.selectedBlock?.id === block.id
|
||||||
$: steps =
|
$: steps =
|
||||||
$automationStore.selectedAutomation?.automation?.definition?.steps ?? []
|
$automationStore.selectedAutomation?.automation?.definition?.steps ?? []
|
||||||
$: blockIdx = steps.findIndex(step => step.id === block.id)
|
|
||||||
$: allowDeleteTrigger = !steps.length
|
|
||||||
|
|
||||||
function deleteStep() {
|
$: blockIdx = steps.findIndex(step => step.id === block.id)
|
||||||
|
$: lastStep = !isTrigger && blockIdx + 1 === steps.length
|
||||||
|
|
||||||
|
// Logic for hiding / showing the add button.first we check if it has a child
|
||||||
|
// then we check to see whether its inputs have been commpleted
|
||||||
|
$: disableAddButton = isTrigger
|
||||||
|
? $automationStore.selectedAutomation?.automation?.definition?.steps
|
||||||
|
.length > 0
|
||||||
|
: !isTrigger && steps.length - blockIdx > 1
|
||||||
|
$: hasCompletedInputs = Object.keys(
|
||||||
|
block.schema?.inputs?.properties || {}
|
||||||
|
).every(x => block?.inputs[x])
|
||||||
|
|
||||||
|
async function deleteStep() {
|
||||||
automationStore.actions.deleteAutomationBlock(block)
|
automationStore.actions.deleteAutomationBlock(block)
|
||||||
|
await automationStore.actions.save({
|
||||||
|
instanceId,
|
||||||
|
automation: $automationStore.selectedAutomation?.automation,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class={`block ${block.type} hoverable`}
|
class={`block ${block.type} hoverable`}
|
||||||
class:selected
|
class:selected
|
||||||
on:click={() => onSelect(block)}
|
on:click={() => {
|
||||||
|
onSelect(block)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<header>
|
<div class="blockSection">
|
||||||
{#if block.type === "TRIGGER"}
|
<div
|
||||||
<Icon name="Light" />
|
on:click={() => {
|
||||||
<span>When this happens...</span>
|
blockComplete = !blockComplete
|
||||||
{:else if block.type === "ACTION"}
|
}}
|
||||||
<Icon name="FlashOn" />
|
class="splitHeader"
|
||||||
<span>Do this...</span>
|
>
|
||||||
{:else if block.type === "LOGIC"}
|
<div class="center-items">
|
||||||
<Icon name="Branch2" />
|
{#if externalActions[block.stepId]}
|
||||||
<span>Only continue if...</span>
|
<img
|
||||||
{/if}
|
alt={externalActions[block.stepId].name}
|
||||||
<div class="label">
|
width="28px"
|
||||||
{#if block.type === "TRIGGER"}Trigger{:else}Step {blockIdx + 1}{/if}
|
height="28px"
|
||||||
|
src={externalActions[block.stepId].icon}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<svg
|
||||||
|
width="28px"
|
||||||
|
height="28px"
|
||||||
|
class="spectrum-Icon"
|
||||||
|
style="color:grey;"
|
||||||
|
focusable="false"
|
||||||
|
>
|
||||||
|
<use xlink:href="#spectrum-icon-18-{block.icon}" />
|
||||||
|
</svg>
|
||||||
|
{/if}
|
||||||
|
<div class="iconAlign">
|
||||||
|
{#if isTrigger}
|
||||||
|
<Body size="XS">When this happens:</Body>
|
||||||
|
{:else}
|
||||||
|
<Body size="XS">Do this:</Body>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<Detail size="S">{block?.name?.toUpperCase() || ""}</Detail>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#if testResult}
|
||||||
|
<span on:click={() => resultsModal.show()}>
|
||||||
|
<StatusLight
|
||||||
|
positive={isTrigger || testResult[0].outputs?.success}
|
||||||
|
negative={!testResult[0].outputs?.success}
|
||||||
|
><Body size="XS">View response</Body></StatusLight
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if block.type !== "TRIGGER" || allowDeleteTrigger}
|
</div>
|
||||||
<div on:click|stopPropagation={deleteStep}><Icon name="Close" /></div>
|
{#if !blockComplete}
|
||||||
{/if}
|
<Divider noMargin />
|
||||||
</header>
|
<div class="blockSection">
|
||||||
<hr />
|
<Layout noPadding gap="S">
|
||||||
<p>
|
<div class="splitHeader">
|
||||||
<AutomationBlockTagline {block} />
|
<div
|
||||||
</p>
|
on:click|stopPropagation={() => {
|
||||||
|
setupToggled = !setupToggled
|
||||||
|
}}
|
||||||
|
class="center-items"
|
||||||
|
>
|
||||||
|
{#if setupToggled}
|
||||||
|
<Icon size="M" name="ChevronDown" />
|
||||||
|
{:else}
|
||||||
|
<Icon size="M" name="ChevronRight" />
|
||||||
|
{/if}
|
||||||
|
<Detail size="S">Setup</Detail>
|
||||||
|
</div>
|
||||||
|
{#if !isTrigger}
|
||||||
|
<div on:click={() => deleteStep()}>
|
||||||
|
<Icon name="DeleteOutline" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if setupToggled}
|
||||||
|
<AutomationBlockSetup
|
||||||
|
schemaProperties={Object.entries(block.schema.inputs.properties)}
|
||||||
|
{block}
|
||||||
|
{webhookModal}
|
||||||
|
/>
|
||||||
|
{#if lastStep}
|
||||||
|
<Button on:click={() => testDataModal.show()} cta
|
||||||
|
>Finish and test automation</Button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
<Button
|
||||||
|
disabled={disableAddButton ? true : !hasCompletedInputs}
|
||||||
|
on:click={() => {
|
||||||
|
setupToggled = false
|
||||||
|
actionModal.show()
|
||||||
|
}}
|
||||||
|
primary={!isTrigger}
|
||||||
|
cta={isTrigger}>Add Action</Button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<Modal bind:this={resultsModal} width="30%">
|
||||||
|
<ResultsModal {isTrigger} {testResult} />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal bind:this={actionModal} width="30%">
|
||||||
|
<ActionModal bind:blockComplete />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal bind:this={webhookModal} width="30%">
|
||||||
|
<CreateWebhookModal />
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.center-items {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.splitHeader {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.iconAlign {
|
||||||
|
padding: 0 0 0 var(--spacing-m);
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
.block {
|
.block {
|
||||||
width: 360px;
|
width: 360px;
|
||||||
padding: 20px;
|
|
||||||
border-radius: var(--border-radius-m);
|
|
||||||
transition: 0.3s all ease;
|
|
||||||
box-shadow: 0 4px 30px 0 rgba(57, 60, 68, 0.08);
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
background-color: var(--spectrum-global-color-gray-50);
|
background-color: var(--spectrum-alias-background-color-secondary);
|
||||||
color: var(--grey-9);
|
color: var(--grey-9);
|
||||||
}
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
||||||
.block.selected,
|
border-radius: 4px 4px 4px 4px;
|
||||||
.block:hover {
|
|
||||||
transform: scale(1.1);
|
|
||||||
box-shadow: 0 4px 30px 0 rgba(57, 60, 68, 0.15);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
.blockSection {
|
||||||
font-size: 16px;
|
padding: var(--spacing-xl);
|
||||||
font-weight: 600;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-xs);
|
|
||||||
}
|
|
||||||
header span {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
}
|
|
||||||
header .label {
|
|
||||||
font-size: 14px;
|
|
||||||
padding: var(--spacing-s);
|
|
||||||
border-radius: var(--border-radius-m);
|
|
||||||
background-color: var(--grey-2);
|
|
||||||
color: var(--grey-8);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
<script>
|
||||||
|
import { ModalContent, Icon, Detail, TextArea } from "@budibase/bbui"
|
||||||
|
|
||||||
|
export let testResult
|
||||||
|
export let isTrigger
|
||||||
|
let inputToggled
|
||||||
|
let outputToggled
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ModalContent
|
||||||
|
showCloseIcon={false}
|
||||||
|
showConfirmButton={false}
|
||||||
|
title="Test Automation"
|
||||||
|
cancelText="Close"
|
||||||
|
>
|
||||||
|
<div slot="header">
|
||||||
|
<div style="float: right;">
|
||||||
|
{#if isTrigger || testResult[0].outputs.success}
|
||||||
|
<div class="iconSuccess">
|
||||||
|
<Icon size="S" name="CheckmarkCircle" />
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="iconFailure">
|
||||||
|
<Icon size="S" name="CloseCircle" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
on:click={() => {
|
||||||
|
inputToggled = !inputToggled
|
||||||
|
}}
|
||||||
|
class="toggle splitHeader"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="padding-left: var(--spacing-s);">
|
||||||
|
<Detail size="S">Input</Detail>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{#if inputToggled}
|
||||||
|
<Icon size="M" name="ChevronDown" />
|
||||||
|
{:else}
|
||||||
|
<Icon size="M" name="ChevronRight" />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#if inputToggled}
|
||||||
|
<div class="text-area-container">
|
||||||
|
<TextArea
|
||||||
|
disabled
|
||||||
|
value={JSON.stringify(testResult[0].inputs, null, 2)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div
|
||||||
|
on:click={() => {
|
||||||
|
outputToggled = !outputToggled
|
||||||
|
}}
|
||||||
|
class="toggle splitHeader"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="padding-left: var(--spacing-s);">
|
||||||
|
<Detail size="S">Output</Detail>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{#if outputToggled}
|
||||||
|
<Icon size="M" name="ChevronDown" />
|
||||||
|
{:else}
|
||||||
|
<Icon size="M" name="ChevronRight" />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#if outputToggled}
|
||||||
|
<div class="text-area-container">
|
||||||
|
<TextArea
|
||||||
|
disabled
|
||||||
|
value={JSON.stringify(testResult[0].outputs, null, 2)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</ModalContent>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.iconSuccess {
|
||||||
|
color: var(--spectrum-global-color-green-600);
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconFailure {
|
||||||
|
color: var(--spectrum-global-color-red-600);
|
||||||
|
}
|
||||||
|
|
||||||
|
.splitHeader {
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area-container :global(textarea) {
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,88 @@
|
||||||
|
<script>
|
||||||
|
import { ModalContent, Tabs, Tab, TextArea, Label } from "@budibase/bbui"
|
||||||
|
import { automationStore } from "builderStore"
|
||||||
|
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
|
||||||
|
import { cloneDeep } from "lodash/fp"
|
||||||
|
|
||||||
|
let failedParse = null
|
||||||
|
// clone the trigger so we're not mutating the reference
|
||||||
|
let trigger = cloneDeep(
|
||||||
|
$automationStore.selectedAutomation.automation.definition.trigger
|
||||||
|
)
|
||||||
|
let schemaProperties = Object.entries(trigger.schema.outputs.properties || {})
|
||||||
|
|
||||||
|
if (!$automationStore.selectedAutomation.automation.testData) {
|
||||||
|
$automationStore.selectedAutomation.automation.testData = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the outputs so we can define the fields
|
||||||
|
|
||||||
|
// check to see if there is existing test data in the store
|
||||||
|
$: testData = $automationStore.selectedAutomation.automation.testData
|
||||||
|
// Check the schema to see if required fields have been entered
|
||||||
|
$: isError = !trigger.schema.outputs.required.every(
|
||||||
|
required => testData[required]
|
||||||
|
)
|
||||||
|
|
||||||
|
function parseTestJSON(e) {
|
||||||
|
try {
|
||||||
|
const obj = JSON.parse(e.detail)
|
||||||
|
failedParse = null
|
||||||
|
automationStore.actions.addTestDataToAutomation(obj)
|
||||||
|
} catch (e) {
|
||||||
|
failedParse = "Invalid JSON"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ModalContent
|
||||||
|
title="Add test data"
|
||||||
|
confirmText="Test"
|
||||||
|
showConfirmButton={true}
|
||||||
|
disabled={isError}
|
||||||
|
onConfirm={() => {
|
||||||
|
automationStore.actions.addTestDataToAutomation(testData)
|
||||||
|
automationStore.actions.test($automationStore.selectedAutomation, testData)
|
||||||
|
}}
|
||||||
|
cancelText="Cancel"
|
||||||
|
>
|
||||||
|
<Tabs selected="Form" quiet
|
||||||
|
><Tab icon="Form" title="Form">
|
||||||
|
<div class="tab-content-padding">
|
||||||
|
<AutomationBlockSetup
|
||||||
|
bind:testData
|
||||||
|
{schemaProperties}
|
||||||
|
isTestModal
|
||||||
|
block={trigger}
|
||||||
|
/>
|
||||||
|
</div></Tab
|
||||||
|
>
|
||||||
|
<Tab icon="FileJson" title="JSON">
|
||||||
|
<div class="tab-content-padding">
|
||||||
|
<Label>JSON</Label>
|
||||||
|
<div class="text-area-container">
|
||||||
|
<TextArea
|
||||||
|
value={JSON.stringify(
|
||||||
|
$automationStore.selectedAutomation.automation.testData,
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}
|
||||||
|
error={failedParse}
|
||||||
|
on:change={e => parseTestJSON(e)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
|
</ModalContent>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.text-area-container :global(textarea) {
|
||||||
|
min-height: 200px;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content-padding {
|
||||||
|
padding: 0 var(--spacing-xl);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -6,7 +6,6 @@
|
||||||
import EditAutomationPopover from "./EditAutomationPopover.svelte"
|
import EditAutomationPopover from "./EditAutomationPopover.svelte"
|
||||||
|
|
||||||
$: selectedAutomationId = $automationStore.selectedAutomation?.automation?._id
|
$: selectedAutomationId = $automationStore.selectedAutomation?.automation?._id
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
automationStore.actions.fetch()
|
automationStore.actions.fetch()
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
import AutomationList from "./AutomationList.svelte"
|
import AutomationList from "./AutomationList.svelte"
|
||||||
import CreateAutomationModal from "./CreateAutomationModal.svelte"
|
import CreateAutomationModal from "./CreateAutomationModal.svelte"
|
||||||
import { Icon, Modal, Tabs, Tab } from "@budibase/bbui"
|
import { Icon, Modal, Tabs, Tab } from "@budibase/bbui"
|
||||||
let modal
|
|
||||||
|
export let modal
|
||||||
|
export let webhookModal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
<div class="tab-content-padding">
|
<div class="tab-content-padding">
|
||||||
<AutomationList />
|
<AutomationList />
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<CreateAutomationModal />
|
<CreateAutomationModal {webhookModal} />
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
|
@ -3,12 +3,14 @@
|
||||||
import { database } from "stores/backend"
|
import { database } from "stores/backend"
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
import { notifications } from "@budibase/bbui"
|
import { notifications } from "@budibase/bbui"
|
||||||
import { Icon, Input, ModalContent } from "@budibase/bbui"
|
import { Input, ModalContent, Layout, Body, Icon } from "@budibase/bbui"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
|
||||||
let name
|
let name
|
||||||
|
let selectedTrigger
|
||||||
|
let triggerVal
|
||||||
|
export let webhookModal
|
||||||
|
|
||||||
$: valid = !!name
|
|
||||||
$: instanceId = $database._id
|
$: instanceId = $database._id
|
||||||
|
|
||||||
async function createAutomation() {
|
async function createAutomation() {
|
||||||
|
@ -16,41 +18,97 @@
|
||||||
name,
|
name,
|
||||||
instanceId,
|
instanceId,
|
||||||
})
|
})
|
||||||
|
const newBlock = $automationStore.selectedAutomation.constructBlock(
|
||||||
|
"TRIGGER",
|
||||||
|
triggerVal.stepId,
|
||||||
|
triggerVal
|
||||||
|
)
|
||||||
|
|
||||||
|
automationStore.actions.addBlockToAutomation(newBlock)
|
||||||
|
if (triggerVal.stepId === "WEBHOOK") {
|
||||||
|
webhookModal.show
|
||||||
|
}
|
||||||
|
|
||||||
|
await automationStore.actions.save({
|
||||||
|
instanceId,
|
||||||
|
automation: $automationStore.selectedAutomation?.automation,
|
||||||
|
})
|
||||||
|
|
||||||
notifications.success(`Automation ${name} created.`)
|
notifications.success(`Automation ${name} created.`)
|
||||||
|
|
||||||
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
|
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
|
||||||
analytics.captureEvent("Automation Created", { name })
|
analytics.captureEvent("Automation Created", { name })
|
||||||
}
|
}
|
||||||
|
$: triggers = Object.entries($automationStore.blockDefinitions.TRIGGER)
|
||||||
|
|
||||||
|
const selectTrigger = trigger => {
|
||||||
|
triggerVal = trigger
|
||||||
|
selectedTrigger = trigger.name
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title="Create Automation"
|
title="Create Automation"
|
||||||
confirmText="Create"
|
confirmText="Save"
|
||||||
size="L"
|
size="M"
|
||||||
onConfirm={createAutomation}
|
onConfirm={createAutomation}
|
||||||
disabled={!valid}
|
disabled={!selectedTrigger}
|
||||||
>
|
>
|
||||||
|
<Body size="XS"
|
||||||
|
>Please name your automation, then select a trigger. Every automation must
|
||||||
|
start with a trigger.
|
||||||
|
</Body>
|
||||||
<Input bind:value={name} label="Name" />
|
<Input bind:value={name} label="Name" />
|
||||||
<a
|
|
||||||
slot="footer"
|
<Layout noPadding>
|
||||||
target="_blank"
|
<Body size="S">Triggers</Body>
|
||||||
href="https://docs.budibase.com/automate/introduction-to-automate"
|
|
||||||
>
|
<div class="item-list">
|
||||||
<Icon name="InfoOutline" />
|
{#each triggers as [idx, trigger]}
|
||||||
<span>Learn about automations</span>
|
<div
|
||||||
</a>
|
class="item"
|
||||||
|
class:selected={selectedTrigger === trigger.name}
|
||||||
|
on:click={() => selectTrigger(trigger)}
|
||||||
|
>
|
||||||
|
<div class="item-body">
|
||||||
|
<Icon name={trigger.icon} />
|
||||||
|
<span class="icon-spacing">
|
||||||
|
<Body size="S">{trigger.name}</Body></span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
a {
|
.icon-spacing {
|
||||||
color: var(--ink);
|
margin-left: var(--spacing-m);
|
||||||
font-size: 14px;
|
|
||||||
vertical-align: middle;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
}
|
||||||
a span {
|
.item-body {
|
||||||
text-decoration: underline;
|
display: flex;
|
||||||
margin-left: var(--spectrum-alias-item-padding-s);
|
margin-left: var(--spacing-m);
|
||||||
|
}
|
||||||
|
.item-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||||
|
grid-gap: var(--spectrum-alias-grid-baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
cursor: pointer;
|
||||||
|
display: grid;
|
||||||
|
grid-gap: var(--spectrum-alias-grid-margin-xsmall);
|
||||||
|
padding: var(--spectrum-alias-item-padding-s);
|
||||||
|
background: var(--spectrum-alias-background-color-secondary);
|
||||||
|
transition: 0.3s all;
|
||||||
|
border: solid #3b3d3c;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
.selected {
|
||||||
|
background: var(--spectrum-alias-background-color-tertiary);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,8 +2,16 @@
|
||||||
import TableSelector from "./TableSelector.svelte"
|
import TableSelector from "./TableSelector.svelte"
|
||||||
import RowSelector from "./RowSelector.svelte"
|
import RowSelector from "./RowSelector.svelte"
|
||||||
import SchemaSetup from "./SchemaSetup.svelte"
|
import SchemaSetup from "./SchemaSetup.svelte"
|
||||||
import { Button, Input, Select, Label } from "@budibase/bbui"
|
import {
|
||||||
|
Button,
|
||||||
|
Input,
|
||||||
|
Select,
|
||||||
|
Label,
|
||||||
|
ActionButton,
|
||||||
|
Drawer,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
|
import { tables } from "stores/backend"
|
||||||
import WebhookDisplay from "../Shared/WebhookDisplay.svelte"
|
import WebhookDisplay from "../Shared/WebhookDisplay.svelte"
|
||||||
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
|
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
|
||||||
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
|
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
|
||||||
|
@ -12,15 +20,50 @@
|
||||||
import QueryParamSelector from "./QueryParamSelector.svelte"
|
import QueryParamSelector from "./QueryParamSelector.svelte"
|
||||||
import CronBuilder from "./CronBuilder.svelte"
|
import CronBuilder from "./CronBuilder.svelte"
|
||||||
import Editor from "components/integration/QueryEditor.svelte"
|
import Editor from "components/integration/QueryEditor.svelte"
|
||||||
|
import { database } from "stores/backend"
|
||||||
|
import { debounce } from "lodash"
|
||||||
|
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
||||||
|
import FilterDrawer from "components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte"
|
||||||
|
// need the client lucene builder to convert to the structure API expects
|
||||||
|
import { buildLuceneQuery } from "../../../../../client/src/utils/lucene"
|
||||||
|
|
||||||
export let block
|
export let block
|
||||||
export let webhookModal
|
export let webhookModal
|
||||||
$: inputs = Object.entries(block.schema?.inputs?.properties || {})
|
export let testData
|
||||||
|
export let schemaProperties
|
||||||
|
export let isTestModal = false
|
||||||
|
let drawer
|
||||||
|
let tempFilters = lookForFilters(schemaProperties) || []
|
||||||
|
let fillWidth = true
|
||||||
|
|
||||||
$: stepId = block.stepId
|
$: stepId = block.stepId
|
||||||
$: bindings = getAvailableBindings(
|
$: bindings = getAvailableBindings(
|
||||||
block,
|
block || $automationStore.selectedBlock,
|
||||||
$automationStore.selectedAutomation?.automation?.definition
|
$automationStore.selectedAutomation?.automation?.definition
|
||||||
)
|
)
|
||||||
|
$: instanceId = $database._id
|
||||||
|
|
||||||
|
$: inputData = testData ? testData : block.inputs
|
||||||
|
$: tableId = inputData ? inputData.tableId : null
|
||||||
|
$: table = tableId
|
||||||
|
? $tables.list.find(table => table._id === inputData.tableId)
|
||||||
|
: { schema: {} }
|
||||||
|
$: schemaFields = table ? Object.values(table.schema) : []
|
||||||
|
|
||||||
|
const onChange = debounce(
|
||||||
|
async function (e, key) {
|
||||||
|
if (isTestModal) {
|
||||||
|
testData[key] = e.detail
|
||||||
|
} else {
|
||||||
|
block.inputs[key] = e.detail
|
||||||
|
await automationStore.actions.save({
|
||||||
|
instanceId,
|
||||||
|
automation: $automationStore.selectedAutomation?.automation,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isTestModal ? 0 : 800
|
||||||
|
)
|
||||||
|
|
||||||
function getAvailableBindings(block, automation) {
|
function getAvailableBindings(block, automation) {
|
||||||
if (!block || !automation) {
|
if (!block || !automation) {
|
||||||
|
@ -52,64 +95,158 @@
|
||||||
}
|
}
|
||||||
return bindings
|
return bindings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lookForFilters(properties) {
|
||||||
|
if (!properties) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
let filters
|
||||||
|
const inputs = testData ? testData : block.inputs
|
||||||
|
for (let [key, field] of properties) {
|
||||||
|
// need to look for the builder definition (keyed separately, see saveFilters)
|
||||||
|
const defKey = `${key}-def`
|
||||||
|
if (field.customType === "filters" && inputs?.[defKey]) {
|
||||||
|
filters = inputs[defKey]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filters || []
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveFilters(key) {
|
||||||
|
const filters = buildLuceneQuery(tempFilters)
|
||||||
|
const defKey = `${key}-def`
|
||||||
|
inputData[key] = filters
|
||||||
|
inputData[defKey] = tempFilters
|
||||||
|
onChange({ detail: filters }, key)
|
||||||
|
// need to store the builder definition in the automation
|
||||||
|
onChange({ detail: tempFilters }, defKey)
|
||||||
|
drawer.hide()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="block-label">{block.name}</div>
|
{#each schemaProperties as [key, value]}
|
||||||
{#each inputs as [key, value]}
|
|
||||||
<div class="block-field">
|
<div class="block-field">
|
||||||
<Label>{value.title}</Label>
|
<Label>{value.title || (key === "row" ? "Table" : key)}</Label>
|
||||||
{#if value.type === "string" && value.enum}
|
{#if value.type === "string" && value.enum}
|
||||||
<Select
|
<Select
|
||||||
bind:value={block.inputs[key]}
|
on:change={e => onChange(e, key)}
|
||||||
|
value={inputData[key]}
|
||||||
options={value.enum}
|
options={value.enum}
|
||||||
getOptionLabel={(x, idx) => (value.pretty ? value.pretty[idx] : x)}
|
getOptionLabel={(x, idx) => (value.pretty ? value.pretty[idx] : x)}
|
||||||
/>
|
/>
|
||||||
|
{:else if value.customType === "column"}
|
||||||
|
<Select
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
value={inputData[key]}
|
||||||
|
options={Object.keys(table.schema)}
|
||||||
|
/>
|
||||||
|
{:else if value.customType === "filters"}
|
||||||
|
<ActionButton on:click={drawer.show}>Define filters</ActionButton>
|
||||||
|
<Drawer bind:this={drawer} {fillWidth} title="Filtering">
|
||||||
|
<Button cta slot="buttons" on:click={() => saveFilters(key)}
|
||||||
|
>Save</Button
|
||||||
|
>
|
||||||
|
<FilterDrawer
|
||||||
|
slot="body"
|
||||||
|
bind:filters={tempFilters}
|
||||||
|
{bindings}
|
||||||
|
{schemaFields}
|
||||||
|
panel={AutomationBindingPanel}
|
||||||
|
/>
|
||||||
|
</Drawer>
|
||||||
{:else if value.customType === "password"}
|
{:else if value.customType === "password"}
|
||||||
<Input type="password" bind:value={block.inputs[key]} />
|
<Input
|
||||||
|
type="password"
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
value={inputData[key]}
|
||||||
|
/>
|
||||||
{:else if value.customType === "email"}
|
{:else if value.customType === "email"}
|
||||||
<DrawerBindableInput
|
{#if isTestModal}
|
||||||
title={value.title}
|
<ModalBindableInput
|
||||||
panel={AutomationBindingPanel}
|
title={value.title}
|
||||||
type="email"
|
value={inputData[key]}
|
||||||
value={block.inputs[key]}
|
panel={AutomationBindingPanel}
|
||||||
on:change={e => (block.inputs[key] = e.detail)}
|
type="email"
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
{bindings}
|
||||||
|
fillWidth
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<DrawerBindableInput
|
||||||
|
fillWidth
|
||||||
|
title={value.title}
|
||||||
|
panel={AutomationBindingPanel}
|
||||||
|
type="email"
|
||||||
|
value={inputData[key]}
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
{bindings}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
{:else if value.customType === "query"}
|
||||||
|
<QuerySelector
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
value={inputData[key]}
|
||||||
|
/>
|
||||||
|
{:else if value.customType === "cron"}
|
||||||
|
<CronBuilder on:change={e => onChange(e, key)} value={inputData[key]} />
|
||||||
|
{:else if value.customType === "queryParams"}
|
||||||
|
<QueryParamSelector
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
value={inputData[key]}
|
||||||
{bindings}
|
{bindings}
|
||||||
/>
|
/>
|
||||||
{:else if value.customType === "query"}
|
|
||||||
<QuerySelector bind:value={block.inputs[key]} />
|
|
||||||
{:else if value.customType === "cron"}
|
|
||||||
<CronBuilder bind:value={block.inputs[key]} />
|
|
||||||
{:else if value.customType === "queryParams"}
|
|
||||||
<QueryParamSelector bind:value={block.inputs[key]} {bindings} />
|
|
||||||
{:else if value.customType === "table"}
|
{:else if value.customType === "table"}
|
||||||
<TableSelector bind:value={block.inputs[key]} />
|
<TableSelector
|
||||||
|
value={inputData[key]}
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
/>
|
||||||
{:else if value.customType === "row"}
|
{:else if value.customType === "row"}
|
||||||
<RowSelector bind:value={block.inputs[key]} {bindings} />
|
<RowSelector
|
||||||
|
value={inputData[key]}
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
{bindings}
|
||||||
|
/>
|
||||||
{:else if value.customType === "webhookUrl"}
|
{:else if value.customType === "webhookUrl"}
|
||||||
<WebhookDisplay value={block.inputs[key]} />
|
<WebhookDisplay value={inputData[key]} />
|
||||||
{:else if value.customType === "triggerSchema"}
|
{:else if value.customType === "triggerSchema"}
|
||||||
<SchemaSetup bind:value={block.inputs[key]} />
|
<SchemaSetup on:change={e => onChange(e, key)} value={value[key]} />
|
||||||
{:else if value.customType === "code"}
|
{:else if value.customType === "code"}
|
||||||
<CodeEditorModal>
|
<CodeEditorModal>
|
||||||
<pre>{JSON.stringify(bindings, null, 2)}</pre>
|
<pre>{JSON.stringify(bindings, null, 2)}</pre>
|
||||||
<Editor
|
<Editor
|
||||||
mode="javascript"
|
mode="javascript"
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
block.inputs[key] = e.detail.value
|
onChange(e, key)
|
||||||
|
inputData[key] = e.detail.value
|
||||||
}}
|
}}
|
||||||
value={block.inputs[key]}
|
value={inputData[key]}
|
||||||
/>
|
/>
|
||||||
</CodeEditorModal>
|
</CodeEditorModal>
|
||||||
{:else if value.type === "string" || value.type === "number"}
|
{:else if value.type === "string" || value.type === "number"}
|
||||||
<DrawerBindableInput
|
{#if isTestModal}
|
||||||
title={value.title}
|
<ModalBindableInput
|
||||||
panel={AutomationBindingPanel}
|
title={value.title}
|
||||||
type={value.customType}
|
value={inputData[key]}
|
||||||
value={block.inputs[key]}
|
panel={AutomationBindingPanel}
|
||||||
on:change={e => (block.inputs[key] = e.detail)}
|
type={value.customType}
|
||||||
{bindings}
|
on:change={e => onChange(e, key)}
|
||||||
/>
|
{bindings}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<div class="test">
|
||||||
|
<DrawerBindableInput
|
||||||
|
fillWidth={true}
|
||||||
|
title={value.title}
|
||||||
|
panel={AutomationBindingPanel}
|
||||||
|
type={value.customType}
|
||||||
|
value={inputData[key]}
|
||||||
|
on:change={e => onChange(e, key)}
|
||||||
|
{bindings}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -132,9 +269,7 @@
|
||||||
grid-gap: 5px;
|
grid-gap: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.block-label {
|
.test :global(.drawer) {
|
||||||
font-weight: 600;
|
width: 10000px !important;
|
||||||
font-size: var(--font-size-s);
|
|
||||||
color: var(--grey-7);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Select, Input } from "@budibase/bbui"
|
import { Button, Select, Input } from "@budibase/bbui"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
const onChange = e => {
|
||||||
|
value = e.detail
|
||||||
|
dispatch("change", e.detail)
|
||||||
|
}
|
||||||
|
|
||||||
let presets = false
|
let presets = false
|
||||||
|
|
||||||
|
@ -30,7 +36,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="block-field">
|
<div class="block-field">
|
||||||
<Input bind:value />
|
<Input on:change={onChange} {value} />
|
||||||
|
|
||||||
<div class="presets">
|
<div class="presets">
|
||||||
<Button on:click={() => (presets = !presets)}
|
<Button on:click={() => (presets = !presets)}
|
||||||
|
@ -38,7 +44,8 @@
|
||||||
>
|
>
|
||||||
{#if presets}
|
{#if presets}
|
||||||
<Select
|
<Select
|
||||||
bind:value
|
on:change={onChange}
|
||||||
|
{value}
|
||||||
secondary
|
secondary
|
||||||
extraThin
|
extraThin
|
||||||
label="Presets"
|
label="Presets"
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
label={field.name}
|
label={field.name}
|
||||||
type="string"
|
type="string"
|
||||||
{bindings}
|
{bindings}
|
||||||
|
fillWidth={true}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,12 +3,25 @@
|
||||||
import { Select } from "@budibase/bbui"
|
import { Select } from "@budibase/bbui"
|
||||||
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
|
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
|
||||||
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
|
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
||||||
|
import { automationStore } from "builderStore"
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
export let bindings
|
export let bindings
|
||||||
|
|
||||||
$: table = $tables.list.find(table => table._id === value?.tableId)
|
$: table = $tables.list.find(table => table._id === value?.tableId)
|
||||||
$: schemaFields = Object.entries(table?.schema ?? {})
|
$: schemaFields = Object.entries(table?.schema ?? {})
|
||||||
|
const onChangeTable = e => {
|
||||||
|
value = { tableId: e.detail }
|
||||||
|
dispatch("change", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const onChange = (e, field) => {
|
||||||
|
value[field] = e.detail
|
||||||
|
dispatch("change", value)
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure any nullish tableId values get set to empty string so
|
// Ensure any nullish tableId values get set to empty string so
|
||||||
// that the select works
|
// that the select works
|
||||||
|
@ -20,7 +33,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
bind:value={value.tableId}
|
on:change={onChangeTable}
|
||||||
|
value={value.tableId}
|
||||||
options={$tables.list}
|
options={$tables.list}
|
||||||
getOptionLabel={table => table.name}
|
getOptionLabel={table => table.name}
|
||||||
getOptionValue={table => table._id}
|
getOptionValue={table => table._id}
|
||||||
|
@ -32,19 +46,32 @@
|
||||||
{#if !schema.autocolumn}
|
{#if !schema.autocolumn}
|
||||||
{#if schemaHasOptions(schema)}
|
{#if schemaHasOptions(schema)}
|
||||||
<Select
|
<Select
|
||||||
|
on:change={e => onChange(e, field)}
|
||||||
label={field}
|
label={field}
|
||||||
bind:value={value[field]}
|
value={value[field]}
|
||||||
options={schema.constraints.inclusion}
|
options={schema.constraints.inclusion}
|
||||||
/>
|
/>
|
||||||
{:else if schema.type === "string" || schema.type === "number"}
|
{:else if schema.type === "string" || schema.type === "number"}
|
||||||
<DrawerBindableInput
|
{#if $automationStore.selectedAutomation.automation.testData}
|
||||||
panel={AutomationBindingPanel}
|
<ModalBindableInput
|
||||||
value={value[field]}
|
value={value[field]}
|
||||||
on:change={e => (value[field] = e.detail)}
|
panel={AutomationBindingPanel}
|
||||||
label={field}
|
label={field}
|
||||||
type="string"
|
type={value.customType}
|
||||||
{bindings}
|
on:change={e => onChange(e, field)}
|
||||||
/>
|
{bindings}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<DrawerBindableInput
|
||||||
|
panel={AutomationBindingPanel}
|
||||||
|
value={value[field]}
|
||||||
|
on:change={e => onChange(e, field)}
|
||||||
|
label={field}
|
||||||
|
type="string"
|
||||||
|
{bindings}
|
||||||
|
fillWidth={true}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { Input, Select } from "@budibase/bbui"
|
import { Input, Select } from "@budibase/bbui"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let value = {}
|
export let value = {}
|
||||||
$: fieldsArray = Object.entries(value).map(([name, type]) => ({
|
$: fieldsArray = Object.entries(value).map(([name, type]) => ({
|
||||||
|
@ -28,13 +31,13 @@
|
||||||
function addField() {
|
function addField() {
|
||||||
const newValue = { ...value }
|
const newValue = { ...value }
|
||||||
newValue[""] = "string"
|
newValue[""] = "string"
|
||||||
value = newValue
|
dispatch("change", newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeField(name) {
|
function removeField(name) {
|
||||||
const newValues = { ...value }
|
const newValues = { ...value }
|
||||||
delete newValues[name]
|
delete newValues[name]
|
||||||
value = newValues
|
dispatch("change", newValues)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldNameChanged = originalName => e => {
|
const fieldNameChanged = originalName => e => {
|
||||||
|
@ -50,6 +53,7 @@
|
||||||
newVals[current.name] = current.type
|
newVals[current.name] = current.type
|
||||||
return newVals
|
return newVals
|
||||||
}, {})
|
}, {})
|
||||||
|
dispatch("change", value)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -68,7 +72,10 @@
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
value={field.type}
|
value={field.type}
|
||||||
on:change={e => (value[field.name] = e.target.value)}
|
on:change={e => {
|
||||||
|
value[field.name] = e.target.value
|
||||||
|
dispatch("change", value)
|
||||||
|
}}
|
||||||
options={typeOptions}
|
options={typeOptions}
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
<script>
|
|
||||||
import { automationStore } from "builderStore"
|
|
||||||
import { database } from "stores/backend"
|
|
||||||
import { notifications, Button, Modal, Heading, Toggle } from "@budibase/bbui"
|
|
||||||
import AutomationBlockSetup from "./AutomationBlockSetup.svelte"
|
|
||||||
import CreateWebookModal from "../Shared/CreateWebhookModal.svelte"
|
|
||||||
|
|
||||||
let webhookModal
|
|
||||||
|
|
||||||
$: instanceId = $database._id
|
|
||||||
$: automation = $automationStore.selectedAutomation?.automation
|
|
||||||
$: automationLive = automation?.live
|
|
||||||
|
|
||||||
function setAutomationLive(live) {
|
|
||||||
if (automationLive === live) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
automation.live = live
|
|
||||||
automationStore.actions.save({ instanceId, automation })
|
|
||||||
if (live) {
|
|
||||||
notifications.info(`Automation ${automation.name} enabled.`)
|
|
||||||
} else {
|
|
||||||
notifications.error(`Automation ${automation.name} disabled.`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function testAutomation() {
|
|
||||||
const result = await automationStore.actions.test({
|
|
||||||
automation: $automationStore.selectedAutomation.automation,
|
|
||||||
})
|
|
||||||
if (result.status === 200) {
|
|
||||||
notifications.success(
|
|
||||||
`Automation ${automation.name} triggered successfully.`
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
notifications.error(`Failed to trigger automation ${automation.name}.`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function saveAutomation() {
|
|
||||||
await automationStore.actions.save({
|
|
||||||
instanceId,
|
|
||||||
automation,
|
|
||||||
})
|
|
||||||
notifications.success(`Automation ${automation.name} saved.`)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="title">
|
|
||||||
<Heading size="S">Setup</Heading>
|
|
||||||
<Toggle
|
|
||||||
value={automationLive}
|
|
||||||
on:change={() => setAutomationLive(!automationLive)}
|
|
||||||
dataCy="activate-automation"
|
|
||||||
text="Live"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{#if $automationStore.selectedBlock}
|
|
||||||
<AutomationBlockSetup
|
|
||||||
bind:block={$automationStore.selectedBlock}
|
|
||||||
{webhookModal}
|
|
||||||
/>
|
|
||||||
{:else if automation}
|
|
||||||
<div class="block-label">{automation.name}</div>
|
|
||||||
<Button secondary on:click={testAutomation}>Test Automation</Button>
|
|
||||||
{/if}
|
|
||||||
<Button
|
|
||||||
secondary
|
|
||||||
wide
|
|
||||||
data-cy="save-automation-setup"
|
|
||||||
on:click={saveAutomation}
|
|
||||||
>
|
|
||||||
Save Automation
|
|
||||||
</Button>
|
|
||||||
<Modal bind:this={webhookModal} width="30%">
|
|
||||||
<CreateWebookModal />
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.title {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-xs);
|
|
||||||
}
|
|
||||||
.title :global(h1) {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-label {
|
|
||||||
font-size: var(--spectrum-global-dimension-font-size-75);
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--grey-7);
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,11 +1,20 @@
|
||||||
<script>
|
<script>
|
||||||
import { tables } from "stores/backend"
|
import { tables } from "stores/backend"
|
||||||
import { Select } from "@budibase/bbui"
|
import { Select } from "@budibase/bbui"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
|
||||||
|
const onChange = e => {
|
||||||
|
value = e.detail
|
||||||
|
dispatch("change", e.detail)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
on:change={onChange}
|
||||||
bind:value
|
bind:value
|
||||||
options={$tables.list}
|
options={$tables.list}
|
||||||
getOptionLabel={table => table.name}
|
getOptionLabel={table => table.name}
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte"
|
import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte"
|
||||||
import ICONS from "./icons"
|
import ICONS from "./icons"
|
||||||
|
|
||||||
|
let openDataSources = []
|
||||||
|
|
||||||
function selectDatasource(datasource) {
|
function selectDatasource(datasource) {
|
||||||
|
toggleNode(datasource)
|
||||||
datasources.select(datasource._id)
|
datasources.select(datasource._id)
|
||||||
$goto(`./datasource/${datasource._id}`)
|
$goto(`./datasource/${datasource._id}`)
|
||||||
}
|
}
|
||||||
|
@ -19,6 +22,15 @@
|
||||||
$goto(`./datasource/${query.datasourceId}/${query._id}`)
|
$goto(`./datasource/${query.datasourceId}/${query._id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleNode(datasource) {
|
||||||
|
const isOpen = openDataSources.includes(datasource._id)
|
||||||
|
if (isOpen) {
|
||||||
|
openDataSources = openDataSources.filter(id => datasource._id !== id)
|
||||||
|
} else {
|
||||||
|
openDataSources = [...openDataSources, datasource._id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
datasources.fetch()
|
datasources.fetch()
|
||||||
queries.fetch()
|
queries.fetch()
|
||||||
|
@ -31,8 +43,11 @@
|
||||||
<NavItem
|
<NavItem
|
||||||
border={idx > 0}
|
border={idx > 0}
|
||||||
text={datasource.name}
|
text={datasource.name}
|
||||||
|
opened={openDataSources.includes(datasource._id)}
|
||||||
selected={$datasources.selected === datasource._id}
|
selected={$datasources.selected === datasource._id}
|
||||||
|
withArrow={true}
|
||||||
on:click={() => selectDatasource(datasource)}
|
on:click={() => selectDatasource(datasource)}
|
||||||
|
on:iconClick={() => toggleNode(datasource)}
|
||||||
>
|
>
|
||||||
<div class="datasource-icon" slot="icon">
|
<div class="datasource-icon" slot="icon">
|
||||||
<svelte:component
|
<svelte:component
|
||||||
|
@ -46,13 +61,16 @@
|
||||||
{/if}
|
{/if}
|
||||||
</NavItem>
|
</NavItem>
|
||||||
|
|
||||||
<TableNavigator sourceId={datasource._id} />
|
{#if openDataSources.includes(datasource._id)}
|
||||||
|
<TableNavigator sourceId={datasource._id} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#each $queries.list.filter(query => query.datasourceId === datasource._id) as query}
|
{#each $queries.list.filter(query => query.datasourceId === datasource._id) as query}
|
||||||
<NavItem
|
<NavItem
|
||||||
indentLevel={1}
|
indentLevel={1}
|
||||||
icon="SQLQuery"
|
icon="SQLQuery"
|
||||||
text={query.name}
|
text={query.name}
|
||||||
|
opened={$queries.selected === query._id}
|
||||||
selected={$queries.selected === query._id}
|
selected={$queries.selected === query._id}
|
||||||
on:click={() => onClickQuery(query)}
|
on:click={() => onClickQuery(query)}
|
||||||
>
|
>
|
||||||
|
|
|
@ -8,9 +8,28 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { admin } from "stores/portal"
|
import { admin } from "stores/portal"
|
||||||
import { goto } from "@roxi/routify"
|
import { goto } from "@roxi/routify"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
|
let width = window.innerWidth
|
||||||
|
$: side = width < 500 ? "right" : "left"
|
||||||
|
|
||||||
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
|
if (entries?.[0]) {
|
||||||
|
width = entries[0].contentRect?.width
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const doc = document.documentElement
|
||||||
|
resizeObserver.observe(doc)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
resizeObserver.unobserve(doc)
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ActionMenu>
|
<ActionMenu align={side}>
|
||||||
<div slot="control" class="icon">
|
<div slot="control" class="icon">
|
||||||
<ProgressCircle size="S" value={$admin.onboardingProgress} />
|
<ProgressCircle size="S" value={$admin.onboardingProgress} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,7 +56,7 @@
|
||||||
.item {
|
.item {
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
grid-template-columns: 200px 20px;
|
grid-template-columns: 175px 20px;
|
||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { Icon } from "@budibase/bbui"
|
import { Icon } from "@budibase/bbui"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let icon
|
export let icon
|
||||||
export let withArrow = false
|
export let withArrow = false
|
||||||
|
@ -10,6 +11,13 @@
|
||||||
export let selected = false
|
export let selected = false
|
||||||
export let opened = false
|
export let opened = false
|
||||||
export let draggable = false
|
export let draggable = false
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
function onIconClick(event) {
|
||||||
|
event.stopPropagation()
|
||||||
|
dispatch("iconClick")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -28,7 +36,7 @@
|
||||||
>
|
>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{#if withArrow}
|
{#if withArrow}
|
||||||
<div class:opened class="icon arrow">
|
<div class:opened class="icon arrow" on:click={onIconClick}>
|
||||||
<Icon size="S" name="ChevronRight" />
|
<Icon size="S" name="ChevronRight" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
export let placeholder
|
export let placeholder
|
||||||
export let label
|
export let label
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
export let fillWidth
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
let bindingDrawer
|
let bindingDrawer
|
||||||
|
@ -45,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<Drawer bind:this={bindingDrawer} {title}>
|
<Drawer {fillWidth} bind:this={bindingDrawer} {title}>
|
||||||
<svelte:fragment slot="description">
|
<svelte:fragment slot="description">
|
||||||
Add the objects on the left to enrich your text.
|
Add the objects on the left to enrich your text.
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount } from "svelte"
|
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
|
import { onMount, onDestroy } from "svelte"
|
||||||
import { store, currentAsset } from "builderStore"
|
import { store, currentAsset } from "builderStore"
|
||||||
import iframeTemplate from "./iframeTemplate"
|
import iframeTemplate from "./iframeTemplate"
|
||||||
import { Screen } from "builderStore/store/screenTemplates/utils/Screen"
|
import { Screen } from "builderStore/store/screenTemplates/utils/Screen"
|
||||||
|
@ -99,51 +99,78 @@
|
||||||
{ once: true }
|
{ once: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
// Add listener for events sent by cliebt library in preview
|
// Add listener for events sent by client library in preview
|
||||||
iframe.contentWindow.addEventListener("bb-event", event => {
|
iframe.contentWindow.addEventListener("bb-event", handleBudibaseEvent)
|
||||||
const { type, data } = event.detail
|
iframe.contentWindow.addEventListener("keydown", handleKeydownEvent)
|
||||||
if (type === "select-component" && data.id) {
|
|
||||||
store.actions.components.select({ _id: data.id })
|
|
||||||
} else if (type === "update-prop") {
|
|
||||||
store.actions.components.updateProp(data.prop, data.value)
|
|
||||||
} else if (type === "delete-component" && data.id) {
|
|
||||||
idToDelete = data.id
|
|
||||||
confirmDeleteDialog.show()
|
|
||||||
} else if (type === "preview-loaded") {
|
|
||||||
// Wait for this event to show the client library if intelligent
|
|
||||||
// loading is supported
|
|
||||||
loading = false
|
|
||||||
} else if (type === "move-component") {
|
|
||||||
// Copy
|
|
||||||
const sourceComponent = findComponent(
|
|
||||||
get(currentAsset).props,
|
|
||||||
data.componentId
|
|
||||||
)
|
|
||||||
const destinationComponent = findComponent(
|
|
||||||
get(currentAsset).props,
|
|
||||||
data.destinationComponentId
|
|
||||||
)
|
|
||||||
|
|
||||||
// Stop if the target is a child of source
|
|
||||||
const path = findComponentPath(
|
|
||||||
sourceComponent,
|
|
||||||
data.destinationComponentId
|
|
||||||
)
|
|
||||||
const ids = path.map(component => component._id)
|
|
||||||
if (ids.includes(data.destinationComponentId)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceComponent && destinationComponent) {
|
|
||||||
store.actions.components.copy(sourceComponent, true)
|
|
||||||
store.actions.components.paste(destinationComponent, data.mode)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.warning(`Client sent unknown event type: ${type}`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Remove all iframe event listeners on component destroy
|
||||||
|
onDestroy(() => {
|
||||||
|
if (iframe.contentWindow) {
|
||||||
|
iframe.contentWindow.removeEventListener("bb-event", handleBudibaseEvent)
|
||||||
|
iframe.contentWindow.removeEventListener("keydown", handleKeydownEvent)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleBudibaseEvent = event => {
|
||||||
|
const { type, data } = event.detail
|
||||||
|
if (type === "select-component" && data.id) {
|
||||||
|
store.actions.components.select({ _id: data.id })
|
||||||
|
} else if (type === "update-prop") {
|
||||||
|
store.actions.components.updateProp(data.prop, data.value)
|
||||||
|
} else if (type === "delete-component" && data.id) {
|
||||||
|
confirmDeleteComponent(data.id)
|
||||||
|
} else if (type === "preview-loaded") {
|
||||||
|
// Wait for this event to show the client library if intelligent
|
||||||
|
// loading is supported
|
||||||
|
loading = false
|
||||||
|
} else if (type === "move-component") {
|
||||||
|
// Copy
|
||||||
|
const sourceComponent = findComponent(
|
||||||
|
get(currentAsset).props,
|
||||||
|
data.componentId
|
||||||
|
)
|
||||||
|
const destinationComponent = findComponent(
|
||||||
|
get(currentAsset).props,
|
||||||
|
data.destinationComponentId
|
||||||
|
)
|
||||||
|
|
||||||
|
// Stop if the target is a child of source
|
||||||
|
const path = findComponentPath(
|
||||||
|
sourceComponent,
|
||||||
|
data.destinationComponentId
|
||||||
|
)
|
||||||
|
const ids = path.map(component => component._id)
|
||||||
|
if (ids.includes(data.destinationComponentId)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceComponent && destinationComponent) {
|
||||||
|
store.actions.components.copy(sourceComponent, true)
|
||||||
|
store.actions.components.paste(destinationComponent, data.mode)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warning(`Client sent unknown event type: ${type}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleKeydownEvent = event => {
|
||||||
|
if (
|
||||||
|
(event.key === "Delete" || event.key === "Backspace") &&
|
||||||
|
selectedComponentId &&
|
||||||
|
["input", "textarea"].indexOf(
|
||||||
|
iframe.contentWindow.document.activeElement?.tagName.toLowerCase()
|
||||||
|
) === -1
|
||||||
|
) {
|
||||||
|
confirmDeleteComponent(selectedComponentId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmDeleteComponent = componentId => {
|
||||||
|
idToDelete = componentId
|
||||||
|
confirmDeleteDialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
const deleteComponent = () => {
|
const deleteComponent = () => {
|
||||||
store.actions.components.delete({ _id: idToDelete })
|
store.actions.components.delete({ _id: idToDelete })
|
||||||
idToDelete = null
|
idToDelete = null
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
DatePicker,
|
|
||||||
Icon,
|
|
||||||
Button,
|
|
||||||
Select,
|
|
||||||
Combobox,
|
|
||||||
Input,
|
|
||||||
DrawerContent,
|
|
||||||
Layout,
|
|
||||||
Body,
|
Body,
|
||||||
|
Button,
|
||||||
|
Combobox,
|
||||||
|
DatePicker,
|
||||||
|
DrawerContent,
|
||||||
|
Icon,
|
||||||
|
Input,
|
||||||
|
Layout,
|
||||||
|
Select,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||||
|
import BindingPanel from "components/common/bindings/BindingPanel.svelte"
|
||||||
import { generate } from "shortid"
|
import { generate } from "shortid"
|
||||||
import { OperatorOptions, getValidOperatorsForType } from "helpers/lucene"
|
import { getValidOperatorsForType, OperatorOptions } from "helpers/lucene"
|
||||||
|
|
||||||
export let schemaFields
|
export let schemaFields
|
||||||
export let filters = []
|
export let filters = []
|
||||||
export let bindings = []
|
export let bindings = []
|
||||||
|
export let panel = BindingPanel
|
||||||
|
|
||||||
const BannedTypes = ["link", "attachment", "formula"]
|
const BannedTypes = ["link", "attachment", "formula"]
|
||||||
|
|
||||||
|
@ -82,9 +84,7 @@
|
||||||
|
|
||||||
const getFieldOptions = field => {
|
const getFieldOptions = field => {
|
||||||
const schema = schemaFields.find(x => x.name === field)
|
const schema = schemaFields.find(x => x.name === field)
|
||||||
const opt = schema?.constraints?.inclusion || []
|
return schema?.constraints?.inclusion || []
|
||||||
|
|
||||||
return opt
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@
|
||||||
title={`Value for "${filter.field}"`}
|
title={`Value for "${filter.field}"`}
|
||||||
value={filter.value}
|
value={filter.value}
|
||||||
placeholder="Value"
|
placeholder="Value"
|
||||||
|
{panel}
|
||||||
{bindings}
|
{bindings}
|
||||||
on:change={event => (filter.value = event.detail)}
|
on:change={event => (filter.value = event.detail)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</Heading>
|
</Heading>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="desktop">
|
||||||
{#if app.updatedAt}
|
{#if app.updatedAt}
|
||||||
{processStringSync("Updated {{ duration time 'millisecond' }} ago", {
|
{processStringSync("Updated {{ duration time 'millisecond' }} ago", {
|
||||||
time: new Date().getTime() - new Date(app.updatedAt).getTime(),
|
time: new Date().getTime() - new Date(app.updatedAt).getTime(),
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
Never updated
|
Never updated
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="desktop">
|
||||||
<StatusLight
|
<StatusLight
|
||||||
positive={!app.lockedYou && !app.lockedOther}
|
positive={!app.lockedYou && !app.lockedOther}
|
||||||
notice={app.lockedYou}
|
notice={app.lockedYou}
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</StatusLight>
|
</StatusLight>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="desktop">
|
||||||
<StatusLight active={app.deployed} neutral={!app.deployed}>
|
<StatusLight active={app.deployed} neutral={!app.deployed}>
|
||||||
{#if app.deployed}Published{:else}Unpublished{/if}
|
{#if app.deployed}Published{:else}Unpublished{/if}
|
||||||
</StatusLight>
|
</StatusLight>
|
||||||
|
@ -109,4 +109,10 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: color 130ms ease;
|
transition: color 130ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.desktop {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title={template ? "Import app" : "Create new app"}
|
title={template ? "Import app" : "Create app"}
|
||||||
confirmText={template ? "Import app" : "Create app"}
|
confirmText={template ? "Import app" : "Create app"}
|
||||||
onConfirm={createNewApp}
|
onConfirm={createNewApp}
|
||||||
disabled={!valid}
|
disabled={!valid}
|
||||||
|
|
|
@ -6,31 +6,35 @@
|
||||||
let loaded = false
|
let loaded = false
|
||||||
|
|
||||||
$: multiTenancyEnabled = $admin.multiTenancy
|
$: multiTenancyEnabled = $admin.multiTenancy
|
||||||
$: hasAdminUser = $admin?.checklist?.adminUser.checked
|
$: hasAdminUser = $admin?.checklist?.adminUser?.checked
|
||||||
$: tenantSet = $auth.tenantSet
|
$: tenantSet = $auth.tenantSet
|
||||||
|
$: cloud = $admin.cloud
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await admin.init()
|
|
||||||
await auth.checkAuth()
|
await auth.checkAuth()
|
||||||
|
await admin.init()
|
||||||
loaded = true
|
loaded = true
|
||||||
})
|
})
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
const apiReady = $admin.loaded && $auth.loaded
|
// We should never see the org or admin user creation screens in the cloud
|
||||||
// if tenant is not set go to it
|
if (!cloud) {
|
||||||
if (loaded && apiReady && multiTenancyEnabled && !tenantSet) {
|
const apiReady = $admin.loaded && $auth.loaded
|
||||||
$redirect("./auth/org")
|
// if tenant is not set go to it
|
||||||
}
|
if (loaded && apiReady && multiTenancyEnabled && !tenantSet) {
|
||||||
// Force creation of an admin user if one doesn't exist
|
$redirect("./auth/org")
|
||||||
else if (loaded && apiReady && !hasAdminUser) {
|
}
|
||||||
$redirect("./admin")
|
// Force creation of an admin user if one doesn't exist
|
||||||
|
else if (loaded && apiReady && !hasAdminUser) {
|
||||||
|
$redirect("./admin")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Redirect to log in at any time if the user isn't authenticated
|
// Redirect to log in at any time if the user isn't authenticated
|
||||||
$: {
|
$: {
|
||||||
if (
|
if (
|
||||||
loaded &&
|
loaded &&
|
||||||
hasAdminUser &&
|
(hasAdminUser || cloud) &&
|
||||||
!$auth.user &&
|
!$auth.user &&
|
||||||
!$isActive("./auth") &&
|
!$isActive("./auth") &&
|
||||||
!$isActive("./invite")
|
!$isActive("./invite")
|
||||||
|
|
|
@ -1,22 +1,50 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { Heading, Body, Layout, Button, Modal } from "@budibase/bbui"
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
import AutomationPanel from "components/automation/AutomationPanel/AutomationPanel.svelte"
|
import AutomationPanel from "components/automation/AutomationPanel/AutomationPanel.svelte"
|
||||||
import SetupPanel from "components/automation/SetupPanel/SetupPanel.svelte"
|
import CreateAutomationModal from "components/automation/AutomationPanel/CreateAutomationModal.svelte"
|
||||||
|
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
|
||||||
|
$: automation = $automationStore.automations[0]
|
||||||
|
let modal
|
||||||
|
let webhookModal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- routify:options index=3 -->
|
<!-- routify:options index=3 -->
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<AutomationPanel />
|
<AutomationPanel {modal} {webhookModal} />
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<slot />
|
{#if automation}
|
||||||
|
<slot />
|
||||||
|
{:else}
|
||||||
|
<div class="centered">
|
||||||
|
<div class="main">
|
||||||
|
<Layout gap="S" justifyItems="center">
|
||||||
|
<svg
|
||||||
|
width="60px"
|
||||||
|
height="60px"
|
||||||
|
class="spectrum-Icon"
|
||||||
|
focusable="false"
|
||||||
|
>
|
||||||
|
<use xlink:href="#spectrum-icon-18-WorkflowAdd" />
|
||||||
|
</svg>
|
||||||
|
<Heading size="M">You have no automations</Heading>
|
||||||
|
<Body size="M">Let's fix that. Call the bots!</Body>
|
||||||
|
<Button on:click={() => modal.show()} size="M" cta
|
||||||
|
>Create automation</Button
|
||||||
|
>
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if $automationStore.selectedAutomation}
|
<Modal bind:this={modal}>
|
||||||
<div class="setup">
|
<CreateAutomationModal {webhookModal} />
|
||||||
<SetupPanel />
|
</Modal>
|
||||||
</div>
|
<Modal bind:this={webhookModal} width="30%">
|
||||||
{/if}
|
<CreateWebhookModal />
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -24,7 +52,7 @@
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
height: 0;
|
height: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 260px minmax(510px, 1fr) 260px;
|
grid-template-columns: 260px minmax(510px, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
|
@ -48,16 +76,20 @@
|
||||||
gap: var(--spacing-l);
|
gap: var(--spacing-l);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
.centered {
|
||||||
.setup {
|
top: 0;
|
||||||
padding: var(--spectrum-global-dimension-size-200);
|
bottom: 0;
|
||||||
border-left: var(--border-light);
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: center;
|
||||||
align-items: stretch;
|
align-items: center;
|
||||||
gap: var(--spacing-l);
|
}
|
||||||
background-color: var(--background);
|
|
||||||
overflow-y: auto;
|
.main {
|
||||||
|
width: 300px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -15,13 +15,3 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i>Create your first automation to get started</i>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
i {
|
|
||||||
font-size: var(--font-size-m);
|
|
||||||
color: var(--grey-5);
|
|
||||||
margin-top: 2px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -41,17 +41,8 @@
|
||||||
<Page>
|
<Page>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<img alt="logo" src={$organisation.logoUrl || Logo} />
|
<div class="header">
|
||||||
<div class="info-title">
|
<img alt="logo" src={$organisation.logoUrl || Logo} />
|
||||||
<Layout noPadding gap="XS">
|
|
||||||
<Heading size="L">
|
|
||||||
Hey {$auth.user.firstName || $auth.user.email}
|
|
||||||
</Heading>
|
|
||||||
<Body>
|
|
||||||
Welcome to the {$organisation.company} portal. Below you'll find
|
|
||||||
the list of apps that you have access to.
|
|
||||||
</Body>
|
|
||||||
</Layout>
|
|
||||||
<ActionMenu align="right">
|
<ActionMenu align="right">
|
||||||
<div slot="control" class="avatar">
|
<div slot="control" class="avatar">
|
||||||
<Avatar
|
<Avatar
|
||||||
|
@ -81,6 +72,15 @@
|
||||||
<MenuItem icon="LogOut" on:click={auth.logout}>Log out</MenuItem>
|
<MenuItem icon="LogOut" on:click={auth.logout}>Log out</MenuItem>
|
||||||
</ActionMenu>
|
</ActionMenu>
|
||||||
</div>
|
</div>
|
||||||
|
<Layout noPadding gap="XS">
|
||||||
|
<Heading size="M">
|
||||||
|
Hey {$auth.user.firstName || $auth.user.email}
|
||||||
|
</Heading>
|
||||||
|
<Body>
|
||||||
|
Welcome to the {$organisation.company} portal. Below you'll find the
|
||||||
|
list of apps that you have access to.
|
||||||
|
</Body>
|
||||||
|
</Layout>
|
||||||
<Divider />
|
<Divider />
|
||||||
{#if publishedApps.length}
|
{#if publishedApps.length}
|
||||||
<Heading>Apps</Heading>
|
<Heading>Apps</Heading>
|
||||||
|
@ -137,18 +137,18 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
padding: 60px 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
img {
|
img {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
margin-bottom: -12px;
|
margin-bottom: -12px;
|
||||||
}
|
}
|
||||||
.info-title {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr auto;
|
|
||||||
grid-gap: var(--spacing-xl);
|
|
||||||
}
|
|
||||||
.avatar {
|
.avatar {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto auto;
|
grid-template-columns: auto auto;
|
||||||
|
@ -160,7 +160,6 @@
|
||||||
filter: brightness(110%);
|
filter: brightness(110%);
|
||||||
}
|
}
|
||||||
.group {
|
.group {
|
||||||
margin-top: var(--spacing-s);
|
|
||||||
}
|
}
|
||||||
.app {
|
.app {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
let tenantId = get(auth).tenantSet ? get(auth).tenantId : ""
|
let tenantId = get(auth).tenantSet ? get(auth).tenantId : ""
|
||||||
$: multiTenancyEnabled = $admin.multiTenancy
|
$: multiTenancyEnabled = $admin.multiTenancy
|
||||||
|
$: cloud = $admin.cloud
|
||||||
|
|
||||||
async function setOrg() {
|
async function setOrg() {
|
||||||
if (tenantId == null || tenantId === "") {
|
if (tenantId == null || tenantId === "") {
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await auth.checkQueryString()
|
await auth.checkQueryString()
|
||||||
if (!multiTenancyEnabled) {
|
if (!multiTenancyEnabled || cloud) {
|
||||||
$goto("../")
|
$goto("../")
|
||||||
} else {
|
} else {
|
||||||
admin.unload()
|
admin.unload()
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
ActionMenu,
|
ActionMenu,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Modal,
|
Modal,
|
||||||
|
clickOutside,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import ConfigChecklist from "components/common/ConfigChecklist.svelte"
|
import ConfigChecklist from "components/common/ConfigChecklist.svelte"
|
||||||
import { organisation, auth } from "stores/portal"
|
import { organisation, auth } from "stores/portal"
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
let loaded = false
|
let loaded = false
|
||||||
let userInfoModal
|
let userInfoModal
|
||||||
let changePasswordModal
|
let changePasswordModal
|
||||||
|
let mobileMenuVisible = false
|
||||||
|
|
||||||
$: menu = buildMenu($auth.isAdmin)
|
$: menu = buildMenu($auth.isAdmin)
|
||||||
|
|
||||||
|
@ -60,7 +62,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// add link to account portal if the user has access
|
// add link to account portal if the user has access
|
||||||
if ($auth?.user?.account) {
|
if ($auth?.user?.accountPortalAccess) {
|
||||||
menu = menu.concat([
|
menu = menu.concat([
|
||||||
{
|
{
|
||||||
title: "Account",
|
title: "Account",
|
||||||
|
@ -71,6 +73,9 @@
|
||||||
return menu
|
return menu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showMobileMenu = () => (mobileMenuVisible = true)
|
||||||
|
const hideMobileMenu = () => (mobileMenuVisible = false)
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
// Prevent non-builders from accessing the portal
|
// Prevent non-builders from accessing the portal
|
||||||
if ($auth.user) {
|
if ($auth.user) {
|
||||||
|
@ -86,7 +91,11 @@
|
||||||
|
|
||||||
{#if $auth.user && loaded}
|
{#if $auth.user && loaded}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="nav">
|
<div
|
||||||
|
class="nav"
|
||||||
|
class:visible={mobileMenuVisible}
|
||||||
|
use:clickOutside={hideMobileMenu}
|
||||||
|
>
|
||||||
<Layout paddingX="L" paddingY="L">
|
<Layout paddingX="L" paddingY="L">
|
||||||
<div class="branding">
|
<div class="branding">
|
||||||
<div class="name" on:click={() => $goto("./apps")}>
|
<div class="name" on:click={() => $goto("./apps")}>
|
||||||
|
@ -100,7 +109,12 @@
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<Navigation>
|
<Navigation>
|
||||||
{#each menu as { title, href, heading }}
|
{#each menu as { title, href, heading }}
|
||||||
<Item selected={$isActive(href)} {href} {heading}>{title}</Item>
|
<Item
|
||||||
|
on:click={hideMobileMenu}
|
||||||
|
selected={$isActive(href)}
|
||||||
|
{href}
|
||||||
|
{heading}>{title}</Item
|
||||||
|
>
|
||||||
{/each}
|
{/each}
|
||||||
</Navigation>
|
</Navigation>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,30 +122,40 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div />
|
<div class="mobile-toggle">
|
||||||
<ActionMenu align="right">
|
<Icon hoverable name="ShowMenu" on:click={showMobileMenu} />
|
||||||
<div slot="control" class="avatar">
|
</div>
|
||||||
<Avatar
|
<div class="mobile-logo">
|
||||||
size="M"
|
<img
|
||||||
initials={$auth.initials}
|
src={$organisation?.logoUrl || Logo}
|
||||||
url={$auth.user.pictureUrl}
|
alt={$organisation?.company || "Budibase"}
|
||||||
/>
|
/>
|
||||||
<Icon size="XL" name="ChevronDown" />
|
</div>
|
||||||
</div>
|
<div class="user-dropdown">
|
||||||
<MenuItem icon="UserEdit" on:click={() => userInfoModal.show()}>
|
<ActionMenu align="right">
|
||||||
Update user information
|
<div slot="control" class="avatar">
|
||||||
</MenuItem>
|
<Avatar
|
||||||
<MenuItem
|
size="M"
|
||||||
icon="LockClosed"
|
initials={$auth.initials}
|
||||||
on:click={() => changePasswordModal.show()}
|
url={$auth.user.pictureUrl}
|
||||||
>
|
/>
|
||||||
Update password
|
<Icon size="XL" name="ChevronDown" />
|
||||||
</MenuItem>
|
</div>
|
||||||
<MenuItem icon="UserDeveloper" on:click={() => $goto("../apps")}>
|
<MenuItem icon="UserEdit" on:click={() => userInfoModal.show()}>
|
||||||
Close developer mode
|
Update user information
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem icon="LogOut" on:click={auth.logout}>Log out</MenuItem>
|
<MenuItem
|
||||||
</ActionMenu>
|
icon="LockClosed"
|
||||||
|
on:click={() => changePasswordModal.show()}
|
||||||
|
>
|
||||||
|
Update password
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem icon="UserDeveloper" on:click={() => $goto("../apps")}>
|
||||||
|
Close developer mode
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem icon="LogOut" on:click={auth.logout}>Log out</MenuItem>
|
||||||
|
</ActionMenu>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<slot />
|
<slot />
|
||||||
|
@ -149,16 +173,20 @@
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 250px 1fr;
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
.nav {
|
.nav {
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
border-right: var(--border-light);
|
border-right: var(--border-light);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 250px;
|
||||||
}
|
}
|
||||||
.main {
|
.main {
|
||||||
|
flex: 1 1 auto;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto 1fr;
|
grid-template-rows: auto 1fr;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -192,11 +220,21 @@
|
||||||
.toolbar {
|
.toolbar {
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
border-bottom: var(--border-light);
|
border-bottom: var(--border-light);
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 250px auto;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: var(--spacing-m) calc(var(--spacing-xl) * 2);
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: var(--spacing-m) calc(var(--spacing-xl) * 2);
|
||||||
|
}
|
||||||
|
.mobile-toggle,
|
||||||
|
.mobile-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.user-dropdown {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
img {
|
img {
|
||||||
width: 28px;
|
width: 28px;
|
||||||
|
@ -210,4 +248,43 @@
|
||||||
.content {
|
.content {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.toolbar {
|
||||||
|
background: var(--background);
|
||||||
|
border-bottom: var(--border-light);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: var(--spacing-m) calc(var(--spacing-xl) * 1.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav {
|
||||||
|
position: absolute;
|
||||||
|
left: -250px;
|
||||||
|
height: 100%;
|
||||||
|
transition: left ease-in-out 230ms;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
.nav.visible {
|
||||||
|
left: 0;
|
||||||
|
box-shadow: 0 0 80px 20px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-toggle,
|
||||||
|
.mobile-logo {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-toggle,
|
||||||
|
.user-dropdown {
|
||||||
|
flex: 1 1 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reduce BBUI page padding */
|
||||||
|
.content :global(> *) {
|
||||||
|
padding: calc(var(--spacing-xl) * 1.5) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -201,7 +201,7 @@
|
||||||
<Heading>Apps</Heading>
|
<Heading>Apps</Heading>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button secondary on:click={initiateAppImport}>Import app</Button>
|
<Button secondary on:click={initiateAppImport}>Import app</Button>
|
||||||
<Button cta on:click={initiateAppCreation}>Create new app</Button>
|
<Button cta on:click={initiateAppCreation}>Create app</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
<div class="filter">
|
<div class="filter">
|
||||||
|
@ -347,4 +347,10 @@
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.appTable {
|
||||||
|
grid-template-columns: 1fr auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -272,7 +272,7 @@
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="M">Authentication</Heading>
|
<Heading size="M">Authentication</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
|
@ -285,19 +285,17 @@
|
||||||
<Divider />
|
<Divider />
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="S">
|
<Heading size="S">
|
||||||
<div>
|
<div class="provider-title">
|
||||||
<GoogleLogo />
|
<GoogleLogo />
|
||||||
Google
|
<span>Google</span>
|
||||||
<div class="google-save-button">
|
<Button
|
||||||
<div>
|
disabled={googleSaveButtonDisabled}
|
||||||
<Button
|
size="s"
|
||||||
disabled={googleSaveButtonDisabled}
|
cta
|
||||||
size="s"
|
on:click={() => save([providers.google])}
|
||||||
cta
|
>
|
||||||
on:click={() => save([providers.google])}>Save</Button
|
Save
|
||||||
>
|
</Button>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Heading>
|
</Heading>
|
||||||
<Body size="S">
|
<Body size="S">
|
||||||
|
@ -317,12 +315,8 @@
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="field">
|
<Label size="L">Activated</Label>
|
||||||
<Label size="L">Activated</Label>
|
<Toggle text="" bind:value={providers.google.config.activated} />
|
||||||
<span class="alignedToggle">
|
|
||||||
<Toggle text="" bind:value={providers.google.config.activated} />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -330,21 +324,19 @@
|
||||||
<Divider />
|
<Divider />
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="S">
|
<Heading size="S">
|
||||||
<div>
|
<div class="provider-title">
|
||||||
<OidcLogo />
|
<OidcLogo />
|
||||||
OpenID Connect
|
<span>OpenID Connect</span>
|
||||||
<div class="oidc-save-button">
|
<Button
|
||||||
<div>
|
disabled={oidcSaveButtonDisabled}
|
||||||
<Button
|
size="s"
|
||||||
disabled={oidcSaveButtonDisabled}
|
cta
|
||||||
size="s"
|
on:click={() => save([providers.oidc])}
|
||||||
cta
|
>
|
||||||
on:click={() => save([providers.oidc])}>Save</Button
|
Save
|
||||||
>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Heading>
|
||||||
</div></Heading
|
|
||||||
>
|
|
||||||
<Body size="S">
|
<Body size="S">
|
||||||
To allow users to authenticate using OIDC, fill out the fields below.
|
To allow users to authenticate using OIDC, fill out the fields below.
|
||||||
</Body>
|
</Body>
|
||||||
|
@ -360,7 +352,8 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<br />
|
</Layout>
|
||||||
|
<Layout gap="XS" noPadding>
|
||||||
<Body size="S">
|
<Body size="S">
|
||||||
To customize your login button, fill out the fields below.
|
To customize your login button, fill out the fields below.
|
||||||
</Body>
|
</Body>
|
||||||
|
@ -383,54 +376,37 @@
|
||||||
on:change={e => onFileSelected(e)}
|
on:change={e => onFileSelected(e)}
|
||||||
bind:this={fileinput}
|
bind:this={fileinput}
|
||||||
/>
|
/>
|
||||||
</Layout>
|
<div class="form-row">
|
||||||
<div class="form-row">
|
|
||||||
<div class="field">
|
|
||||||
<Label size="L">Activated</Label>
|
<Label size="L">Activated</Label>
|
||||||
<span class="alignedToggle">
|
<Toggle
|
||||||
<Toggle
|
text=""
|
||||||
text=""
|
bind:value={providers.oidc.config.configs[0].activated}
|
||||||
bind:value={providers.oidc.config.configs[0].activated}
|
/>
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.field {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alignedToggle {
|
|
||||||
margin-left: 63%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-row {
|
.form-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 20% 1fr;
|
grid-template-columns: 100px 1fr;
|
||||||
grid-gap: var(--spacing-l);
|
grid-gap: var(--spacing-l);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
span {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-s);
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input[type="file"] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.google-save-button {
|
.provider-title {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
margin-left: 400px;
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-m);
|
||||||
}
|
}
|
||||||
|
.provider-title span {
|
||||||
.oidc-save-button {
|
flex: 1 1 auto;
|
||||||
display: inline-block;
|
|
||||||
margin-left: 320px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -71,90 +71,109 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout gap="XS" noPadding>
|
<Layout noPadding>
|
||||||
<div class="back">
|
<Layout gap="XS" noPadding>
|
||||||
<ActionButton
|
<div>
|
||||||
on:click={() => $goto("./")}
|
<ActionButton
|
||||||
quiet
|
on:click={() => $goto("./")}
|
||||||
size="S"
|
quiet
|
||||||
icon="BackAndroid"
|
size="S"
|
||||||
>
|
icon="BackAndroid"
|
||||||
Back to email settings
|
>
|
||||||
</ActionButton>
|
Back to email settings
|
||||||
|
</ActionButton>
|
||||||
|
</div>
|
||||||
|
<header>
|
||||||
|
<Heading>
|
||||||
|
Email Template: {name}
|
||||||
|
</Heading>
|
||||||
|
<Button cta on:click={saveTemplate}>Save</Button>
|
||||||
|
</header>
|
||||||
|
<Body>
|
||||||
|
{description}
|
||||||
|
<br />
|
||||||
|
Change the email template here. Add dynamic content by using the bindings menu
|
||||||
|
on the right.
|
||||||
|
</Body>
|
||||||
|
</Layout>
|
||||||
|
<div>
|
||||||
|
<Tabs selected="Edit" on:select={fixMountBug}>
|
||||||
|
<Tab title="Edit">
|
||||||
|
<div class="template-editor">
|
||||||
|
<div class="template-text-editor">
|
||||||
|
<Editor
|
||||||
|
editorHeight={640}
|
||||||
|
bind:this={htmlEditor}
|
||||||
|
mode="handlebars"
|
||||||
|
on:change={e => {
|
||||||
|
selectedTemplate.contents = e.detail.value
|
||||||
|
}}
|
||||||
|
value={selectedTemplate?.contents}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="bindings-editor">
|
||||||
|
<Detail size="L">Bindings</Detail>
|
||||||
|
{#if mounted}
|
||||||
|
<Tabs selected="Template">
|
||||||
|
<Tab title="Template">
|
||||||
|
<TemplateBindings
|
||||||
|
title="Template Bindings"
|
||||||
|
bindings={templateBindings}
|
||||||
|
onBindingClick={setTemplateBinding}
|
||||||
|
/>
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Common">
|
||||||
|
<TemplateBindings
|
||||||
|
title="Common Bindings"
|
||||||
|
bindings={$email?.definitions?.bindings?.common}
|
||||||
|
onBindingClick={setTemplateBinding}
|
||||||
|
/>
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Tab>
|
||||||
|
<Tab title="Preview">
|
||||||
|
<div class="preview">
|
||||||
|
<iframe title="preview" srcdoc={previewContent} />
|
||||||
|
</div>
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
<header>
|
|
||||||
<Heading>
|
|
||||||
Email Template: {name}
|
|
||||||
</Heading>
|
|
||||||
<Button cta on:click={saveTemplate}>Save</Button>
|
|
||||||
</header>
|
|
||||||
<Detail>Description</Detail>
|
|
||||||
<Body>{description}</Body>
|
|
||||||
<Body
|
|
||||||
>Change the email template here. Add dynamic content by using the bindings
|
|
||||||
menu on the right.</Body
|
|
||||||
>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
<Tabs selected="Edit" on:select={fixMountBug}>
|
|
||||||
<Tab title="Edit">
|
|
||||||
<div class="template-editor">
|
|
||||||
<Editor
|
|
||||||
editorHeight={800}
|
|
||||||
bind:this={htmlEditor}
|
|
||||||
mode="handlebars"
|
|
||||||
on:change={e => {
|
|
||||||
selectedTemplate.contents = e.detail.value
|
|
||||||
}}
|
|
||||||
value={selectedTemplate?.contents}
|
|
||||||
/>
|
|
||||||
<div class="bindings-editor">
|
|
||||||
<Detail size="L">Bindings</Detail>
|
|
||||||
{#if mounted}
|
|
||||||
<Tabs selected="Template">
|
|
||||||
<Tab title="Template">
|
|
||||||
<TemplateBindings
|
|
||||||
title="Template Bindings"
|
|
||||||
bindings={templateBindings}
|
|
||||||
onBindingClick={setTemplateBinding}
|
|
||||||
/>
|
|
||||||
</Tab>
|
|
||||||
<Tab title="Common">
|
|
||||||
<TemplateBindings
|
|
||||||
title="Common Bindings"
|
|
||||||
bindings={$email?.definitions?.bindings?.common}
|
|
||||||
onBindingClick={setTemplateBinding}
|
|
||||||
/>
|
|
||||||
</Tab>
|
|
||||||
</Tabs>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Tab>
|
|
||||||
<Tab title="Preview">
|
|
||||||
<div class="preview">
|
|
||||||
<iframe title="preview" srcdoc={previewContent} />
|
|
||||||
</div>
|
|
||||||
</Tab>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.template-editor {
|
.template-editor {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 1fr minmax(250px, 20%);
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
|
flex-wrap: wrap;
|
||||||
grid-gap: var(--spacing-xl);
|
grid-gap: var(--spacing-xl);
|
||||||
margin-top: var(--spacing-xl);
|
margin-top: var(--spacing-xl);
|
||||||
}
|
}
|
||||||
|
.template-text-editor {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
.bindings-editor {
|
||||||
|
margin-top: var(--spacing-s);
|
||||||
|
max-height: 640px;
|
||||||
|
overflow: auto;
|
||||||
|
flex: 0 0 300px;
|
||||||
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: var(--spacing-l);
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview {
|
.preview {
|
||||||
height: 800px;
|
height: 640px;
|
||||||
padding: var(--spacing-xl) 0;
|
margin-top: calc(var(--spacing-xl) + var(--spacing-s));
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
iframe {
|
iframe {
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
fetchSmtp()
|
fetchSmtp()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout>
|
<Layout noPadding>
|
||||||
<Layout noPadding gap="XS">
|
<Layout noPadding gap="XS">
|
||||||
<Heading size="M">Email</Heading>
|
<Heading size="M">Email</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
<style>
|
<style>
|
||||||
.form-row {
|
.form-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 25% 1fr;
|
grid-template-columns: 120px 1fr;
|
||||||
grid-gap: var(--spacing-l);
|
grid-gap: var(--spacing-l);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<div class="back">
|
<div>
|
||||||
<ActionButton
|
<ActionButton
|
||||||
on:click={() => $goto("./")}
|
on:click={() => $goto("./")}
|
||||||
quiet
|
quiet
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading>Users</Heading>
|
<Heading>Users</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $auth.isAdmin}
|
{#if $auth.isAdmin}
|
||||||
<Layout>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="M">Organisation</Heading>
|
<Heading size="M">Organisation</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
</Layout>
|
</Layout>
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Label size="L">Organization name</Label>
|
<Label size="L">Org. name</Label>
|
||||||
<Input thin bind:value={$values.company} />
|
<Input thin bind:value={$values.company} />
|
||||||
</div>
|
</div>
|
||||||
<div class="field logo">
|
<div class="field logo">
|
||||||
|
@ -138,12 +138,10 @@
|
||||||
please let us know below.
|
please let us know below.
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
<div class="fields">
|
<Toggle
|
||||||
<div class="field">
|
text="Send Analytics to Budibase"
|
||||||
<Label size="L">Send Analytics to Budibase</Label>
|
bind:value={$values.analytics}
|
||||||
<Toggle text="" bind:value={$values.analytics} />
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<Button disabled={loading} on:click={saveConfig} cta>Save</Button>
|
<Button disabled={loading} on:click={saveConfig} cta>Save</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -158,7 +156,7 @@
|
||||||
}
|
}
|
||||||
.field {
|
.field {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 33% 1fr;
|
grid-template-columns: 100px 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.file {
|
.file {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="M">Theming</Heading>
|
<Heading size="M">Theming</Heading>
|
||||||
<Body>Customize how Budibase looks and feels.</Body>
|
<Body>Customize how Budibase looks and feels.</Body>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
.field {
|
.field {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 33% 1fr;
|
grid-template-columns: 120px 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
notifications,
|
notifications,
|
||||||
|
Label,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
import { auth } from "stores/portal"
|
import { auth } from "stores/portal"
|
||||||
|
@ -47,36 +48,25 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $auth.isAdmin}
|
{#if $auth.isAdmin}
|
||||||
<Layout>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="M">Update</Heading>
|
<Heading size="M">Updates</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
Keep your budibase installation up to date to take advantage of the
|
Keep your budibase installation up to date to take advantage of the
|
||||||
latest features, security updates and much more.
|
latest features, security updates and much more.
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
<Divider size="S" />
|
<Divider size="S" />
|
||||||
<div class="fields">
|
{#if version}
|
||||||
<div class="field">
|
<div>
|
||||||
{#if version}
|
<Label size="L">Current version</Label>
|
||||||
Current Version: {version}
|
<Heading size="XS">
|
||||||
{/if}
|
{version}
|
||||||
</div>
|
</Heading>
|
||||||
<div class="field">
|
|
||||||
<Button cta on:click={updateBudibase}>Check For Updates</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div>
|
||||||
|
<Button cta on:click={updateBudibase}>Check for updates</Button>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
|
||||||
.fields {
|
|
||||||
display: grid;
|
|
||||||
grid-gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
.field {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 33% 1fr;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"module": "dist/budibase-client.js",
|
"module": "dist/budibase-client.js",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.125-alpha.7",
|
"@budibase/bbui": "^0.9.125-alpha.12",
|
||||||
"@budibase/standard-components": "^0.9.124",
|
"@budibase/standard-components": "^0.9.124",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.7",
|
"@budibase/string-templates": "^0.9.125-alpha.12",
|
||||||
"regexparam": "^1.3.0",
|
"regexparam": "^1.3.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
"svelte-spa-router": "^3.0.5"
|
"svelte-spa-router": "^3.0.5"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -49,7 +49,8 @@
|
||||||
"!src/automations/tests/**/*",
|
"!src/automations/tests/**/*",
|
||||||
"!src/utilities/fileProcessor.js",
|
"!src/utilities/fileProcessor.js",
|
||||||
"!src/utilities/fileSystem/**/*",
|
"!src/utilities/fileSystem/**/*",
|
||||||
"!src/utilities/redis.js"
|
"!src/utilities/redis.js",
|
||||||
|
"!src/api/controllers/row/internalSearch.js"
|
||||||
],
|
],
|
||||||
"coverageReporters": [
|
"coverageReporters": [
|
||||||
"lcov",
|
"lcov",
|
||||||
|
@ -63,9 +64,9 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.125-alpha.7",
|
"@budibase/auth": "^0.9.125-alpha.12",
|
||||||
"@budibase/client": "^0.9.125-alpha.7",
|
"@budibase/client": "^0.9.125-alpha.12",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.7",
|
"@budibase/string-templates": "^0.9.125-alpha.12",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
"@koa/router": "8.0.0",
|
"@koa/router": "8.0.0",
|
||||||
"@sendgrid/mail": "7.1.1",
|
"@sendgrid/mail": "7.1.1",
|
||||||
|
|
|
@ -113,6 +113,7 @@ exports.destroy = async function (ctx) {
|
||||||
exports.search = async ctx => {
|
exports.search = async ctx => {
|
||||||
const tableId = getTableId(ctx)
|
const tableId = getTableId(ctx)
|
||||||
try {
|
try {
|
||||||
|
ctx.status = 200
|
||||||
ctx.body = await pickApi(tableId).search(ctx)
|
ctx.body = await pickApi(tableId).search(ctx)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(400, err)
|
ctx.throw(400, err)
|
||||||
|
|
|
@ -13,6 +13,7 @@ const zapier = require("./steps/zapier")
|
||||||
const integromat = require("./steps/integromat")
|
const integromat = require("./steps/integromat")
|
||||||
let filter = require("./steps/filter")
|
let filter = require("./steps/filter")
|
||||||
let delay = require("./steps/delay")
|
let delay = require("./steps/delay")
|
||||||
|
let queryRow = require("./steps/queryRows")
|
||||||
|
|
||||||
const ACTION_IMPLS = {
|
const ACTION_IMPLS = {
|
||||||
SEND_EMAIL_SMTP: sendSmtpEmail.run,
|
SEND_EMAIL_SMTP: sendSmtpEmail.run,
|
||||||
|
@ -26,6 +27,7 @@ const ACTION_IMPLS = {
|
||||||
SERVER_LOG: serverLog.run,
|
SERVER_LOG: serverLog.run,
|
||||||
DELAY: delay.run,
|
DELAY: delay.run,
|
||||||
FILTER: filter.run,
|
FILTER: filter.run,
|
||||||
|
QUERY_ROWS: queryRow.run,
|
||||||
// these used to be lowercase step IDs, maintain for backwards compat
|
// these used to be lowercase step IDs, maintain for backwards compat
|
||||||
discord: discord.run,
|
discord: discord.run,
|
||||||
slack: slack.run,
|
slack: slack.run,
|
||||||
|
@ -44,6 +46,7 @@ const ACTION_DEFINITIONS = {
|
||||||
SERVER_LOG: serverLog.definition,
|
SERVER_LOG: serverLog.definition,
|
||||||
DELAY: delay.definition,
|
DELAY: delay.definition,
|
||||||
FILTER: filter.definition,
|
FILTER: filter.definition,
|
||||||
|
QUERY_ROWS: queryRow.definition,
|
||||||
// these used to be lowercase step IDs, maintain for backwards compat
|
// these used to be lowercase step IDs, maintain for backwards compat
|
||||||
discord: discord.definition,
|
discord: discord.definition,
|
||||||
slack: slack.definition,
|
slack: slack.definition,
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { processStringSync } = require("@budibase/string-templates")
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Bash Scripting",
|
name: "Bash Scripting",
|
||||||
tagline: "Execute a bash command",
|
tagline: "Execute a bash command",
|
||||||
icon: "ri-terminal-box-line",
|
icon: "JourneyEvent",
|
||||||
description: "Run a bash script",
|
description: "Run a bash script",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -6,7 +6,7 @@ const usage = require("../../utilities/usageQuota")
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Create Row",
|
name: "Create Row",
|
||||||
tagline: "Create a {{inputs.enriched.table.name}} row",
|
tagline: "Create a {{inputs.enriched.table.name}} row",
|
||||||
icon: "ri-save-3-line",
|
icon: "TableRowAddBottom",
|
||||||
description: "Add a row to your database",
|
description: "Add a row to your database",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -2,7 +2,7 @@ let { wait } = require("../../utilities")
|
||||||
|
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Delay",
|
name: "Delay",
|
||||||
icon: "ri-time-line",
|
icon: "Clock",
|
||||||
tagline: "Delay for {{inputs.time}} milliseconds",
|
tagline: "Delay for {{inputs.time}} milliseconds",
|
||||||
description: "Delay the automation until an amount of time has passed",
|
description: "Delay the automation until an amount of time has passed",
|
||||||
stepId: "DELAY",
|
stepId: "DELAY",
|
||||||
|
|
|
@ -4,7 +4,7 @@ const usage = require("../../utilities/usageQuota")
|
||||||
|
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
description: "Delete a row from your database",
|
description: "Delete a row from your database",
|
||||||
icon: "ri-delete-bin-line",
|
icon: "TableRowRemoveCenter",
|
||||||
name: "Delete Row",
|
name: "Delete Row",
|
||||||
tagline: "Delete a {{inputs.enriched.table.name}} row",
|
tagline: "Delete a {{inputs.enriched.table.name}} row",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { buildCtx } = require("./utils")
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "External Data Connector",
|
name: "External Data Connector",
|
||||||
tagline: "Execute Data Connector",
|
tagline: "Execute Data Connector",
|
||||||
icon: "ri-database-2-line",
|
icon: "Data",
|
||||||
description: "Execute a query in an external data connector",
|
description: "Execute a query in an external data connector",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
stepId: "EXECUTE_QUERY",
|
stepId: "EXECUTE_QUERY",
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { buildCtx } = require("./utils")
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "JS Scripting",
|
name: "JS Scripting",
|
||||||
tagline: "Execute JavaScript Code",
|
tagline: "Execute JavaScript Code",
|
||||||
icon: "ri-terminal-box-line",
|
icon: "Code",
|
||||||
description: "Run a piece of JavaScript code in your automation",
|
description: "Run a piece of JavaScript code in your automation",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -18,7 +18,7 @@ exports.PrettyFilterConditions = PrettyFilterConditions
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Filter",
|
name: "Filter",
|
||||||
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
|
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
|
||||||
icon: "ri-git-branch-line",
|
icon: "Branch2",
|
||||||
description: "Filter any automations which do not meet certain conditions",
|
description: "Filter any automations which do not meet certain conditions",
|
||||||
type: "LOGIC",
|
type: "LOGIC",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -20,7 +20,7 @@ const BODY_REQUESTS = [RequestType.POST, RequestType.PUT, RequestType.PATCH]
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Outgoing webhook",
|
name: "Outgoing webhook",
|
||||||
tagline: "Send a {{inputs.requestMethod}} request",
|
tagline: "Send a {{inputs.requestMethod}} request",
|
||||||
icon: "ri-send-plane-line",
|
icon: "Send",
|
||||||
description: "Send a request of specified method to a URL",
|
description: "Send a request of specified method to a URL",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
const rowController = require("../../api/controllers/row")
|
||||||
|
const tableController = require("../../api/controllers/table")
|
||||||
|
const { FieldTypes } = require("../../constants")
|
||||||
|
|
||||||
|
const SortOrders = {
|
||||||
|
ASCENDING: "ascending",
|
||||||
|
DESCENDING: "descending",
|
||||||
|
}
|
||||||
|
|
||||||
|
const SortOrdersPretty = {
|
||||||
|
[SortOrders.ASCENDING]: "Ascending",
|
||||||
|
[SortOrders.DESCENDING]: "Descending",
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.definition = {
|
||||||
|
description: "Query rows from the database",
|
||||||
|
icon: "Search",
|
||||||
|
name: "Query rows",
|
||||||
|
tagline: "Query rows from {{inputs.enriched.table.name}} table",
|
||||||
|
type: "ACTION",
|
||||||
|
stepId: "QUERY_ROWS",
|
||||||
|
internal: true,
|
||||||
|
inputs: {},
|
||||||
|
schema: {
|
||||||
|
inputs: {
|
||||||
|
properties: {
|
||||||
|
tableId: {
|
||||||
|
type: "string",
|
||||||
|
customType: "table",
|
||||||
|
title: "Table",
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
type: "object",
|
||||||
|
customType: "filters",
|
||||||
|
title: "Filtering",
|
||||||
|
},
|
||||||
|
sortColumn: {
|
||||||
|
type: "string",
|
||||||
|
title: "Sort Column",
|
||||||
|
customType: "column",
|
||||||
|
},
|
||||||
|
sortOrder: {
|
||||||
|
type: "string",
|
||||||
|
title: "Sort Order",
|
||||||
|
enum: Object.values(SortOrders),
|
||||||
|
pretty: Object.values(SortOrdersPretty),
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: "number",
|
||||||
|
title: "Limit",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["tableId"],
|
||||||
|
},
|
||||||
|
outputs: {
|
||||||
|
properties: {
|
||||||
|
rows: {
|
||||||
|
type: "array",
|
||||||
|
customType: "rows",
|
||||||
|
description: "The rows that were found",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
type: "boolean",
|
||||||
|
description: "Whether the deletion was successful",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ["rows", "success"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getTable(appId, tableId) {
|
||||||
|
const ctx = {
|
||||||
|
params: {
|
||||||
|
id: tableId,
|
||||||
|
},
|
||||||
|
appId,
|
||||||
|
}
|
||||||
|
await tableController.find(ctx)
|
||||||
|
return ctx.body
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.run = async function ({ inputs, appId }) {
|
||||||
|
const { tableId, filters, sortColumn, sortOrder, limit } = inputs
|
||||||
|
const table = await getTable(appId, tableId)
|
||||||
|
let sortType = FieldTypes.STRING
|
||||||
|
if (table && table.schema && sortColumn) {
|
||||||
|
const fieldType = table.schema[sortColumn].type
|
||||||
|
sortType =
|
||||||
|
fieldType === FieldTypes.NUMBER ? FieldTypes.NUMBER : FieldTypes.STRING
|
||||||
|
}
|
||||||
|
const ctx = {
|
||||||
|
params: {
|
||||||
|
tableId,
|
||||||
|
},
|
||||||
|
request: {
|
||||||
|
body: {
|
||||||
|
sortOrder,
|
||||||
|
sortType,
|
||||||
|
sort: sortColumn,
|
||||||
|
query: filters || {},
|
||||||
|
limit,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
appId,
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await rowController.search(ctx)
|
||||||
|
return {
|
||||||
|
rows: ctx.body ? ctx.body.rows : [],
|
||||||
|
success: ctx.status === 200,
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
response: err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ const { sendSmtpEmail } = require("../../utilities/workerRequests")
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
description: "Send an email using SMTP",
|
description: "Send an email using SMTP",
|
||||||
tagline: "Send SMTP email to {{inputs.to}}",
|
tagline: "Send SMTP email to {{inputs.to}}",
|
||||||
icon: "ri-mail-open-line",
|
icon: "Email",
|
||||||
name: "Send Email (SMTP)",
|
name: "Send Email (SMTP)",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Backend log",
|
name: "Backend log",
|
||||||
tagline: "Console log a value in the backend",
|
tagline: "Console log a value in the backend",
|
||||||
icon: "ri-server-line",
|
icon: "Monitoring",
|
||||||
description: "Logs the given text to the server (using console.log)",
|
description: "Logs the given text to the server (using console.log)",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -4,7 +4,7 @@ const automationUtils = require("../automationUtils")
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Update Row",
|
name: "Update Row",
|
||||||
tagline: "Update a {{inputs.enriched.table.name}} row",
|
tagline: "Update a {{inputs.enriched.table.name}} row",
|
||||||
icon: "ri-refresh-line",
|
icon: "Refresh",
|
||||||
description: "Update a row in your database",
|
description: "Update a row in your database",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
internal: true,
|
internal: true,
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
// lucene searching not supported in test due to use of PouchDB
|
||||||
|
let rows = []
|
||||||
|
jest.mock("../../api/controllers/row/internalSearch", () => ({
|
||||||
|
fullSearch: jest.fn(() => {
|
||||||
|
return {
|
||||||
|
rows,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
paginatedSearch: jest.fn(),
|
||||||
|
}))
|
||||||
|
const setup = require("./utilities")
|
||||||
|
|
||||||
|
const NAME = "Test"
|
||||||
|
|
||||||
|
describe("Test a query step automation", () => {
|
||||||
|
let table
|
||||||
|
let config = setup.getConfig()
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await config.init()
|
||||||
|
table = await config.createTable()
|
||||||
|
const row = {
|
||||||
|
name: NAME,
|
||||||
|
description: "original description",
|
||||||
|
tableId: table._id,
|
||||||
|
}
|
||||||
|
rows.push(await config.createRow(row))
|
||||||
|
rows.push(await config.createRow(row))
|
||||||
|
})
|
||||||
|
|
||||||
|
afterAll(setup.afterAll)
|
||||||
|
|
||||||
|
it("should be able to run the query step", async () => {
|
||||||
|
const inputs = {
|
||||||
|
tableId: table._id,
|
||||||
|
filters: {
|
||||||
|
equal: {
|
||||||
|
name: NAME,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sortColumn: "name",
|
||||||
|
sortOrder: "ascending",
|
||||||
|
limit: 10,
|
||||||
|
}
|
||||||
|
const res = await setup.runStep(setup.actions.QUERY_ROWS.stepId, inputs)
|
||||||
|
expect(res.success).toBe(true)
|
||||||
|
expect(res.rows).toBeDefined()
|
||||||
|
expect(res.rows.length).toBe(2)
|
||||||
|
expect(res.rows[0].name).toBe(NAME)
|
||||||
|
})
|
||||||
|
})
|
|
@ -1,7 +1,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "App Action",
|
name: "App Action",
|
||||||
event: "app:trigger",
|
event: "app:trigger",
|
||||||
icon: "ri-window-fill",
|
icon: "Apps",
|
||||||
tagline: "Automation fired from the frontend",
|
tagline: "Automation fired from the frontend",
|
||||||
description: "Trigger an automation from an action inside your app",
|
description: "Trigger an automation from an action inside your app",
|
||||||
stepId: "APP",
|
stepId: "APP",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Cron Trigger",
|
name: "Cron Trigger",
|
||||||
event: "cron:trigger",
|
event: "cron:trigger",
|
||||||
icon: "ri-timer-line",
|
icon: "Clock",
|
||||||
tagline: "Cron Trigger (<b>{{inputs.cron}}</b>)",
|
tagline: "Cron Trigger (<b>{{inputs.cron}}</b>)",
|
||||||
description: "Triggers automation on a cron schedule.",
|
description: "Triggers automation on a cron schedule.",
|
||||||
stepId: "CRON",
|
stepId: "CRON",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Row Deleted",
|
name: "Row Deleted",
|
||||||
event: "row:delete",
|
event: "row:delete",
|
||||||
icon: "ri-delete-bin-line",
|
icon: "TableRowRemoveCenter",
|
||||||
tagline: "Row is deleted from {{inputs.enriched.table.name}}",
|
tagline: "Row is deleted from {{inputs.enriched.table.name}}",
|
||||||
description: "Fired when a row is deleted from your database",
|
description: "Fired when a row is deleted from your database",
|
||||||
stepId: "ROW_DELETED",
|
stepId: "ROW_DELETED",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Row Created",
|
name: "Row Created",
|
||||||
event: "row:save",
|
event: "row:save",
|
||||||
icon: "ri-save-line",
|
icon: "TableRowAddBottom",
|
||||||
tagline: "Row is added to {{inputs.enriched.table.name}}",
|
tagline: "Row is added to {{inputs.enriched.table.name}}",
|
||||||
description: "Fired when a row is added to your database",
|
description: "Fired when a row is added to your database",
|
||||||
stepId: "ROW_SAVED",
|
stepId: "ROW_SAVED",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Row Updated",
|
name: "Row Updated",
|
||||||
event: "row:update",
|
event: "row:update",
|
||||||
icon: "ri-refresh-line",
|
icon: "Refresh",
|
||||||
tagline: "Row is updated in {{inputs.enriched.table.name}}",
|
tagline: "Row is updated in {{inputs.enriched.table.name}}",
|
||||||
description: "Fired when a row is updated in your database",
|
description: "Fired when a row is updated in your database",
|
||||||
stepId: "ROW_UPDATED",
|
stepId: "ROW_UPDATED",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
exports.definition = {
|
exports.definition = {
|
||||||
name: "Webhook",
|
name: "Webhook",
|
||||||
event: "web:trigger",
|
event: "web:trigger",
|
||||||
icon: "ri-global-line",
|
icon: "Send",
|
||||||
tagline: "Webhook endpoint is hit",
|
tagline: "Webhook endpoint is hit",
|
||||||
description: "Trigger an automation when a HTTP POST webhook is hit",
|
description: "Trigger an automation when a HTTP POST webhook is hit",
|
||||||
stepId: "WEBHOOK",
|
stepId: "WEBHOOK",
|
||||||
|
|
|
@ -1090,6 +1090,115 @@
|
||||||
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is less than or equal to <code>b</code></strong>.</p>\n"
|
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is less than or equal to <code>b</code></strong>.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"object": {
|
||||||
|
"extend": {
|
||||||
|
"args": [
|
||||||
|
"objects"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Extend the context with the properties of other objects. A shallow merge is performed to avoid mutating the context.</p>\n"
|
||||||
|
},
|
||||||
|
"forIn": {
|
||||||
|
"args": [
|
||||||
|
"context",
|
||||||
|
"options"
|
||||||
|
],
|
||||||
|
"numArgs": 2,
|
||||||
|
"description": "<p>Block helper that iterates over the properties of an object, exposing each key and value on the context.</p>\n"
|
||||||
|
},
|
||||||
|
"forOwn": {
|
||||||
|
"args": [
|
||||||
|
"obj",
|
||||||
|
"options"
|
||||||
|
],
|
||||||
|
"numArgs": 2,
|
||||||
|
"description": "<p>Block helper that iterates over the <strong>own</strong> properties of an object, exposing each key and value on the context.</p>\n"
|
||||||
|
},
|
||||||
|
"toPath": {
|
||||||
|
"args": [
|
||||||
|
"prop"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Take arguments and, if they are string or number, convert them to a dot-delineated object property path.</p>\n"
|
||||||
|
},
|
||||||
|
"get": {
|
||||||
|
"args": [
|
||||||
|
"prop",
|
||||||
|
"context",
|
||||||
|
"options"
|
||||||
|
],
|
||||||
|
"numArgs": 3,
|
||||||
|
"description": "<p>Use property paths (<code>a.b.c</code>) to get a value or nested value from the context. Works as a regular helper or block helper.</p>\n"
|
||||||
|
},
|
||||||
|
"getObject": {
|
||||||
|
"args": [
|
||||||
|
"prop",
|
||||||
|
"context"
|
||||||
|
],
|
||||||
|
"numArgs": 2,
|
||||||
|
"description": "<p>Use property paths (<code>a.b.c</code>) to get an object from the context. Differs from the <code>get</code> helper in that this helper will return the actual object, including the given property key. Also, this helper does not work as a block helper.</p>\n"
|
||||||
|
},
|
||||||
|
"hasOwn": {
|
||||||
|
"args": [
|
||||||
|
"key",
|
||||||
|
"context"
|
||||||
|
],
|
||||||
|
"numArgs": 2,
|
||||||
|
"description": "<p>Return true if <code>key</code> is an own, enumerable property of the given <code>context</code> object.</p>\n"
|
||||||
|
},
|
||||||
|
"isObject": {
|
||||||
|
"args": [
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Return true if <code>value</code> is an object.</p>\n"
|
||||||
|
},
|
||||||
|
"JSONparse": {
|
||||||
|
"args": [
|
||||||
|
"string"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Parses the given string using <code>JSON.parse</code>.</p>\n"
|
||||||
|
},
|
||||||
|
"JSONstringify": {
|
||||||
|
"args": [
|
||||||
|
"obj"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Stringify an object using <code>JSON.stringify</code>.</p>\n"
|
||||||
|
},
|
||||||
|
"merge": {
|
||||||
|
"args": [
|
||||||
|
"object",
|
||||||
|
"objects"
|
||||||
|
],
|
||||||
|
"numArgs": 2,
|
||||||
|
"description": "<p>Deeply merge the properties of the given <code>objects</code> with the context object.</p>\n"
|
||||||
|
},
|
||||||
|
"parseJSON": {
|
||||||
|
"args": [
|
||||||
|
"string"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Parses the given string using <code>JSON.parse</code>.</p>\n"
|
||||||
|
},
|
||||||
|
"pick": {
|
||||||
|
"args": [
|
||||||
|
"properties",
|
||||||
|
"context",
|
||||||
|
"options"
|
||||||
|
],
|
||||||
|
"numArgs": 3,
|
||||||
|
"description": "<p>Pick properties from the context object.</p>\n"
|
||||||
|
},
|
||||||
|
"stringify": {
|
||||||
|
"args": [
|
||||||
|
"obj"
|
||||||
|
],
|
||||||
|
"numArgs": 1,
|
||||||
|
"description": "<p>Stringify an object using <code>JSON.stringify</code>.</p>\n"
|
||||||
|
}
|
||||||
|
},
|
||||||
"date": {
|
"date": {
|
||||||
"date": {
|
"date": {
|
||||||
"args": [
|
"args": [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "src/index.cjs",
|
"main": "src/index.cjs",
|
||||||
"module": "dist/bundle.mjs",
|
"module": "dist/bundle.mjs",
|
||||||
|
|
|
@ -11,7 +11,15 @@ const marked = require("marked")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const DIRECTORY = fs.existsSync("node_modules") ? "." : ".."
|
const DIRECTORY = fs.existsSync("node_modules") ? "." : ".."
|
||||||
const COLLECTIONS = ["math", "array", "number", "url", "string", "comparison"]
|
const COLLECTIONS = [
|
||||||
|
"math",
|
||||||
|
"array",
|
||||||
|
"number",
|
||||||
|
"url",
|
||||||
|
"string",
|
||||||
|
"comparison",
|
||||||
|
"object",
|
||||||
|
]
|
||||||
const FILENAME = `${DIRECTORY}/manifest.json`
|
const FILENAME = `${DIRECTORY}/manifest.json`
|
||||||
const outputJSON = {}
|
const outputJSON = {}
|
||||||
const ADDED_HELPERS = {
|
const ADDED_HELPERS = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.125-alpha.7",
|
"version": "0.9.125-alpha.12",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.125-alpha.7",
|
"@budibase/auth": "^0.9.125-alpha.12",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.7",
|
"@budibase/string-templates": "^0.9.125-alpha.12",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"@techpass/passport-openidconnect": "^0.3.0",
|
"@techpass/passport-openidconnect": "^0.3.0",
|
||||||
"aws-sdk": "^2.811.0",
|
"aws-sdk": "^2.811.0",
|
||||||
|
|
|
@ -197,10 +197,10 @@ exports.getSelf = async ctx => {
|
||||||
// this will set the body
|
// this will set the body
|
||||||
await exports.find(ctx)
|
await exports.find(ctx)
|
||||||
|
|
||||||
// append the account portal session information if present
|
// forward session information not found in db
|
||||||
if (ctx.user.account) {
|
ctx.body.account = ctx.user.account
|
||||||
ctx.body.account = ctx.user.account
|
ctx.body.budibaseAccess = ctx.user.budibaseAccess
|
||||||
}
|
ctx.body.accountPortalAccess = ctx.user.accountPortalAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.updateSelf = async ctx => {
|
exports.updateSelf = async ctx => {
|
||||||
|
|
|
@ -84,7 +84,10 @@ router
|
||||||
.use(buildTenancyMiddleware(PUBLIC_ENDPOINTS, NO_TENANCY_ENDPOINTS))
|
.use(buildTenancyMiddleware(PUBLIC_ENDPOINTS, NO_TENANCY_ENDPOINTS))
|
||||||
// for now no public access is allowed to worker (bar health check)
|
// for now no public access is allowed to worker (bar health check)
|
||||||
.use((ctx, next) => {
|
.use((ctx, next) => {
|
||||||
if (!ctx.isAuthenticated && !ctx.publicEndpoint) {
|
if (ctx.publicEndpoint) {
|
||||||
|
return next()
|
||||||
|
}
|
||||||
|
if (!ctx.isAuthenticated || !ctx.user.budibaseAccess) {
|
||||||
ctx.throw(403, "Unauthorized - no public worker access")
|
ctx.throw(403, "Unauthorized - no public worker access")
|
||||||
}
|
}
|
||||||
return next()
|
return next()
|
||||||
|
|