|
|
@ -1,6 +1,7 @@ |
|
|
<script> |
|
|
<script> |
|
|
import { onMount } from "svelte" |
|
|
import { onMount } from "svelte" |
|
|
import { store, backendUiStore } from "../../builderStore" |
|
|
import { store, backendUiStore } from "../../builderStore" |
|
|
|
|
|
import { last } from "lodash/fp"; |
|
|
import Select from "../../common/Select.svelte" |
|
|
import Select from "../../common/Select.svelte" |
|
|
import { getIndexSchema } from "../../common/core" |
|
|
import { getIndexSchema } from "../../common/core" |
|
|
import ActionButton from "../../common/ActionButton.svelte" |
|
|
import ActionButton from "../../common/ActionButton.svelte" |
|
|
@ -36,12 +37,21 @@ |
|
|
backendUiStore.update(state => { |
|
|
backendUiStore.update(state => { |
|
|
state.selectedView.records = recordsForIndex |
|
|
state.selectedView.records = recordsForIndex |
|
|
if (state.selectedView.records.length > 0) { |
|
|
if (state.selectedView.records.length > 0) { |
|
|
headers = Object.keys(recordsForIndex[0]) |
|
|
headers = Object.keys(recordsForIndex[0]) |
|
|
} |
|
|
} |
|
|
return state |
|
|
return state |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function drillIntoRecord(record) { |
|
|
|
|
|
backendUiStore.update(state => { |
|
|
|
|
|
state.selectedRecord = record |
|
|
|
|
|
state.breadcrumbs = [state.selectedDatabase.name, record.id] |
|
|
|
|
|
// Update the dropdown with the child indexes for that record |
|
|
|
|
|
return state |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
onMount(async () => { |
|
|
onMount(async () => { |
|
|
if (views.length > 0) { |
|
|
if (views.length > 0) { |
|
|
await fetchRecordsForView(views[0].name, currentAppInfo) |
|
|
await fetchRecordsForView(views[0].name, currentAppInfo) |
|
|
@ -52,7 +62,7 @@ |
|
|
<section> |
|
|
<section> |
|
|
<div class="table-controls"> |
|
|
<div class="table-controls"> |
|
|
<h4 class="budibase__title--3"> |
|
|
<h4 class="budibase__title--3"> |
|
|
{$backendUiStore.selectedDatabase.name || ''} |
|
|
{last($backendUiStore.breadcrumbs)} |
|
|
</h4> |
|
|
</h4> |
|
|
<Select |
|
|
<Select |
|
|
icon="ri-eye-line" |
|
|
icon="ri-eye-line" |
|
|
@ -83,7 +93,7 @@ |
|
|
<div uk-dropdown="mode: click"> |
|
|
<div uk-dropdown="mode: click"> |
|
|
<ul class="uk-nav uk-dropdown-nav"> |
|
|
<ul class="uk-nav uk-dropdown-nav"> |
|
|
<li> |
|
|
<li> |
|
|
<div on:click={async () => {}}>View</div> |
|
|
<div on:click={() => drillIntoRecord(row)}>View</div> |
|
|
</li> |
|
|
</li> |
|
|
<li |
|
|
<li |
|
|
on:click={() => { |
|
|
on:click={() => { |
|
|
@ -101,14 +111,6 @@ |
|
|
Delete |
|
|
Delete |
|
|
</div> |
|
|
</div> |
|
|
</li> |
|
|
</li> |
|
|
<li> |
|
|
|
|
|
<div |
|
|
|
|
|
on:click={async () => { |
|
|
|
|
|
const response = await api.saveRecord(row) |
|
|
|
|
|
}}> |
|
|
|
|
|
Duplicate |
|
|
|
|
|
</div> |
|
|
|
|
|
</li> |
|
|
|
|
|
</ul> |
|
|
</ul> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|