|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -1,56 +0,0 @@ |
|||
const { readdir, stat, copyFile, ensureDir } = require("fs-extra") |
|||
const { constants } = require("fs") |
|||
const { join, basename } = require("path") |
|||
|
|||
const packagesFolder = ".." |
|||
|
|||
const jsFile = dir => join(dir, "budibase-client.js") |
|||
const jsMapFile = dir => join(dir, "budibase-client.js.map") |
|||
const sourceJs = jsFile("dist") |
|||
const sourceJsMap = jsMapFile("dist") |
|||
|
|||
const appPackages = join( |
|||
packagesFolder, |
|||
"server", |
|||
serverConfig.latestPackagesFolder |
|||
) |
|||
|
|||
const publicMain = appName => join(appPackages, appName, "public", "main") |
|||
const publicUnauth = appName => |
|||
join(appPackages, appName, "public", "unauthenticated") |
|||
|
|||
;(async () => { |
|||
const apps = await readdir(appPackages) |
|||
|
|||
const copySource = file => async toDir => { |
|||
await ensureDir(toDir) |
|||
const dest = join(toDir, basename(file)) |
|||
try { |
|||
await copyFile(file, dest, constants.COPYFILE_FICLONE) |
|||
console.log(`COPIED ${file} to ${dest}`) |
|||
} catch (e) { |
|||
console.log(`COPY FAILED ${file} to ${dest}: ${e}`) |
|||
} |
|||
} |
|||
|
|||
const copySourceJs = copySource(sourceJs) |
|||
const copySourceJsMap = copySource(sourceJsMap) |
|||
|
|||
for (let app of apps) { |
|||
if (app === ".data") continue |
|||
if (!(await stat(join(appPackages, app))).isDirectory()) continue |
|||
|
|||
//await copySourceJs(nodeModules(app))
|
|||
//await copySourceJsMap(nodeModules(app))
|
|||
|
|||
await copySourceJs(publicMain(app)) |
|||
await copySourceJsMap(publicMain(app)) |
|||
|
|||
await copySourceJs(publicUnauth(app)) |
|||
await copySourceJsMap(publicUnauth(app)) |
|||
|
|||
await copySource(join("dist", "budibase-client.esm.mjs"))( |
|||
join(packagesFolder, "server", "builder") |
|||
) |
|||
} |
|||
})() |
|||
@ -1,94 +0,0 @@ |
|||
const { readdir, stat, copyFile, ensureDir } = require("fs-extra") |
|||
const { constants } = require("fs") |
|||
const { join, basename } = require("path") |
|||
const serverConfig = require("../../server/config")() |
|||
|
|||
const packagesFolder = ".." |
|||
|
|||
const jsFile = dir => join(dir, "index.js") |
|||
const jsMapFile = dir => join(dir, "index.js.map") |
|||
const sourceJs = jsFile("dist") |
|||
const sourceJsMap = jsMapFile("dist") |
|||
const componentsFile = "components.json" |
|||
|
|||
const appPackages = join( |
|||
packagesFolder, |
|||
"server", |
|||
serverConfig.latestPackagesFolder |
|||
) |
|||
|
|||
const publicMain = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"public", |
|||
"main", |
|||
"lib", |
|||
"node_modules", |
|||
"@budibase", |
|||
"materialdesign-components" |
|||
) |
|||
const publicUnauth = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"public", |
|||
"unauthenticated", |
|||
"lib", |
|||
"node_modules", |
|||
"@budibase", |
|||
"materialdesign-components" |
|||
) |
|||
const nodeModulesDist = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"node_modules", |
|||
"@budibase", |
|||
"materialdesign-components", |
|||
"dist" |
|||
) |
|||
|
|||
const nodeModules = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"node_modules", |
|||
"@budibase", |
|||
"materialdesign-components" |
|||
) |
|||
|
|||
;(async () => { |
|||
const apps = await readdir(appPackages) |
|||
|
|||
const copySource = file => async toDir => { |
|||
await ensureDir(toDir) |
|||
const dest = join(toDir, basename(file)) |
|||
try { |
|||
await copyFile(file, dest, constants.COPYFILE_FICLONE) |
|||
console.log(`COPIED ${file} to ${dest}`) |
|||
} catch (e) { |
|||
console.log(`COPY FAILED ${file} to ${dest}: ${e}`) |
|||
} |
|||
} |
|||
|
|||
const copySourceJs = copySource(sourceJs) |
|||
const copySourceJsMap = copySource(sourceJsMap) |
|||
const copyComponentsJson = copySource(componentsFile) |
|||
|
|||
for (let app of apps) { |
|||
if (app === ".data") continue |
|||
if (!(await stat(join(appPackages, app))).isDirectory()) continue |
|||
|
|||
await copySourceJs(nodeModulesDist(app)) |
|||
await copySourceJsMap(nodeModulesDist(app)) |
|||
|
|||
await copyComponentsJson(nodeModules(app)) |
|||
|
|||
await copySourceJs(join(publicMain(app), "dist")) |
|||
await copySourceJsMap(join(publicMain(app), "dist")) |
|||
|
|||
await copySourceJs(join(publicUnauth(app), "dist")) |
|||
await copySourceJsMap(join(publicUnauth(app), "dist")) |
|||
} |
|||
})() |
|||
@ -1,88 +0,0 @@ |
|||
const { readdir, stat, copyFile, ensureDir } = require("fs-extra") |
|||
const { constants } = require("fs") |
|||
const { join, basename } = require("path") |
|||
const serverConfig = require("../../server/config")() |
|||
|
|||
const packagesFolder = ".." |
|||
|
|||
const jsFile = dir => join(dir, "index.js") |
|||
const jsMapFile = dir => join(dir, "index.js.map") |
|||
const sourceJs = jsFile("dist") |
|||
const sourceJsMap = jsMapFile("dist") |
|||
const componentsFile = "components.json" |
|||
|
|||
const appPackages = join( |
|||
packagesFolder, |
|||
"server", |
|||
resolve(homedir(), ".budibase") |
|||
) |
|||
|
|||
const publicMain = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"public", |
|||
"main", |
|||
"lib", |
|||
"node_modules", |
|||
"@budibase", |
|||
"standard-components" |
|||
) |
|||
const publicUnauth = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"public", |
|||
"unauthenticated", |
|||
"lib", |
|||
"node_modules", |
|||
"@budibase", |
|||
"standard-components" |
|||
) |
|||
const nodeModulesDist = appName => |
|||
join( |
|||
appPackages, |
|||
appName, |
|||
"node_modules", |
|||
"@budibase", |
|||
"standard-components", |
|||
"dist" |
|||
) |
|||
|
|||
const nodeModules = appName => |
|||
join(appPackages, appName, "node_modules", "@budibase", "standard-components") |
|||
|
|||
;(async () => { |
|||
const apps = await readdir(appPackages) |
|||
|
|||
const copySource = file => async toDir => { |
|||
await ensureDir(toDir) |
|||
const dest = join(toDir, basename(file)) |
|||
try { |
|||
await copyFile(file, dest, constants.COPYFILE_FICLONE) |
|||
console.log(`COPIED ${file} to ${dest}`) |
|||
} catch (e) { |
|||
console.log(`COPY FAILED ${file} to ${dest}: ${e}`) |
|||
} |
|||
} |
|||
|
|||
const copySourceJs = copySource(sourceJs) |
|||
const copySourceJsMap = copySource(sourceJsMap) |
|||
const copyComponentsJson = copySource(componentsFile) |
|||
|
|||
for (let app of apps) { |
|||
if (app === ".data") continue |
|||
if (!(await stat(join(appPackages, app))).isDirectory()) continue |
|||
|
|||
await copySourceJs(nodeModulesDist(app)) |
|||
await copySourceJsMap(nodeModulesDist(app)) |
|||
|
|||
await copyComponentsJson(nodeModules(app)) |
|||
|
|||
await copySourceJs(join(publicMain(app), "dist")) |
|||
await copySourceJsMap(join(publicMain(app), "dist")) |
|||
|
|||
await copySourceJs(join(publicUnauth(app), "dist")) |
|||
await copySourceJsMap(join(publicUnauth(app), "dist")) |
|||
} |
|||
})() |
|||
@ -0,0 +1,27 @@ |
|||
<script> |
|||
import { onMount } from "svelte"; |
|||
|
|||
export let _bb |
|||
export let _viewName |
|||
export let _instanceId |
|||
|
|||
let username |
|||
let password |
|||
|
|||
</script> |
|||
|
|||
<form class="uk-form"> |
|||
<div> |
|||
<div class="uk-margin"> |
|||
<label class="uk-form-label" for="form-stacked-text">Username</label> |
|||
<input class="uk-input" type="text" bind:value={username} /> |
|||
</div> |
|||
<div class="uk-margin"> |
|||
<label class="uk-form-label" for="form-stacked-text">Password</label> |
|||
<input class="uk-input" type="password" bind:value={password} /> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
|
|||
<style> |
|||
</style> |
|||
@ -0,0 +1,110 @@ |
|||
<script> |
|||
import { onMount } from "svelte"; |
|||
// import { cssVars, createClasses } from "./cssVars" |
|||
// import { buildStyle } from "./buildStyle" |
|||
|
|||
export let _bb |
|||
export let onLoad |
|||
export let _viewName |
|||
export let _instanceId |
|||
|
|||
let cssVariables |
|||
let headers = [] |
|||
let data = [] |
|||
|
|||
async function fetchData() { |
|||
const FETCH_RECORDS_URL = `/api/${_instanceId}/${_viewName}/records`; |
|||
const response = await _bb.api.get(FETCH_RECORDS_URL); |
|||
if (response.status === 200) { |
|||
const json = await response.json(); |
|||
|
|||
if (json.length > 0) { |
|||
data = json; |
|||
headers = Object.keys(data[0]); |
|||
} else { |
|||
console.log("NO DATA"); |
|||
} |
|||
} else { |
|||
throw new Error("Failed to fetch records.."); |
|||
console.log("FAILED"); |
|||
} |
|||
} |
|||
|
|||
onMount(async () => { |
|||
await fetchData(); |
|||
}) |
|||
</script> |
|||
|
|||
<!-- This prop was in the old one --> |
|||
<!-- use:cssVars={cssVariables} --> |
|||
|
|||
<table class="uk-table"> |
|||
<thead> |
|||
<tr> |
|||
{#each headers as header} |
|||
<th>{header}</th> |
|||
{/each} |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{#each data as row} |
|||
<tr> |
|||
{#each headers as header} |
|||
{#if row[header]} |
|||
<td> |
|||
{row[header]} |
|||
</td> |
|||
{/if} |
|||
{/each} |
|||
</tr> |
|||
{/each} |
|||
</tbody> |
|||
</table> |
|||
|
|||
|
|||
<!-- <button |
|||
bind:this={theButton} |
|||
use:cssVars={cssVariables} |
|||
class="{className} |
|||
{customClasses}" |
|||
disabled={disabled || false} |
|||
on:click={clickHandler} |
|||
style={buttonStyles}> |
|||
{#if !_bb.props._children || _bb.props._children.length === 0} |
|||
{contentText} |
|||
{/if} |
|||
</button> --> |
|||
|
|||
<style> |
|||
table { |
|||
border: 1px solid #ccc; |
|||
background: #fff; |
|||
border-radius: 3px; |
|||
border-collapse: collapse; |
|||
} |
|||
|
|||
thead { |
|||
background: #f9f9f9; |
|||
border: 1px solid #ccc; |
|||
} |
|||
|
|||
thead th { |
|||
color: var(--button-text); |
|||
text-transform: capitalize; |
|||
font-weight: 500; |
|||
font-size: 14px; |
|||
text-rendering: optimizeLegibility; |
|||
letter-spacing: 1px; |
|||
} |
|||
|
|||
tbody tr { |
|||
border-bottom: 1px solid #ccc; |
|||
transition: 0.3s background-color; |
|||
color: var(--secondary100); |
|||
font-size: 14px; |
|||
} |
|||
|
|||
tbody tr:hover { |
|||
background: #fafafa; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,43 @@ |
|||
#!/usr/bin/env node
|
|||
|
|||
/** |
|||
This script symlinks the budibase component and client paths to the |
|||
ones that exist in your local development directories. This means you |
|||
can work your budibase apps but also change code for the components |
|||
and client library in real time. |
|||
*/ |
|||
|
|||
const fs = require("fs"); |
|||
const { resolve } = require("path") |
|||
|
|||
const devDir = "/tmp/.budibase/@budibase"; |
|||
|
|||
// create the dev directory if it doesn't exist
|
|||
if (!fs.existsSync(devDir)) { |
|||
fs.mkdirSync(devDir, { recursive: true }); |
|||
} |
|||
|
|||
const SYMLINK_PATHS = [ |
|||
{ |
|||
symlink: "/tmp/.budibase/@budibase/materialdesign-components", |
|||
destination: resolve("packages/materialdesign-components"), |
|||
}, |
|||
{ |
|||
symlink: "/tmp/.budibase/@budibase/standard-components", |
|||
destination: resolve("packages/standard-components") |
|||
}, |
|||
{ |
|||
symlink: "/tmp/.budibase/budibase-client.esm.mjs", |
|||
destination: resolve("packages/client/dist/budibase-client.esm.mjs") |
|||
}, |
|||
{ |
|||
symlink: "/tmp/.budibase/budibase-client.js", |
|||
destination: resolve("packages/client/dist/budibase-client.js"), |
|||
} |
|||
] |
|||
|
|||
SYMLINK_PATHS.forEach(sym => { |
|||
fs.symlinkSync(sym.destination, sym.symlink); |
|||
}); |
|||
|
|||
console.log("Dev Symlinks Created Successfully.") |
|||