add link to checklist items for direct navigation (and lint issues)
This commit is contained in:
parent
d374d25393
commit
dafd06737c
|
@ -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}
|
||||||
|
|
|
@ -24,7 +24,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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,16 @@ import {
|
||||||
SearchFilters,
|
SearchFilters,
|
||||||
SortJson,
|
SortJson,
|
||||||
} from "../../../definitions/datasource"
|
} from "../../../definitions/datasource"
|
||||||
import {Datasource, FieldSchema, Row, Table} from "../../../definitions/common"
|
import {
|
||||||
import {breakRowIdField, generateRowIdField} from "../../../integrations/utils"
|
Datasource,
|
||||||
|
FieldSchema,
|
||||||
|
Row,
|
||||||
|
Table,
|
||||||
|
} from "../../../definitions/common"
|
||||||
|
import {
|
||||||
|
breakRowIdField,
|
||||||
|
generateRowIdField,
|
||||||
|
} from "../../../integrations/utils"
|
||||||
import { RelationshipTypes } from "../../../constants"
|
import { RelationshipTypes } from "../../../constants"
|
||||||
|
|
||||||
interface ManyRelationship {
|
interface ManyRelationship {
|
||||||
|
@ -387,7 +395,11 @@ module External {
|
||||||
* isn't supposed to exist anymore and delete those. This is better than the usual method of delete them
|
* isn't supposed to exist anymore and delete those. This is better than the usual method of delete them
|
||||||
* all and then re-create, as theres no chance of losing data (e.g. delete succeed, but write fail).
|
* all and then re-create, as theres no chance of losing data (e.g. delete succeed, but write fail).
|
||||||
*/
|
*/
|
||||||
async handleManyRelationships(mainTableId: string, row: Row, relationships: ManyRelationship[]) {
|
async handleManyRelationships(
|
||||||
|
mainTableId: string,
|
||||||
|
row: Row,
|
||||||
|
relationships: ManyRelationship[]
|
||||||
|
) {
|
||||||
const { appId } = this
|
const { appId } = this
|
||||||
// if we're creating (in a through table) need to wipe the existing ones first
|
// if we're creating (in a through table) need to wipe the existing ones first
|
||||||
const promises = []
|
const promises = []
|
||||||
|
@ -399,8 +411,10 @@ module External {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const linkPrimary = linkTable.primary[0]
|
const linkPrimary = linkTable.primary[0]
|
||||||
const rows = related[key].rows || []
|
const rows = related[key].rows || []
|
||||||
const found = rows.find((row: { [key: string]: any }) =>
|
const found = rows.find(
|
||||||
row[linkPrimary] === relationship.id || row[linkPrimary] === body[linkPrimary]
|
(row: { [key: string]: any }) =>
|
||||||
|
row[linkPrimary] === relationship.id ||
|
||||||
|
row[linkPrimary] === body[linkPrimary]
|
||||||
)
|
)
|
||||||
const operation = isUpdate
|
const operation = isUpdate
|
||||||
? DataSourceOperation.UPDATE
|
? DataSourceOperation.UPDATE
|
||||||
|
@ -420,13 +434,17 @@ module External {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// finally cleanup anything that needs to be removed
|
// finally cleanup anything that needs to be removed
|
||||||
for (let [colName, {isMany, rows, tableId}] of Object.entries(related)) {
|
for (let [colName, { isMany, rows, tableId }] of Object.entries(
|
||||||
|
related
|
||||||
|
)) {
|
||||||
const table = this.getTable(tableId)
|
const table = this.getTable(tableId)
|
||||||
for (let row of rows) {
|
for (let row of rows) {
|
||||||
const filters = buildFilters(generateIdForRow(row, table), {}, table)
|
const filters = buildFilters(generateIdForRow(row, table), {}, table)
|
||||||
// safety check, if there are no filters on deletion bad things happen
|
// safety check, if there are no filters on deletion bad things happen
|
||||||
if (Object.keys(filters).length !== 0) {
|
if (Object.keys(filters).length !== 0) {
|
||||||
const op = isMany ? DataSourceOperation.DELETE : DataSourceOperation.UPDATE
|
const op = isMany
|
||||||
|
? DataSourceOperation.DELETE
|
||||||
|
: DataSourceOperation.UPDATE
|
||||||
const body = isMany ? null : { [colName]: null }
|
const body = isMany ? null : { [colName]: null }
|
||||||
promises.push(
|
promises.push(
|
||||||
makeExternalQuery(this.appId, {
|
makeExternalQuery(this.appId, {
|
||||||
|
@ -448,7 +466,10 @@ module External {
|
||||||
* Creating the specific list of fields that we desire, and excluding the ones that are no use to us
|
* Creating the specific list of fields that we desire, and excluding the ones that are no use to us
|
||||||
* is more performant and has the added benefit of protecting against this scenario.
|
* is more performant and has the added benefit of protecting against this scenario.
|
||||||
*/
|
*/
|
||||||
buildFields(table: Table, includeRelations: IncludeRelationships = IncludeRelationships.INCLUDE) {
|
buildFields(
|
||||||
|
table: Table,
|
||||||
|
includeRelations: IncludeRelationships = IncludeRelationships.INCLUDE
|
||||||
|
) {
|
||||||
function extractNonLinkFieldNames(table: Table, existing: string[] = []) {
|
function extractNonLinkFieldNames(table: Table, existing: string[] = []) {
|
||||||
return Object.entries(table.schema)
|
return Object.entries(table.schema)
|
||||||
.filter(
|
.filter(
|
||||||
|
@ -523,7 +544,10 @@ module External {
|
||||||
// can't really use response right now
|
// can't really use response right now
|
||||||
const response = await makeExternalQuery(appId, json)
|
const response = await makeExternalQuery(appId, json)
|
||||||
// handle many to many relationships now if we know the ID (could be auto increment)
|
// handle many to many relationships now if we know the ID (could be auto increment)
|
||||||
if (operation !== DataSourceOperation.READ && processed.manyRelationships) {
|
if (
|
||||||
|
operation !== DataSourceOperation.READ &&
|
||||||
|
processed.manyRelationships
|
||||||
|
) {
|
||||||
await this.handleManyRelationships(
|
await this.handleManyRelationships(
|
||||||
table._id || "",
|
table._id || "",
|
||||||
response[0],
|
response[0],
|
||||||
|
|
|
@ -42,7 +42,7 @@ export enum SourceNames {
|
||||||
|
|
||||||
export enum IncludeRelationships {
|
export enum IncludeRelationships {
|
||||||
INCLUDE = 1,
|
INCLUDE = 1,
|
||||||
EXCLUDE = 0
|
EXCLUDE = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueryDefinition {
|
export interface QueryDefinition {
|
||||||
|
|
|
@ -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 != null,
|
||||||
|
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)
|
||||||
|
|
Loading…
Reference in New Issue