mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 23:30:05 +02:00
feat(cp-frontend): handle removal of parent property
This commit is contained in:
parent
92181a2df0
commit
9802bba502
@ -6,7 +6,15 @@ query Services($deploymentGroupSlug: String!){
|
|||||||
...DeploymentGroupInfo
|
...DeploymentGroupInfo
|
||||||
services {
|
services {
|
||||||
...ServiceInfo
|
...ServiceInfo
|
||||||
parent
|
branches {
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
instances {
|
||||||
|
id
|
||||||
|
status
|
||||||
|
healthy
|
||||||
|
}
|
||||||
|
}
|
||||||
connections
|
connections
|
||||||
instances {
|
instances {
|
||||||
id
|
id
|
||||||
|
@ -132,24 +132,6 @@ const getService = (service, index) => {
|
|||||||
|
|
||||||
const processServices = services => {
|
const processServices = services => {
|
||||||
return forceArray(services).reduce((ss, s, i) => {
|
return forceArray(services).reduce((ss, s, i) => {
|
||||||
if (s.parent) {
|
|
||||||
const parents = ss.filter(parentS => parentS.id === s.parent);
|
|
||||||
let parent;
|
|
||||||
if (parents.length) {
|
|
||||||
parent = parents[0];
|
|
||||||
} else {
|
|
||||||
parent = { id: s.parent };
|
|
||||||
ss.push(parent);
|
|
||||||
}
|
|
||||||
if (!parent.children) {
|
|
||||||
parent.children = [];
|
|
||||||
}
|
|
||||||
const child = getService(s, i);
|
|
||||||
parent.instancesActive = parent.instancesActive
|
|
||||||
? true
|
|
||||||
: child.instancesActive;
|
|
||||||
parent.children.push(child);
|
|
||||||
} else {
|
|
||||||
const serviceIndex = ss.findIndex(existingS => existingS.id === s.id);
|
const serviceIndex = ss.findIndex(existingS => existingS.id === s.id);
|
||||||
if (serviceIndex === -1) {
|
if (serviceIndex === -1) {
|
||||||
ss.push(getService(s, i));
|
ss.push(getService(s, i));
|
||||||
@ -159,7 +141,7 @@ const processServices = services => {
|
|||||||
...getService(s, i)
|
...getService(s, i)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ss;
|
return ss;
|
||||||
}, []);
|
}, []);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user