From 71e88f4de53b9bddd77d176e2f4efce6cb4a6cf4 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Feb 2020 15:17:27 +0000 Subject: [PATCH] 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