diff --git a/packages/auth/src/db/Replication.js b/packages/auth/src/db/Replication.js
index 9720776413..931bc3d496 100644
--- a/packages/auth/src/db/Replication.js
+++ b/packages/auth/src/db/Replication.js
@@ -31,7 +31,7 @@ class Replication {
* Two way replication operation, intended to be promise based.
* @param {Object} opts - PouchDB replication options
*/
- sync(opts) {
+ sync(opts = {}) {
this.replication = this.promisify(this.source.sync, opts)
return this.replication
}
@@ -40,7 +40,7 @@ class Replication {
* One way replication operation, intended to be promise based.
* @param {Object} opts - PouchDB replication options
*/
- replicate(opts) {
+ replicate(opts = {}) {
this.replication = this.promisify(this.source.replicate.to, opts)
return this.replication
}
@@ -61,8 +61,13 @@ class Replication {
})
}
+ /**
+ * Rollback the target DB back to the state of the source DB
+ */
async rollback() {
await this.target.destroy()
+ // Recreate the DB again
+ this.target = getDB(this.target.name)
await this.replicate()
}
diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js
index 3f97a01a1c..b5e5242cb5 100644
--- a/packages/auth/src/db/utils.js
+++ b/packages/auth/src/db/utils.js
@@ -13,6 +13,9 @@ exports.StaticDatabases = {
GLOBAL: {
name: "global-db",
},
+ DEPLOYMENTS: {
+ name: "deployments",
+ },
}
const DocumentTypes = {
@@ -22,6 +25,7 @@ const DocumentTypes = {
TEMPLATE: "template",
APP: "app",
APP_DEV: "app_dev",
+ APP_METADATA: "app_metadata",
ROLE: "role",
}
@@ -162,7 +166,7 @@ exports.getAllApps = async (devApps = false) => {
const appDbNames = allDbs.filter(dbName =>
dbName.startsWith(exports.APP_PREFIX)
)
- const appPromises = appDbNames.map(db => new CouchDB(db).get(db))
+ const appPromises = appDbNames.map(db => new CouchDB(db).get(DocumentTypes.APP_METADATA))
if (appPromises.length === 0) {
return []
} else {
@@ -172,9 +176,9 @@ exports.getAllApps = async (devApps = false) => {
.map(({ value }) => value)
return apps.filter(app => {
if (devApps) {
- return app._id.startsWith(exports.APP_DEV_PREFIX)
+ return app.appId.startsWith(exports.APP_DEV_PREFIX)
}
- return !app._id.startsWith(exports.APP_DEV_PREFIX)
+ return !app.appId.startsWith(exports.APP_DEV_PREFIX)
})
}
}
diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js
index be553066b9..0d80065f2f 100644
--- a/packages/builder/src/builderStore/store/frontend.js
+++ b/packages/builder/src/builderStore/store/frontend.js
@@ -51,14 +51,14 @@ export const getFrontendStore = () => {
store.actions = {
initialise: async pkg => {
const { layouts, screens, application, clientLibPath } = pkg
- const components = await fetchComponentLibDefinitions(application._id)
+ const components = await fetchComponentLibDefinitions(application.appId)
store.update(state => ({
...state,
libraries: application.componentLibraries,
components,
name: application.name,
description: application.description,
- appId: application._id,
+ appId: application.appId,
url: application.url,
layouts,
screens,
diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte
new file mode 100644
index 0000000000..5fffa4cd55
--- /dev/null
+++ b/packages/builder/src/components/deploy/DeployModal.svelte
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+ The changes you have made will be published to the production version of the application.
+
+
diff --git a/packages/builder/src/components/deploy/RevertModal.svelte b/packages/builder/src/components/deploy/RevertModal.svelte
new file mode 100644
index 0000000000..7eaac42bbd
--- /dev/null
+++ b/packages/builder/src/components/deploy/RevertModal.svelte
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+ The changes you have made will be deleted and the application reverted back to its production state.
+
+
diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte
index a4edb756f4..3e7d87bb0f 100644
--- a/packages/builder/src/components/start/AppCard.svelte
+++ b/packages/builder/src/components/start/AppCard.svelte
@@ -41,7 +41,7 @@
{/if}
{#if app.lockedBy && app.lockedBy?.email === $auth.user?.email}
-