removed lodash and axios
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import InlineEdit from "../InlineEdit.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import DialogRecord from "../../dialog/DialogRecord.svelte";
|
||||
import axios from "axios";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import { apiGet } from "../../../helpers";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
@@ -24,7 +24,7 @@
|
||||
e.preventDefault();
|
||||
console.log("Save inline");
|
||||
inLineCreateRecord = null;
|
||||
dialogRecord.close()
|
||||
dialogRecord.close();
|
||||
dispatch("save", {
|
||||
records: e.detail.records,
|
||||
after: recordId,
|
||||
@@ -44,11 +44,10 @@
|
||||
function createInlineReference(e, schemaUId) {
|
||||
e.preventDefault();
|
||||
inLineCreateRecord = null;
|
||||
axios
|
||||
.get(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||
apiGet(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||
.then((response) => {
|
||||
inLineCreateRecord = response.data;
|
||||
dialogRecord.open()
|
||||
inLineCreateRecord = response;
|
||||
dialogRecord.open();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -57,60 +56,53 @@
|
||||
</script>
|
||||
|
||||
{#if schemas.length > 1}
|
||||
<div
|
||||
style="display: flex;align-items: center;gap:4px"
|
||||
>
|
||||
<div style="display: flex;align-items: center;gap:4px">
|
||||
<Dropdown>
|
||||
<div slot="button">New</div>
|
||||
{#each schemas as schema}
|
||||
<button
|
||||
class=" button"
|
||||
on:click={(e) =>
|
||||
createInlineReference(e, schema.name)}
|
||||
>{schema.label}
|
||||
class=" button"
|
||||
on:click={(e) => createInlineReference(e, schema.name)}
|
||||
>{schema.label}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
</Dropdown>
|
||||
<Dropdown>
|
||||
<div slot="button"> <Icon icon="magnifying-glass"/></div>
|
||||
<div slot="button"><Icon icon="magnifying-glass" /></div>
|
||||
{#each schemas as schema}
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schema.name)}
|
||||
>{schema.label}
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schema.name)}
|
||||
>{schema.label}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
</Dropdown>
|
||||
</div>
|
||||
{:else}
|
||||
<div style="display:flex;align-items: center;gap: 4px">
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => createInlineReference(e, schemas[0].name)}
|
||||
>New
|
||||
class="button"
|
||||
on:click={(e) => createInlineReference(e, schemas[0].name)}
|
||||
>New
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schemas[0].name)}
|
||||
>
|
||||
<Icon icon="magnifying-glass"/>
|
||||
</button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schemas[0].name)}
|
||||
>
|
||||
<Icon icon="magnifying-glass" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<DialogRecord bind:this={dialogRecord}>
|
||||
{#if inLineCreateRecord}
|
||||
<InlineEdit
|
||||
{...inLineCreateRecord}
|
||||
isCreateMode={true}
|
||||
on:cancel={(e) => (inLineCreateRecord = null)}
|
||||
on:inlinesaved={save}
|
||||
{...inLineCreateRecord}
|
||||
isCreateMode={true}
|
||||
on:cancel={(e) => (inLineCreateRecord = null)}
|
||||
on:inlinesaved={save}
|
||||
/>
|
||||
|
||||
{/if}
|
||||
</DialogRecord>
|
||||
|
||||
<Dialog bind:this={browseModal} on:insert={insert}/>
|
||||
<Dialog bind:this={browseModal} on:insert={insert} />
|
||||
|
||||
Reference in New Issue
Block a user