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> <script>
import { notifications, Select } from "@budibase/bbui"
import { users } from "stores/portal" import { users } from "stores/portal"
import { Constants } from "@budibase/frontend-core" import { Constants } from "@budibase/frontend-core"
export let row export let row
$: value = users.getUserRole(row) $: value =
Constants.BbRoles.find(x => x.value === users.getUserRole(row))?.label ||
async function updateUserRole({ detail }) { "Not Available"
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")
}
}
</script> </script>
<div on:click|stopPropagation> <div on:click|stopPropagation>
<Select {value}
{value}
options={Constants.BbRoles}
autoWidth
quiet
on:change={updateUserRole}
/>
</div> </div>
<style> <style>