Add dedicateed renderer for roles tags

This commit is contained in:
Rory Powell 2021-07-25 21:14:49 +01:00
parent 3b3b90c721
commit eed5ca5ce2
3 changed files with 13 additions and 4 deletions

View File

@ -19,7 +19,8 @@
import { fetchData } from "helpers" import { fetchData } from "helpers"
import { users, auth } from "stores/portal" import { users, auth } from "stores/portal"
import TagsRenderer from "./_components/TagsTableRenderer.svelte" import TagsRenderer from "./_components/RolesTagsTableRenderer.svelte"
import UpdateRolesModal from "./_components/UpdateRolesModal.svelte" import UpdateRolesModal from "./_components/UpdateRolesModal.svelte"
import ForceResetPasswordModal from "./_components/ForceResetPasswordModal.svelte" import ForceResetPasswordModal from "./_components/ForceResetPasswordModal.svelte"

View File

@ -0,0 +1,8 @@
<script>
import TagsTableRenderer from "./TagsTableRenderer.svelte"
export let value
$: roles = value?.filter(role => role != null).map(role => role.name) ?? []
</script>
<TagsTableRenderer value={roles} />

View File

@ -4,9 +4,9 @@
const displayLimit = 5 const displayLimit = 5
$: roles = value?.filter(role => role != null).map(role => role.name) ?? [] $: values = value?.filter(value => value != null) ?? []
$: tags = roles.slice(0, displayLimit) $: tags = values.slice(0, displayLimit)
$: leftover = roles.length - tags.length $: leftover = values.length - tags.length
</script> </script>
<div class="tag-renderer"> <div class="tag-renderer">