Merge branch 'develop' of github.com:Budibase/budibase into responsive-preview
This commit is contained in:
commit
0409e2144f
|
@ -20,7 +20,6 @@
|
|||
"setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev",
|
||||
"bootstrap": "lerna link && lerna bootstrap",
|
||||
"build": "lerna run build",
|
||||
"initialise": "lerna run initialise",
|
||||
"publishdev": "lerna run publishdev",
|
||||
"publishnpm": "yarn build && lerna publish --force-publish",
|
||||
"release": "yarn build && lerna publish patch --yes --force-publish",
|
||||
|
|
|
@ -7,13 +7,7 @@
|
|||
ProgressCircle,
|
||||
} from "@budibase/bbui"
|
||||
import { admin } from "stores/portal"
|
||||
|
||||
const MESSAGES = {
|
||||
apps: "Create your first app",
|
||||
smtp: "Set up email",
|
||||
adminUser: "Create your first user",
|
||||
sso: "Set up single sign-on",
|
||||
}
|
||||
import { goto } from "@roxi/routify"
|
||||
</script>
|
||||
|
||||
<ActionMenu>
|
||||
|
@ -28,9 +22,12 @@
|
|||
</MenuItem>
|
||||
{#each Object.keys($admin.checklist) as checklistItem, idx}
|
||||
<MenuItem>
|
||||
<div class="item">
|
||||
<span>{idx + 1}. {MESSAGES[checklistItem]}</span>
|
||||
<Checkbox value={!!$admin.checklist[checklistItem]} />
|
||||
<div
|
||||
class="item"
|
||||
on:click={() => $goto($admin.checklist[checklistItem].link)}
|
||||
>
|
||||
<span>{idx + 1}. {$admin.checklist[checklistItem].label}</span>
|
||||
<Checkbox value={$admin.checklist[checklistItem].checked} />
|
||||
</div>
|
||||
</MenuItem>
|
||||
{/each}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
let loaded = false
|
||||
|
||||
$: multiTenancyEnabled = $admin.multiTenancy
|
||||
$: hasAdminUser = !!$admin?.checklist?.adminUser
|
||||
$: hasAdminUser = $admin?.checklist?.adminUser.checked
|
||||
$: tenantSet = $auth.tenantSet
|
||||
|
||||
onMount(async () => {
|
||||
|
@ -26,7 +26,6 @@
|
|||
$redirect("./admin")
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to log in at any time if the user isn't authenticated
|
||||
$: {
|
||||
if (
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
let loaded = false
|
||||
|
||||
onMount(() => {
|
||||
if ($admin?.checklist?.adminUser) {
|
||||
if ($admin?.checklist?.adminUser.checked) {
|
||||
$redirect("../")
|
||||
} else {
|
||||
loaded = true
|
||||
|
|
|
@ -8,7 +8,12 @@ export function createAdminStore() {
|
|||
multiTenancy: false,
|
||||
sandbox: false,
|
||||
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)
|
||||
|
@ -24,7 +29,7 @@ export function createAdminStore() {
|
|||
const onboardingSteps = Object.keys(json)
|
||||
|
||||
const stepsComplete = onboardingSteps.reduce(
|
||||
(score, step) => score + Number(!!json[step]),
|
||||
(score, step) => (score + step.checked ? 1 : 0),
|
||||
0
|
||||
)
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
"format": "prettier --config ../../.prettierrc.json 'src/**/*.ts' --write",
|
||||
"lint": "eslint --fix src/",
|
||||
"lint:fix": "yarn run format && yarn run lint",
|
||||
"initialise": "node scripts/initialise.js",
|
||||
"multi:enable": "node scripts/multiTenancy.js enable",
|
||||
"multi:disable": "node scripts/multiTenancy.js disable"
|
||||
},
|
||||
|
@ -96,7 +95,7 @@
|
|||
"lodash": "4.17.21",
|
||||
"mongodb": "3.6.3",
|
||||
"mssql": "6.2.3",
|
||||
"mysql": "2.18.1",
|
||||
"mysql": "^2.18.1",
|
||||
"node-fetch": "2.6.0",
|
||||
"open": "7.3.0",
|
||||
"pg": "8.5.1",
|
||||
|
|
|
@ -276,7 +276,7 @@ module External {
|
|||
}
|
||||
|
||||
outputProcessing(
|
||||
rows: Row[],
|
||||
rows: Row[] = [],
|
||||
table: Table,
|
||||
relationships: RelationshipsJson[]
|
||||
) {
|
||||
|
|
|
@ -140,7 +140,7 @@ module MySQLModule {
|
|||
this.client = mysql.createConnection(config)
|
||||
}
|
||||
|
||||
async buildSchema(datasourceId: string) {
|
||||
async buildSchema(datasourceId: string, entities: Record<string, Table>) {
|
||||
const tables: { [key: string]: Table } = {}
|
||||
const database = this.config.database
|
||||
this.client.connect()
|
||||
|
@ -193,6 +193,19 @@ module MySQLModule {
|
|||
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()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -248,10 +248,26 @@ exports.configChecklist = async function (ctx) {
|
|||
const adminUser = users.rows.some(row => row.doc.admin)
|
||||
|
||||
ctx.body = {
|
||||
apps: apps.length,
|
||||
smtp: !!smtpConfig,
|
||||
adminUser,
|
||||
sso: !!googleConfig || !!oidcConfig,
|
||||
apps: {
|
||||
checked: apps.length > 0,
|
||||
label: "Create your first app",
|
||||
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) {
|
||||
ctx.throw(err.status, err)
|
||||
|
|
|
@ -4,7 +4,7 @@ const setup = require("./utilities")
|
|||
jest.mock("nodemailer")
|
||||
const nodemailer = require("nodemailer")
|
||||
nodemailer.createTransport.mockReturnValue({
|
||||
verify: jest.fn()
|
||||
verify: jest.fn(),
|
||||
})
|
||||
|
||||
describe("/api/global/configs/checklist", () => {
|
||||
|
@ -28,8 +28,8 @@ describe("/api/global/configs/checklist", () => {
|
|||
|
||||
const checklist = res.body
|
||||
|
||||
expect(checklist.apps).toBe(0)
|
||||
expect(checklist.smtp).toBe(true)
|
||||
expect(checklist.adminUser).toBe(true)
|
||||
expect(checklist.apps.checked).toBeFalsy()
|
||||
expect(checklist.smtp.checked).toBeTruthy()
|
||||
expect(checklist.adminUser.checked).toBeTruthy()
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue