Files
speckle-server/packages/frontend-2/lib/projects/graphql/mutations.ts
T
andrewwallacespeckle 0045c353c6 Feature: FE2 - Project Webhooks Page (#1792)
* Layout Pages

* Add Multi Select with Badges

* Add MultiBadge

* Add prevent close on click outside

* Fix import issue

* Import Table

* Add Classnames to buttons

* Add Switch Component

* Update for webhooks

* skip precommit hooks

* Remove Infinite Load. Update Types

* Create Webhook Dialog

* Tidy Ups

* Edit Webhook dialog

* WIP Breadcurmbs

* Changes from calls with Fabians

* Breadcrumbs

* Reorders

* Fix Create Dialog

* Rename MultiBadge to BadgeSelected

* Fix and update Story file for Table

* Adjust Padding for Buttons in Table

* Add extra story, adjust padding for no buttons

* Fix bug with Edit Select

* fixed Webhook sorting + added Webhook.hasSecret and Webhook.projectId

* fixed hydration mismatch

* Changes from PR feedback

* Validation Rule for Select

* Reset Dialogs on Cancel. Conditionally render headers in Table

* stricter webhook gql types

* stricter webhook gql types

* Fix initial dialogs

* Quick Fixes

* Add projectWebhooksRoute

* Remove TableItemType

* Fixes from PR

* Fix broken Query

* Fixes from PR

* Fix based on PR

* Fix from PR

* Changes to index

* Fix in index

* Updates to Validation and Table

* Add "by" prop to FormSelectBadges and renamed component

* Use defineModel for Switch

* Revert "Use defineModel for Switch"

This reverts commit 6bc9e07a767cdc64f06c03b028150915e013ed4f.

* Replace breadcrumbs with projectWebhooksRoute

* Rename FormValues to WebhookFormValues

* Add target blank and simplify trigger mapping

* Fix casing of webhookFormValues

* Change webhookModel to prevent props mutation

* Remove unnecessary typecast

* Webhook deletion now uses fieldNameWhitelist.

* Use convertThrowIntoFetchResult and getFirstErrorMessage in Create

* Use defineModel for handling open state of Dialogs

* Optimise Switch component with defineModel

* Merge Create and Edit Dialogs

* Fix issue with Status Icons

* Remove console log

* WIP Merge of Edit and Create

* Add optional placeholder to SelectBase. Update Events placeholder.

* Add secret to Create webhook dialog

* Update Watch

* Rename Dialogs. Fix active select items

* Fix Select active items

* Simplify triggers, add secret to create call

* Remove $webhooksId: String

* fix: stale form state across edit/create webhook dialog sessions

* Fix from PR

* Swap t.text for t.id

* Use enum for historyStatus

* Use consistent story formatting

* More consistent create/edit mutations

* fix be linting errors

---------

Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
2023-09-26 15:41:29 +02:00

165 lines
3.5 KiB
TypeScript

import { graphql } from '~~/lib/common/generated/gql'
export const createModelMutation = graphql(`
mutation CreateModel($input: CreateModelInput!) {
modelMutations {
create(input: $input) {
...ProjectPageLatestItemsModelItem
}
}
}
`)
export const createProjectMutation = graphql(`
mutation CreateProject($input: ProjectCreateInput) {
projectMutations {
create(input: $input) {
...ProjectPageProject
...ProjectDashboardItem
}
}
}
`)
export const updateModelMutation = graphql(`
mutation UpdateModel($input: UpdateModelInput!) {
modelMutations {
update(input: $input) {
...ProjectPageLatestItemsModelItem
}
}
}
`)
export const deleteModelMutation = graphql(`
mutation DeleteModel($input: DeleteModelInput!) {
modelMutations {
delete(input: $input)
}
}
`)
export const updateProjectRoleMutation = graphql(`
mutation UpdateProjectRole($input: ProjectUpdateRoleInput!) {
projectMutations {
updateRole(input: $input) {
id
team {
role
user {
...LimitedUserAvatar
}
}
}
}
}
`)
export const inviteProjectUserMutation = graphql(`
mutation InviteProjectUser($projectId: ID!, $input: [ProjectInviteCreateInput!]!) {
projectMutations {
invites {
batchCreate(projectId: $projectId, input: $input) {
...ProjectPageTeamDialog
}
}
}
}
`)
export const cancelProjectInviteMutation = graphql(`
mutation CancelProjectInvite($projectId: ID!, $inviteId: String!) {
projectMutations {
invites {
cancel(projectId: $projectId, inviteId: $inviteId) {
...ProjectPageTeamDialog
}
}
}
}
`)
export const updateProjectMetadataMutation = graphql(`
mutation UpdateProjectMetadata($update: ProjectUpdateInput!) {
projectMutations {
update(update: $update) {
id
...ProjectUpdatableMetadata
}
}
}
`)
export const deleteProjectMutation = graphql(`
mutation DeleteProject($id: String!) {
projectMutations {
delete(id: $id)
}
}
`)
export const useProjectInviteMutation = graphql(`
mutation UseProjectInvite($input: ProjectInviteUseInput!) {
projectMutations {
invites {
use(input: $input)
}
}
}
`)
export const leaveProjectMutation = graphql(`
mutation LeaveProject($projectId: String!) {
projectMutations {
leave(id: $projectId)
}
}
`)
export const deleteVersionsMutation = graphql(`
mutation DeleteVersions($input: DeleteVersionsInput!) {
versionMutations {
delete(input: $input)
}
}
`)
export const moveVersionsMutation = graphql(`
mutation MoveVersions($input: MoveVersionsInput!) {
versionMutations {
moveToModel(input: $input) {
id
}
}
}
`)
export const updateVersionMutation = graphql(`
mutation UpdateVersion($input: UpdateVersionInput!) {
versionMutations {
update(input: $input) {
id
message
}
}
}
`)
export const deleteWebhookMutation = graphql(`
mutation deleteWebhook($webhook: WebhookDeleteInput!) {
webhookDelete(webhook: $webhook)
}
`)
export const createWebhookMutation = graphql(`
mutation createWebhook($webhook: WebhookCreateInput!) {
webhookCreate(webhook: $webhook)
}
`)
export const updateWebhookMutation = graphql(`
mutation updateWebhook($webhook: WebhookUpdateInput!) {
webhookUpdate(webhook: $webhook)
}
`)