1
0
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:
JUDIT GRESKOVITS 2017-06-01 15:05:10 +01:00
parent 53bec9df41
commit 8cd863f394
14 changed files with 36 additions and 36 deletions

View File

@ -46,7 +46,7 @@ const ServiceListItem = ({
const children = service.children
? service.children.map(service => (
<ServiceListItem
key={service.uuid}
key={service.id}
deploymentGroup={deploymentGroup}
service={service}
/>
@ -125,7 +125,7 @@ const ServiceListItem = ({
collapsed={service.collapsed}
flat={isChild}
headed={!isChild}
key={service.uuid}
key={service.id}
stacked={isChild && service.instances > 1}
>
{header}

View File

@ -75,7 +75,7 @@ const DeploymentGroupList = ({
DeploymentGroupList.propTypes = {
deploymentGroups: PropTypes.arrayOf(
PropTypes.shape({
uuid: PropTypes.string,
id: PropTypes.string,
id: PropTypes.string,
name: PropTypes.string
})

View File

@ -31,7 +31,7 @@ class InstanceList extends Component {
? instances.map((instance, index) => (
<InstanceListItem
instance={instance}
key={instance.uuid}
key={instance.id}
toggleCollapsed={() => null}
/>
))

View File

@ -50,12 +50,12 @@ class ServiceList extends Component {
const serviceList = services.map(service => (
<ServiceListItem
key={service.uuid}
key={service.id}
deploymentGroup={deploymentGroup.slug}
service={service}
showQuickActions={
servicesQuickActions.service &&
servicesQuickActions.service.uuid === service.uuid
servicesQuickActions.service.id === service.id
}
onQuickActionsClick={handleQuickActionsClick}
onQuickActionsBlur={handleQuickActionsBlur}

View File

@ -1,5 +1,5 @@
fragment DeploymentGroupInfo on DeploymentGroup {
uuid
id
name
slug
}

View File

@ -7,7 +7,7 @@ query Instances($deploymentGroupSlug: String!, $serviceSlug: String) {
services(slug: $serviceSlug) {
...ServiceInfo
instances {
uuid
id
name
}
}

View File

@ -4,7 +4,7 @@ query Portal {
firstName
}
datacenter {
uuid
id
region
}
}

View File

@ -1,5 +1,5 @@
fragment ServiceInfo on Service {
uuid
id
name
slug
}

View File

@ -8,7 +8,7 @@ query Services($deploymentGroupSlug: String!){
...ServiceInfo
parent
instances {
uuid
id
}
}
}

View File

@ -9,7 +9,7 @@ query Instances($deploymentGroupSlug: String!){
parent
connections
instances {
uuid
id
}
}
}

View File

@ -1,7 +1,7 @@
query SingleMetrics {
instanceMetric {
type {
uuid
id
name
machineId
}

View File

@ -81,9 +81,9 @@ class Topology extends React.Component {
};
}
findNode(nodeUuid) {
findNode(nodeId) {
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) {
const node = this.findNode(nodeUuid);
getConstrainedNodePosition(nodeId, children = false) {
const node = this.findNode(nodeId);
return this.constrainNodePosition(node.x, node.y, children);
}
findNodeData(nodesData, nodeUuid) {
findNodeData(nodesData, nodeId) {
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 = {
dragging,
nodeUuid,
nodeId,
position
};
}
@ -126,7 +126,7 @@ class Topology extends React.Component {
const nodesData = services.map((service, index) => {
const nodePosition = service.id === 'consul'
? this.getConsulNodePosition()
: this.getConstrainedNodePosition(service.uuid, service.children);
: this.getConstrainedNodePosition(service.id, service.children);
return {
...service,
@ -138,8 +138,8 @@ class Topology extends React.Component {
// if it does, the height of it will be different
const linksData = links
.map((link, index) => ({
source: this.findNodeData(nodesData, link.source.uuid),
target: this.findNodeData(nodesData, link.target.uuid)
source: this.findNodeData(nodesData, link.source.id),
target: this.findNodeData(nodesData, link.target.id)
}))
.map((linkData, index) => calculateLineLayout(linkData, index));
@ -170,7 +170,7 @@ class Topology extends React.Component {
};
const dragNodes = nodes.map((simNode, index) => {
if (simNode.uuid === this.dragInfo.nodeUuid) {
if (simNode.id === this.dragInfo.nodeId) {
return {
...simNode,
x: simNode.x + offset.x,
@ -186,7 +186,7 @@ class Topology extends React.Component {
nodes: dragNodes
});
this.setDragInfo(true, this.dragInfo.nodeUuid, {
this.setDragInfo(true, this.dragInfo.nodeId, {
x,
y
});
@ -219,7 +219,7 @@ class Topology extends React.Component {
const renderedNodes = this.dragInfo && this.dragInfo.dragging
? nodesData
.filter((n, index) => n.uuid !== this.dragInfo.nodeUuid)
.filter((n, index) => n.id !== this.dragInfo.nodeId)
.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
? 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))
: linksData.map((l, index) => renderedLinkArrow(l, index));
@ -235,7 +235,7 @@ class Topology extends React.Component {
? null
: renderedNode(
nodesData.reduce((dragNode, n, index) => {
if (n.uuid === this.dragInfo.nodeUuid) {
if (n.id === this.dragInfo.nodeId) {
return n;
}
return dragNode;
@ -248,7 +248,7 @@ class Topology extends React.Component {
? null
: renderedLinkArrow(
linksData.reduce((dragLinkArrow, l, index) => {
if (l.target.uuid === this.dragInfo.nodeUuid) {
if (l.target.id === this.dragInfo.nodeId) {
return l;
}
return dragLinkArrow;

View File

@ -56,7 +56,7 @@ const GraphNode = ({
const onStart = evt => {
evt.preventDefault();
onDragStart(evt, data.uuid);
onDragStart(evt, data.id);
};
const nodeRectEvents = connected

View File

@ -23,7 +23,7 @@ const createLinks = services =>
service.connections
? acc.concat(
service.connections.map((connection, index) => ({
source: service.uuid,
source: service.id,
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
// We should pass two objects to the components - one for positioning and one for data
const nodes = services.map((service, index) => ({
uuid: service.uuid,
id: service.id,
index
}));
@ -46,7 +46,7 @@ const createSimulation = (services, svgSize, animationTicks = 0) => {
const nodeRadius = rectRadius(Constants.nodeSizeWithChildren);
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('center', forceCenter(width / 2, height / 2));
@ -71,7 +71,7 @@ const updateSimulation = (
) => {
const nodes = services.map((service, index) => {
const simNode = simNodes.reduce((acc, n, i) => {
return service.uuid === n.id ? n : acc;
return service.id === n.id ? n : acc;
}, null);
return simNode
@ -82,7 +82,7 @@ const updateSimulation = (
index
}
: {
id: service.uuid,
id: service.id,
index
};
});