records and edgs

This commit is contained in:
2024-08-19 17:48:10 +03:00
parent 509d7c13f2
commit c97be8666e
46 changed files with 4790 additions and 1387 deletions
@@ -6,6 +6,7 @@
import ReferenceInlineButtons from "./ReferenceInlineButtons.svelte";
import Sortable from "../../libs/Sortable.svelte";
import PreviewReference from "../previews/PreviewReference.svelte";
import axios from "axios";
const channel = getContext("channel");
export let record;
@@ -39,7 +40,16 @@
function insert(e) {
e.preventDefault();
graph = insertEdges(graph,record,e.detail.records,field.name,e.detail.action);
// axios.post(channel.lucentUrl + "/edges/insert-many", {
// source: record.id,
// sourceSchema: record.schema,
// targetSchema: e.detail.schema,
// field: field.name,
// targets: e.detail.records.map(r => r.id),
// }).then(function (response) {
// graph = response.data.graph;
// })
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
}
</script>
@@ -51,10 +61,10 @@
{/if}
<div class="inline-card-wrapper">
<ReferenceInlineButtons
recordId={null}
schemas={collections}
on:insert={insert}
on:save={insert}
recordId={null}
schemas={collections}
on:insert={insert}
on:save={insert}
/>
</div>
{#if references.length > 0}
@@ -63,9 +73,9 @@
<div>
<PreviewReference
{graph}
record={reference}
hasDelete={true}
on:remove={removeReference}
record={reference}
hasDelete={true}
on:remove={removeReference}
/>
</div>
{/each}