diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte
index 025a6fc684..6498976751 100644
--- a/packages/builder/src/components/backend/DataTable/DataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte
@@ -74,6 +74,6 @@
{/if}
-
+
{/if}
diff --git a/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte
index 17c0b0e0f5..740027a8fd 100644
--- a/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte
@@ -20,7 +20,7 @@
async function exportView() {
download(
`/api/views/export?view=${encodeURIComponent(
- view.name
+ view
)}&format=${exportFormat}`
)
}
diff --git a/packages/builder/src/components/deploy/DeploymentHistory.svelte b/packages/builder/src/components/deploy/DeploymentHistory.svelte
index 0cf4ef5c2f..f6bbcef4d4 100644
--- a/packages/builder/src/components/deploy/DeploymentHistory.svelte
+++ b/packages/builder/src/components/deploy/DeploymentHistory.svelte
@@ -88,8 +88,7 @@
onMount(() => {
fetchDeployments()
- // TODO: fix
- // poll = setInterval(fetchDeployments, POLL_INTERVAL)
+ poll = setInterval(fetchDeployments, POLL_INTERVAL)
})
onDestroy(() => clearInterval(poll))
diff --git a/packages/builder/src/pages/builder/app/[application]/data/table/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/table/_layout.svelte
index f957355c5c..200ebc8d46 100644
--- a/packages/builder/src/pages/builder/app/[application]/data/table/_layout.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/data/table/_layout.svelte
@@ -9,7 +9,7 @@
if (
!$leftover &&
$tables.list.length > 0
- // (!$tables.selected || !$tables.selected._id)
+ (!$tables.selected || !$tables.selected._id)
) {
$goto(`./${$tables.list[0]._id}`)
}
diff --git a/packages/builder/src/stores/backend/datasources.js b/packages/builder/src/stores/backend/datasources.js
index 5e0cc168f2..bb4a94b63b 100644
--- a/packages/builder/src/stores/backend/datasources.js
+++ b/packages/builder/src/stores/backend/datasources.js
@@ -16,12 +16,12 @@ export function createDatasourcesStore() {
init: async () => {
const response = await api.get(`/api/datasources`)
const json = await response.json()
- set({ list: json })
+ set({ list: json, selected: null })
},
fetch: async () => {
const response = await api.get(`/api/datasources`)
const json = await response.json()
- update(state => ({ ...state, list: json }))
+ update(state => ({ ...state, list: json, selected: null }))
return json
},
select: async datasourceId => {
diff --git a/packages/builder/src/stores/backend/tests/datasources.spec.js b/packages/builder/src/stores/backend/tests/datasources.spec.js
index f4e10b6aa3..fb175f03b9 100644
--- a/packages/builder/src/stores/backend/tests/datasources.spec.js
+++ b/packages/builder/src/stores/backend/tests/datasources.spec.js
@@ -24,10 +24,10 @@ describe("Datasources Store", () => {
})
it("fetches all the datasources and updates the store", async () => {
- api.get.mockReturnValue({ json: () => [SOME_DATASOURCE]})
+ api.get.mockReturnValue({ json: () => [SOME_DATASOURCE] })
await store.fetch()
- expect(get(store)).toEqual({ list: [SOME_DATASOURCE], selected: null})
+ expect(get(store)).toEqual({ list: [SOME_DATASOURCE], selected: null })
})
it("selects a datasource", async () => {
@@ -44,7 +44,7 @@ describe("Datasources Store", () => {
})
it("saves the datasource, updates the store and returns status message", async () => {
- api.post.mockReturnValue({ json: () => SAVE_DATASOURCE})
+ api.post.mockReturnValue({ status: 200, json: () => SAVE_DATASOURCE})
await store.save({
name: 'CoolDB',
diff --git a/packages/builder/src/stores/backend/tests/queries.spec.js b/packages/builder/src/stores/backend/tests/queries.spec.js
index d1efd678f9..1d1a1d0154 100644
--- a/packages/builder/src/stores/backend/tests/queries.spec.js
+++ b/packages/builder/src/stores/backend/tests/queries.spec.js
@@ -30,13 +30,6 @@ describe("Queries Store", () => {
expect(get(store)).toEqual({ list: [SOME_QUERY], selected: null})
})
- it("selects a query and updates selected datasource", async () => {
- await store.select(SOME_QUERY)
-
- expect(get(store).selected).toEqual(SOME_QUERY._id)
- expect(get(datasources).selected).toEqual(SOME_QUERY.datasourceId)
- })
-
it("saves the query, updates the store and returns status message", async () => {
api.post.mockReturnValue({ json: () => SAVE_QUERY_RESPONSE})
diff --git a/packages/builder/src/stores/backend/tests/tables.spec.js b/packages/builder/src/stores/backend/tests/tables.spec.js
index 72b68bd0e4..faed217d43 100644
--- a/packages/builder/src/stores/backend/tests/tables.spec.js
+++ b/packages/builder/src/stores/backend/tests/tables.spec.js
@@ -41,14 +41,6 @@ describe("Tables Store", () => {
expect(get(store).draft).toEqual({})
})
- it("selecting a table updates the view store", async () => {
- const tableToSelect = SOME_TABLES[0]
- await store.select(tableToSelect)
-
- expect(get(store).selected).toEqual(tableToSelect)
- expect(get(views).selected).toEqual({ name: tableToSelect._id })
- })
-
it("saving a table also selects it", async () => {
api.post.mockReturnValue({ json: () => SAVE_TABLES_RESPONSE})
diff --git a/packages/server/src/api/controllers/row/internal.js b/packages/server/src/api/controllers/row/internal.js
index 2a55bcb333..93d4a63eb7 100644
--- a/packages/server/src/api/controllers/row/internal.js
+++ b/packages/server/src/api/controllers/row/internal.js
@@ -135,8 +135,8 @@ exports.fetchView = async ctx => {
const viewName = ctx.params.viewName
// if this is a table view being looked for just transfer to that
- if (viewName.startsWith(TABLE_VIEW_BEGINS_WITH)) {
- ctx.params.tableId = viewName.substring(4)
+ if (viewName.includes(DocumentTypes.TABLE)) {
+ ctx.params.tableId = viewName
return exports.fetch(ctx)
}