diff --git a/packages/builder/src/components/start/ExportAppModal.svelte b/packages/builder/src/components/start/ExportAppModal.svelte
new file mode 100644
index 0000000000..19f86b12d8
--- /dev/null
+++ b/packages/builder/src/components/start/ExportAppModal.svelte
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte
index a25e7e2c6a..494cf0df92 100644
--- a/packages/builder/src/pages/builder/portal/apps/index.svelte
+++ b/packages/builder/src/pages/builder/portal/apps/index.svelte
@@ -18,6 +18,7 @@
import CreateAppModal from "components/start/CreateAppModal.svelte"
import UpdateAppModal from "components/start/UpdateAppModal.svelte"
import ChooseIconModal from "components/start/ChooseIconModal.svelte"
+ import ExportAppModal from "components/start/ExportAppModal.svelte"
import { store, automationStore } from "builderStore"
import { API } from "api"
@@ -38,6 +39,7 @@
let updatingModal
let deletionModal
let unpublishModal
+ let exportModal
let iconModal
let creatingApp = false
let loaded = $apps?.length || $templates?.length
@@ -198,9 +200,8 @@
}
const exportApp = app => {
- const id = app.deployed ? app.prodId : app.devId
- const appName = encodeURIComponent(app.name)
- window.location = `/api/backups/export?appId=${id}&appname=${appName}`
+ exportModal.show()
+ selectedApp = app
}
const unpublishApp = app => {
@@ -434,6 +435,10 @@
+
+
+
+
{
return fs.createReadStream(path)
}
+exports.defineFilter = includeRows => {
+ if (includeRows) {
+ return doc =>
+ !(
+ doc._id.includes(USER_METDATA_PREFIX) ||
+ doc._id.includes(LINK_USER_METADATA_PREFIX)
+ )
+ } else if (!includeRows) {
+ return doc =>
+ !(
+ doc._id.includes(USER_METDATA_PREFIX) ||
+ doc._id.includes(LINK_USER_METADATA_PREFIX) ||
+ doc._id.includes(TABLE_ROW_PREFIX)
+ )
+ }
+}
+
/**
* Local utility to back up the database state for an app, excluding global user
* data or user relationships.
@@ -116,14 +134,10 @@ exports.apiFileReturn = contents => {
* @param {object} config Config to send to export DB
* @returns {*} either a string or a stream of the backup
*/
-const backupAppData = async (appId, config) => {
+const backupAppData = async (appId, config, noRows) => {
return await exports.exportDB(appId, {
...config,
- filter: doc =>
- !(
- doc._id.includes(USER_METDATA_PREFIX) ||
- doc._id.includes(LINK_USER_METADATA_PREFIX)
- ),
+ filter: exports.defineFilter(noRows),
})
}
@@ -142,8 +156,8 @@ exports.performBackup = async (appId, backupName) => {
* @param {string} appId The ID of the app which is to be backed up.
* @returns {*} a readable stream of the backup which is written in real time
*/
-exports.streamBackup = async appId => {
- return await backupAppData(appId, { stream: true })
+exports.streamBackup = async (appId, includeRows) => {
+ return await backupAppData(appId, { stream: true }, includeRows)
}
/**