select fix, select all on access levels, modal fixes
This commit is contained in:
parent
7438e6f057
commit
71e88f4de5
|
@ -24,12 +24,18 @@
|
||||||
((!p2.nodeKey && !p1.nodeKey) || p2.nodeKey === p1.nodeKey)
|
((!p2.nodeKey && !p1.nodeKey) || p2.nodeKey === p1.nodeKey)
|
||||||
|
|
||||||
const hasPermission = hasPerm =>
|
const hasPermission = hasPerm =>
|
||||||
some(p => matchPermissions(p, hasPerm))(clonedLevel.permissions)
|
clonedLevel.permissions.some(permission =>
|
||||||
|
matchPermissions(permission, hasPerm)
|
||||||
|
)
|
||||||
|
|
||||||
$: permissionMatrix = map(p => ({
|
$: permissionMatrix = allPermissions.map(permission => ({
|
||||||
permission: p,
|
permission,
|
||||||
hasPermission: hasPermission(p),
|
hasPermission: hasPermission(permission),
|
||||||
}))(allPermissions)
|
}))
|
||||||
|
|
||||||
|
$: allPermissionsSelected = permissionMatrix.every(
|
||||||
|
permission => permission.hasPermission
|
||||||
|
)
|
||||||
|
|
||||||
const getPermissionName = perm =>
|
const getPermissionName = perm =>
|
||||||
perm.nodeKey ? `${perm.type} - ${perm.nodeKey}` : perm.type
|
perm.nodeKey ? `${perm.type} - ${perm.nodeKey}` : perm.type
|
||||||
|
@ -37,7 +43,7 @@
|
||||||
const save = () => {
|
const save = () => {
|
||||||
const newLevels = isNew
|
const newLevels = isNew
|
||||||
? [...allLevels, clonedLevel]
|
? [...allLevels, clonedLevel]
|
||||||
: [...filter(l => l.name !== level.name)(allLevels), clonedLevel]
|
: [...allLevels.filter(l => l.name !== level.name), clonedLevel]
|
||||||
|
|
||||||
errors = validateAccessLevels(hierarchy, actions, newLevels)
|
errors = validateAccessLevels(hierarchy, actions, newLevels)
|
||||||
|
|
||||||
|
@ -68,6 +74,15 @@
|
||||||
<Textbox label="Access Level Name" bind:text={clonedLevel.name} />
|
<Textbox label="Access Level Name" bind:text={clonedLevel.name} />
|
||||||
|
|
||||||
<h4 class="budibase__title--4">Permissions</h4>
|
<h4 class="budibase__title--4">Permissions</h4>
|
||||||
|
|
||||||
|
<Checkbox
|
||||||
|
label={'Select All'}
|
||||||
|
checked={allPermissionsSelected}
|
||||||
|
on:change={ev => {
|
||||||
|
permissionMatrix.forEach(permission =>
|
||||||
|
permissionChanged(permission.permission)(ev)
|
||||||
|
)
|
||||||
|
}} />
|
||||||
{#each permissionMatrix as permission}
|
{#each permissionMatrix as permission}
|
||||||
<div class="permission-container">
|
<div class="permission-container">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -92,6 +107,7 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.permission-container {
|
.permission-container {
|
||||||
|
margin-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="select-container">
|
<div class="select-container">
|
||||||
<select on:change {value}>
|
<select on:change bind:value={value}>
|
||||||
<slot />
|
<slot />
|
||||||
</select>
|
</select>
|
||||||
<span class="arrow">
|
<span class="arrow">
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
height: 35px;
|
||||||
display: block;
|
display: block;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import PropsView from "./PropsView.svelte"
|
import PropsView from "./PropsView.svelte"
|
||||||
import Textbox from "../common/Textbox.svelte"
|
import Textbox from "../common/Textbox.svelte"
|
||||||
import Button from "../common/Button.svelte"
|
import Button from "../common/Button.svelte"
|
||||||
|
import ActionButton from "../common/ActionButton.svelte"
|
||||||
import ButtonGroup from "../common/ButtonGroup.svelte"
|
import ButtonGroup from "../common/ButtonGroup.svelte"
|
||||||
import { pipe } from "../common/core"
|
import { pipe } from "../common/core"
|
||||||
import UIkit from "uikit"
|
import UIkit from "uikit"
|
||||||
|
@ -122,8 +123,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ButtonGroup style="float: right;">
|
<ButtonGroup style="float: right;">
|
||||||
<Button color="primary" grouped on:click={save}>Create Screen</Button>
|
<ActionButton primary on:click={save}>Create Screen</ActionButton>
|
||||||
<Button color="tertiary" grouped on:click={cancel}>Cancel</Button>
|
<ActionButton alert on:click={cancel}>Cancel</ActionButton>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue