mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
fix(joyent-cp-frontend,joyent-ui-toolkit): Uuids become ids
This commit is contained in:
parent
53bec9df41
commit
8cd863f394
@ -46,7 +46,7 @@ const ServiceListItem = ({
|
|||||||
const children = service.children
|
const children = service.children
|
||||||
? service.children.map(service => (
|
? service.children.map(service => (
|
||||||
<ServiceListItem
|
<ServiceListItem
|
||||||
key={service.uuid}
|
key={service.id}
|
||||||
deploymentGroup={deploymentGroup}
|
deploymentGroup={deploymentGroup}
|
||||||
service={service}
|
service={service}
|
||||||
/>
|
/>
|
||||||
@ -125,7 +125,7 @@ const ServiceListItem = ({
|
|||||||
collapsed={service.collapsed}
|
collapsed={service.collapsed}
|
||||||
flat={isChild}
|
flat={isChild}
|
||||||
headed={!isChild}
|
headed={!isChild}
|
||||||
key={service.uuid}
|
key={service.id}
|
||||||
stacked={isChild && service.instances > 1}
|
stacked={isChild && service.instances > 1}
|
||||||
>
|
>
|
||||||
{header}
|
{header}
|
||||||
|
@ -75,7 +75,7 @@ const DeploymentGroupList = ({
|
|||||||
DeploymentGroupList.propTypes = {
|
DeploymentGroupList.propTypes = {
|
||||||
deploymentGroups: PropTypes.arrayOf(
|
deploymentGroups: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
uuid: PropTypes.string,
|
id: PropTypes.string,
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
name: PropTypes.string
|
name: PropTypes.string
|
||||||
})
|
})
|
||||||
|
@ -31,7 +31,7 @@ class InstanceList extends Component {
|
|||||||
? instances.map((instance, index) => (
|
? instances.map((instance, index) => (
|
||||||
<InstanceListItem
|
<InstanceListItem
|
||||||
instance={instance}
|
instance={instance}
|
||||||
key={instance.uuid}
|
key={instance.id}
|
||||||
toggleCollapsed={() => null}
|
toggleCollapsed={() => null}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
@ -50,12 +50,12 @@ class ServiceList extends Component {
|
|||||||
|
|
||||||
const serviceList = services.map(service => (
|
const serviceList = services.map(service => (
|
||||||
<ServiceListItem
|
<ServiceListItem
|
||||||
key={service.uuid}
|
key={service.id}
|
||||||
deploymentGroup={deploymentGroup.slug}
|
deploymentGroup={deploymentGroup.slug}
|
||||||
service={service}
|
service={service}
|
||||||
showQuickActions={
|
showQuickActions={
|
||||||
servicesQuickActions.service &&
|
servicesQuickActions.service &&
|
||||||
servicesQuickActions.service.uuid === service.uuid
|
servicesQuickActions.service.id === service.id
|
||||||
}
|
}
|
||||||
onQuickActionsClick={handleQuickActionsClick}
|
onQuickActionsClick={handleQuickActionsClick}
|
||||||
onQuickActionsBlur={handleQuickActionsBlur}
|
onQuickActionsBlur={handleQuickActionsBlur}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fragment DeploymentGroupInfo on DeploymentGroup {
|
fragment DeploymentGroupInfo on DeploymentGroup {
|
||||||
uuid
|
id
|
||||||
name
|
name
|
||||||
slug
|
slug
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ query Instances($deploymentGroupSlug: String!, $serviceSlug: String) {
|
|||||||
services(slug: $serviceSlug) {
|
services(slug: $serviceSlug) {
|
||||||
...ServiceInfo
|
...ServiceInfo
|
||||||
instances {
|
instances {
|
||||||
uuid
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ query Portal {
|
|||||||
firstName
|
firstName
|
||||||
}
|
}
|
||||||
datacenter {
|
datacenter {
|
||||||
uuid
|
id
|
||||||
region
|
region
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fragment ServiceInfo on Service {
|
fragment ServiceInfo on Service {
|
||||||
uuid
|
id
|
||||||
name
|
name
|
||||||
slug
|
slug
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ query Services($deploymentGroupSlug: String!){
|
|||||||
...ServiceInfo
|
...ServiceInfo
|
||||||
parent
|
parent
|
||||||
instances {
|
instances {
|
||||||
uuid
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ query Instances($deploymentGroupSlug: String!){
|
|||||||
parent
|
parent
|
||||||
connections
|
connections
|
||||||
instances {
|
instances {
|
||||||
uuid
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
query SingleMetrics {
|
query SingleMetrics {
|
||||||
instanceMetric {
|
instanceMetric {
|
||||||
type {
|
type {
|
||||||
uuid
|
id
|
||||||
name
|
name
|
||||||
machineId
|
machineId
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,9 @@ class Topology extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
findNode(nodeUuid) {
|
findNode(nodeId) {
|
||||||
return this.state.nodes.reduce(
|
return this.state.nodes.reduce(
|
||||||
(acc, simNode, index) => (simNode.uuid === nodeUuid ? simNode : acc),
|
(acc, simNode, index) => (simNode.id === nodeId ? simNode : acc),
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -98,22 +98,22 @@ class Topology extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getConstrainedNodePosition(nodeUuid, children = false) {
|
getConstrainedNodePosition(nodeId, children = false) {
|
||||||
const node = this.findNode(nodeUuid);
|
const node = this.findNode(nodeId);
|
||||||
return this.constrainNodePosition(node.x, node.y, children);
|
return this.constrainNodePosition(node.x, node.y, children);
|
||||||
}
|
}
|
||||||
|
|
||||||
findNodeData(nodesData, nodeUuid) {
|
findNodeData(nodesData, nodeId) {
|
||||||
return nodesData.reduce(
|
return nodesData.reduce(
|
||||||
(acc, nodeData, index) => (nodeData.uuid === nodeUuid ? nodeData : acc),
|
(acc, nodeData, index) => (nodeData.id === nodeId ? nodeData : acc),
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDragInfo(dragging, nodeUuid = null, position = {}) {
|
setDragInfo(dragging, nodeId = null, position = {}) {
|
||||||
this.dragInfo = {
|
this.dragInfo = {
|
||||||
dragging,
|
dragging,
|
||||||
nodeUuid,
|
nodeId,
|
||||||
position
|
position
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ class Topology extends React.Component {
|
|||||||
const nodesData = services.map((service, index) => {
|
const nodesData = services.map((service, index) => {
|
||||||
const nodePosition = service.id === 'consul'
|
const nodePosition = service.id === 'consul'
|
||||||
? this.getConsulNodePosition()
|
? this.getConsulNodePosition()
|
||||||
: this.getConstrainedNodePosition(service.uuid, service.children);
|
: this.getConstrainedNodePosition(service.id, service.children);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...service,
|
...service,
|
||||||
@ -138,8 +138,8 @@ class Topology extends React.Component {
|
|||||||
// if it does, the height of it will be different
|
// if it does, the height of it will be different
|
||||||
const linksData = links
|
const linksData = links
|
||||||
.map((link, index) => ({
|
.map((link, index) => ({
|
||||||
source: this.findNodeData(nodesData, link.source.uuid),
|
source: this.findNodeData(nodesData, link.source.id),
|
||||||
target: this.findNodeData(nodesData, link.target.uuid)
|
target: this.findNodeData(nodesData, link.target.id)
|
||||||
}))
|
}))
|
||||||
.map((linkData, index) => calculateLineLayout(linkData, index));
|
.map((linkData, index) => calculateLineLayout(linkData, index));
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class Topology extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const dragNodes = nodes.map((simNode, index) => {
|
const dragNodes = nodes.map((simNode, index) => {
|
||||||
if (simNode.uuid === this.dragInfo.nodeUuid) {
|
if (simNode.id === this.dragInfo.nodeId) {
|
||||||
return {
|
return {
|
||||||
...simNode,
|
...simNode,
|
||||||
x: simNode.x + offset.x,
|
x: simNode.x + offset.x,
|
||||||
@ -186,7 +186,7 @@ class Topology extends React.Component {
|
|||||||
nodes: dragNodes
|
nodes: dragNodes
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setDragInfo(true, this.dragInfo.nodeUuid, {
|
this.setDragInfo(true, this.dragInfo.nodeId, {
|
||||||
x,
|
x,
|
||||||
y
|
y
|
||||||
});
|
});
|
||||||
@ -219,7 +219,7 @@ class Topology extends React.Component {
|
|||||||
|
|
||||||
const renderedNodes = this.dragInfo && this.dragInfo.dragging
|
const renderedNodes = this.dragInfo && this.dragInfo.dragging
|
||||||
? nodesData
|
? nodesData
|
||||||
.filter((n, index) => n.uuid !== this.dragInfo.nodeUuid)
|
.filter((n, index) => n.id !== this.dragInfo.nodeId)
|
||||||
.map((n, index) => renderedNode(n, index))
|
.map((n, index) => renderedNode(n, index))
|
||||||
: nodesData.map((n, index) => renderedNode(n, index));
|
: nodesData.map((n, index) => renderedNode(n, index));
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ class Topology extends React.Component {
|
|||||||
|
|
||||||
const renderedLinkArrows = this.dragInfo && this.dragInfo.dragging
|
const renderedLinkArrows = this.dragInfo && this.dragInfo.dragging
|
||||||
? linksData
|
? linksData
|
||||||
.filter((l, index) => l.target.uuid !== this.dragInfo.nodeUuid)
|
.filter((l, index) => l.target.id !== this.dragInfo.nodeId)
|
||||||
.map((l, index) => renderedLinkArrow(l, index))
|
.map((l, index) => renderedLinkArrow(l, index))
|
||||||
: linksData.map((l, index) => renderedLinkArrow(l, index));
|
: linksData.map((l, index) => renderedLinkArrow(l, index));
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ class Topology extends React.Component {
|
|||||||
? null
|
? null
|
||||||
: renderedNode(
|
: renderedNode(
|
||||||
nodesData.reduce((dragNode, n, index) => {
|
nodesData.reduce((dragNode, n, index) => {
|
||||||
if (n.uuid === this.dragInfo.nodeUuid) {
|
if (n.id === this.dragInfo.nodeId) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
return dragNode;
|
return dragNode;
|
||||||
@ -248,7 +248,7 @@ class Topology extends React.Component {
|
|||||||
? null
|
? null
|
||||||
: renderedLinkArrow(
|
: renderedLinkArrow(
|
||||||
linksData.reduce((dragLinkArrow, l, index) => {
|
linksData.reduce((dragLinkArrow, l, index) => {
|
||||||
if (l.target.uuid === this.dragInfo.nodeUuid) {
|
if (l.target.id === this.dragInfo.nodeId) {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
return dragLinkArrow;
|
return dragLinkArrow;
|
||||||
|
@ -56,7 +56,7 @@ const GraphNode = ({
|
|||||||
|
|
||||||
const onStart = evt => {
|
const onStart = evt => {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
onDragStart(evt, data.uuid);
|
onDragStart(evt, data.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const nodeRectEvents = connected
|
const nodeRectEvents = connected
|
||||||
|
@ -23,7 +23,7 @@ const createLinks = services =>
|
|||||||
service.connections
|
service.connections
|
||||||
? acc.concat(
|
? acc.concat(
|
||||||
service.connections.map((connection, index) => ({
|
service.connections.map((connection, index) => ({
|
||||||
source: service.uuid,
|
source: service.id,
|
||||||
target: connection
|
target: connection
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
@ -35,7 +35,7 @@ const createSimulation = (services, svgSize, animationTicks = 0) => {
|
|||||||
// This is not going to work given that as well as the d3 layout stuff, other things might be at play too
|
// This is not going to work given that as well as the d3 layout stuff, other things might be at play too
|
||||||
// We should pass two objects to the components - one for positioning and one for data
|
// We should pass two objects to the components - one for positioning and one for data
|
||||||
const nodes = services.map((service, index) => ({
|
const nodes = services.map((service, index) => ({
|
||||||
uuid: service.uuid,
|
id: service.id,
|
||||||
index
|
index
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ const createSimulation = (services, svgSize, animationTicks = 0) => {
|
|||||||
const nodeRadius = rectRadius(Constants.nodeSizeWithChildren);
|
const nodeRadius = rectRadius(Constants.nodeSizeWithChildren);
|
||||||
|
|
||||||
const simulation = forceSimulation(nodes)
|
const simulation = forceSimulation(nodes)
|
||||||
.force('link', forceLink(links).id(d => d.uuid))
|
.force('link', forceLink(links).id(d => d.id))
|
||||||
.force('collide', forceCollide(nodeRadius))
|
.force('collide', forceCollide(nodeRadius))
|
||||||
.force('center', forceCenter(width / 2, height / 2));
|
.force('center', forceCenter(width / 2, height / 2));
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ const updateSimulation = (
|
|||||||
) => {
|
) => {
|
||||||
const nodes = services.map((service, index) => {
|
const nodes = services.map((service, index) => {
|
||||||
const simNode = simNodes.reduce((acc, n, i) => {
|
const simNode = simNodes.reduce((acc, n, i) => {
|
||||||
return service.uuid === n.id ? n : acc;
|
return service.id === n.id ? n : acc;
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
return simNode
|
return simNode
|
||||||
@ -82,7 +82,7 @@ const updateSimulation = (
|
|||||||
index
|
index
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
id: service.uuid,
|
id: service.id,
|
||||||
index
|
index
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user