Merge pull request #132 from shogunpurple/ui-bugs

Ui bugs
This commit is contained in:
Martin McKeaveney 2020-02-27 18:08:07 +00:00 committed by GitHub
commit 1c3fd54929
7 changed files with 60 additions and 41 deletions

View File

@ -16,7 +16,9 @@ const _builderProxy = proxy("/_builder", {
pathRewrite: { "^/_builder": "" }, pathRewrite: { "^/_builder": "" },
}) })
const apiProxy = proxy(["/_builder/assets/**", "/_builder/api/**", "/_builder/**/componentlibrary"], { const apiProxy = proxy(
["/_builder/assets/**", "/_builder/api/**", "/_builder/**/componentlibrary"],
{
target, target,
logLevel: "debug", logLevel: "debug",
changeOrigin: true, changeOrigin: true,
@ -26,7 +28,8 @@ const apiProxy = proxy(["/_builder/assets/**", "/_builder/api/**", "/_builder/**
proxyReq.setHeader("origin", target) proxyReq.setHeader("origin", target)
} }
}, },
}) }
)
const production = !process.env.ROLLUP_WATCH const production = !process.env.ROLLUP_WATCH

View File

@ -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)
@ -56,6 +62,7 @@
clonedLevel.permissions clonedLevel.permissions
) )
} }
allPermissions = allPermissions
} }
</script> </script>
@ -68,6 +75,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 +108,7 @@
<style> <style>
.permission-container { .permission-container {
margin-top: 10px;
margin-bottom: 10px; margin-bottom: 10px;
} }
</style> </style>

View File

@ -4,7 +4,7 @@
</script> </script>
<div class="select-container"> <div class="select-container">
<select on:change {value}> <select on:change bind: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;

View File

@ -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>

View File

@ -38,10 +38,10 @@ const tableProps = (index, indexSchema) => ({
"##eventHandlerType": "List Records", "##eventHandlerType": "List Records",
parameters: { parameters: {
indexKey: "/all_contacts", indexKey: "/all_contacts",
statePath: "all_contacts" statePath: "all_contacts",
} },
} },
] ],
}) })
const columnHeaders = indexSchema => const columnHeaders = indexSchema =>

View File

@ -309,26 +309,20 @@ module.exports = (config, app) => {
}) })
.post("/:appname/api/listRecords/*", async ctx => { .post("/:appname/api/listRecords/*", async ctx => {
const indexkey = getRecordKey(ctx.params.appname, ctx.request.path) const indexkey = getRecordKey(ctx.params.appname, ctx.request.path)
ctx.body = await ctx.instance.indexApi.listItems( ctx.body = await ctx.instance.indexApi.listItems(indexkey, {
indexkey,
{
rangeStartParams: ctx.request.body.rangeStartParams, rangeStartParams: ctx.request.body.rangeStartParams,
rangeEndParams: ctx.request.body.rangeEndParams, rangeEndParams: ctx.request.body.rangeEndParams,
searchPhrase: ctx.request.body.searchPhrase, searchPhrase: ctx.request.body.searchPhrase,
} })
)
ctx.response.status = StatusCodes.OK ctx.response.status = StatusCodes.OK
}) })
.post("/:appname/api/aggregates/*", async ctx => { .post("/:appname/api/aggregates/*", async ctx => {
const indexkey = getRecordKey(ctx.params.appname, ctx.request.path) const indexkey = getRecordKey(ctx.params.appname, ctx.request.path)
ctx.body = await ctx.instance.indexApi.aggregates( ctx.body = await ctx.instance.indexApi.aggregates(indexkey, {
indexkey,
{
rangeStartParams: ctx.request.body.rangeStartParams, rangeStartParams: ctx.request.body.rangeStartParams,
rangeEndParams: ctx.request.body.rangeEndParams, rangeEndParams: ctx.request.body.rangeEndParams,
searchPhrase: ctx.request.body.searchPhrase, searchPhrase: ctx.request.body.searchPhrase,
} })
)
ctx.response.status = StatusCodes.OK ctx.response.status = StatusCodes.OK
}) })
.post("/:appname/api/files/*", async ctx => { .post("/:appname/api/files/*", async ctx => {

View File

@ -30,7 +30,10 @@ module.exports.appsFolder = config => appPackageFolder(config, "")
module.exports.masterAppPackage = context => { module.exports.masterAppPackage = context => {
const { config } = context const { config } = context
const standardPackage = createAppPackage(context, `${__dirname}/../appPackages/_master`) const standardPackage = createAppPackage(
context,
`${__dirname}/../appPackages/_master`
)
const customizeMaster = const customizeMaster =
config && config.customizeMaster ? config.customizeMaster : a => a config && config.customizeMaster ? config.customizeMaster : a => a