Frontend work and basic API work for app update support.
This commit is contained in:
parent
fd518548fd
commit
bd197bee9e
|
@ -0,0 +1,40 @@
|
|||
<script>
|
||||
import { ModalContent, Toggle, Input, Layout, Dropzone } from "@budibase/bbui"
|
||||
|
||||
export let app
|
||||
|
||||
$: disabled = (encrypted && !password) || !file
|
||||
let encrypted = false,
|
||||
password
|
||||
let file
|
||||
|
||||
function updateApp() {
|
||||
console.log("confirm")
|
||||
}
|
||||
</script>
|
||||
|
||||
<ModalContent
|
||||
title={`Update ${app.name}`}
|
||||
confirmText="Update"
|
||||
onConfirm={updateApp}
|
||||
bind:disabled
|
||||
>
|
||||
<Layout noPadding gap="XS">
|
||||
<Dropzone
|
||||
gallery={false}
|
||||
label="App export"
|
||||
on:change={e => {
|
||||
file = e.detail?.[0]
|
||||
}}
|
||||
/>
|
||||
<Toggle text="Encrypted" bind:value={encrypted} />
|
||||
{#if encrypted}
|
||||
<Input
|
||||
type="password"
|
||||
label="Password"
|
||||
placeholder="Type here..."
|
||||
bind:value={password}
|
||||
/>
|
||||
{/if}
|
||||
</Layout>
|
||||
</ModalContent>
|
|
@ -32,9 +32,9 @@
|
|||
active={$isActive("./embed")}
|
||||
/>
|
||||
<SideNavItem
|
||||
text="Export"
|
||||
url={$url("./export")}
|
||||
active={$isActive("./export")}
|
||||
text="Export/Import"
|
||||
url={$url("./exportImport")}
|
||||
active={$isActive("./exportImport")}
|
||||
/>
|
||||
<SideNavItem
|
||||
text="Name and URL"
|
||||
|
|
|
@ -11,31 +11,39 @@
|
|||
import { apps } from "stores/portal"
|
||||
import { store } from "builderStore"
|
||||
import ExportAppModal from "components/start/ExportAppModal.svelte"
|
||||
import ImportAppModal from "components/start/ImportAppModal.svelte"
|
||||
|
||||
$: filteredApps = $apps.filter(app => app.devId == $store.appId)
|
||||
$: app = filteredApps.length ? filteredApps[0] : {}
|
||||
$: appDeployed = app?.status === AppStatus.DEPLOYED
|
||||
|
||||
let exportModal
|
||||
let exportModal, importModal
|
||||
let exportPublishedVersion = false
|
||||
|
||||
const exportApp = opts => {
|
||||
exportPublishedVersion = !!opts?.published
|
||||
exportModal.show()
|
||||
}
|
||||
|
||||
const importApp = () => {
|
||||
importModal.show()
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:this={exportModal} padding={false}>
|
||||
<ExportAppModal {app} published={exportPublishedVersion} />
|
||||
</Modal>
|
||||
|
||||
<Modal bind:this={importModal} padding={false}>
|
||||
<ImportAppModal {app} />
|
||||
</Modal>
|
||||
|
||||
<Layout noPadding>
|
||||
<Layout gap="XS" noPadding>
|
||||
<Heading>Export your app</Heading>
|
||||
<Body>Export your latest edited or published app</Body>
|
||||
</Layout>
|
||||
<Divider />
|
||||
<div class="export-body">
|
||||
<div class="body">
|
||||
<ActionButton secondary on:click={() => exportApp({ published: false })}>
|
||||
Export latest edited app
|
||||
</ActionButton>
|
||||
|
@ -47,10 +55,20 @@
|
|||
Export latest published app
|
||||
</ActionButton>
|
||||
</div>
|
||||
<Divider />
|
||||
<Layout gap="XS" noPadding>
|
||||
<Heading>Import your app</Heading>
|
||||
<Body>Import an export to update this app</Body>
|
||||
</Layout>
|
||||
<div class="body">
|
||||
<ActionButton secondary on:click={() => importApp()}>
|
||||
Import app
|
||||
</ActionButton>
|
||||
</div>
|
||||
</Layout>
|
||||
|
||||
<style>
|
||||
.export-body {
|
||||
.body {
|
||||
display: flex;
|
||||
gap: var(--spacing-l);
|
||||
}
|
|
@ -9,6 +9,7 @@ CREATE TABLE Persons (
|
|||
Address varchar(255),
|
||||
City varchar(255) DEFAULT 'Belfast',
|
||||
Age INTEGER DEFAULT 20 NOT NULL,
|
||||
Year INTEGER,
|
||||
Type person_job
|
||||
);
|
||||
CREATE TABLE Tasks (
|
||||
|
@ -49,9 +50,10 @@ CREATE TABLE CompositeTable (
|
|||
Name varchar(255),
|
||||
PRIMARY KEY (KeyPartOne, KeyPartTwo)
|
||||
);
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type) VALUES ('Mike', 'Hughes', '123 Fake Street', 'Belfast', 'qa');
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type) VALUES ('John', 'Smith', '64 Updown Road', 'Dublin', 'programmer');
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type, Age) VALUES ('Foo', 'Bar', 'Foo Street', 'Bartown', 'support', 0);
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type, Year) VALUES ('Mike', 'Hughes', '123 Fake Street', 'Belfast', 'qa', 1999);
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type, Year) VALUES ('John', 'Smith', '64 Updown Road', 'Dublin', 'programmer', 1996);
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type, Age, Year) VALUES ('Foo', 'Bar', 'Foo Street', 'Bartown', 'support', 0, 1993);
|
||||
INSERT INTO Persons (FirstName, LastName, Address, City, Type) VALUES ('Jonny', 'Muffin', 'Muffin Street', 'Cork', 'support');
|
||||
INSERT INTO Tasks (ExecutorID, QaID, TaskName, Completed) VALUES (1, 2, 'assembling', TRUE);
|
||||
INSERT INTO Tasks (ExecutorID, QaID, TaskName, Completed) VALUES (2, 1, 'processing', FALSE);
|
||||
INSERT INTO Products (ProductName) VALUES ('Computers');
|
||||
|
|
|
@ -575,6 +575,8 @@ export async function sync(ctx: UserCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function updateWithExport(ctx: UserCtx) {}
|
||||
|
||||
export async function updateAppPackage(appPackage: any, appId: any) {
|
||||
return context.doInAppContext(appId, async () => {
|
||||
const db = context.getAppDB()
|
||||
|
|
|
@ -58,5 +58,10 @@ router
|
|||
authorized(permissions.GLOBAL_BUILDER),
|
||||
controller.destroy
|
||||
)
|
||||
.post(
|
||||
"/api/applications/:appId/update",
|
||||
authorized(permissions.BUILDER),
|
||||
controller.updateWithExport
|
||||
)
|
||||
|
||||
export default router
|
||||
|
|
Loading…
Reference in New Issue