adding sum and count functionality, preventing user from doing bad filters
This commit is contained in:
parent
a2f64a80a0
commit
a23440c740
|
@ -23,7 +23,9 @@
|
||||||
class="automation-block hoverable"
|
class="automation-block hoverable"
|
||||||
on:click={addBlockToAutomation}
|
on:click={addBlockToAutomation}
|
||||||
data-cy={stepId}>
|
data-cy={stepId}>
|
||||||
<div><i class={blockDefinition.icon} /></div>
|
<div>
|
||||||
|
<i class={blockDefinition.icon} />
|
||||||
|
</div>
|
||||||
<div class="automation-text">
|
<div class="automation-text">
|
||||||
<h4>{blockDefinition.name}</h4>
|
<h4>{blockDefinition.name}</h4>
|
||||||
<p>{blockDefinition.description}</p>
|
<p>{blockDefinition.description}</p>
|
||||||
|
|
|
@ -62,7 +62,10 @@
|
||||||
{#if $automationStore.selectedBlock}
|
{#if $automationStore.selectedBlock}
|
||||||
<AutomationBlockSetup bind:block={$automationStore.selectedBlock} />
|
<AutomationBlockSetup bind:block={$automationStore.selectedBlock} />
|
||||||
{:else if $automationStore.selectedAutomation}
|
{:else if $automationStore.selectedAutomation}
|
||||||
<div class="block-label">Automation <b>{automation.name}</b></div>
|
<div class="block-label">
|
||||||
|
Automation
|
||||||
|
<b>{automation.name}</b>
|
||||||
|
</div>
|
||||||
<Button secondary wide on:click={testAutomation}>Test Automation</Button>
|
<Button secondary wide on:click={testAutomation}>Test Automation</Button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -108,8 +108,7 @@
|
||||||
<div
|
<div
|
||||||
class:link={row[header] && row[header].length}
|
class:link={row[header] && row[header].length}
|
||||||
on:click={() => selectRelationship(row, header)}>
|
on:click={() => selectRelationship(row, header)}>
|
||||||
{row[header] ? row[header].length : 0}
|
{row[header] ? row[header].length : 0} related row(s)
|
||||||
related row(s)
|
|
||||||
</div>
|
</div>
|
||||||
{:else if schema[header].type === 'attachment'}
|
{:else if schema[header].type === 'attachment'}
|
||||||
<AttachmentList files={row[header] || []} />
|
<AttachmentList files={row[header] || []} />
|
||||||
|
|
|
@ -49,7 +49,9 @@
|
||||||
<button class:selected={currentPage === 0} on:click={() => selectPage(0)}>
|
<button class:selected={currentPage === 0} on:click={() => selectPage(0)}>
|
||||||
1
|
1
|
||||||
</button>
|
</button>
|
||||||
{#if currentPage > 3}<button disabled>...</button>{/if}
|
{#if currentPage > 3}
|
||||||
|
<button disabled>...</button>
|
||||||
|
{/if}
|
||||||
{#each pagesAroundCurrent as idx}
|
{#each pagesAroundCurrent as idx}
|
||||||
<button
|
<button
|
||||||
class:selected={idx === currentPage}
|
class:selected={idx === currentPage}
|
||||||
|
@ -57,7 +59,9 @@
|
||||||
{idx + 1}
|
{idx + 1}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
{#if currentPage < numPages - 4}<button disabled>...</button>{/if}
|
{#if currentPage < numPages - 4}
|
||||||
|
<button disabled>...</button>
|
||||||
|
{/if}
|
||||||
<button
|
<button
|
||||||
class:selected={currentPage === numPages - 1}
|
class:selected={currentPage === numPages - 1}
|
||||||
on:click={() => selectPage(numPages - 1)}>
|
on:click={() => selectPage(numPages - 1)}>
|
||||||
|
@ -73,13 +77,8 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{#if numPages > 1}
|
{#if numPages > 1}
|
||||||
Showing
|
Showing {ITEMS_PER_PAGE * currentPage + 1} - {ITEMS_PER_PAGE * currentPage + pageItemCount}
|
||||||
{ITEMS_PER_PAGE * currentPage + 1}
|
of {data.length} rows
|
||||||
-
|
|
||||||
{ITEMS_PER_PAGE * currentPage + pageItemCount}
|
|
||||||
of
|
|
||||||
{data.length}
|
|
||||||
rows
|
|
||||||
{:else if numPages === 1}Showing all {data.length} row(s){/if}
|
{:else if numPages === 1}Showing all {data.length} row(s){/if}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,15 +15,16 @@
|
||||||
// Fetch rows for specified view
|
// Fetch rows for specified view
|
||||||
$: {
|
$: {
|
||||||
if (!name.startsWith("all_")) {
|
if (!name.startsWith("all_")) {
|
||||||
fetchViewData(name, view.field, view.groupBy)
|
fetchViewData(name, view.field, view.groupBy, view.calculation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchViewData(name, field, groupBy) {
|
async function fetchViewData(name, field, groupBy, calculation) {
|
||||||
const params = new URLSearchParams()
|
const params = new URLSearchParams()
|
||||||
if (field) {
|
if (calculation) {
|
||||||
params.set("field", field)
|
params.set("field", field)
|
||||||
params.set("stats", true)
|
// todo, maybe won't work
|
||||||
|
params.set("calculation", calculation)
|
||||||
}
|
}
|
||||||
if (groupBy) {
|
if (groupBy) {
|
||||||
params.set("group", groupBy)
|
params.set("group", groupBy)
|
||||||
|
|
|
@ -9,6 +9,14 @@
|
||||||
name: "Statistics",
|
name: "Statistics",
|
||||||
key: "stats",
|
key: "stats",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Count",
|
||||||
|
key: "count",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Sum",
|
||||||
|
key: "sum",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export let view = {}
|
export let view = {}
|
||||||
|
@ -22,6 +30,7 @@
|
||||||
Object.keys(viewTable.schema).filter(
|
Object.keys(viewTable.schema).filter(
|
||||||
field => viewTable.schema[field].type === "number"
|
field => viewTable.schema[field].type === "number"
|
||||||
)
|
)
|
||||||
|
$: valid = view.calculation === "count" || view.field
|
||||||
|
|
||||||
function saveView() {
|
function saveView() {
|
||||||
if (!view.calculation) view.calculation = "stats"
|
if (!view.calculation) view.calculation = "stats"
|
||||||
|
@ -35,17 +44,20 @@
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<h5>Calculate</h5>
|
<h5>Calculate</h5>
|
||||||
<div class="input-group-row">
|
<div class="input-group-row">
|
||||||
<!-- <p>The</p>
|
<p>The</p>
|
||||||
<Select secondary thin bind:value={view.calculation}>
|
<Select secondary thin bind:value={view.calculation}>
|
||||||
<option value="">Choose an option</option>
|
<option value={''}>Choose an option</option>
|
||||||
{#each CALCULATIONS as calculation}
|
{#each CALCULATIONS as calculation}
|
||||||
<option value={calculation.key}>{calculation.name}</option>
|
<option value={calculation.key}>{calculation.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
<p>of</p> -->
|
<p>of</p>
|
||||||
<p>The statistics of</p>
|
|
||||||
<Select secondary thin bind:value={view.field}>
|
<Select secondary thin bind:value={view.field}>
|
||||||
<option value="">Choose an option</option>
|
<option value={''}>
|
||||||
|
{#if view.calculation === 'count'}
|
||||||
|
All Rows
|
||||||
|
{:else}You must choose an option{/if}
|
||||||
|
</option>
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
<option value={field}>{field}</option>
|
<option value={field}>{field}</option>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -53,7 +65,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<Button secondary on:click={onClosed}>Cancel</Button>
|
<Button secondary on:click={onClosed}>Cancel</Button>
|
||||||
<Button primary on:click={saveView}>Save</Button>
|
<Button primary on:click={saveView} disabled={!valid}>Save</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,9 @@
|
||||||
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>
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="img"><img src="https://picsum.photos/60/60" alt="zoom" /></div>
|
<div class="img">
|
||||||
|
<img src="https://picsum.photos/60/60" alt="zoom" />
|
||||||
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="title">Zoom</div>
|
<div class="title">Zoom</div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<Label extraSmall grey>Current Users</Label>
|
<Label extraSmall grey>Current Users</Label>
|
||||||
{#await fetchUsersPromise}
|
{#await fetchUsersPromise}
|
||||||
Loading...
|
Loading...
|
||||||
{:then users}
|
{:then [object Object]}
|
||||||
<ul>
|
<ul>
|
||||||
{#each users as user}
|
{#each users as user}
|
||||||
<li>
|
<li>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
<li>No Users found</li>
|
<li>No Users found</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
{:catch error}
|
{:catch [object Object]}
|
||||||
Something went wrong when trying to fetch users. Please refresh (CMD + R /
|
Something went wrong when trying to fetch users. Please refresh (CMD + R /
|
||||||
CTRL + R) the page and try again.
|
CTRL + R) the page and try again.
|
||||||
{/await}
|
{/await}
|
||||||
|
|
|
@ -10,9 +10,7 @@
|
||||||
<Spacer medium />
|
<Spacer medium />
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<TextButton text medium blue href="/_builder/{_id}">
|
<TextButton text medium blue href="/_builder/{_id}">
|
||||||
Open
|
Open {name} →
|
||||||
{name}
|
|
||||||
→
|
|
||||||
</TextButton>
|
</TextButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<div class="spinner-container">
|
<div class="spinner-container">
|
||||||
<Spinner size="30" />
|
<Spinner size="30" />
|
||||||
</div>
|
</div>
|
||||||
{:then apps}
|
{:then [object Object]}
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:catch err}
|
{:catch [object Object]}
|
||||||
<h1 style="color:red">{err}</h1>
|
<h1 style="color:red">{err}</h1>
|
||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<div class="spinner-container">
|
<div class="spinner-container">
|
||||||
<Spinner size="30" />
|
<Spinner size="30" />
|
||||||
</div>
|
</div>
|
||||||
{:then templates}
|
{:then [object Object]}
|
||||||
<div class="templates">
|
<div class="templates">
|
||||||
{#each templates as template}
|
{#each templates as template}
|
||||||
<div class="templates-card">
|
<div class="templates-card">
|
||||||
|
@ -28,17 +28,18 @@
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<Body medium grey>{template.category}</Body>
|
<Body medium grey>{template.category}</Body>
|
||||||
<Body lh small black>{template.description}</Body>
|
<Body lh small black>{template.description}</Body>
|
||||||
<div><img src={template.image} width="100%" /></div>
|
<div>
|
||||||
|
<img src={template.image} width="100%" />
|
||||||
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<Button secondary on:click={() => onSelect(template)}>
|
<Button secondary on:click={() => onSelect(template)}>
|
||||||
Create
|
Create {template.name}
|
||||||
{template.name}
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:catch err}
|
{:catch [object Object]}
|
||||||
<h1 style="color:red">{err}</h1>
|
<h1 style="color:red">{err}</h1>
|
||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -99,7 +99,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:this={anchor} on:click|stopPropagation={() => {}}>
|
<div bind:this={anchor} on:click|stopPropagation={() => {}}>
|
||||||
<div class="icon" on:click={dropdown.show}><i class="ri-more-line" /></div>
|
<div class="icon" on:click={dropdown.show}>
|
||||||
|
<i class="ri-more-line" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
bind:this={dropdown}
|
bind:this={dropdown}
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="handler-option">
|
<div class="handler-option">
|
||||||
{#if parameter.name === 'automation'}<span>{parameter.name}</span>{/if}
|
{#if parameter.name === 'automation'}
|
||||||
|
<span>{parameter.name}</span>
|
||||||
|
{/if}
|
||||||
{#if parameter.name === 'automation'}
|
{#if parameter.name === 'automation'}
|
||||||
<Select on:change bind:value={parameter.value}>
|
<Select on:change bind:value={parameter.value}>
|
||||||
<option value="" />
|
<option value="" />
|
||||||
|
|
|
@ -126,7 +126,9 @@
|
||||||
on:click={() => switchLetter(letter)}>
|
on:click={() => switchLetter(letter)}>
|
||||||
{letter}
|
{letter}
|
||||||
</span>
|
</span>
|
||||||
{#if idx !== alphabet.length - 1}<span>-</span>{/if}
|
{#if idx !== alphabet.length - 1}
|
||||||
|
<span>-</span>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="search-input">
|
<div class="search-input">
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div data-cy={item.name} class="item-item" on:click>
|
<div data-cy={item.name} class="item-item" on:click>
|
||||||
<div class="item-icon"><i class={item.icon} /></div>
|
<div class="item-icon">
|
||||||
|
<i class={item.icon} />
|
||||||
|
</div>
|
||||||
<div class="item-text">
|
<div class="item-text">
|
||||||
<div class="item-name">{item.name}</div>
|
<div class="item-name">{item.name}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -80,9 +80,9 @@
|
||||||
{#await promise}
|
{#await promise}
|
||||||
<!-- This should probably be some kind of loading state? -->
|
<!-- This should probably be some kind of loading state? -->
|
||||||
<div />
|
<div />
|
||||||
{:then results}
|
{:then [object Object]}
|
||||||
<slot />
|
<slot />
|
||||||
{:catch error}
|
{:catch [object Object]}
|
||||||
<p>Something went wrong: {error.message}</p>
|
<p>Something went wrong: {error.message}</p>
|
||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
|
|
||||||
{#if $backendUiStore.selectedDatabase._id && selectedTable.name}
|
{#if $backendUiStore.selectedDatabase._id && selectedTable.name}
|
||||||
<TableDataTable />
|
<TableDataTable />
|
||||||
{:else}<i>Create your first table to start building</i>{/if}
|
{:else}
|
||||||
|
<i>Create your first table to start building</i>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
i {
|
i {
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
|
|
||||||
{#if $backendUiStore.tables.length === 0}
|
{#if $backendUiStore.tables.length === 0}
|
||||||
<i>Create your first table to start building</i>
|
<i>Create your first table to start building</i>
|
||||||
{:else}<i>Select a table to edit</i>{/if}
|
{:else}
|
||||||
|
<i>Select a table to edit</i>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
i {
|
i {
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
|
|
||||||
{#if $backendUiStore.selectedDatabase._id && selectedView}
|
{#if $backendUiStore.selectedDatabase._id && selectedView}
|
||||||
<ViewDataTable view={selectedView} />
|
<ViewDataTable view={selectedView} />
|
||||||
{:else}<i>Create your first table to start building</i>{/if}
|
{:else}
|
||||||
|
<i>Create your first table to start building</i>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
i {
|
i {
|
||||||
|
|
|
@ -137,7 +137,7 @@ exports.save = async function(ctx) {
|
||||||
exports.fetchView = async function(ctx) {
|
exports.fetchView = async function(ctx) {
|
||||||
const instanceId = ctx.user.instanceId
|
const instanceId = ctx.user.instanceId
|
||||||
const db = new CouchDB(instanceId)
|
const db = new CouchDB(instanceId)
|
||||||
const { stats, group, field } = ctx.query
|
const { calculation, group, field } = ctx.query
|
||||||
const viewName = ctx.params.viewName
|
const viewName = ctx.params.viewName
|
||||||
|
|
||||||
// if this is a table view being looked for just transfer to that
|
// if this is a table view being looked for just transfer to that
|
||||||
|
@ -148,22 +148,34 @@ exports.fetchView = async function(ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await db.query(`database/${viewName}`, {
|
const response = await db.query(`database/${viewName}`, {
|
||||||
include_docs: !stats,
|
include_docs: !calculation,
|
||||||
group,
|
group,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (stats) {
|
// TODO: create constants for calculation types
|
||||||
|
if (!calculation) {
|
||||||
|
response.rows = response.rows.map(row => row.doc)
|
||||||
|
ctx.body = await linkRows.attachLinkInfo(instanceId, response.rows)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calculation === "stats") {
|
||||||
response.rows = response.rows.map(row => ({
|
response.rows = response.rows.map(row => ({
|
||||||
group: row.key,
|
group: row.key,
|
||||||
field,
|
field,
|
||||||
...row.value,
|
...row.value,
|
||||||
avg: row.value.sum / row.value.count,
|
avg: row.value.sum / row.value.count,
|
||||||
}))
|
}))
|
||||||
} else {
|
ctx.body = response.rows
|
||||||
response.rows = response.rows.map(row => row.doc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.body = await linkRows.attachLinkInfo(instanceId, response.rows)
|
if (calculation === "count" || calculation === "sum") {
|
||||||
|
ctx.body = field
|
||||||
|
? response.rows.map(row => ({
|
||||||
|
field,
|
||||||
|
value: row.value,
|
||||||
|
}))
|
||||||
|
: [{ field: "All Rows", value: response.total_rows }]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.fetchTableRows = async function(ctx) {
|
exports.fetchTableRows = async function(ctx) {
|
||||||
|
|
|
@ -23,6 +23,14 @@ const FIELD_PROPERTY = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const SCHEMA_MAP = {
|
const SCHEMA_MAP = {
|
||||||
|
sum: {
|
||||||
|
field: "string",
|
||||||
|
value: "number",
|
||||||
|
},
|
||||||
|
count: {
|
||||||
|
field: "string",
|
||||||
|
value: "number",
|
||||||
|
},
|
||||||
stats: {
|
stats: {
|
||||||
sum: {
|
sum: {
|
||||||
type: "number",
|
type: "number",
|
||||||
|
@ -82,7 +90,7 @@ function parseFilterExpression(filters) {
|
||||||
*/
|
*/
|
||||||
function parseEmitExpression(field, groupBy) {
|
function parseEmitExpression(field, groupBy) {
|
||||||
if (field) return `emit(doc["${groupBy || "_id"}"], doc["${field}"]);`
|
if (field) return `emit(doc["${groupBy || "_id"}"], doc["${field}"]);`
|
||||||
return `emit(doc._id);`
|
return `emit(doc._id, 1);`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +110,7 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) {
|
||||||
|
|
||||||
const emitExpression = parseEmitExpression(field, groupBy)
|
const emitExpression = parseEmitExpression(field, groupBy)
|
||||||
|
|
||||||
const reduction = field ? { reduce: "_stats" } : {}
|
const reduction = field ? { reduce: `_${calculation}` } : {}
|
||||||
|
|
||||||
let schema = null
|
let schema = null
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:cssVars={cssVariables} class="container">
|
<div use:cssVars={cssVariables} class="container">
|
||||||
{#if showImage}<img class="image" src={imageUrl} alt="" />{/if}
|
{#if showImage}
|
||||||
|
<img class="image" src={imageUrl} alt="" />
|
||||||
|
{/if}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h2 class="heading">{heading}</h2>
|
<h2 class="heading">{heading}</h2>
|
||||||
<h4 class="text">{description}</h4>
|
<h4 class="text">{description}</h4>
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:cssVars={cssVariables} class="container">
|
<div use:cssVars={cssVariables} class="container">
|
||||||
{#if showImage}<img class="image" src={imageUrl} alt="" />{/if}
|
{#if showImage}
|
||||||
|
<img class="image" src={imageUrl} alt="" />
|
||||||
|
{/if}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<main>
|
<main>
|
||||||
<h2 class="heading">{heading}</h2>
|
<h2 class="heading">{heading}</h2>
|
||||||
|
|
|
@ -27,4 +27,15 @@
|
||||||
on:newRow={() => dispatch('newRow')} />
|
on:newRow={() => dispatch('newRow')} />
|
||||||
</DropdownMenu> -->
|
</DropdownMenu> -->
|
||||||
|
|
||||||
<!--<style ✂prettier:content✂="CiAgZGl2IHsKICAgIGRpc3BsYXk6IGdyaWQ7CiAgICBncmlkLXRlbXBsYXRlLWNvbHVtbnM6IGF1dG8gYXV0bzsKICAgIHBsYWNlLWl0ZW1zOiBzdGFydCBjZW50ZXI7CiAgfQogIGg1IHsKICAgIHBhZGRpbmc6IHZhcigtLXNwYWNpbmcteGwpIDAgMCB2YXIoLS1zcGFjaW5nLXhsKTsKICAgIG1hcmdpbjogMDsKICAgIGZvbnQtd2VpZ2h0OiA1MDA7CiAgfQo=" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂=""></style>-->
|
<!--<style>
|
||||||
|
div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto;
|
||||||
|
place-items: start center;
|
||||||
|
}
|
||||||
|
h5 {
|
||||||
|
padding: var(--spacing-xl) 0 0 var(--spacing-xl);
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
</style>-->
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
export let editable
|
export let editable
|
||||||
export let theme = "alpine"
|
export let theme = "alpine"
|
||||||
export let height = 500
|
export let height = 500
|
||||||
export let pagination
|
export let pagination = true
|
||||||
|
|
||||||
// These can never change at runtime so don't need to be reactive
|
// These can never change at runtime so don't need to be reactive
|
||||||
let canEdit = editable && datasource && datasource.type !== "view"
|
let canEdit = editable && datasource && datasource.type !== "view"
|
||||||
|
@ -135,9 +135,7 @@
|
||||||
{#if selectedRows.length > 0}
|
{#if selectedRows.length > 0}
|
||||||
<DeleteButton text small on:click={deleteRows}>
|
<DeleteButton text small on:click={deleteRows}>
|
||||||
<Icon name="addrow" />
|
<Icon name="addrow" />
|
||||||
Delete
|
Delete {selectedRows.length} row(s)
|
||||||
{selectedRows.length}
|
|
||||||
row(s)
|
|
||||||
</DeleteButton>
|
</DeleteButton>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -42,7 +42,9 @@
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{#if logo}
|
{#if logo}
|
||||||
<div class="logo-container"><img src={logo} alt="logo" /></div>
|
<div class="logo-container">
|
||||||
|
<img src={logo} alt="logo" />
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if title}
|
{#if title}
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
{#if logoUrl}
|
{#if logoUrl}
|
||||||
<img class="logo" alt="logo" src={logoUrl} height="48" />
|
<img class="logo" alt="logo" src={logoUrl} height="48" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if title}<span>{title}</span>{/if}
|
{#if title}
|
||||||
|
<span>{title}</span>
|
||||||
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
<div class="nav__controls">
|
<div class="nav__controls">
|
||||||
<div on:click={logOut}>Log out</div>
|
<div on:click={logOut}>Log out</div>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
{#await _appPromise}
|
{#await _appPromise}
|
||||||
loading
|
loading
|
||||||
{:then _bb}
|
{:then [object Object]}
|
||||||
<div id="current_component" bind:this={currentComponent} />
|
<div id="current_component" bind:this={currentComponent} />
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
|
|
|
@ -33,4 +33,6 @@
|
||||||
<sub class={className}>{text}</sub>
|
<sub class={className}>{text}</sub>
|
||||||
{:else if isTag('sup')}
|
{:else if isTag('sup')}
|
||||||
<sup class={className}>{text}</sup>
|
<sup class={className}>{text}</sup>
|
||||||
{:else}<span>{text}</span>{/if}
|
{:else}
|
||||||
|
<span>{text}</span>
|
||||||
|
{/if}
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
<div class="file">
|
<div class="file">
|
||||||
{#if FILE_TYPES.IMAGE.includes(file.extension.toLowerCase())}
|
{#if FILE_TYPES.IMAGE.includes(file.extension.toLowerCase())}
|
||||||
<img {width} {height} src={file.url} alt="preview of {file.name}" />
|
<img {width} {height} src={file.url} alt="preview of {file.name}" />
|
||||||
{:else}<i class="far fa-file" />{/if}
|
{:else}
|
||||||
|
<i class="far fa-file" />
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<span>{file.name}</span>
|
<span>{file.name}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue