Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cc35c284
Commit
cc35c284
authored
Mar 24, 2022
by
Coung Ngo
Committed by
Natalia Tepluhina
Mar 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove work item local typedefs and resolvers
Remove them as they now exist in the backend.
parent
2de1f3d0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
41 additions
and
191 deletions
+41
-191
app/assets/javascripts/sidebar/graphql.js
app/assets/javascripts/sidebar/graphql.js
+0
-3
app/assets/javascripts/work_items/constants.js
app/assets/javascripts/work_items/constants.js
+0
-4
app/assets/javascripts/work_items/graphql/provider.js
app/assets/javascripts/work_items/graphql/provider.js
+1
-35
app/assets/javascripts/work_items/graphql/resolvers.js
app/assets/javascripts/work_items/graphql/resolvers.js
+0
-29
app/assets/javascripts/work_items/graphql/typedefs.graphql
app/assets/javascripts/work_items/graphql/typedefs.graphql
+0
-56
app/assets/javascripts/work_items/graphql/widget.fragment.graphql
...ts/javascripts/work_items/graphql/widget.fragment.graphql
+0
-3
app/assets/javascripts/work_items/pages/create_work_item.vue
app/assets/javascripts/work_items/pages/create_work_item.vue
+0
-4
spec/frontend/work_items/components/work_item_title_spec.js
spec/frontend/work_items/components/work_item_title_spec.js
+12
-6
spec/frontend/work_items/mock_data.js
spec/frontend/work_items/mock_data.js
+19
-38
spec/frontend/work_items/pages/create_work_item_spec.js
spec/frontend/work_items/pages/create_work_item_spec.js
+5
-9
spec/frontend/work_items/pages/work_item_detail_spec.js
spec/frontend/work_items/pages/work_item_detail_spec.js
+3
-3
spec/frontend/work_items/router_spec.js
spec/frontend/work_items/router_spec.js
+1
-1
No files found.
app/assets/javascripts/sidebar/graphql.js
View file @
cc35c284
import
produce
from
'
immer
'
;
import
produce
from
'
immer
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
getIssueStateQuery
from
'
~/issues/show/queries/get_issue_state.query.graphql
'
;
import
getIssueStateQuery
from
'
~/issues/show/queries/get_issue_state.query.graphql
'
;
import
{
resolvers
as
workItemResolvers
}
from
'
~/work_items/graphql/resolvers
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
const
resolvers
=
{
const
resolvers
=
{
...
workItemResolvers
,
Mutation
:
{
Mutation
:
{
updateIssueState
:
(
_
,
{
issueType
=
undefined
,
isDirty
=
false
},
{
cache
})
=>
{
updateIssueState
:
(
_
,
{
issueType
=
undefined
,
isDirty
=
false
},
{
cache
})
=>
{
const
sourceData
=
cache
.
readQuery
({
query
:
getIssueStateQuery
});
const
sourceData
=
cache
.
readQuery
({
query
:
getIssueStateQuery
});
...
@@ -14,7 +12,6 @@ const resolvers = {
...
@@ -14,7 +12,6 @@ const resolvers = {
});
});
cache
.
writeQuery
({
query
:
getIssueStateQuery
,
data
});
cache
.
writeQuery
({
query
:
getIssueStateQuery
,
data
});
},
},
...
workItemResolvers
.
Mutation
,
},
},
};
};
...
...
app/assets/javascripts/work_items/constants.js
View file @
cc35c284
...
@@ -4,7 +4,3 @@ export const i18n = {
...
@@ -4,7 +4,3 @@ export const i18n = {
fetchError
:
s__
(
'
WorkItem|Something went wrong when fetching the work item. Please try again.
'
),
fetchError
:
s__
(
'
WorkItem|Something went wrong when fetching the work item. Please try again.
'
),
updateError
:
s__
(
'
WorkItem|Something went wrong while updating the work item. Please try again.
'
),
updateError
:
s__
(
'
WorkItem|Something went wrong while updating the work item. Please try again.
'
),
};
};
export
const
widgetTypes
=
{
title
:
'
TITLE
'
,
};
app/assets/javascripts/work_items/graphql/provider.js
View file @
cc35c284
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
workItemQuery
from
'
./work_item.query.graphql
'
;
import
{
resolvers
}
from
'
./resolvers
'
;
import
typeDefs
from
'
./typedefs.graphql
'
;
export
function
createApolloProvider
()
{
export
function
createApolloProvider
()
{
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
defaultClient
=
createDefaultClient
(
resolvers
,
{
const
defaultClient
=
createDefaultClient
();
typeDefs
,
cacheConfig
:
{
possibleTypes
:
{
LocalWorkItemWidget
:
[
'
LocalTitleWidget
'
],
},
},
});
defaultClient
.
cache
.
writeQuery
({
query
:
workItemQuery
,
variables
:
{
id
:
'
gid://gitlab/WorkItem/1
'
,
},
data
:
{
workItem
:
{
__typename
:
'
WorkItem
'
,
id
:
'
gid://gitlab/WorkItem/1
'
,
// eslint-disable-next-line @gitlab/require-i18n-strings
title
:
'
Test Work Item
'
,
workItemType
:
{
__typename
:
'
WorkItemType
'
,
id
:
'
work-item-type-1
'
,
name
:
'
Type
'
,
// eslint-disable-line @gitlab/require-i18n-strings
},
widgets
:
{
__typename
:
'
LocalWorkItemWidgetConnection
'
,
nodes
:
[],
},
},
},
});
return
new
VueApollo
({
return
new
VueApollo
({
defaultClient
,
defaultClient
,
...
...
app/assets/javascripts/work_items/graphql/resolvers.js
deleted
100644 → 0
View file @
2de1f3d0
import
workItemQuery
from
'
./work_item.query.graphql
'
;
export
const
resolvers
=
{
Mutation
:
{
localUpdateWorkItem
(
_
,
{
input
},
{
cache
})
{
const
workItem
=
{
__typename
:
'
LocalWorkItem
'
,
type
:
'
FEATURE
'
,
id
:
input
.
id
,
title
:
input
.
title
,
widgets
:
{
__typename
:
'
LocalWorkItemWidgetConnection
'
,
nodes
:
[],
},
};
cache
.
writeQuery
({
query
:
workItemQuery
,
variables
:
{
id
:
input
.
id
},
data
:
{
localWorkItem
:
workItem
},
});
return
{
__typename
:
'
LocalUpdateWorkItemPayload
'
,
workItem
,
};
},
},
};
app/assets/javascripts/work_items/graphql/typedefs.graphql
deleted
100644 → 0
View file @
2de1f3d0
enum
LocalWorkItemType
{
FEATURE
}
enum
LocalWidgetType
{
TITLE
}
interface
LocalWorkItemWidget
{
type
:
LocalWidgetType
!
}
# Replicating Relay connection type for client schema
type
LocalWorkItemWidgetEdge
{
cursor
:
String
!
node
:
LocalWorkItemWidget
}
type
LocalWorkItemWidgetConnection
{
edges
:
[
LocalWorkItemWidgetEdge
]
nodes
:
[
LocalWorkItemWidget
]
pageInfo
:
PageInfo
!
}
type
LocalWorkItem
{
id
:
ID
!
type
:
LocalWorkItemType
!
title
:
String
!
widgets
:
[
LocalWorkItemWidgetConnection
]
}
input
LocalCreateWorkItemInput
{
title
:
String
!
}
input
LocalUpdateWorkItemInput
{
id
:
ID
!
title
:
String
}
type
LocalCreateWorkItemPayload
{
workItem
:
LocalWorkItem
!
}
type
LocalUpdateWorkItemPayload
{
workItem
:
LocalWorkItem
!
}
extend
type
Query
{
localWorkItem
(
id
:
ID
!):
LocalWorkItem
!
}
extend
type
Mutation
{
localCreateWorkItem
(
input
:
LocalCreateWorkItemInput
!):
LocalCreateWorkItemPayload
!
localUpdateWorkItem
(
input
:
LocalUpdateWorkItemInput
!):
LocalUpdateWorkItemPayload
!
}
app/assets/javascripts/work_items/graphql/widget.fragment.graphql
deleted
100644 → 0
View file @
2de1f3d0
fragment
WidgetBase
on
LocalWorkItemWidget
{
type
}
app/assets/javascripts/work_items/pages/create_work_item.vue
View file @
cc35c284
...
@@ -128,10 +128,6 @@ export default {
...
@@ -128,10 +128,6 @@ export default {
id
,
id
,
title
,
title
,
workItemType
,
workItemType
,
widgets
:
{
__typename
:
'
LocalWorkItemWidgetConnection
'
,
nodes
:
[],
},
},
},
},
},
});
});
...
...
spec/frontend/work_items/components/work_item_title_spec.js
View file @
cc35c284
...
@@ -22,13 +22,14 @@ describe('WorkItemTitle component', () => {
...
@@ -22,13 +22,14 @@ describe('WorkItemTitle component', () => {
const
findItemTitle
=
()
=>
wrapper
.
findComponent
(
ItemTitle
);
const
findItemTitle
=
()
=>
wrapper
.
findComponent
(
ItemTitle
);
const
createComponent
=
({
loading
=
false
,
mutationHandler
=
mutationSuccessHandler
}
=
{})
=>
{
const
createComponent
=
({
loading
=
false
,
mutationHandler
=
mutationSuccessHandler
}
=
{})
=>
{
const
{
id
,
title
,
workItemType
}
=
workItemQueryResponse
.
data
.
workItem
;
wrapper
=
shallowMount
(
WorkItemTitle
,
{
wrapper
=
shallowMount
(
WorkItemTitle
,
{
apolloProvider
:
createMockApollo
([[
updateWorkItemMutation
,
mutationHandler
]]),
apolloProvider
:
createMockApollo
([[
updateWorkItemMutation
,
mutationHandler
]]),
propsData
:
{
propsData
:
{
loading
,
loading
,
workItemId
:
workItemQueryResponse
.
workItem
.
id
,
workItemId
:
id
,
workItemTitle
:
workItemQueryResponse
.
workItem
.
title
,
workItemTitle
:
title
,
workItemType
:
workItem
QueryResponse
.
workItem
.
workItem
Type
.
name
,
workItemType
:
workItemType
.
name
,
},
},
});
});
};
};
...
@@ -61,7 +62,7 @@ describe('WorkItemTitle component', () => {
...
@@ -61,7 +62,7 @@ describe('WorkItemTitle component', () => {
});
});
it
(
'
renders title
'
,
()
=>
{
it
(
'
renders title
'
,
()
=>
{
expect
(
findItemTitle
().
props
(
'
title
'
)).
toBe
(
workItemQueryResponse
.
workItem
.
title
);
expect
(
findItemTitle
().
props
(
'
title
'
)).
toBe
(
workItemQueryResponse
.
data
.
workItem
.
title
);
});
});
});
});
...
@@ -73,13 +74,18 @@ describe('WorkItemTitle component', () => {
...
@@ -73,13 +74,18 @@ describe('WorkItemTitle component', () => {
findItemTitle
().
vm
.
$emit
(
'
title-changed
'
,
title
);
findItemTitle
().
vm
.
$emit
(
'
title-changed
'
,
title
);
expect
(
mutationSuccessHandler
).
toHaveBeenCalledWith
({
input
:
{
id
:
'
1
'
,
title
}
});
expect
(
mutationSuccessHandler
).
toHaveBeenCalledWith
({
input
:
{
id
:
workItemQueryResponse
.
data
.
workItem
.
id
,
title
,
},
});
});
});
it
(
'
does not call a mutation when the title has not changed
'
,
()
=>
{
it
(
'
does not call a mutation when the title has not changed
'
,
()
=>
{
createComponent
();
createComponent
();
findItemTitle
().
vm
.
$emit
(
'
title-changed
'
,
workItemQueryResponse
.
workItem
.
title
);
findItemTitle
().
vm
.
$emit
(
'
title-changed
'
,
workItemQueryResponse
.
data
.
workItem
.
title
);
expect
(
mutationSuccessHandler
).
not
.
toHaveBeenCalled
();
expect
(
mutationSuccessHandler
).
not
.
toHaveBeenCalled
();
});
});
...
...
spec/frontend/work_items/mock_data.js
View file @
cc35c284
export
const
workItemQueryResponse
=
{
export
const
workItemQueryResponse
=
{
workItem
:
{
data
:
{
__typename
:
'
WorkItem
'
,
workItem
:
{
id
:
'
1
'
,
__typename
:
'
WorkItem
'
,
title
:
'
Test
'
,
id
:
'
gid://gitlab/WorkItem/1
'
,
workItemType
:
{
title
:
'
Test
'
,
__typename
:
'
WorkItemType
'
,
workItemType
:
{
id
:
'
work-item-type-1
'
,
__typename
:
'
WorkItemType
'
,
name
:
'
Task
'
,
id
:
'
gid://gitlab/WorkItems::Type/5
'
,
},
name
:
'
Task
'
,
widgets
:
{
},
__typename
:
'
LocalWorkItemWidgetConnection
'
,
nodes
:
[
{
__typename
:
'
LocalTitleWidget
'
,
type
:
'
TITLE
'
,
contentText
:
'
Test
'
,
},
],
},
},
},
},
};
};
...
@@ -24,27 +16,16 @@ export const workItemQueryResponse = {
...
@@ -24,27 +16,16 @@ export const workItemQueryResponse = {
export
const
updateWorkItemMutationResponse
=
{
export
const
updateWorkItemMutationResponse
=
{
data
:
{
data
:
{
workItemUpdate
:
{
workItemUpdate
:
{
__typename
:
'
LocalUpdateWorkItem
Payload
'
,
__typename
:
'
WorkItemUpdate
Payload
'
,
workItem
:
{
workItem
:
{
__typename
:
'
Local
WorkItem
'
,
__typename
:
'
WorkItem
'
,
id
:
'
1
'
,
id
:
'
gid://gitlab/WorkItem/
1
'
,
title
:
'
Updated title
'
,
title
:
'
Updated title
'
,
workItemType
:
{
workItemType
:
{
__typename
:
'
WorkItemType
'
,
__typename
:
'
WorkItemType
'
,
id
:
'
work-item-type-1
'
,
id
:
'
gid://gitlab/WorkItems::Type/5
'
,
name
:
'
Task
'
,
name
:
'
Task
'
,
},
},
widgets
:
{
__typename
:
'
LocalWorkItemWidgetConnection
'
,
nodes
:
[
{
__typename
:
'
LocalTitleWidget
'
,
type
:
'
TITLE
'
,
enabled
:
true
,
contentText
:
'
Updated title
'
,
},
],
},
},
},
},
},
},
},
...
@@ -53,11 +34,11 @@ export const updateWorkItemMutationResponse = {
...
@@ -53,11 +34,11 @@ export const updateWorkItemMutationResponse = {
export
const
projectWorkItemTypesQueryResponse
=
{
export
const
projectWorkItemTypesQueryResponse
=
{
data
:
{
data
:
{
workspace
:
{
workspace
:
{
id
:
'
1
'
,
id
:
'
gid://gitlab/WorkItem/
1
'
,
workItemTypes
:
{
workItemTypes
:
{
nodes
:
[
nodes
:
[
{
id
:
'
work-item-
1
'
,
name
:
'
Issue
'
},
{
id
:
'
gid://gitlab/WorkItems::Type/
1
'
,
name
:
'
Issue
'
},
{
id
:
'
work-item-
2
'
,
name
:
'
Incident
'
},
{
id
:
'
gid://gitlab/WorkItems::Type/
2
'
,
name
:
'
Incident
'
},
],
],
},
},
},
},
...
@@ -70,11 +51,11 @@ export const createWorkItemMutationResponse = {
...
@@ -70,11 +51,11 @@ export const createWorkItemMutationResponse = {
__typename
:
'
WorkItemCreatePayload
'
,
__typename
:
'
WorkItemCreatePayload
'
,
workItem
:
{
workItem
:
{
__typename
:
'
WorkItem
'
,
__typename
:
'
WorkItem
'
,
id
:
'
1
'
,
id
:
'
gid://gitlab/WorkItem/
1
'
,
title
:
'
Updated title
'
,
title
:
'
Updated title
'
,
workItemType
:
{
workItemType
:
{
__typename
:
'
WorkItemType
'
,
__typename
:
'
WorkItemType
'
,
id
:
'
work-item-type-1
'
,
id
:
'
gid://gitlab/WorkItems::Type/5
'
,
name
:
'
Task
'
,
name
:
'
Task
'
,
},
},
},
},
...
...
spec/frontend/work_items/pages/create_work_item_spec.js
View file @
cc35c284
...
@@ -6,7 +6,6 @@ import createMockApollo from 'helpers/mock_apollo_helper';
...
@@ -6,7 +6,6 @@ import createMockApollo from 'helpers/mock_apollo_helper';
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
CreateWorkItem
from
'
~/work_items/pages/create_work_item.vue
'
;
import
CreateWorkItem
from
'
~/work_items/pages/create_work_item.vue
'
;
import
ItemTitle
from
'
~/work_items/components/item_title.vue
'
;
import
ItemTitle
from
'
~/work_items/components/item_title.vue
'
;
import
{
resolvers
}
from
'
~/work_items/graphql/resolvers
'
;
import
projectWorkItemTypesQuery
from
'
~/work_items/graphql/project_work_item_types.query.graphql
'
;
import
projectWorkItemTypesQuery
from
'
~/work_items/graphql/project_work_item_types.query.graphql
'
;
import
createWorkItemMutation
from
'
~/work_items/graphql/create_work_item.mutation.graphql
'
;
import
createWorkItemMutation
from
'
~/work_items/graphql/create_work_item.mutation.graphql
'
;
import
createWorkItemFromTaskMutation
from
'
~/work_items/graphql/create_work_item_from_task.mutation.graphql
'
;
import
createWorkItemFromTaskMutation
from
'
~/work_items/graphql/create_work_item_from_task.mutation.graphql
'
;
...
@@ -46,14 +45,11 @@ describe('Create work item component', () => {
...
@@ -46,14 +45,11 @@ describe('Create work item component', () => {
queryHandler
=
querySuccessHandler
,
queryHandler
=
querySuccessHandler
,
mutationHandler
=
createWorkItemSuccessHandler
,
mutationHandler
=
createWorkItemSuccessHandler
,
}
=
{})
=>
{
}
=
{})
=>
{
fakeApollo
=
createMockApollo
(
fakeApollo
=
createMockApollo
([
[
[
projectWorkItemTypesQuery
,
queryHandler
],
[
projectWorkItemTypesQuery
,
queryHandler
],
[
createWorkItemMutation
,
mutationHandler
],
[
createWorkItemMutation
,
mutationHandler
],
[
createWorkItemFromTaskMutation
,
mutationHandler
],
[
createWorkItemFromTaskMutation
,
mutationHandler
],
]);
],
resolvers
,
);
wrapper
=
shallowMount
(
CreateWorkItem
,
{
wrapper
=
shallowMount
(
CreateWorkItem
,
{
apolloProvider
:
fakeApollo
,
apolloProvider
:
fakeApollo
,
data
()
{
data
()
{
...
...
spec/frontend/work_items/pages/work_item_detail_spec.js
View file @
cc35c284
...
@@ -16,14 +16,14 @@ describe('WorkItemDetail component', () => {
...
@@ -16,14 +16,14 @@ describe('WorkItemDetail component', () => {
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
successHandler
=
jest
.
fn
().
mockResolvedValue
(
{
data
:
workItemQueryResponse
}
);
const
successHandler
=
jest
.
fn
().
mockResolvedValue
(
workItemQueryResponse
);
const
initialSubscriptionHandler
=
jest
.
fn
().
mockResolvedValue
(
workItemTitleSubscriptionResponse
);
const
initialSubscriptionHandler
=
jest
.
fn
().
mockResolvedValue
(
workItemTitleSubscriptionResponse
);
const
findAlert
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
const
findAlert
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
const
findWorkItemTitle
=
()
=>
wrapper
.
findComponent
(
WorkItemTitle
);
const
findWorkItemTitle
=
()
=>
wrapper
.
findComponent
(
WorkItemTitle
);
const
createComponent
=
({
const
createComponent
=
({
workItemId
=
workItemQueryResponse
.
workItem
.
id
,
workItemId
=
workItemQueryResponse
.
data
.
workItem
.
id
,
handler
=
successHandler
,
handler
=
successHandler
,
subscriptionHandler
=
initialSubscriptionHandler
,
subscriptionHandler
=
initialSubscriptionHandler
,
}
=
{})
=>
{
}
=
{})
=>
{
...
@@ -93,7 +93,7 @@ describe('WorkItemDetail component', () => {
...
@@ -93,7 +93,7 @@ describe('WorkItemDetail component', () => {
createComponent
();
createComponent
();
expect
(
initialSubscriptionHandler
).
toHaveBeenCalledWith
({
expect
(
initialSubscriptionHandler
).
toHaveBeenCalledWith
({
issuableId
:
workItemQueryResponse
.
workItem
.
id
,
issuableId
:
workItemQueryResponse
.
data
.
workItem
.
id
,
});
});
});
});
});
});
spec/frontend/work_items/router_spec.js
View file @
cc35c284
...
@@ -37,7 +37,7 @@ describe('Work items router', () => {
...
@@ -37,7 +37,7 @@ describe('Work items router', () => {
it
(
'
renders work item on `/1` route
'
,
async
()
=>
{
it
(
'
renders work item on `/1` route
'
,
async
()
=>
{
await
createComponent
(
'
/1
'
);
await
createComponent
(
'
/1
'
);
expect
(
wrapper
.
find
(
WorkItemsRoot
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
WorkItemsRoot
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders create work item page on `/new` route
'
,
async
()
=>
{
it
(
'
renders create work item page on `/new` route
'
,
async
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment