From 013e2f773b23edbf9f234db52a72100b0a5a8df7 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Feb 2020 15:17:27 +0000 Subject: [PATCH 1/3] select fix, select all on access levels, modal fixes --- .../src/accessLevels/AccessLevelView.svelte | 28 +++++++++++++++---- packages/builder/src/common/Select.svelte | 3 +- .../src/userInterface/NewScreen.svelte | 5 ++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/accessLevels/AccessLevelView.svelte b/packages/builder/src/accessLevels/AccessLevelView.svelte index a21f768d7f..c5a985d5ed 100644 --- a/packages/builder/src/accessLevels/AccessLevelView.svelte +++ b/packages/builder/src/accessLevels/AccessLevelView.svelte @@ -24,12 +24,18 @@ ((!p2.nodeKey && !p1.nodeKey) || p2.nodeKey === p1.nodeKey) const hasPermission = hasPerm => - some(p => matchPermissions(p, hasPerm))(clonedLevel.permissions) + clonedLevel.permissions.some(permission => + matchPermissions(permission, hasPerm) + ) - $: permissionMatrix = map(p => ({ - permission: p, - hasPermission: hasPermission(p), - }))(allPermissions) + $: permissionMatrix = allPermissions.map(permission => ({ + permission, + hasPermission: hasPermission(permission), + })) + + $: allPermissionsSelected = permissionMatrix.every( + permission => permission.hasPermission + ) const getPermissionName = perm => perm.nodeKey ? `${perm.type} - ${perm.nodeKey}` : perm.type @@ -37,7 +43,7 @@ const save = () => { const newLevels = isNew ? [...allLevels, clonedLevel] - : [...filter(l => l.name !== level.name)(allLevels), clonedLevel] + : [...allLevels.filter(l => l.name !== level.name), clonedLevel] errors = validateAccessLevels(hierarchy, actions, newLevels) @@ -68,6 +74,15 @@

Permissions

+ + { + permissionMatrix.forEach(permission => + permissionChanged(permission.permission)(ev) + ) + }} /> {#each permissionMatrix as permission}
.permission-container { + margin-top: 10px; margin-bottom: 10px; } diff --git a/packages/builder/src/common/Select.svelte b/packages/builder/src/common/Select.svelte index 0e09bc7d2b..261b652490 100644 --- a/packages/builder/src/common/Select.svelte +++ b/packages/builder/src/common/Select.svelte @@ -4,7 +4,7 @@
- @@ -23,6 +23,7 @@ } select { + height: 35px; display: block; font-family: sans-serif; font-weight: 500; diff --git a/packages/builder/src/userInterface/NewScreen.svelte b/packages/builder/src/userInterface/NewScreen.svelte index 3fb7fb0fbb..ce460c6c61 100644 --- a/packages/builder/src/userInterface/NewScreen.svelte +++ b/packages/builder/src/userInterface/NewScreen.svelte @@ -3,6 +3,7 @@ import PropsView from "./PropsView.svelte" import Textbox from "../common/Textbox.svelte" import Button from "../common/Button.svelte" + import ActionButton from "../common/ActionButton.svelte" import ButtonGroup from "../common/ButtonGroup.svelte" import { pipe } from "../common/core" import UIkit from "uikit" @@ -122,8 +123,8 @@
- - + Create Screen + Cancel
From 86504a44d6fb6736bfa7be096128f983c55bc308 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Feb 2020 16:41:10 +0000 Subject: [PATCH 2/3] fix reactive declaration --- packages/builder/src/accessLevels/AccessLevelView.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/accessLevels/AccessLevelView.svelte b/packages/builder/src/accessLevels/AccessLevelView.svelte index c5a985d5ed..e5423db018 100644 --- a/packages/builder/src/accessLevels/AccessLevelView.svelte +++ b/packages/builder/src/accessLevels/AccessLevelView.svelte @@ -62,6 +62,7 @@ clonedLevel.permissions ) } + allPermissions = allPermissions } From f746a0416c3239c5a5d69ac6dc44015b0ac95065 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Feb 2020 16:45:24 +0000 Subject: [PATCH 3/3] lint failures --- packages/builder/rollup.config.js | 25 ++++++++++-------- packages/builder/src/common/Select.svelte | 2 +- .../src/Templates/indexDatatable.js | 8 +++--- packages/server/middleware/routers.js | 26 +++++++------------ packages/server/utilities/createAppPackage.js | 5 +++- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 9af67db34a..183dba265c 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -16,17 +16,20 @@ const _builderProxy = proxy("/_builder", { pathRewrite: { "^/_builder": "" }, }) -const apiProxy = proxy(["/_builder/assets/**", "/_builder/api/**", "/_builder/**/componentlibrary"], { - target, - logLevel: "debug", - changeOrigin: true, - cookieDomainRewrite: true, - onProxyReq(proxyReq) { - if (proxyReq.getHeader("origin")) { - proxyReq.setHeader("origin", target) - } - }, -}) +const apiProxy = proxy( + ["/_builder/assets/**", "/_builder/api/**", "/_builder/**/componentlibrary"], + { + target, + logLevel: "debug", + changeOrigin: true, + cookieDomainRewrite: true, + onProxyReq(proxyReq) { + if (proxyReq.getHeader("origin")) { + proxyReq.setHeader("origin", target) + } + }, + } +) const production = !process.env.ROLLUP_WATCH diff --git a/packages/builder/src/common/Select.svelte b/packages/builder/src/common/Select.svelte index 261b652490..e360c1c4d6 100644 --- a/packages/builder/src/common/Select.svelte +++ b/packages/builder/src/common/Select.svelte @@ -4,7 +4,7 @@
- diff --git a/packages/materialdesign-components/src/Templates/indexDatatable.js b/packages/materialdesign-components/src/Templates/indexDatatable.js index 798a9061ba..4042ec18c0 100644 --- a/packages/materialdesign-components/src/Templates/indexDatatable.js +++ b/packages/materialdesign-components/src/Templates/indexDatatable.js @@ -38,10 +38,10 @@ const tableProps = (index, indexSchema) => ({ "##eventHandlerType": "List Records", parameters: { indexKey: "/all_contacts", - statePath: "all_contacts" - } - } - ] + statePath: "all_contacts", + }, + }, + ], }) const columnHeaders = indexSchema => diff --git a/packages/server/middleware/routers.js b/packages/server/middleware/routers.js index 08169463ab..3d07ac29d9 100644 --- a/packages/server/middleware/routers.js +++ b/packages/server/middleware/routers.js @@ -309,26 +309,20 @@ module.exports = (config, app) => { }) .post("/:appname/api/listRecords/*", async ctx => { const indexkey = getRecordKey(ctx.params.appname, ctx.request.path) - ctx.body = await ctx.instance.indexApi.listItems( - indexkey, - { - rangeStartParams: ctx.request.body.rangeStartParams, - rangeEndParams: ctx.request.body.rangeEndParams, - searchPhrase: ctx.request.body.searchPhrase, - } - ) + ctx.body = await ctx.instance.indexApi.listItems(indexkey, { + rangeStartParams: ctx.request.body.rangeStartParams, + rangeEndParams: ctx.request.body.rangeEndParams, + searchPhrase: ctx.request.body.searchPhrase, + }) ctx.response.status = StatusCodes.OK }) .post("/:appname/api/aggregates/*", async ctx => { const indexkey = getRecordKey(ctx.params.appname, ctx.request.path) - ctx.body = await ctx.instance.indexApi.aggregates( - indexkey, - { - rangeStartParams: ctx.request.body.rangeStartParams, - rangeEndParams: ctx.request.body.rangeEndParams, - searchPhrase: ctx.request.body.searchPhrase, - } - ) + ctx.body = await ctx.instance.indexApi.aggregates(indexkey, { + rangeStartParams: ctx.request.body.rangeStartParams, + rangeEndParams: ctx.request.body.rangeEndParams, + searchPhrase: ctx.request.body.searchPhrase, + }) ctx.response.status = StatusCodes.OK }) .post("/:appname/api/files/*", async ctx => { diff --git a/packages/server/utilities/createAppPackage.js b/packages/server/utilities/createAppPackage.js index 60a2d9d8a1..3aaa6ce09f 100644 --- a/packages/server/utilities/createAppPackage.js +++ b/packages/server/utilities/createAppPackage.js @@ -30,7 +30,10 @@ module.exports.appsFolder = config => appPackageFolder(config, "") module.exports.masterAppPackage = context => { const { config } = context - const standardPackage = createAppPackage(context, `${__dirname}/../appPackages/_master`) + const standardPackage = createAppPackage( + context, + `${__dirname}/../appPackages/_master` + ) const customizeMaster = config && config.customizeMaster ? config.customizeMaster : a => a