2020-05-27 22:51:32 +02:00
|
|
|
<script>
|
2020-06-01 22:31:55 +02:00
|
|
|
import { fade } from "svelte/transition"
|
2020-05-28 21:20:03 +02:00
|
|
|
import { onMount, getContext } from "svelte"
|
2020-05-27 22:51:32 +02:00
|
|
|
import { backendUiStore, workflowStore } from "builderStore"
|
2020-05-29 17:06:23 +02:00
|
|
|
import { notifier } from "@beyonk/svelte-notifications"
|
2020-05-27 22:51:32 +02:00
|
|
|
import api from "builderStore/api"
|
2020-05-28 21:20:03 +02:00
|
|
|
import WorkflowBlockSetup from "./WorkflowBlockSetup.svelte"
|
|
|
|
import DeleteWorkflowModal from "./DeleteWorkflowModal.svelte"
|
2020-05-27 22:51:32 +02:00
|
|
|
|
2020-05-28 21:20:03 +02:00
|
|
|
const { open, close } = getContext("simple-modal")
|
|
|
|
|
2020-06-01 22:26:32 +02:00
|
|
|
let selectedTab = "SETUP"
|
|
|
|
let testResult
|
|
|
|
|
2020-05-29 17:06:23 +02:00
|
|
|
$: workflow =
|
|
|
|
$workflowStore.currentWorkflow && $workflowStore.currentWorkflow.workflow
|
2020-05-27 22:51:32 +02:00
|
|
|
$: workflowBlock = $workflowStore.selectedWorkflowBlock
|
|
|
|
|
|
|
|
function deleteWorkflow() {
|
2020-05-28 21:20:03 +02:00
|
|
|
open(
|
|
|
|
DeleteWorkflowModal,
|
|
|
|
{
|
|
|
|
onClosed: close,
|
|
|
|
},
|
|
|
|
{ styleContent: { padding: "0" } }
|
|
|
|
)
|
2020-05-27 22:51:32 +02:00
|
|
|
}
|
2020-05-28 21:20:03 +02:00
|
|
|
|
2020-05-27 22:51:32 +02:00
|
|
|
function deleteWorkflowBlock() {
|
|
|
|
workflowStore.actions.deleteWorkflowBlock(workflowBlock)
|
2020-05-29 17:06:23 +02:00
|
|
|
notifier.info("Workflow block deleted.")
|
2020-05-27 22:51:32 +02:00
|
|
|
}
|
2020-06-01 22:26:32 +02:00
|
|
|
|
|
|
|
function testWorkflow() {
|
|
|
|
testResult = "PASSED"
|
|
|
|
}
|
2020-05-27 22:51:32 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<header>
|
2020-06-01 22:26:32 +02:00
|
|
|
<span
|
|
|
|
class="hoverable"
|
|
|
|
class:selected={selectedTab === 'SETUP'}
|
2020-06-01 22:31:55 +02:00
|
|
|
on:click={() => {
|
2020-06-01 22:26:32 +02:00
|
|
|
selectedTab = 'SETUP'
|
|
|
|
testResult = null
|
|
|
|
}}>
|
|
|
|
Setup
|
|
|
|
</span>
|
|
|
|
{#if !workflowBlock}
|
|
|
|
<span
|
|
|
|
class="hoverable"
|
|
|
|
class:selected={selectedTab === 'TEST'}
|
|
|
|
on:click={() => (selectedTab = 'TEST')}>
|
|
|
|
Test
|
|
|
|
</span>
|
|
|
|
{/if}
|
2020-05-27 22:51:32 +02:00
|
|
|
</header>
|
2020-06-01 22:26:32 +02:00
|
|
|
{#if selectedTab === 'TEST'}
|
|
|
|
<div class="uk-margin config-item">
|
|
|
|
{#if testResult}
|
|
|
|
<button
|
|
|
|
transition:fade
|
|
|
|
class:passed={testResult === 'PASSED'}
|
|
|
|
class:failed={testResult === 'FAILED'}
|
|
|
|
class="test-result">
|
|
|
|
{testResult}
|
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
<button class="workflow-button hoverable" on:click={testWorkflow}>
|
|
|
|
Test
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{#if selectedTab === 'SETUP'}
|
|
|
|
{#if workflowBlock}
|
|
|
|
<WorkflowBlockSetup {workflowBlock} />
|
|
|
|
<button class="workflow-button hoverable" on:click={deleteWorkflowBlock}>
|
|
|
|
Delete Block
|
|
|
|
</button>
|
|
|
|
{:else if $workflowStore.currentWorkflow}
|
|
|
|
<div class="panel-body">
|
|
|
|
<label class="uk-form-label">Workflow: {workflow.name}</label>
|
|
|
|
<div class="uk-margin config-item">
|
|
|
|
<label class="uk-form-label">Name</label>
|
|
|
|
<div class="uk-form-controls">
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
class="budibase__input"
|
|
|
|
bind:value={workflow.name} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="uk-margin config-item">
|
|
|
|
<label class="uk-form-label">User Access</label>
|
|
|
|
<label>
|
|
|
|
<input class="uk-checkbox" type="checkbox" name="radio1" />
|
|
|
|
Admin
|
|
|
|
</label>
|
|
|
|
<br />
|
|
|
|
<label>
|
|
|
|
<input class="uk-checkbox" type="checkbox" name="radio1" />
|
|
|
|
Power User
|
|
|
|
</label>
|
|
|
|
<br />
|
2020-05-27 22:51:32 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-01 22:31:55 +02:00
|
|
|
<button class="workflow-button hoverable" on:click={deleteWorkflow}>
|
2020-06-01 22:26:32 +02:00
|
|
|
Delete Workflow
|
|
|
|
</button>
|
|
|
|
{/if}
|
2020-05-29 17:06:23 +02:00
|
|
|
{/if}
|
2020-05-27 22:51:32 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
section {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2020-05-29 17:06:23 +02:00
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.panel-body {
|
|
|
|
flex: 1;
|
2020-05-27 22:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
header {
|
|
|
|
font-size: 20px;
|
|
|
|
font-weight: bold;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2020-05-31 18:12:52 +02:00
|
|
|
margin-bottom: 20px;
|
2020-05-27 22:51:32 +02:00
|
|
|
}
|
|
|
|
|
2020-06-01 22:26:32 +02:00
|
|
|
.selected {
|
2020-05-31 18:12:52 +02:00
|
|
|
color: var(--font);
|
2020-05-27 22:51:32 +02:00
|
|
|
}
|
|
|
|
|
2020-06-01 22:26:32 +02:00
|
|
|
.config-item {
|
|
|
|
padding: 20px;
|
|
|
|
background: var(--light-grey);
|
|
|
|
}
|
|
|
|
|
|
|
|
header > span {
|
|
|
|
color: var(--dark-grey);
|
|
|
|
margin-right: 20px;
|
|
|
|
}
|
|
|
|
|
2020-05-27 22:51:32 +02:00
|
|
|
label {
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 14px;
|
|
|
|
color: var(--font);
|
|
|
|
}
|
|
|
|
|
2020-06-01 22:26:32 +02:00
|
|
|
.workflow-button {
|
2020-05-27 22:51:32 +02:00
|
|
|
font-family: Roboto;
|
|
|
|
width: 100%;
|
|
|
|
border: solid 1px #f2f2f2;
|
|
|
|
border-radius: 2px;
|
|
|
|
background: var(--white);
|
|
|
|
height: 32px;
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 500;
|
|
|
|
}
|
2020-06-01 22:26:32 +02:00
|
|
|
|
|
|
|
.test-result {
|
|
|
|
border: none;
|
|
|
|
width: 100%;
|
|
|
|
border-radius: 2px;
|
|
|
|
height: 32px;
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 500;
|
|
|
|
color: var(--white);
|
|
|
|
text-align: center;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.passed {
|
|
|
|
background: #84c991;
|
|
|
|
}
|
|
|
|
|
|
|
|
.failed {
|
|
|
|
background: var(--coral);
|
|
|
|
}
|
2020-05-27 22:51:32 +02:00
|
|
|
</style>
|