e72b193f06
* Add settings tab. Update style of component * Structuring of files/components * Updates to TexInput * Add RadioGroup * Last FE work * FE Updates * Webhooks Settings Tab * Styling updates to webhooks * Title/Description Update * General Page done * Collaborators WIP * Styling updates * Add custom message to updateProject * Radio Group Same Height * Styling updates to radio group. Disabled state * Updates pre demo * Updates to icons & post demo changes * Major Updates * Unsaved Changes Dialog * Routing WIP * Remove StatsBlock * Auto update discussions on Private * Routing/Redirects * New input style * Invite Dialog * Fix mobile radiogroup * Mobile Improvements * Fix console warning * Fix build * Disabled States * Fix console * Unhide webhooks * Updates from testing * Responsive fixes * Alignment fixes * Fix textarea mobile height * Updates to GraphQL Fragments * Fix disabled state * WIP Arrows for scroll * Update PageTabs - broken * Fix to PageTabs * PageTab fix initial scroll * Hide Scrollbar * Better underline method * Fix mobile initial underline * Webhooks Empty State * Fix input border * Fix empty state * Input Styling updates * Remove mobile smaller text * Update disabled state for disabled items * Updates disabled sates on Settings Block * Fix build. Disable Invite * Fixes to invite permissions * Disable role select when invite is disabled * Small alignment fix * Fix webhooks empty state * cleaning up unnecessary vue files * story improvement * Remove DisabledMessage prop * Fix disabled prop on Button * Move team to Leave Fragment * Remove unused Disabled Message props * Add limit to graphql query * Updates to BlockDiscussions * add formatTriggers function to webhooks * Remove md from button. Improved switch * Update RadioGroup.stories.ts * Update RadioGroup to use defineModel * Various styling and copy updates - More concise and accurate copy - More readable - Works better on mobile * Updates to Invite Dialog * Custom success Message * Update slot names * Remove md in TextInput. Set h-8 to default * Changes from call with fabs * Replace isOwner with composable * Set SettingsBlock icon as optional * Comments from PR * Updates from PR * Final Tidy Ups * Fix Title/Description * Fix spacing issue on Webhooks page * Update borders and colors to align with Automate Makes the same changes that I recently made to the unreleased Automate tab * WEB-869 * Improve styling of radiogroup component Better borders, hover effect, bigger checkmark icon, more subtle active background color, same across breakpoints. * Adjust border styling of RadioGroup component * Improve circle around checkmark in RadioGroup * Split Tabs into 2 components * Restyle overflow arrows * Adjust gap and remove icons from vertical nav Too many icons on the screen got distracting. * Ensure active item visible * Increase gap on vertical nav * Update copy for Access and Discussions settings * Input Tidyup * WEB-877 update-collaborators-block * Update inputs to new style * Fix webhooks button hover state * Fix comment copy Appears in the access settings before embedding a model * Remove hover shadow from search input on Dashboard * Small change from Benjamin * Change collaborators permissions copy * Comments from PR #1 * Comments from PR #2 * Fix condition for EditableHeader * Updates from CR --------- Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com> Co-authored-by: Benjamin Ottensten <benjamin.ottensten@gmail.com>
96 lines
2.9 KiB
Vue
96 lines
2.9 KiB
Vue
<template>
|
|
<FormSelectBase
|
|
v-model="selectedValue"
|
|
:items="roles"
|
|
:multiple="multiple"
|
|
:disabled-item-predicate="disabledItemPredicate"
|
|
name="serverRoles"
|
|
label="Server roles"
|
|
class="min-w-[110px]"
|
|
:fully-control-value="fullyControlValue"
|
|
:label-id="labelId"
|
|
:button-id="buttonId"
|
|
mount-menu-on-body
|
|
>
|
|
<template #nothing-selected>
|
|
{{ multiple ? 'Select roles' : 'Select role' }}
|
|
</template>
|
|
<template #something-selected="{ value }">
|
|
<template v-if="isMultiItemArrayValue(value)">
|
|
<div ref="elementToWatchForChanges" class="flex items-center space-x-0.5">
|
|
<div
|
|
ref="itemContainer"
|
|
class="flex flex-wrap overflow-hidden space-x-0.5 h-6"
|
|
>
|
|
<div v-for="(item, i) in value" :key="item" class="text-foreground">
|
|
{{ RoleInfo.Server[item] + (i < value.length - 1 ? ', ' : '') }}
|
|
</div>
|
|
</div>
|
|
<div v-if="hiddenSelectedItemCount > 0" class="text-foreground-2 normal">
|
|
+{{ hiddenSelectedItemCount }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="truncate text-foreground">
|
|
{{ RoleInfo.Server[firstItem(value)] }}
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template #option="{ item }">
|
|
<div class="flex items-center">
|
|
<span class="truncate">{{ RoleInfo.Server[firstItem(item)] }}</span>
|
|
</div>
|
|
</template>
|
|
</FormSelectBase>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { Roles, RoleInfo } from '@speckle/shared'
|
|
import type { Nullable, ServerRoles } from '@speckle/shared'
|
|
import { useFormSelectChildInternals } from '@speckle/ui-components'
|
|
import type { PropType } from 'vue'
|
|
|
|
type ValueType = ServerRoles | ServerRoles[] | undefined
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'update:modelValue', v: ValueType): void
|
|
}>()
|
|
|
|
const props = defineProps({
|
|
multiple: Boolean,
|
|
modelValue: {
|
|
type: [String, Array] as PropType<ValueType>,
|
|
default: undefined
|
|
},
|
|
allowGuest: Boolean,
|
|
allowAdmin: Boolean,
|
|
allowArchived: Boolean,
|
|
fullyControlValue: Boolean
|
|
})
|
|
|
|
const elementToWatchForChanges = ref(null as Nullable<HTMLElement>)
|
|
const itemContainer = ref(null as Nullable<HTMLElement>)
|
|
const labelId = useId()
|
|
const buttonId = useId()
|
|
|
|
const { selectedValue, isMultiItemArrayValue, hiddenSelectedItemCount, firstItem } =
|
|
useFormSelectChildInternals<ServerRoles>({
|
|
props: toRefs(props),
|
|
emit,
|
|
dynamicVisibility: { elementToWatchForChanges, itemContainer }
|
|
})
|
|
|
|
const roles = computed(() =>
|
|
Object.values(Roles.Server).filter((r) => {
|
|
if (r === Roles.Server.Admin) return props.allowAdmin
|
|
if (r === Roles.Server.ArchivedUser) return props.allowArchived
|
|
return true
|
|
})
|
|
)
|
|
|
|
const disabledItemPredicate = (item: ServerRoles) => {
|
|
if (item === Roles.Server.Guest) return !props.allowGuest
|
|
return false
|
|
}
|
|
</script>
|