removed role dropdown from users table due to incompatibilities with table horizontal scroll and overflowing dropdown component

This commit is contained in:
NEOLPAR 2022-07-15 10:13:03 +01:00
parent 8034b85db3
commit 341ba71564
1 changed files with 4 additions and 26 deletions

View File

@ -1,37 +1,15 @@
<script>
import { notifications, Select } from "@budibase/bbui"
import { users } from "stores/portal"
import { Constants } from "@budibase/frontend-core"
export let row
$: value = users.getUserRole(row)
async function updateUserRole({ detail }) {
if (detail === "developer") {
toggleFlags({ admin: { global: false }, builder: { global: true } })
} else if (detail === "admin") {
toggleFlags({ admin: { global: true }, builder: { global: false } })
} else if (detail === "appUser") {
toggleFlags({ admin: { global: false }, builder: { global: false } })
}
}
async function toggleFlags(roleFlags) {
try {
await users.save({ ...(await users.get(row._id)), ...roleFlags })
} catch (error) {
notifications.error("Error updating user")
}
}
$: value =
Constants.BbRoles.find(x => x.value === users.getUserRole(row))?.label ||
"Not Available"
</script>
<div on:click|stopPropagation>
<Select
{value}
options={Constants.BbRoles}
autoWidth
quiet
on:change={updateUserRole}
/>
{value}
</div>
<style>