This commit is contained in:
mike12345567 2021-01-14 17:02:05 +00:00
parent 0c66d9fca4
commit 29424e59c0
11 changed files with 84 additions and 60 deletions

View File

@ -45,7 +45,7 @@ export const getHostingStore = () => {
return state
})
return deployments
}
},
}
return store
}

View File

@ -50,7 +50,10 @@
function addBlockToAutomation(stepId, blockDefinition) {
const newBlock = $automationStore.selectedAutomation.constructBlock(
selectedTab, stepId, blockDefinition)
selectedTab,
stepId,
blockDefinition
)
automationStore.actions.addBlockToAutomation(newBlock)
closePopover()
if (stepId === "WEBHOOK") {

View File

@ -36,9 +36,7 @@
</script>
<div class="root">
<div class="add-field">
<i class="ri-add-line" on:click={addField} />
</div>
<div class="add-field"><i class="ri-add-line" on:click={addField} /></div>
<div class="spacer" />
{#each fieldsArray as field}
<div class="field">
@ -57,13 +55,11 @@
<option>datetime</option>
</Select>
<i class="remove-field ri-delete-bin-line"
<i
class="remove-field ri-delete-bin-line"
on:click={() => removeField(field.name)} />
</div>
{/each}
</div>
<style>
@ -105,7 +101,8 @@
}
.field :global(input) {
padding: var(--spacing-m) var(--spacing-xl) var(--spacing-xs) var(--spacing-m);
padding: var(--spacing-m) var(--spacing-xl) var(--spacing-xs)
var(--spacing-m);
font-size: var(--font-size-s);
font-weight: bold;
}
@ -129,5 +126,4 @@
.add-field > i {
cursor: pointer;
}
</style>

View File

@ -36,7 +36,8 @@
let errorReason
let poll
let deployments = []
let urlComponent = $hostingStore.hostingInfo.type === "self" ? $store.url : `/${appId}`
let urlComponent =
$hostingStore.hostingInfo.type === "self" ? $store.url : `/${appId}`
let deploymentUrl = `${$hostingStore.appUrl}${urlComponent}`
const formatDate = (date, format) =>

View File

@ -47,7 +47,8 @@
}
onMount(async () => {
const nameError = "Your application must have a name.", urlError = "Your application must have a URL."
const nameError = "Your application must have a name.",
urlError = "Your application must have a URL."
let hostingInfo = await hostingStore.actions.fetch()
if (hostingInfo.type === "self") {
await hostingStore.actions.fetchDeployedApps()
@ -55,8 +56,16 @@
const existingAppUrls = get(hostingStore).deployedAppUrls
existingAppNames.splice(existingAppNames.indexOf(get(store).name), 1)
existingAppUrls.splice(existingAppUrls.indexOf(get(store).url), 1)
nameValidation = { name: string().required(nameError).notOneOf(existingAppNames) }
urlValidation = { url: string().required(urlError).notOneOf(existingAppUrls) }
nameValidation = {
name: string()
.required(nameError)
.notOneOf(existingAppNames),
}
urlValidation = {
url: string()
.required(urlError)
.notOneOf(existingAppUrls),
}
} else {
nameValidation = { name: string.required(nameError) }
}
@ -71,7 +80,7 @@
bind:value={$store.name}
bind:error={nameError}
label="App Name" />
{#if $hostingStore.hostingInfo.type === "self"}
{#if $hostingStore.hostingInfo.type === 'self'}
<Input
on:save={e => updateApplication({ url: e.detail })}
thin

View File

@ -84,7 +84,9 @@
if (hostingInfo.type === "self") {
await hostingStore.actions.fetchDeployedApps()
const existingAppNames = svelteGet(hostingStore).deployedAppNames
infoValidation.applicationName = string().required("Your application must have a name.").notOneOf(existingAppNames)
infoValidation.applicationName = string()
.required("Your application must have a name.")
.notOneOf(existingAppNames)
isApiKeyValid = true
steps = [buildStep(Info), buildStep(User)]
validationSchemas = [infoValidation, userValidation]

View File

@ -59,20 +59,24 @@
const appActionDefinition = $automationStore.blockDefinitions.TRIGGER.APP
const newBlock = $automationStore.selectedAutomation.constructBlock(
"TRIGGER", "APP", appActionDefinition)
"TRIGGER",
"APP",
appActionDefinition
)
newBlock.inputs = {
fields: Object.entries(parameters.fields).reduce((fields, [key, value]) => {
fields: Object.entries(parameters.fields).reduce(
(fields, [key, value]) => {
fields[key] = value.type
return fields
}, {})
},
{}
),
}
automationStore.actions.addBlockToAutomation(newBlock)
await automationStore.actions.save(
$automationStore.selectedAutomation)
await automationStore.actions.save($automationStore.selectedAutomation)
parameters.automationId = $automationStore.selectedAutomation.automation._id
delete parameters.newAutomationName

View File

@ -1,6 +1,13 @@
<script>
// accepts an array of field names, and outputs an object of { FieldName: value }
import { DataList, Label, TextButton, Spacer, Select, Input } from "@budibase/bbui"
import {
DataList,
Label,
TextButton,
Spacer,
Select,
Input,
} from "@budibase/bbui"
import { store, backendUiStore, currentAsset } from "builderStore"
import fetchBindableProperties from "builderStore/fetchBindableProperties"
import { CloseCircleIcon, AddIcon } from "components/common/Icons"
@ -60,7 +67,9 @@
// value and type is needed by the client, so it can parse
// a string into a correct type
newParameterFields[field.name] = {
type: schemaFields ? schemaFields.find(f => f.name === field.name).type : "string",
type: schemaFields
? schemaFields.find(f => f.name === field.name).type
: "string",
value: readableToRuntimeBinding(bindableProperties, field.value),
}
}
@ -105,7 +114,8 @@
<Spacer small />
<TextButton text small blue on:click={addField}>
Add {fieldLabel}
Add
{fieldLabel}
<div style="height: 20px; width: 20px;">
<AddIcon />
</div>

View File

@ -41,53 +41,53 @@
newOrExisting = "existing"
parameters.newAutomationName = ""
}
</script>
<div class="root">
<div class="radio-container" on:click={setNew}>
<input
type="radio"
value="new"
bind:group={newOrExisting}
disabled={!hasAutomations}>
disabled={!hasAutomations} />
<Label disabled={!hasAutomations}>Create a new automation</Label>
</div>
<div class="radio-container" on:click={setExisting}>
<input
type="radio"
value="existing"
bind:group={newOrExisting}
disabled={!hasAutomations}>
disabled={!hasAutomations} />
<Label disabled={!hasAutomations}>Use an existing automation</Label>
</div>
<Label size="m" color="dark">Automation</Label>
{#if newOrExisting=== "existing"}
<Select secondary bind:value={parameters.automationId} placeholder="Choose automation">
{#if newOrExisting === 'existing'}
<Select
secondary
bind:value={parameters.automationId}
placeholder="Choose automation">
<option value="" />
{#each automations as automation}
<option value={automation._id}>{automation.name}</option>
{/each}
</Select>
{:else}
<Input secondary bind:value={parameters.newAutomationName} placeholder="Enter automation name" />
<Input
secondary
bind:value={parameters.newAutomationName}
placeholder="Enter automation name" />
{/if}
<SaveFields
parameterFields={parameters.fields}
schemaFields={newOrExisting === "existing" && selectedAutomation && selectedAutomation.schema}
schemaFields={newOrExisting === 'existing' && selectedAutomation && selectedAutomation.schema}
fieldLabel="Field"
on:fieldschanged={onFieldsChanged} />
</div>
<style>
@ -127,5 +127,4 @@
.radio-container > input:focus {
outline: none;
}
</style>

View File

@ -5,7 +5,8 @@ const { join } = require("path")
const { homedir } = require("os")
// level option is purely for testing (development)
const COUCH_DB_URL = env.COUCH_DB_URL || `leveldb://${join(homedir(), ".budibase")}/.data/`
const COUCH_DB_URL =
env.COUCH_DB_URL || `leveldb://${join(homedir(), ".budibase")}/.data/`
const Pouch = PouchDB.defaults({
prefix: COUCH_DB_URL,

View File

@ -2,8 +2,7 @@ const env = require("../environment")
module.exports = async (ctx, next) => {
const selfHostKey =
ctx.request.headers["x-budibase-auth"] ||
ctx.request.body.selfHostKey
ctx.request.headers["x-budibase-auth"] || ctx.request.body.selfHostKey
if (!selfHostKey || env.SELF_HOST_KEY !== selfHostKey) {
ctx.throw(401, "Request unauthorised")
} else {