Linting.
This commit is contained in:
parent
c8f8fec8a0
commit
c8295f0fbd
|
@ -20,12 +20,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div on:click|stopPropagation bind:this={anchor}>
|
<div on:click|stopPropagation bind:this={anchor}>
|
||||||
<TextButton
|
<TextButton text on:click={dropdown.show} active={false}>
|
||||||
text
|
<Icon name="add" />
|
||||||
on:click={dropdown.show}
|
Add Parameters
|
||||||
active={false}>
|
|
||||||
<Icon name="add" />
|
|
||||||
Add Parameters
|
|
||||||
</TextButton>
|
</TextButton>
|
||||||
<DropdownMenu align="right" {anchor} bind:this={dropdown}>
|
<DropdownMenu align="right" {anchor} bind:this={dropdown}>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { notificationStore } from "builderStore/store/notifications"
|
import { notificationStore } from "builderStore/store/notifications"
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from "svelte/animate"
|
||||||
import { fly } from "svelte/transition"
|
import { fly } from "svelte/transition"
|
||||||
|
|
||||||
export let themes = {
|
export let themes = {
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form on:submit|preventDefault>
|
<form on:submit|preventDefault>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
{#each schemaKeys as field}
|
{#each schemaKeys as field}
|
||||||
<Input
|
<Input
|
||||||
placeholder="Enter {field} name"
|
placeholder="Enter {field} name"
|
||||||
outline
|
outline
|
||||||
|
@ -33,8 +33,8 @@
|
||||||
type={schema.fields[field]?.type}
|
type={schema.fields[field]?.type}
|
||||||
required={schema.fields[field]?.required}
|
required={schema.fields[field]?.required}
|
||||||
bind:value={fields[field]} />
|
bind:value={fields[field]} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{#if schema.customisable}
|
{#if schema.customisable}
|
||||||
<Editor
|
<Editor
|
||||||
|
|
|
@ -135,17 +135,22 @@
|
||||||
<Input placeholder="✎ Edit Query Name" bind:value={query.name} />
|
<Input placeholder="✎ Edit Query Name" bind:value={query.name} />
|
||||||
</div>
|
</div>
|
||||||
{#if config}
|
{#if config}
|
||||||
<div class="props">
|
<div class="props">
|
||||||
<div class="query-type">Query type: <span class="query-type-span">{config[query.queryVerb].type}</span></div>
|
<div class="query-type">
|
||||||
<div class="select">
|
Query type:
|
||||||
<Select primary thin bind:value={query.queryVerb}>
|
<span class="query-type-span">{config[query.queryVerb].type}</span>
|
||||||
{#each Object.keys(config) as queryVerb}
|
</div>
|
||||||
<option value={queryVerb}>{queryVerb}</option>
|
<div class="select">
|
||||||
{/each}
|
<Select primary thin bind:value={query.queryVerb}>
|
||||||
</Select>
|
{#each Object.keys(config) as queryVerb}
|
||||||
</div>
|
<option value={queryVerb}>{queryVerb}</option>
|
||||||
|
{/each}
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<EditQueryParamsPopover bind:parameters={query.parameters} bindable={false} />
|
<EditQueryParamsPopover
|
||||||
|
bind:parameters={query.parameters}
|
||||||
|
bindable={false} />
|
||||||
{/if}
|
{/if}
|
||||||
</header>
|
</header>
|
||||||
<Spacer extraLarge />
|
<Spacer extraLarge />
|
||||||
|
@ -162,10 +167,7 @@
|
||||||
<Spacer large />
|
<Spacer large />
|
||||||
|
|
||||||
<div class="viewer-controls">
|
<div class="viewer-controls">
|
||||||
<Button
|
<Button blue disabled={data.length === 0} on:click={saveQuery}>
|
||||||
blue
|
|
||||||
disabled={data.length === 0}
|
|
||||||
on:click={saveQuery}>
|
|
||||||
Save Query
|
Save Query
|
||||||
</Button>
|
</Button>
|
||||||
<Button primary on:click={previewQuery}>Run Query</Button>
|
<Button primary on:click={previewQuery}>Run Query</Button>
|
||||||
|
@ -182,7 +184,11 @@
|
||||||
{#each fields as field, idx}
|
{#each fields as field, idx}
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Input outline placeholder="Field Name" type={'text'} bind:value={field.name} />
|
<Input
|
||||||
|
outline
|
||||||
|
placeholder="Field Name"
|
||||||
|
type={'text'}
|
||||||
|
bind:value={field.name} />
|
||||||
<Select thin border bind:value={field.type}>
|
<Select thin border bind:value={field.type}>
|
||||||
<option value={''}>Select a field type</option>
|
<option value={''}>Select a field type</option>
|
||||||
<option value={'STRING'}>Text</option>
|
<option value={'STRING'}>Text</option>
|
||||||
|
@ -195,8 +201,8 @@
|
||||||
on:click={() => deleteField(idx)} />
|
on:click={() => deleteField(idx)} />
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<Button thin secondary on:click={newField}>Add Field</Button>
|
<Button thin secondary on:click={newField}>Add Field</Button>
|
||||||
{/if}
|
{/if}
|
||||||
</Switcher>
|
</Switcher>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -206,7 +212,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{#if schema}
|
{#if schema}
|
||||||
{#key query._id}
|
{#key query._id}
|
||||||
{#if schema.type === QueryTypes.SQL}
|
{#if schema.type === QueryTypes.SQL}
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -2,9 +2,14 @@
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import { setContext, onMount } from "svelte"
|
import { setContext, onMount } from "svelte"
|
||||||
import Component from "./Component.svelte"
|
import Component from "./Component.svelte"
|
||||||
import NotificationDisplay from './NotificationDisplay.svelte'
|
import NotificationDisplay from "./NotificationDisplay.svelte"
|
||||||
import SDK from "../sdk"
|
import SDK from "../sdk"
|
||||||
import { createDataStore, initialise, screenStore, notificationStore } from "../store"
|
import {
|
||||||
|
createDataStore,
|
||||||
|
initialise,
|
||||||
|
screenStore,
|
||||||
|
notificationStore,
|
||||||
|
} from "../store"
|
||||||
|
|
||||||
// Provide contexts
|
// Provide contexts
|
||||||
setContext("sdk", SDK)
|
setContext("sdk", SDK)
|
||||||
|
|
|
@ -1,60 +1,59 @@
|
||||||
<script>
|
<script>
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from "svelte/animate"
|
||||||
import { fly } from "svelte/transition"
|
import { fly } from "svelte/transition"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
const { notifications } = getContext("sdk")
|
const { notifications } = getContext("sdk")
|
||||||
|
|
||||||
export let themes = {
|
export let themes = {
|
||||||
danger: "#E26D69",
|
danger: "#E26D69",
|
||||||
success: "#84C991",
|
success: "#84C991",
|
||||||
warning: "#f0ad4e",
|
warning: "#f0ad4e",
|
||||||
info: "#5bc0de",
|
info: "#5bc0de",
|
||||||
default: "#aaaaaa",
|
default: "#aaaaaa",
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="notifications">
|
<div class="notifications">
|
||||||
{#each $notifications as notification (notification.id)}
|
{#each $notifications as notification (notification.id)}
|
||||||
<div
|
<div
|
||||||
animate:flip
|
animate:flip
|
||||||
class="toast"
|
class="toast"
|
||||||
style="background: {themes[notification.type]};"
|
style="background: {themes[notification.type]};"
|
||||||
transition:fly={{ y: -30 }}>
|
transition:fly={{ y: -30 }}>
|
||||||
<div class="content">{notification.message}</div>
|
<div class="content">{notification.message}</div>
|
||||||
{#if notification.icon}<i class={notification.icon} />{/if}
|
{#if notification.icon}<i class={notification.icon} />{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.notifications {
|
.notifications {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast {
|
.toast {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
border-radius: var(--border-radius-s);
|
border-radius: var(--border-radius-s);
|
||||||
/* The toasts now support being auto sized, so this static width could be removed */
|
/* The toasts now support being auto sized, so this static width could be removed */
|
||||||
width: 40vw;
|
width: 40vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
|
||||||
padding: 10px;
|
|
||||||
display: block;
|
|
||||||
color: white;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 10px;
|
||||||
|
display: block;
|
||||||
|
color: white;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
const Helper = require("./Helper")
|
const Helper = require("./Helper")
|
||||||
const { SafeString } = require("handlebars")
|
const { SafeString } = require("handlebars")
|
||||||
const externalHandlebars = require("./external")
|
const externalHandlebars = require("./external")
|
||||||
const { HelperFunctionNames, HelperFunctionBuiltin, LITERAL_MARKER } = require("./constants")
|
const {
|
||||||
|
HelperFunctionNames,
|
||||||
|
HelperFunctionBuiltin,
|
||||||
|
LITERAL_MARKER,
|
||||||
|
} = require("./constants")
|
||||||
|
|
||||||
const HTML_SWAPS = {
|
const HTML_SWAPS = {
|
||||||
"<": "<",
|
"<": "<",
|
||||||
|
@ -29,10 +33,10 @@ const HELPERS = [
|
||||||
}),
|
}),
|
||||||
// adds a note for post-processor
|
// adds a note for post-processor
|
||||||
new Helper(HelperFunctionNames.LITERAL, value => {
|
new Helper(HelperFunctionNames.LITERAL, value => {
|
||||||
const type = typeof(value)
|
const type = typeof value
|
||||||
const outputVal = type === "object" ? JSON.stringify(value) : value
|
const outputVal = type === "object" ? JSON.stringify(value) : value
|
||||||
return `{{-${LITERAL_MARKER}-${type}-${outputVal}-}}`
|
return `{{-${LITERAL_MARKER}-${type}-${outputVal}-}}`
|
||||||
})
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports.HelperNames = () => {
|
module.exports.HelperNames = () => {
|
||||||
|
|
|
@ -39,5 +39,5 @@ module.exports.processors = [
|
||||||
return JSON.parse(value)
|
return JSON.parse(value)
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
})
|
}),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue