Files
speckle-server/packages/frontend-2/components/projects/AddDialog.vue
T
andrewwallacespeckle 671979e012 Feature - Frontend2 - Server Settings Pages (#1764)
* Add server management menu item

* Server Management Page & Settings Dialog

* escape from the precommits hooks

* Add Delete User Dialog

* Add invitations page

* Add Projects Page

* Pulling in GraphQL Data

* Settings Mutations

* Fix cardinfo type

* GraphQL in Active Users

* Add icons

* Infinite Load on Active Users

* Tidy Ups

* TS fixes

* Add Update button functionality

* Add Delete User

* Projects

* Home Done

* New query

* Delete User

* WIP User Roles

* Overflow fix

* Table Update

* Add Onclick to rows

* Fix bugs

* Fix console error

* Admin Middleware

* Role Update Dialog

* TS Fixes

* Latest updates

* Tidyups

* Tidy Up Nav Menu

* Tidy Up Card

* ChangeUserRoleDialog Tidyup

* Fix bubbling issue on Table

* Design fixes

* fix: speckle server version hydration mismatch

* Remove Dialog bg-white

* Rename Query, Fix Export

* fix: allowing FormSelectBase to reject updates

* feat: cache policies for new admin graph fields

* feat: cache updates so no refetch necessary

* PR Changes

* Fix Projects Page

* Updates to Roles

* Project Delete Mutation

* Add Resend & Delete Invite Mutation

* Fix console warnings

* Disable active user role select

* Linting fixes

* Reorder

* Linting fixes

* Changes from PR

* Fixes from PR

* Ui Fixes

* Update Settings Dialog Cache on Save

* Fix colours

* Delete Invitation Mutation Moved

* Delete Project Logic moved

* Delete Mutation moved to component

* Change User Role mutation moved to Dialog

* Reorder

* WIP - Checkbox Bug

* attempted checkbox fix

* Update Caching

* Rollback tsc

* Update to Resend Button

* Add new buttons

* Use defineModel

* Re-add emits

* Move mutation

* serverInfo cache update fix

* fixed delete invite cache update

* Updates to Project Delete Dialog Caching

* Remove unneeded props

* Fix caching in DeleteUserDialog

* Improved error handling in server info update

* Swap Invite modal to new style

* updated evictObjectFields details

* Update cache on successfull invite

* Add Invite dialog

* Add project Dialog Update

* defineModel

* Remove emits from Add Project and Invites

* Add missing Dialog

* Updates from PR

* Adjust query

* Remove need for items in admin data query

---------

Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
2023-09-04 11:57:34 +01:00

93 lines
2.3 KiB
Vue

<template>
<LayoutDialog
v-model:open="open"
max-width="sm"
title="Create new project"
:buttons="dialogButtons"
>
<form class="flex flex-col text-foreground" @submit="onSubmit">
<div class="flex flex-col space-y-3 mb-6">
<FormTextInput
name="name"
label="Project name"
placeholder="Project name"
size="lg"
:rules="[isRequired, isStringOfLength({ maxLength: 512 })]"
show-required
auto-focus
/>
<FormTextArea
name="description"
label="Project description"
placeholder="Description (optional)"
size="lg"
:rules="[isStringOfLength({ maxLength: 65536 })]"
/>
</div>
<div
class="flex flex-col space-y-4 items-end md:flex-row md:justify-between md:items-center md:space-y-0"
>
<ProjectVisibilitySelect
v-model="visibility"
class="sm:max-w-none w-full sm:w-80"
/>
</div>
</form>
</LayoutDialog>
</template>
<script setup lang="ts">
import { useForm } from 'vee-validate'
import { ProjectVisibility } from '~~/lib/common/generated/gql/graphql'
import { isRequired, isStringOfLength } from '~~/lib/common/helpers/validation'
import { useMixpanel } from '~~/lib/core/composables/mp'
import { useCreateProject } from '~~/lib/projects/composables/projectManagement'
type FormValues = {
name: string
description?: string
}
const emit = defineEmits<{
(e: 'created'): void
}>()
const createProject = useCreateProject()
const { handleSubmit } = useForm<FormValues>()
const visibility = ref(ProjectVisibility.Unlisted)
const open = defineModel<boolean>('open', { required: true })
const mp = useMixpanel()
const onSubmit = handleSubmit(async (values) => {
await createProject({
...values,
visibility: visibility.value
})
emit('created')
mp.track('Stream Action', { type: 'action', name: 'create' })
open.value = false
})
const dialogButtons = computed(() => [
{
text: 'Cancel',
props: { color: 'secondary', fullWidth: true },
onClick: () => {
open.value = false
}
},
{
text: 'Create',
props: {
color: 'primary',
fullWidth: true,
outline: true,
submit: true
},
onClick: onSubmit
}
])
</script>