mirror of https://github.com/Budibase/budibase.git
62 changed files with 5491 additions and 2338 deletions
@ -0,0 +1,31 @@ |
|||
<script> |
|||
import "@spectrum-css/toast/dist/index-vars.css" |
|||
import Portal from "svelte-portal" |
|||
import { banner } from "../Stores/banner" |
|||
import Banner from "./Banner.svelte" |
|||
import { fly } from "svelte/transition" |
|||
</script> |
|||
|
|||
<Portal target=".banner-container"> |
|||
<div class="banner"> |
|||
{#if $banner.message} |
|||
<div transition:fly={{ y: -30 }}> |
|||
<Banner |
|||
type={$banner.type} |
|||
extraButtonText={$banner.extraButtonText} |
|||
extraButtonAction={$banner.extraButtonAction} |
|||
on:change={$banner.onChange} |
|||
> |
|||
{$banner.message} |
|||
</Banner> |
|||
</div> |
|||
{/if} |
|||
</div> |
|||
</Portal> |
|||
|
|||
<style> |
|||
.banner { |
|||
pointer-events: none; |
|||
width: 100%; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,37 @@ |
|||
import { writable } from "svelte/store" |
|||
|
|||
export function createBannerStore() { |
|||
const DEFAULT_CONFIG = {} |
|||
|
|||
const banner = writable(DEFAULT_CONFIG) |
|||
|
|||
const show = async ( |
|||
// eslint-disable-next-line
|
|||
config = { message, type, extraButtonText, extraButtonAction, onChange } |
|||
) => { |
|||
banner.update(store => { |
|||
return { |
|||
...store, |
|||
...config, |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const showStatus = async () => { |
|||
const config = { |
|||
message: "Some systems are experiencing issues", |
|||
type: "negative", |
|||
extraButtonText: "View Status", |
|||
extraButtonAction: () => window.open("https://status.budibase.com/"), |
|||
} |
|||
|
|||
await show(config) |
|||
} |
|||
|
|||
return { |
|||
subscribe: banner.subscribe, |
|||
showStatus, |
|||
} |
|||
} |
|||
|
|||
export const banner = createBannerStore() |
|||
File diff suppressed because it is too large
@ -0,0 +1,86 @@ |
|||
<script> |
|||
import { Label, Select, Body } from "@budibase/bbui" |
|||
import { findAllMatchingComponents } from "builderStore/componentUtils" |
|||
import { currentAsset } from "builderStore" |
|||
import { onMount } from "svelte" |
|||
|
|||
export let parameters |
|||
|
|||
$: tables = findAllMatchingComponents($currentAsset?.props, component => |
|||
component._component.endsWith("table") |
|||
).map(table => ({ |
|||
label: table._instanceName, |
|||
value: table._id, |
|||
})) |
|||
|
|||
$: tableBlocks = findAllMatchingComponents($currentAsset?.props, component => |
|||
component._component.endsWith("tableblock") |
|||
).map(block => ({ |
|||
label: block._instanceName, |
|||
value: `${block._id}-table`, |
|||
})) |
|||
|
|||
$: componentOptions = tables.concat(tableBlocks) |
|||
|
|||
const FORMATS = [ |
|||
{ |
|||
label: "CSV", |
|||
value: "csv", |
|||
}, |
|||
{ |
|||
label: "JSON", |
|||
value: "json", |
|||
}, |
|||
] |
|||
|
|||
onMount(() => { |
|||
if (!parameters.type) { |
|||
parameters.type = "csv" |
|||
} |
|||
}) |
|||
</script> |
|||
|
|||
<div class="root"> |
|||
<Body size="S"> |
|||
Choose the table component that you would like to export your row selection |
|||
from. |
|||
<br /> |
|||
Please ensure you have enabled row selection in the table settings. |
|||
</Body> |
|||
|
|||
<div class="params"> |
|||
<Label small>Table</Label> |
|||
<Select |
|||
bind:value={parameters.tableComponentId} |
|||
options={componentOptions} |
|||
/> |
|||
|
|||
<Label small>Export as</Label> |
|||
<Select bind:value={parameters.type} options={FORMATS} /> |
|||
</div> |
|||
</div> |
|||
|
|||
<style> |
|||
.root { |
|||
width: 100%; |
|||
max-width: 500px; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: flex-start; |
|||
align-items: stretch; |
|||
gap: var(--spacing-xl); |
|||
} |
|||
|
|||
.root :global(p) { |
|||
line-height: 1.5; |
|||
} |
|||
|
|||
.params { |
|||
display: grid; |
|||
column-gap: var(--spacing-xs); |
|||
row-gap: var(--spacing-s); |
|||
grid-template-columns: 70px 1fr; |
|||
align-items: center; |
|||
} |
|||
</style> |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
@ -1,61 +1,66 @@ |
|||
export const buildAttachmentEndpoints = API => ({ |
|||
/** |
|||
* Uploads an attachment to the server. |
|||
* @param data the attachment to upload |
|||
* @param tableId the table ID to upload to |
|||
*/ |
|||
uploadAttachment: async ({ data, tableId }) => { |
|||
return await API.post({ |
|||
url: `/api/attachments/${tableId}/upload`, |
|||
body: data, |
|||
json: false, |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* Uploads an attachment to the server as a builder user from the builder. |
|||
* @param data the data to upload |
|||
*/ |
|||
uploadBuilderAttachment: async data => { |
|||
return await API.post({ |
|||
url: "/api/attachments/process", |
|||
body: data, |
|||
json: false, |
|||
}) |
|||
}, |
|||
|
|||
export const buildAttachmentEndpoints = API => { |
|||
/** |
|||
* Generates a signed URL to upload a file to an external datasource. |
|||
* @param datasourceId the ID of the datasource to upload to |
|||
* @param bucket the name of the bucket to upload to |
|||
* @param key the name of the file to upload to |
|||
*/ |
|||
getSignedDatasourceURL: async ({ datasourceId, bucket, key }) => { |
|||
const getSignedDatasourceURL = async ({ datasourceId, bucket, key }) => { |
|||
return await API.post({ |
|||
url: `/api/attachments/${datasourceId}/url`, |
|||
body: { bucket, key }, |
|||
}) |
|||
}, |
|||
} |
|||
|
|||
/** |
|||
* Uploads a file to an external datasource. |
|||
* @param datasourceId the ID of the datasource to upload to |
|||
* @param bucket the name of the bucket to upload to |
|||
* @param key the name of the file to upload to |
|||
* @param data the file to upload |
|||
*/ |
|||
externalUpload: async ({ datasourceId, bucket, key, data }) => { |
|||
const { signedUrl, publicUrl } = await API.getSignedDatasourceURL({ |
|||
datasourceId, |
|||
bucket, |
|||
key, |
|||
}) |
|||
await API.put({ |
|||
url: signedUrl, |
|||
body: data, |
|||
json: false, |
|||
external: true, |
|||
}) |
|||
return { publicUrl } |
|||
}, |
|||
}) |
|||
return { |
|||
getSignedDatasourceURL, |
|||
|
|||
/** |
|||
* Uploads an attachment to the server. |
|||
* @param data the attachment to upload |
|||
* @param tableId the table ID to upload to |
|||
*/ |
|||
uploadAttachment: async ({ data, tableId }) => { |
|||
return await API.post({ |
|||
url: `/api/attachments/${tableId}/upload`, |
|||
body: data, |
|||
json: false, |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* Uploads an attachment to the server as a builder user from the builder. |
|||
* @param data the data to upload |
|||
*/ |
|||
uploadBuilderAttachment: async data => { |
|||
return await API.post({ |
|||
url: "/api/attachments/process", |
|||
body: data, |
|||
json: false, |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* Uploads a file to an external datasource. |
|||
* @param datasourceId the ID of the datasource to upload to |
|||
* @param bucket the name of the bucket to upload to |
|||
* @param key the name of the file to upload to |
|||
* @param data the file to upload |
|||
*/ |
|||
externalUpload: async ({ datasourceId, bucket, key, data }) => { |
|||
console.log(API) |
|||
const { signedUrl, publicUrl } = await getSignedDatasourceURL({ |
|||
datasourceId, |
|||
bucket, |
|||
key, |
|||
}) |
|||
await API.put({ |
|||
url: signedUrl, |
|||
body: data, |
|||
json: false, |
|||
external: true, |
|||
}) |
|||
return { publicUrl } |
|||
}, |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,15 @@ |
|||
const accounts = require("@budibase/backend-core/accounts") |
|||
const env = require("../../../environment") |
|||
|
|||
exports.fetch = async ctx => { |
|||
if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) { |
|||
const status = await accounts.getStatus() |
|||
ctx.body = status |
|||
} else { |
|||
ctx.body = { |
|||
health: { |
|||
passing: true, |
|||
}, |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
const Router = require("@koa/router") |
|||
const controller = require("../../controllers/system/status") |
|||
|
|||
const router = Router() |
|||
|
|||
router.get("/api/system/status", controller.fetch) |
|||
|
|||
module.exports = router |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue