diff --git a/packages/builder/src/database/DatabaseRoot.svelte b/packages/builder/src/database/DatabaseRoot.svelte index 83d40b7f4e..412e9bf65b 100644 --- a/packages/builder/src/database/DatabaseRoot.svelte +++ b/packages/builder/src/database/DatabaseRoot.svelte @@ -76,7 +76,11 @@ {/if} - + {#if $backendUiStore.selectedDatabase.id} + + {:else} + Please select a database + {/if} diff --git a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte index e4996e9883..697926bd3e 100644 --- a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte @@ -21,7 +21,7 @@ $: views = $store.hierarchy.indexes $: currentAppInfo = { appname: $store.appname, - instanceId: $backendUiStore.selectedDatabase.id + instanceId: $backendUiStore.selectedDatabase.id, } $: data = $backendUiStore.selectedView.records.slice( currentPage * ITEMS_PER_PAGE, @@ -43,93 +43,88 @@ } onMount(async () => { - if (showTable) { + if (views.length > 0) { await fetchRecordsForView(views[0].name, currentAppInfo) } }) -{#if showTable} -
-
-

{$backendUiStore.selectedDatabase.name || ""}

- fetchRecordsForView(e.target.value)}> + {#each views as view} + + {/each} + +
+ + + + + {#each headers as header} + {/each} - - -
Edit{header}
- - - - {#each headers as header} - - {/each} - - - - {#if data.length === 0} -
No Data.
- {/if} - {#each data as row} - - + {#if data.length === 0} +
No Data.
+ {/if} + {#each data as row} + + - {#each headers as header} - - {/each} - - {/each} - -
Edit{header}
-
- -
-
    -
  • -
    { - // fetch the child records for that particular row - }}> - View -
    -
  • -
  • + +
+
+ +
+
    +
  • +
    {}}>View
    +
  • +
  • { + selectRecord(row) + backendUiStore.actions.modals.show('RECORD') + }}> +
    Edit
    +
  • +
  • +
    { selectRecord(row) - backendUiStore.actions.modals.show('RECORD') + backendUiStore.actions.modals.show('DELETE_RECORD') }}> -
    Edit
    -
  • -
  • -
    { - selectRecord(row) - backendUiStore.actions.modals.show('DELETE_RECORD') - }}> - Delete -
    -
  • -
  • -
    { - const response = await api.saveRecord(row) - }}> - Duplicate -
    -
  • -
-
+ Delete +
+ +
  • +
    { + const response = await api.saveRecord(row) + }}> + Duplicate +
    +
  • + -
    {row[header]}
    - -
    -{:else} - Please select a database. -{/if} - + + + {#each headers as header} + {row[header]} + {/each} + + {/each} + + + +