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
349d5202
Commit
349d5202
authored
Jul 30, 2020
by
Natalia Tepluhina
Committed by
Nicolò Maria Mezzopera
Jul 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed design management tests
Fixed mocks to remove edges
parent
bcc3ed8a
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
92 additions
and
144 deletions
+92
-144
app/assets/javascripts/design_management/components/design_sidebar.vue
...vascripts/design_management/components/design_sidebar.vue
+1
-1
app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue
..._management/components/upload/design_version_dropdown.vue
+6
-8
app/assets/javascripts/design_management/graphql/mutations/create_image_diff_note.mutation.graphql
...graphql/mutations/create_image_diff_note.mutation.graphql
+2
-4
app/assets/javascripts/design_management/graphql/mutations/upload_design.mutation.graphql
...nagement/graphql/mutations/upload_design.mutation.graphql
+3
-5
app/assets/javascripts/design_management/graphql/queries/get_design.query.graphql
...esign_management/graphql/queries/get_design.query.graphql
+9
-13
app/assets/javascripts/design_management/graphql/queries/get_design_list.query.graphql
..._management/graphql/queries/get_design_list.query.graphql
+4
-8
app/assets/javascripts/design_management/mixins/all_designs.js
...ssets/javascripts/design_management/mixins/all_designs.js
+9
-4
app/assets/javascripts/design_management/mixins/all_versions.js
...sets/javascripts/design_management/mixins/all_versions.js
+3
-3
app/assets/javascripts/design_management/utils/cache_update.js
...ssets/javascripts/design_management/utils/cache_update.js
+27
-37
app/assets/javascripts/design_management/utils/design_management_utils.js
...cripts/design_management/utils/design_management_utils.js
+8
-21
spec/frontend/design_management/components/upload/mock_data/all_versions.js
...gn_management/components/upload/mock_data/all_versions.js
+4
-8
spec/frontend/design_management/mock_data/all_versions.js
spec/frontend/design_management/mock_data/all_versions.js
+2
-4
spec/frontend/design_management/mock_data/design.js
spec/frontend/design_management/mock_data/design.js
+5
-7
spec/frontend/design_management/mock_data/designs.js
spec/frontend/design_management/mock_data/designs.js
+1
-5
spec/frontend/design_management/mock_data/no_designs.js
spec/frontend/design_management/mock_data/no_designs.js
+1
-1
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/pages/index_spec.js
+5
-10
spec/frontend/design_management/utils/design_management_utils_spec.js
...d/design_management/utils/design_management_utils_spec.js
+2
-5
No files found.
app/assets/javascripts/design_management/components/design_sidebar.vue
View file @
349d5202
...
@@ -48,7 +48,7 @@ export default {
...
@@ -48,7 +48,7 @@ export default {
};
};
},
},
discussionParticipants
()
{
discussionParticipants
()
{
return
extractParticipants
(
this
.
issue
.
participants
);
return
extractParticipants
(
this
.
issue
.
participants
.
nodes
);
},
},
resolvedDiscussions
()
{
resolvedDiscussions
()
{
return
this
.
discussions
.
filter
(
discussion
=>
discussion
.
resolved
);
return
this
.
discussions
.
filter
(
discussion
=>
discussion
.
resolved
);
...
...
app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue
View file @
349d5202
...
@@ -18,7 +18,7 @@ export default {
...
@@ -18,7 +18,7 @@ export default {
if
(
!
this
.
queryVersion
)
return
0
;
if
(
!
this
.
queryVersion
)
return
0
;
const
idx
=
this
.
allVersions
.
findIndex
(
const
idx
=
this
.
allVersions
.
findIndex
(
version
=>
this
.
findVersionId
(
version
.
node
.
id
)
===
this
.
queryVersion
,
version
=>
this
.
findVersionId
(
version
.
id
)
===
this
.
queryVersion
,
);
);
// if the currentVersionId isn't a valid version (i.e. not in allVersions)
// if the currentVersionId isn't a valid version (i.e. not in allVersions)
...
@@ -29,7 +29,7 @@ export default {
...
@@ -29,7 +29,7 @@ export default {
if
(
this
.
queryVersion
)
return
this
.
queryVersion
;
if
(
this
.
queryVersion
)
return
this
.
queryVersion
;
const
currentVersion
=
this
.
allVersions
[
this
.
currentVersionIdx
];
const
currentVersion
=
this
.
allVersions
[
this
.
currentVersionIdx
];
return
this
.
findVersionId
(
currentVersion
.
node
.
id
);
return
this
.
findVersionId
(
currentVersion
.
id
);
},
},
dropdownText
()
{
dropdownText
()
{
if
(
this
.
isLatestVersion
)
{
if
(
this
.
isLatestVersion
)
{
...
@@ -51,23 +51,21 @@ export default {
...
@@ -51,23 +51,21 @@ export default {
<
template
>
<
template
>
<gl-new-dropdown
:text=
"dropdownText"
size=
"small"
class=
"design-version-dropdown"
>
<gl-new-dropdown
:text=
"dropdownText"
size=
"small"
class=
"design-version-dropdown"
>
<gl-new-dropdown-item
v-for=
"(version, index) in allVersions"
:key=
"version.
node.
id"
>
<gl-new-dropdown-item
v-for=
"(version, index) in allVersions"
:key=
"version.id"
>
<router-link
<router-link
class=
"d-flex js-version-link"
class=
"d-flex js-version-link"
:to=
"
{ path: $route.path, query: { version: findVersionId(version.
node.
id) } }"
:to=
"
{ path: $route.path, query: { version: findVersionId(version.id) } }"
>
>
<div
class=
"flex-grow-1 ml-2"
>
<div
class=
"flex-grow-1 ml-2"
>
<div>
<div>
<strong
<strong
>
{{
__
(
'
Version
'
)
}}
{{
allVersions
.
length
-
index
}}
>
{{
__
(
'
Version
'
)
}}
{{
allVersions
.
length
-
index
}}
<span
v-if=
"findVersionId(version.node.id) === latestVersionId"
<span
v-if=
"findVersionId(version.id) === latestVersionId"
>
(
{{
__
(
'
latest
'
)
}}
)
</span>
>
(
{{
__
(
'
latest
'
)
}}
)
</span
>
</strong>
</strong>
</div>
</div>
</div>
</div>
<i
<i
v-if=
"findVersionId(version.
node.
id) === currentVersionId"
v-if=
"findVersionId(version.id) === currentVersionId"
class=
"fa fa-check float-right gl-mr-2"
class=
"fa fa-check float-right gl-mr-2"
></i>
></i>
</router-link>
</router-link>
...
...
app/assets/javascripts/design_management/graphql/mutations/create_image_diff_note.mutation.graphql
View file @
349d5202
...
@@ -8,10 +8,8 @@ mutation createImageDiffNote($input: CreateImageDiffNoteInput!) {
...
@@ -8,10 +8,8 @@ mutation createImageDiffNote($input: CreateImageDiffNoteInput!) {
id
id
replyId
replyId
notes
{
notes
{
edges
{
nodes
{
node
{
...
DesignNote
...
DesignNote
}
}
}
}
}
}
}
...
...
app/assets/javascripts/design_management/graphql/mutations/upload_design.mutation.graphql
View file @
349d5202
...
@@ -5,11 +5,9 @@ mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) {
...
@@ -5,11 +5,9 @@ mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) {
designs
{
designs
{
...
DesignItem
...
DesignItem
versions
{
versions
{
edges
{
nodes
{
node
{
id
id
sha
sha
}
}
}
}
}
}
}
...
...
app/assets/javascripts/design_management/graphql/queries/get_design.query.graphql
View file @
349d5202
...
@@ -7,19 +7,15 @@ query getDesign($fullPath: ID!, $iid: String!, $atVersion: ID, $filenames: [Stri
...
@@ -7,19 +7,15 @@ query getDesign($fullPath: ID!, $iid: String!, $atVersion: ID, $filenames: [Stri
issue
(
iid
:
$iid
)
{
issue
(
iid
:
$iid
)
{
designCollection
{
designCollection
{
designs
(
atVersion
:
$atVersion
,
filenames
:
$filenames
)
{
designs
(
atVersion
:
$atVersion
,
filenames
:
$filenames
)
{
edges
{
nodes
{
node
{
...
DesignItem
...
DesignItem
issue
{
issue
{
title
title
webPath
webPath
webUrl
webUrl
participants
{
participants
{
nodes
{
edges
{
...
Author
node
{
...
Author
}
}
}
}
}
}
}
}
...
...
app/assets/javascripts/design_management/graphql/queries/get_design_list.query.graphql
View file @
349d5202
...
@@ -7,17 +7,13 @@ query getDesignList($fullPath: ID!, $iid: String!, $atVersion: ID) {
...
@@ -7,17 +7,13 @@ query getDesignList($fullPath: ID!, $iid: String!, $atVersion: ID) {
issue
(
iid
:
$iid
)
{
issue
(
iid
:
$iid
)
{
designCollection
{
designCollection
{
designs
(
atVersion
:
$atVersion
)
{
designs
(
atVersion
:
$atVersion
)
{
edges
{
nodes
{
node
{
...
DesignListItem
...
DesignListItem
}
}
}
}
}
versions
{
versions
{
edges
{
nodes
{
node
{
...
VersionListItem
...
VersionListItem
}
}
}
}
}
}
}
...
...
app/assets/javascripts/design_management/mixins/all_designs.js
View file @
349d5202
...
@@ -2,7 +2,6 @@ import { propertyOf } from 'lodash';
...
@@ -2,7 +2,6 @@ import { propertyOf } from 'lodash';
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
getDesignListQuery
from
'
../graphql/queries/get_design_list.query.graphql
'
;
import
getDesignListQuery
from
'
../graphql/queries/get_design_list.query.graphql
'
;
import
{
extractNodes
}
from
'
../utils/design_management_utils
'
;
import
allVersionsMixin
from
'
./all_versions
'
;
import
allVersionsMixin
from
'
./all_versions
'
;
import
{
DESIGNS_ROUTE_NAME
}
from
'
../router/constants
'
;
import
{
DESIGNS_ROUTE_NAME
}
from
'
../router/constants
'
;
...
@@ -19,9 +18,15 @@ export default {
...
@@ -19,9 +18,15 @@ export default {
};
};
},
},
update
:
data
=>
{
update
:
data
=>
{
const
designEdges
=
propertyOf
(
data
)([
'
project
'
,
'
issue
'
,
'
designCollection
'
,
'
designs
'
]);
const
designNodes
=
propertyOf
(
data
)([
if
(
designEdges
)
{
'
project
'
,
return
extractNodes
(
designEdges
);
'
issue
'
,
'
designCollection
'
,
'
designs
'
,
'
nodes
'
,
]);
if
(
designNodes
)
{
return
designNodes
;
}
}
return
[];
return
[];
},
},
...
...
app/assets/javascripts/design_management/mixins/all_versions.js
View file @
349d5202
...
@@ -12,7 +12,7 @@ export default {
...
@@ -12,7 +12,7 @@ export default {
atVersion
:
null
,
atVersion
:
null
,
};
};
},
},
update
:
data
=>
data
.
project
.
issue
.
designCollection
.
versions
.
edg
es
,
update
:
data
=>
data
.
project
.
issue
.
designCollection
.
versions
.
nod
es
,
},
},
},
},
inject
:
{
inject
:
{
...
@@ -28,7 +28,7 @@ export default {
...
@@ -28,7 +28,7 @@ export default {
return
(
return
(
this
.
$route
.
query
.
version
&&
this
.
$route
.
query
.
version
&&
this
.
allVersions
&&
this
.
allVersions
&&
this
.
allVersions
.
some
(
version
=>
version
.
node
.
id
.
endsWith
(
this
.
$route
.
query
.
version
))
this
.
allVersions
.
some
(
version
=>
version
.
id
.
endsWith
(
this
.
$route
.
query
.
version
))
);
);
},
},
designsVersion
()
{
designsVersion
()
{
...
@@ -38,7 +38,7 @@ export default {
...
@@ -38,7 +38,7 @@ export default {
},
},
latestVersionId
()
{
latestVersionId
()
{
const
latestVersion
=
this
.
allVersions
[
0
];
const
latestVersion
=
this
.
allVersions
[
0
];
return
latestVersion
&&
findVersionId
(
latestVersion
.
node
.
id
);
return
latestVersion
&&
findVersionId
(
latestVersion
.
id
);
},
},
isLatestVersion
()
{
isLatestVersion
()
{
if
(
this
.
allVersions
.
length
>
0
)
{
if
(
this
.
allVersions
.
length
>
0
)
{
...
...
app/assets/javascripts/design_management/utils/cache_update.js
View file @
349d5202
...
@@ -12,10 +12,10 @@ import {
...
@@ -12,10 +12,10 @@ import {
const
deleteDesignsFromStore
=
(
store
,
query
,
selectedDesigns
)
=>
{
const
deleteDesignsFromStore
=
(
store
,
query
,
selectedDesigns
)
=>
{
const
data
=
store
.
readQuery
(
query
);
const
data
=
store
.
readQuery
(
query
);
const
changedDesigns
=
data
.
project
.
issue
.
designCollection
.
designs
.
edg
es
.
filter
(
const
changedDesigns
=
data
.
project
.
issue
.
designCollection
.
designs
.
nod
es
.
filter
(
({
node
})
=>
!
selectedDesigns
.
includes
(
node
.
filename
),
node
=>
!
selectedDesigns
.
includes
(
node
.
filename
),
);
);
data
.
project
.
issue
.
designCollection
.
designs
.
edg
es
=
[...
changedDesigns
];
data
.
project
.
issue
.
designCollection
.
designs
.
nod
es
=
[...
changedDesigns
];
store
.
writeQuery
({
store
.
writeQuery
({
...
query
,
...
query
,
...
@@ -34,11 +34,10 @@ const addNewVersionToStore = (store, query, version) => {
...
@@ -34,11 +34,10 @@ const addNewVersionToStore = (store, query, version) => {
if
(
!
version
)
return
;
if
(
!
version
)
return
;
const
data
=
store
.
readQuery
(
query
);
const
data
=
store
.
readQuery
(
query
);
const
newEdge
=
{
node
:
version
,
__typename
:
'
DesignVersionEdge
'
};
data
.
project
.
issue
.
designCollection
.
versions
.
edg
es
=
[
data
.
project
.
issue
.
designCollection
.
versions
.
nod
es
=
[
newEdge
,
version
,
...
data
.
project
.
issue
.
designCollection
.
versions
.
edg
es
,
...
data
.
project
.
issue
.
designCollection
.
versions
.
nod
es
,
];
];
store
.
writeQuery
({
store
.
writeQuery
({
...
@@ -59,18 +58,15 @@ const addDiscussionCommentToStore = (store, createNote, query, queryVariables, d
...
@@ -59,18 +58,15 @@ const addDiscussionCommentToStore = (store, createNote, query, queryVariables, d
design
.
notesCount
+=
1
;
design
.
notesCount
+=
1
;
if
(
if
(
!
design
.
issue
.
participants
.
edg
es
.
some
(
!
design
.
issue
.
participants
.
nod
es
.
some
(
participant
=>
participant
.
node
.
username
===
createNote
.
note
.
author
.
username
,
participant
=>
participant
.
username
===
createNote
.
note
.
author
.
username
,
)
)
)
{
)
{
design
.
issue
.
participants
.
edg
es
=
[
design
.
issue
.
participants
.
nod
es
=
[
...
design
.
issue
.
participants
.
edg
es
,
...
design
.
issue
.
participants
.
nod
es
,
{
{
__typename
:
'
UserEdge
'
,
__typename
:
'
User
'
,
node
:
{
...
createNote
.
note
.
author
,
__typename
:
'
User
'
,
...
createNote
.
note
.
author
,
},
},
},
];
];
}
}
...
@@ -108,18 +104,15 @@ const addImageDiffNoteToStore = (store, createImageDiffNote, query, variables) =
...
@@ -108,18 +104,15 @@ const addImageDiffNoteToStore = (store, createImageDiffNote, query, variables) =
const
notesCount
=
design
.
notesCount
+
1
;
const
notesCount
=
design
.
notesCount
+
1
;
design
.
discussions
.
nodes
=
[...
design
.
discussions
.
nodes
,
newDiscussion
];
design
.
discussions
.
nodes
=
[...
design
.
discussions
.
nodes
,
newDiscussion
];
if
(
if
(
!
design
.
issue
.
participants
.
edg
es
.
some
(
!
design
.
issue
.
participants
.
nod
es
.
some
(
participant
=>
participant
.
node
.
username
===
createImageDiffNote
.
note
.
author
.
username
,
participant
=>
participant
.
username
===
createImageDiffNote
.
note
.
author
.
username
,
)
)
)
{
)
{
design
.
issue
.
participants
.
edg
es
=
[
design
.
issue
.
participants
.
nod
es
=
[
...
design
.
issue
.
participants
.
edg
es
,
...
design
.
issue
.
participants
.
nod
es
,
{
{
__typename
:
'
UserEdge
'
,
__typename
:
'
User
'
,
node
:
{
...
createImageDiffNote
.
note
.
author
,
__typename
:
'
User
'
,
...
createImageDiffNote
.
note
.
author
,
},
},
},
];
];
}
}
...
@@ -166,9 +159,9 @@ const updateImageDiffNoteInStore = (store, updateImageDiffNote, query, variables
...
@@ -166,9 +159,9 @@ const updateImageDiffNoteInStore = (store, updateImageDiffNote, query, variables
const
addNewDesignToStore
=
(
store
,
designManagementUpload
,
query
)
=>
{
const
addNewDesignToStore
=
(
store
,
designManagementUpload
,
query
)
=>
{
const
data
=
store
.
readQuery
(
query
);
const
data
=
store
.
readQuery
(
query
);
const
newDesigns
=
data
.
project
.
issue
.
designCollection
.
designs
.
edg
es
.
reduce
((
acc
,
design
)
=>
{
const
newDesigns
=
data
.
project
.
issue
.
designCollection
.
designs
.
nod
es
.
reduce
((
acc
,
design
)
=>
{
if
(
!
acc
.
find
(
d
=>
d
.
filename
===
design
.
node
.
filename
))
{
if
(
!
acc
.
find
(
d
=>
d
.
filename
===
design
.
filename
))
{
acc
.
push
(
design
.
node
);
acc
.
push
(
design
);
}
}
return
acc
;
return
acc
;
...
@@ -178,30 +171,27 @@ const addNewDesignToStore = (store, designManagementUpload, query) => {
...
@@ -178,30 +171,27 @@ const addNewDesignToStore = (store, designManagementUpload, query) => {
const
findNewVersions
=
designManagementUpload
.
designs
.
find
(
design
=>
design
.
versions
);
const
findNewVersions
=
designManagementUpload
.
designs
.
find
(
design
=>
design
.
versions
);
if
(
findNewVersions
)
{
if
(
findNewVersions
)
{
const
findNewVersions
Edges
=
findNewVersions
.
versions
.
edg
es
;
const
findNewVersions
Nodes
=
findNewVersions
.
versions
.
nod
es
;
if
(
findNewVersions
Edges
&&
findNewVersionsEdg
es
.
length
)
{
if
(
findNewVersions
Nodes
&&
findNewVersionsNod
es
.
length
)
{
newVersionNode
=
[
findNewVersions
Edg
es
[
0
]];
newVersionNode
=
[
findNewVersions
Nod
es
[
0
]];
}
}
}
}
const
newVersions
=
[
const
newVersions
=
[
...(
newVersionNode
||
[]),
...(
newVersionNode
||
[]),
...
data
.
project
.
issue
.
designCollection
.
versions
.
edg
es
,
...
data
.
project
.
issue
.
designCollection
.
versions
.
nod
es
,
];
];
const
updatedDesigns
=
{
const
updatedDesigns
=
{
__typename
:
'
DesignCollection
'
,
__typename
:
'
DesignCollection
'
,
designs
:
{
designs
:
{
__typename
:
'
DesignConnection
'
,
__typename
:
'
DesignConnection
'
,
edges
:
newDesigns
.
map
(
design
=>
({
nodes
:
newDesigns
,
__typename
:
'
DesignEdge
'
,
node
:
design
,
})),
},
},
versions
:
{
versions
:
{
__typename
:
'
DesignVersionConnection
'
,
__typename
:
'
DesignVersionConnection
'
,
edg
es
:
newVersions
,
nod
es
:
newVersions
,
},
},
};
};
...
...
app/assets/javascripts/design_management/utils/design_management_utils.js
View file @
349d5202
...
@@ -5,17 +5,7 @@ export const isValidDesignFile = ({ type }) =>
...
@@ -5,17 +5,7 @@ export const isValidDesignFile = ({ type }) =>
(
type
.
match
(
VALID_DESIGN_FILE_MIMETYPE
.
regex
)
||
[]).
length
>
0
;
(
type
.
match
(
VALID_DESIGN_FILE_MIMETYPE
.
regex
)
||
[]).
length
>
0
;
/**
/**
* Returns formatted array that doesn't contain
* Returns formatted array of discussions
* `edges`->`node` nesting
*
* @param {Array} elements
*/
export
const
extractNodes
=
elements
=>
elements
.
edges
.
map
(({
node
})
=>
node
);
/**
* Returns formatted array of discussions that doesn't contain
* `edges`->`node` nesting for child notes
*
*
* @param {Array} discussions
* @param {Array} discussions
*/
*/
...
@@ -40,9 +30,9 @@ export const findVersionId = id => (id.match('::Version/(.+$)') || [])[1];
...
@@ -40,9 +30,9 @@ export const findVersionId = id => (id.match('::Version/(.+$)') || [])[1];
export
const
findNoteId
=
id
=>
(
id
.
match
(
'
DiffNote/(.+$)
'
)
||
[])[
1
];
export
const
findNoteId
=
id
=>
(
id
.
match
(
'
DiffNote/(.+$)
'
)
||
[])[
1
];
export
const
extractDesigns
=
data
=>
data
.
project
.
issue
.
designCollection
.
designs
.
edg
es
;
export
const
extractDesigns
=
data
=>
data
.
project
.
issue
.
designCollection
.
designs
.
nod
es
;
export
const
extractDesign
=
data
=>
(
extractDesigns
(
data
)
||
[])[
0
]
?.
node
;
export
const
extractDesign
=
data
=>
(
extractDesigns
(
data
)
||
[])[
0
];
/**
/**
* Generates optimistic response for a design upload mutation
* Generates optimistic response for a design upload mutation
...
@@ -72,13 +62,10 @@ export const designUploadOptimisticResponse = files => {
...
@@ -72,13 +62,10 @@ export const designUploadOptimisticResponse = files => {
},
},
versions
:
{
versions
:
{
__typename
:
'
DesignVersionConnection
'
,
__typename
:
'
DesignVersionConnection
'
,
edges
:
{
nodes
:
{
__typename
:
'
DesignVersionEdge
'
,
__typename
:
'
DesignVersion
'
,
node
:
{
id
:
-
uniqueId
(),
__typename
:
'
DesignVersion
'
,
sha
:
-
uniqueId
(),
id
:
-
uniqueId
(),
sha
:
-
uniqueId
(),
},
},
},
},
},
}));
}));
...
@@ -123,6 +110,6 @@ const normalizeAuthor = author => ({
...
@@ -123,6 +110,6 @@ const normalizeAuthor = author => ({
avatar_url
:
author
.
avatarUrl
,
avatar_url
:
author
.
avatarUrl
,
});
});
export
const
extractParticipants
=
users
=>
users
.
edges
.
map
(({
node
})
=>
normalizeAuthor
(
node
));
export
const
extractParticipants
=
users
=>
users
.
map
(
node
=>
normalizeAuthor
(
node
));
export
const
getPageLayoutElement
=
()
=>
document
.
querySelector
(
'
.layout-page
'
);
export
const
getPageLayoutElement
=
()
=>
document
.
querySelector
(
'
.layout-page
'
);
spec/frontend/design_management/components/upload/mock_data/all_versions.js
View file @
349d5202
export
default
[
export
default
[
{
{
node
:
{
id
:
'
gid://gitlab/DesignManagement::Version/3
'
,
id
:
'
gid://gitlab/DesignManagement::Version/3
'
,
sha
:
'
0945756378e0b1588b9dd40d5a6b99e8b7198f55
'
,
sha
:
'
0945756378e0b1588b9dd40d5a6b99e8b7198f55
'
,
},
},
},
{
{
node
:
{
id
:
'
gid://gitlab/DesignManagement::Version/2
'
,
id
:
'
gid://gitlab/DesignManagement::Version/2
'
,
sha
:
'
5b063fef0cd7213b312db65b30e24f057df21b20
'
,
sha
:
'
5b063fef0cd7213b312db65b30e24f057df21b20
'
,
},
},
},
];
];
spec/frontend/design_management/mock_data/all_versions.js
View file @
349d5202
export
default
[
export
default
[
{
{
node
:
{
id
:
'
gid://gitlab/DesignManagement::Version/1
'
,
id
:
'
gid://gitlab/DesignManagement::Version/1
'
,
sha
:
'
b389071a06c153509e11da1f582005b316667001
'
,
sha
:
'
b389071a06c153509e11da1f582005b316667001
'
,
},
},
},
];
];
spec/frontend/design_management/mock_data/design.js
View file @
349d5202
...
@@ -12,14 +12,12 @@ export default {
...
@@ -12,14 +12,12 @@ export default {
webPath
:
'
full-issue-path
'
,
webPath
:
'
full-issue-path
'
,
webUrl
:
'
full-issue-url
'
,
webUrl
:
'
full-issue-url
'
,
participants
:
{
participants
:
{
edg
es
:
[
nod
es
:
[
{
{
node
:
{
name
:
'
Administrator
'
,
name
:
'
Administrator
'
,
username
:
'
root
'
,
username
:
'
root
'
,
webUrl
:
'
link-to-author
'
,
webUrl
:
'
link-to-author
'
,
avatarUrl
:
'
link-to-avatar
'
,
avatarUrl
:
'
link-to-avatar
'
,
},
},
},
],
],
},
},
...
...
spec/frontend/design_management/mock_data/designs.js
View file @
349d5202
...
@@ -5,11 +5,7 @@ export default {
...
@@ -5,11 +5,7 @@ export default {
issue
:
{
issue
:
{
designCollection
:
{
designCollection
:
{
designs
:
{
designs
:
{
edges
:
[
nodes
:
[
design
],
{
node
:
design
,
},
],
},
},
},
},
},
},
...
...
spec/frontend/design_management/mock_data/no_designs.js
View file @
349d5202
...
@@ -3,7 +3,7 @@ export default {
...
@@ -3,7 +3,7 @@ export default {
issue
:
{
issue
:
{
designCollection
:
{
designCollection
:
{
designs
:
{
designs
:
{
edg
es
:
[],
nod
es
:
[],
},
},
},
},
},
},
...
...
spec/frontend/design_management/pages/index_spec.js
View file @
349d5202
...
@@ -57,9 +57,7 @@ const mockDesigns = [
...
@@ -57,9 +57,7 @@ const mockDesigns = [
];
];
const
mockVersion
=
{
const
mockVersion
=
{
node
:
{
id
:
'
gid://gitlab/DesignManagement::Version/1
'
,
id
:
'
gid://gitlab/DesignManagement::Version/1
'
,
},
};
};
describe
(
'
Design management index page
'
,
()
=>
{
describe
(
'
Design management index page
'
,
()
=>
{
...
@@ -240,13 +238,10 @@ describe('Design management index page', () => {
...
@@ -240,13 +238,10 @@ describe('Design management index page', () => {
},
},
versions
:
{
versions
:
{
__typename
:
'
DesignVersionConnection
'
,
__typename
:
'
DesignVersionConnection
'
,
edges
:
{
nodes
:
{
__typename
:
'
DesignVersionEdge
'
,
__typename
:
'
DesignVersion
'
,
node
:
{
id
:
expect
.
anything
(),
__typename
:
'
DesignVersion
'
,
sha
:
expect
.
anything
(),
id
:
expect
.
anything
(),
sha
:
expect
.
anything
(),
},
},
},
},
},
},
},
...
...
spec/frontend/design_management/utils/design_management_utils_spec.js
View file @
349d5202
...
@@ -51,7 +51,7 @@ describe('extractDiscussions', () => {
...
@@ -51,7 +51,7 @@ describe('extractDiscussions', () => {
};
};
});
});
it
(
'
discards the
edges.
node artifacts of GraphQL
'
,
()
=>
{
it
(
'
discards the node artifacts of GraphQL
'
,
()
=>
{
expect
(
extractDiscussions
(
discussions
)).
toEqual
([
expect
(
extractDiscussions
(
discussions
)).
toEqual
([
{
id
:
1
,
notes
:
[
'
a
'
],
index
:
1
},
{
id
:
1
,
notes
:
[
'
a
'
],
index
:
1
},
{
id
:
2
,
notes
:
[
'
b
'
],
index
:
2
},
{
id
:
2
,
notes
:
[
'
b
'
],
index
:
2
},
...
@@ -96,10 +96,7 @@ describe('optimistic responses', () => {
...
@@ -96,10 +96,7 @@ describe('optimistic responses', () => {
discussions
:
{
__typename
:
'
DesignDiscussion
'
,
nodes
:
[]
},
discussions
:
{
__typename
:
'
DesignDiscussion
'
,
nodes
:
[]
},
versions
:
{
versions
:
{
__typename
:
'
DesignVersionConnection
'
,
__typename
:
'
DesignVersionConnection
'
,
edges
:
{
nodes
:
{
__typename
:
'
DesignVersion
'
,
id
:
-
1
,
sha
:
-
1
},
__typename
:
'
DesignVersionEdge
'
,
node
:
{
__typename
:
'
DesignVersion
'
,
id
:
-
1
,
sha
:
-
1
},
},
},
},
},
},
],
],
...
...
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