This commit is contained in:
Martin McKeaveney 2021-05-17 21:43:50 +01:00
parent 96142c91cd
commit d5fb542589
11 changed files with 66 additions and 43 deletions

View File

@ -166,7 +166,9 @@ exports.getAllApps = async (devApps = false) => {
const appDbNames = allDbs.filter(dbName =>
dbName.startsWith(exports.APP_PREFIX)
)
const appPromises = appDbNames.map(db => new CouchDB(db).get(DocumentTypes.APP_METADATA))
const appPromises = appDbNames.map(db =>
new CouchDB(db).get(DocumentTypes.APP_METADATA)
)
if (appPromises.length === 0) {
return []
} else {

View File

@ -143,7 +143,6 @@ class RedisWrapper {
}
async clear() {
const db = this._db
let items = await this.scan()
await Promise.all(items.map(obj => this.delete(obj.key)))
}

View File

@ -14,7 +14,6 @@
const POLL_INTERVAL = 1000
let loading = false
let feedbackModal
let deployments = []
@ -64,7 +63,10 @@
function checkIncomingDeploymentStatus(current, incoming) {
console.log(current, incoming)
for (let incomingDeployment of incoming) {
if (incomingDeployment.status === DeploymentStatus.FAILURE || incomingDeployment.status === DeploymentStatus.SUCCESS) {
if (
incomingDeployment.status === DeploymentStatus.FAILURE ||
incomingDeployment.status === DeploymentStatus.SUCCESS
) {
const currentDeployment = current.find(
deployment => deployment._id === incomingDeployment._id
)
@ -77,14 +79,17 @@
if (incomingDeployment.status === DeploymentStatus.FAILURE) {
notifications.error(incomingDeployment.err)
} else {
notifications.send("Published to Production.", "success", "CheckmarkCircle")
notifications.send(
"Published to Production.",
"success",
"CheckmarkCircle"
)
}
}
}
}
}
onMount(() => {
fetchDeployments()
poll = setInterval(fetchDeployments, POLL_INTERVAL)
@ -93,19 +98,16 @@
onDestroy(() => clearInterval(poll))
</script>
<Button
secondary
on:click={publishModal.show}
>
Publish
</Button>
<Button secondary on:click={publishModal.show}>Publish</Button>
<Modal bind:this={publishModal}>
<ModalContent
title="Publish to Production"
confirmText="Publish"
onConfirm={deployApp}
>
<span>The changes you have made will be published to the production version of the application.</span>
<span
>The changes you have made will be published to the production version of
the application.</span
>
</ModalContent>
</Modal>

View File

@ -1,6 +1,12 @@
<script>
import { onMount, onDestroy } from "svelte"
import { Button, Icon, Modal, notifications, ModalContent } from "@budibase/bbui"
import {
Button,
Icon,
Modal,
notifications,
ModalContent,
} from "@budibase/bbui"
import { store } from "builderStore"
import { apps } from "stores/portal"
import api from "builderStore/api"
@ -16,7 +22,9 @@
if (response.status !== 200) throw json.message
// Reset frontend state after revert
const applicationPkg = await api.get(`/api/applications/${appId}/appPackage`)
const applicationPkg = await api.get(
`/api/applications/${appId}/appPackage`
)
const pkg = await applicationPkg.json()
if (applicationPkg.ok) {
await store.actions.initialise(pkg)
@ -31,14 +39,12 @@
}
</script>
<Icon name="Revert" hoverable on:click={revertModal.show} />
<Modal bind:this={revertModal}>
<ModalContent
title="Revert Changes"
confirmText="Revert"
onConfirm={revert}
<ModalContent title="Revert Changes" confirmText="Revert" onConfirm={revert}>
<span
>The changes you have made will be deleted and the application reverted
back to its production state.</span
>
<span>The changes you have made will be deleted and the application reverted back to its production state.</span>
</ModalContent>
</Modal>

View File

@ -1,7 +1,16 @@
<script>
import { store, automationStore } from "builderStore"
import { roles } from "stores/backend"
import { Button, Icon, Modal, ModalContent, ActionGroup, ActionButton, Tabs, Tab } from "@budibase/bbui"
import {
Button,
Icon,
Modal,
ModalContent,
ActionGroup,
ActionButton,
Tabs,
Tab,
} from "@budibase/bbui"
import SettingsLink from "components/settings/Link.svelte"
import ThemeEditorDropdown from "components/settings/ThemeEditorDropdown.svelte"
import FeedbackNavLink from "components/feedback/FeedbackNavLink.svelte"
@ -84,7 +93,9 @@
</div>
<div class="toprightnav">
<RevertModal />
<Icon name="Play" hoverable
<Icon
name="Play"
hoverable
on:click={() => {
window.open(`/${application}`)
}}

View File

@ -63,14 +63,16 @@
const openApp = app => {
if (app.lockedBy && app.lockedBy?.email !== $auth.user?.email) {
notifications.error(`App locked by ${app.lockedBy.email}. Please allow lock to expire or have them unlock this app.`)
notifications.error(
`App locked by ${app.lockedBy.email}. Please allow lock to expire or have them unlock this app.`
)
return
}
if (appStatus === AppStatus.DEV) {
$goto(`../../app/${app.appId}`)
} else {
window.open(`/${app.appId}`, '_blank');
window.open(`/${app.appId}`, "_blank")
}
}

View File

@ -244,7 +244,7 @@ exports.delete = async function (ctx) {
}
const createEmptyAppPackage = async (ctx, app) => {
const db = new CouchDB(app.instance._id)
const db = new CouchDB(app.appId)
let screensAndLayouts = []
for (let layout of BASE_LAYOUTS) {

View File

@ -1,15 +1,12 @@
const CouchDB = require("../../db")
const {
getBuiltinRoles,
Role,
getRole,
isBuiltin,
getExternalRoleID,
getAllRoles,
} = require("@budibase/auth/roles")
const {
generateRoleID,
getRoleParams,
getUserMetadataParams,
InternalTables,
} = require("../../db/utils")

View File

@ -1,5 +1,9 @@
const { getAllRoles } = require("@budibase/auth/roles")
const { getAllApps, getDeployedAppID, DocumentTypes } = require("@budibase/auth/db")
const {
getAllApps,
getDeployedAppID,
DocumentTypes,
} = require("@budibase/auth/db")
const CouchDB = require("../../../db")
exports.fetch = async ctx => {

View File

@ -29,7 +29,7 @@ exports.getApps = async ctx => {
let url = app.url || encodeURI(`${app.name}`)
url = `/${url.replace(URL_REGEX_SLASH, "")}`
body[url] = {
appId: app.instance._id,
appId: app.appId,
name: app.name,
url,
}