summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/work_items/graphql
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 20:02:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 20:02:30 +0000
commit41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch)
tree9c8d89a8624828992f06d892cd2f43818ff5dcc8 /app/assets/javascripts/work_items/graphql
parent0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff)
downloadgitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/work_items/graphql')
-rw-r--r--app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql14
-rw-r--r--app/assets/javascripts/work_items/graphql/provider.js23
-rw-r--r--app/assets/javascripts/work_items/graphql/resolvers.js43
-rw-r--r--app/assets/javascripts/work_items/graphql/typedefs.graphql8
-rw-r--r--app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql14
-rw-r--r--app/assets/javascripts/work_items/graphql/work_item.query.graphql12
6 files changed, 40 insertions, 74 deletions
diff --git a/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql b/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql
index 2f302dae7d7..9312d1c582b 100644
--- a/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql
+++ b/app/assets/javascripts/work_items/graphql/create_work_item.mutation.graphql
@@ -1,16 +1,16 @@
#import './widget.fragment.graphql'
-mutation createWorkItem($input: LocalCreateWorkItemInput) {
- localCreateWorkItem(input: $input) @client {
+mutation createWorkItem($input: WorkItemCreateInput!) {
+ workItemCreate(input: $input) {
workItem {
id
- type
- widgets {
+ title
+ workItemType {
+ id
+ }
+ widgets @client {
nodes {
...WidgetBase
- ... on LocalTitleWidget {
- contentText
- }
}
}
}
diff --git a/app/assets/javascripts/work_items/graphql/provider.js b/app/assets/javascripts/work_items/graphql/provider.js
index 676fffb12d8..28328a840cf 100644
--- a/app/assets/javascripts/work_items/graphql/provider.js
+++ b/app/assets/javascripts/work_items/graphql/provider.js
@@ -10,29 +10,28 @@ export function createApolloProvider() {
const defaultClient = createDefaultClient(resolvers, {
typeDefs,
+ cacheConfig: {
+ possibleTypes: {
+ LocalWorkItemWidget: ['LocalTitleWidget'],
+ },
+ },
});
defaultClient.cache.writeQuery({
query: workItemQuery,
variables: {
- id: '1',
+ id: 'gid://gitlab/WorkItem/1',
},
data: {
- workItem: {
+ localWorkItem: {
__typename: 'LocalWorkItem',
- id: '1',
+ id: 'gid://gitlab/WorkItem/1',
type: 'FEATURE',
+ // eslint-disable-next-line @gitlab/require-i18n-strings
+ title: 'Test Work Item',
widgets: {
__typename: 'LocalWorkItemWidgetConnection',
- nodes: [
- {
- __typename: 'LocalTitleWidget',
- type: 'TITLE',
- enabled: true,
- // eslint-disable-next-line @gitlab/require-i18n-strings
- contentText: 'Test Work Item Title',
- },
- ],
+ nodes: [],
},
},
},
diff --git a/app/assets/javascripts/work_items/graphql/resolvers.js b/app/assets/javascripts/work_items/graphql/resolvers.js
index 63d5234d083..fb74e27f840 100644
--- a/app/assets/javascripts/work_items/graphql/resolvers.js
+++ b/app/assets/javascripts/work_items/graphql/resolvers.js
@@ -1,53 +1,24 @@
-import { uuids } from '~/lib/utils/uuids';
import workItemQuery from './work_item.query.graphql';
export const resolvers = {
Mutation: {
- localCreateWorkItem(_, { input }, { cache }) {
- const id = uuids()[0];
- const workItem = {
- __typename: 'LocalWorkItem',
- type: 'FEATURE',
- id,
- widgets: {
- __typename: 'LocalWorkItemWidgetConnection',
- nodes: [
- {
- __typename: 'LocalTitleWidget',
- type: 'TITLE',
- enabled: true,
- contentText: input.title,
- },
- ],
- },
- };
-
- cache.writeQuery({ query: workItemQuery, variables: { id }, data: { workItem } });
-
- return {
- __typename: 'LocalCreateWorkItemPayload',
- workItem,
- };
- },
-
localUpdateWorkItem(_, { input }, { cache }) {
- const workItemTitle = {
- __typename: 'LocalTitleWidget',
- type: 'TITLE',
- enabled: true,
- contentText: input.title,
- };
const workItem = {
__typename: 'LocalWorkItem',
type: 'FEATURE',
id: input.id,
+ title: input.title,
widgets: {
__typename: 'LocalWorkItemWidgetConnection',
- nodes: [workItemTitle],
+ nodes: [],
},
};
- cache.writeQuery({ query: workItemQuery, variables: { id: input.id }, data: { workItem } });
+ cache.writeQuery({
+ query: workItemQuery,
+ variables: { id: input.id },
+ data: { localWorkItem: workItem },
+ });
return {
__typename: 'LocalUpdateWorkItemPayload',
diff --git a/app/assets/javascripts/work_items/graphql/typedefs.graphql b/app/assets/javascripts/work_items/graphql/typedefs.graphql
index 177eea00322..9b4811203f5 100644
--- a/app/assets/javascripts/work_items/graphql/typedefs.graphql
+++ b/app/assets/javascripts/work_items/graphql/typedefs.graphql
@@ -22,14 +22,10 @@ type LocalWorkItemWidgetConnection {
pageInfo: PageInfo!
}
-type LocalTitleWidget implements LocalWorkItemWidget {
- type: LocalWidgetType!
- contentText: String!
-}
-
type LocalWorkItem {
id: ID!
type: LocalWorkItemType!
+ title: String!
widgets: [LocalWorkItemWidgetConnection]
}
@@ -51,7 +47,7 @@ type LocalUpdateWorkItemPayload {
}
extend type Query {
- workItem(id: ID!): LocalWorkItem!
+ localWorkItem(id: ID!): LocalWorkItem!
}
extend type Mutation {
diff --git a/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql b/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql
index f0563f099b2..efb1ed8d6df 100644
--- a/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql
+++ b/app/assets/javascripts/work_items/graphql/update_work_item.mutation.graphql
@@ -1,16 +1,16 @@
#import './widget.fragment.graphql'
-mutation updateWorkItem($input: LocalUpdateWorkItemInput) {
- localUpdateWorkItem(input: $input) @client {
+mutation workItemUpdate($input: WorkItemUpdateInput!) {
+ workItemUpdate(input: $input) {
workItem {
id
- type
- widgets {
+ title
+ workItemType {
+ id
+ }
+ widgets @client {
nodes {
...WidgetBase
- ... on LocalTitleWidget {
- contentText
- }
}
}
}
diff --git a/app/assets/javascripts/work_items/graphql/work_item.query.graphql b/app/assets/javascripts/work_items/graphql/work_item.query.graphql
index 9f173f7c302..b32cb4f28fb 100644
--- a/app/assets/javascripts/work_items/graphql/work_item.query.graphql
+++ b/app/assets/javascripts/work_items/graphql/work_item.query.graphql
@@ -1,15 +1,15 @@
#import './widget.fragment.graphql'
query WorkItem($id: ID!) {
- workItem(id: $id) @client {
+ workItem(id: $id) {
id
- type
- widgets {
+ title
+ workItemType {
+ id
+ }
+ widgets @client {
nodes {
...WidgetBase
- ... on LocalTitleWidget {
- contentText
- }
}
}
}