Commit 159e9869 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '31258-design-management-graphql-uses-deprecated-field-designs-2' into 'master'

Resolve "Design Management GraphQL Uses Deprecated Field `designs`"

See merge request gitlab-org/gitlab!19472
parents a0e07733 30fff052
......@@ -29,7 +29,7 @@ const defaultClient = createDefaultClient(
},
})
.then(({ data }) => {
const edge = data.project.issue.designs.designs.edges.find(
const edge = data.project.issue.designCollection.designs.edges.find(
({ node }) => node.filename === id,
);
return edge.node;
......
......@@ -5,7 +5,7 @@ query project($fullPath: ID!, $iid: String!, $atVersion: ID) {
project(fullPath: $fullPath) {
id
issue(iid: $iid) {
designs {
designCollection {
designs(atVersion: $atVersion) {
edges {
node {
......
......@@ -37,7 +37,7 @@ export default () => {
})
.subscribe(({ data }) => {
if (badge) {
badge.textContent = data.project.issue.designs.designs.edges.length;
badge.textContent = data.project.issue.designCollection.designs.edges.length;
}
});
......
......@@ -18,7 +18,7 @@ export default {
};
},
update: data => {
const designEdges = propertyOf(data)(['project', 'issue', 'designs', 'designs']);
const designEdges = propertyOf(data)(['project', 'issue', 'designCollection', 'designs']);
if (designEdges) {
return extractNodes(designEdges);
}
......
......@@ -21,7 +21,7 @@ export default {
atVersion: null,
};
},
update: data => data.project.issue.designs.versions.edges,
update: data => data.project.issue.designCollection.versions.edges,
},
},
computed: {
......
......@@ -147,13 +147,16 @@ export default {
update: (store, { data: { designManagementUpload } }) => {
const data = store.readQuery(this.projectQueryBody);
const newDesigns = data.project.issue.designs.designs.edges.reduce((acc, design) => {
if (!acc.find(d => d.filename === design.node.filename)) {
acc.push(design.node);
}
const newDesigns = data.project.issue.designCollection.designs.edges.reduce(
(acc, design) => {
if (!acc.find(d => d.filename === design.node.filename)) {
acc.push(design.node);
}
return acc;
}, designManagementUpload.designs);
return acc;
},
designManagementUpload.designs,
);
let newVersionNode;
const findNewVersions = designManagementUpload.designs.find(design => design.versions);
......@@ -168,7 +171,7 @@ export default {
const newVersions = [
...(newVersionNode || []),
...data.project.issue.designs.versions.edges,
...data.project.issue.designCollection.versions.edges,
];
const updatedDesigns = {
......@@ -186,7 +189,7 @@ export default {
},
};
data.project.issue.designs = updatedDesigns;
data.project.issue.designCollection = updatedDesigns;
store.writeQuery({
...this.projectQueryBody,
......
......@@ -36,10 +36,10 @@ export const extractCurrentDiscussion = (discussions, id) =>
const deleteDesignsFromStore = (store, query, selectedDesigns) => {
const data = store.readQuery(query);
const changedDesigns = data.project.issue.designs.designs.edges.filter(
const changedDesigns = data.project.issue.designCollection.designs.edges.filter(
({ node }) => !selectedDesigns.includes(node.filename),
);
data.project.issue.designs.designs.edges = [...changedDesigns];
data.project.issue.designCollection.designs.edges = [...changedDesigns];
store.writeQuery({
...query,
......@@ -53,9 +53,9 @@ const addNewVersionToStore = (store, query, version) => {
const data = store.readQuery(query);
const newEdge = { node: version, __typename: 'DesignVersionEdge' };
data.project.issue.designs.versions.edges = [
data.project.issue.designCollection.versions.edges = [
newEdge,
...data.project.issue.designs.versions.edges,
...data.project.issue.designCollection.versions.edges,
];
store.writeQuery({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment