This commit is contained in:
Martin McKeaveney 2020-06-24 16:12:55 +01:00
parent 31e89e77e5
commit c46ccd05f9
5 changed files with 23 additions and 17 deletions

View File

@ -4,11 +4,10 @@
import { Router, basepath } from "@sveltech/routify"
import { routes } from "../routify/routes"
import { store, initialise } from "builderStore"
import NotificationDisplay from "components/common/Notification/NotificationDisplay.svelte";
import NotificationDisplay from "components/common/Notification/NotificationDisplay.svelte"
$basepath = "/_builder"
</script>
<NotificationDisplay />
<Router {routes} />

View File

@ -1,13 +1,16 @@
import { writable } from 'svelte/store'
import { writable } from "svelte/store"
import { generate } from "shortid"
export const notificationStore = writable({
notifications: []
notifications: [],
})
export function send(message, type = 'default') {
export function send(message, type = "default") {
notificationStore.update(state => {
state.notifications = [...state.notifications, { id: generate(), type, message }]
state.notifications = [
...state.notifications,
{ id: generate(), type, message },
]
return state
})
}
@ -16,5 +19,5 @@ export const notifier = {
danger: msg => send(msg, "danger"),
warning: msg => send(msg, "warning"),
info: msg => send(msg, "info"),
success: msg => send(msg, "success")
}
success: msg => send(msg, "success"),
}

View File

@ -16,17 +16,20 @@
$: if ($notificationStore.notifications.length) {
setTimeout(() => {
notificationStore.update(state => {
state.notifications.shift();
state.notifications.shift()
state.notifications = state.notifications
return state;
return state
})
}, timeout)
}
}
</script>
<ul class="notifications">
{#each $notificationStore.notifications as notification (notification.id)}
<li class="toast" style="background: {themes[notification.type]};" transition:fade>
<li
class="toast"
style="background: {themes[notification.type]};"
transition:fade>
<div class="content">{notification.message}</div>
{#if notification.icon}
<i class={notification.icon} />

View File

@ -132,11 +132,9 @@
</td>
{#each headers as header}
<td>
{#if schema[header].type === "link"}
{#if schema[header].type === 'link'}
<LinkedRecord field={schema[header]} ids={row[header]} />
{:else}
{row[header]}
{/if}
{:else}{row[header]}{/if}
</td>
{/each}
</tr>

View File

@ -78,7 +78,10 @@
{:else if field.type === 'link'}
<div class="field">
<label>Link</label>
<select class="budibase__input" bind:value={field.modelId} on:change={attachModelIdToSchema}>
<select
class="budibase__input"
bind:value={field.modelId}
on:change={attachModelIdToSchema}>
<option value={''} />
{#each $backendUiStore.models as model}
{#if model._id !== $backendUiStore.draftModel._id}