Browse Source
Merge pull request #2556 from mslourens/checklist_item_navigation
add link to checklist items for direct navigation (and lint issues)
gh-pages
Martin McKeaveney
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
42 additions and
25 deletions
-
packages/builder/src/components/common/ConfigChecklist.svelte
-
packages/builder/src/pages/builder/_layout.svelte
-
packages/builder/src/pages/builder/admin/_layout.svelte
-
packages/builder/src/stores/portal/admin.js
-
packages/worker/src/api/controllers/global/configs.js
-
packages/worker/src/api/routes/tests/configs.spec.js
|
|
|
@ -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 |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@ -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", () => { |
|
|
|
@ -25,11 +25,11 @@ describe("/api/global/configs/checklist", () => { |
|
|
|
.set(config.defaultHeaders()) |
|
|
|
.expect("Content-Type", /json/) |
|
|
|
.expect(200) |
|
|
|
|
|
|
|
|
|
|
|
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() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|