1
0
Fork 0
mirror of synced 2024-07-02 21:10:43 +12:00

Merge branch 'develop' of github.com:Budibase/budibase into responsive-preview

This commit is contained in:
Andrew Kingston 2021-09-09 13:56:18 +01:00
commit 3d0f7125d2
11 changed files with 1156 additions and 48 deletions

View file

@ -20,7 +20,6 @@
"setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev", "setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev",
"bootstrap": "lerna link && lerna bootstrap", "bootstrap": "lerna link && lerna bootstrap",
"build": "lerna run build", "build": "lerna run build",
"initialise": "lerna run initialise",
"publishdev": "lerna run publishdev", "publishdev": "lerna run publishdev",
"publishnpm": "yarn build && lerna publish --force-publish", "publishnpm": "yarn build && lerna publish --force-publish",
"release": "yarn build && lerna publish patch --yes --force-publish", "release": "yarn build && lerna publish patch --yes --force-publish",

View file

@ -7,13 +7,7 @@
ProgressCircle, ProgressCircle,
} from "@budibase/bbui" } from "@budibase/bbui"
import { admin } from "stores/portal" import { admin } from "stores/portal"
import { goto } from "@roxi/routify"
const MESSAGES = {
apps: "Create your first app",
smtp: "Set up email",
adminUser: "Create your first user",
sso: "Set up single sign-on",
}
</script> </script>
<ActionMenu> <ActionMenu>
@ -28,9 +22,12 @@
</MenuItem> </MenuItem>
{#each Object.keys($admin.checklist) as checklistItem, idx} {#each Object.keys($admin.checklist) as checklistItem, idx}
<MenuItem> <MenuItem>
<div class="item"> <div
<span>{idx + 1}. {MESSAGES[checklistItem]}</span> class="item"
<Checkbox value={!!$admin.checklist[checklistItem]} /> on:click={() => $goto($admin.checklist[checklistItem].link)}
>
<span>{idx + 1}. {$admin.checklist[checklistItem].label}</span>
<Checkbox value={$admin.checklist[checklistItem].checked} />
</div> </div>
</MenuItem> </MenuItem>
{/each} {/each}

View file

@ -6,7 +6,7 @@
let loaded = false let loaded = false
$: multiTenancyEnabled = $admin.multiTenancy $: multiTenancyEnabled = $admin.multiTenancy
$: hasAdminUser = !!$admin?.checklist?.adminUser $: hasAdminUser = $admin?.checklist?.adminUser.checked
$: tenantSet = $auth.tenantSet $: tenantSet = $auth.tenantSet
onMount(async () => { onMount(async () => {
@ -26,7 +26,6 @@
$redirect("./admin") $redirect("./admin")
} }
} }
// Redirect to log in at any time if the user isn't authenticated // Redirect to log in at any time if the user isn't authenticated
$: { $: {
if ( if (

View file

@ -6,7 +6,7 @@
let loaded = false let loaded = false
onMount(() => { onMount(() => {
if ($admin?.checklist?.adminUser) { if ($admin?.checklist?.adminUser.checked) {
$redirect("../") $redirect("../")
} else { } else {
loaded = true loaded = true

View file

@ -8,7 +8,12 @@ export function createAdminStore() {
multiTenancy: false, multiTenancy: false,
sandbox: false, sandbox: false,
onboardingProgress: 0, onboardingProgress: 0,
checklist: { apps: 0, smtp: false, adminUser: false, sso: false }, checklist: {
apps: { checked: false },
smtp: { checked: false },
adminUser: { checked: false },
sso: { checked: false },
},
} }
const admin = writable(DEFAULT_CONFIG) const admin = writable(DEFAULT_CONFIG)
@ -24,7 +29,7 @@ export function createAdminStore() {
const onboardingSteps = Object.keys(json) const onboardingSteps = Object.keys(json)
const stepsComplete = onboardingSteps.reduce( const stepsComplete = onboardingSteps.reduce(
(score, step) => score + Number(!!json[step]), (score, step) => (score + step.checked ? 1 : 0),
0 0
) )

View file

@ -23,7 +23,6 @@
"format": "prettier --config ../../.prettierrc.json 'src/**/*.ts' --write", "format": "prettier --config ../../.prettierrc.json 'src/**/*.ts' --write",
"lint": "eslint --fix src/", "lint": "eslint --fix src/",
"lint:fix": "yarn run format && yarn run lint", "lint:fix": "yarn run format && yarn run lint",
"initialise": "node scripts/initialise.js",
"multi:enable": "node scripts/multiTenancy.js enable", "multi:enable": "node scripts/multiTenancy.js enable",
"multi:disable": "node scripts/multiTenancy.js disable" "multi:disable": "node scripts/multiTenancy.js disable"
}, },
@ -96,7 +95,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"mongodb": "3.6.3", "mongodb": "3.6.3",
"mssql": "6.2.3", "mssql": "6.2.3",
"mysql": "2.18.1", "mysql": "^2.18.1",
"node-fetch": "2.6.0", "node-fetch": "2.6.0",
"open": "7.3.0", "open": "7.3.0",
"pg": "8.5.1", "pg": "8.5.1",

View file

@ -276,7 +276,7 @@ module External {
} }
outputProcessing( outputProcessing(
rows: Row[], rows: Row[] = [],
table: Table, table: Table,
relationships: RelationshipsJson[] relationships: RelationshipsJson[]
) { ) {

View file

@ -140,7 +140,7 @@ module MySQLModule {
this.client = mysql.createConnection(config) this.client = mysql.createConnection(config)
} }
async buildSchema(datasourceId: string) { async buildSchema(datasourceId: string, entities: Record<string, Table>) {
const tables: { [key: string]: Table } = {} const tables: { [key: string]: Table } = {}
const database = this.config.database const database = this.config.database
this.client.connect() this.client.connect()
@ -193,6 +193,19 @@ module MySQLModule {
schema, schema,
} }
} }
// add the existing relationships from the entities if they exist, to prevent them from being overridden
if (entities && entities[tableName]) {
const existingTableSchema = entities[tableName].schema
for (let key in existingTableSchema) {
if (!existingTableSchema.hasOwnProperty(key)) {
continue
}
if (existingTableSchema[key].type === "link") {
tables[tableName].schema[key] = existingTableSchema[key]
}
}
}
} }
this.client.end() this.client.end()

File diff suppressed because it is too large Load diff

View file

@ -248,10 +248,26 @@ exports.configChecklist = async function (ctx) {
const adminUser = users.rows.some(row => row.doc.admin) const adminUser = users.rows.some(row => row.doc.admin)
ctx.body = { ctx.body = {
apps: apps.length, apps: {
smtp: !!smtpConfig, checked: apps.length > 0,
adminUser, label: "Create your first app",
sso: !!googleConfig || !!oidcConfig, link: "/builder/portal/apps",
},
smtp: {
checked: !!smtpConfig,
label: "Set up email",
link: "/builder/portal/manage/email",
},
adminUser: {
checked: adminUser,
label: "Create your first user",
link: "/builder/portal/manage/users",
},
sso: {
checked: !!googleConfig || !!oidcConfig,
label: "Set up single sign-on",
link: "/builder/portal/manage/auth",
},
} }
} catch (err) { } catch (err) {
ctx.throw(err.status, err) ctx.throw(err.status, err)

View file

@ -4,7 +4,7 @@ const setup = require("./utilities")
jest.mock("nodemailer") jest.mock("nodemailer")
const nodemailer = require("nodemailer") const nodemailer = require("nodemailer")
nodemailer.createTransport.mockReturnValue({ nodemailer.createTransport.mockReturnValue({
verify: jest.fn() verify: jest.fn(),
}) })
describe("/api/global/configs/checklist", () => { describe("/api/global/configs/checklist", () => {
@ -25,11 +25,11 @@ describe("/api/global/configs/checklist", () => {
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
const checklist = res.body const checklist = res.body
expect(checklist.apps).toBe(0) expect(checklist.apps.checked).toBeFalsy()
expect(checklist.smtp).toBe(true) expect(checklist.smtp.checked).toBeTruthy()
expect(checklist.adminUser).toBe(true) expect(checklist.adminUser.checked).toBeTruthy()
}) })
}) })