mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Add data-cy to content loader; move simulatioWorker to /util directory.
This commit is contained in:
@@ -24,7 +24,7 @@ const TopologyIcon = styled(PFTopologyIcon)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const ContentLoading = ({ className, progress }) => (
|
const ContentLoading = ({ className, progress }) => (
|
||||||
<EmptyState variant="full" className={className}>
|
<EmptyState variant="full" className={className} data-cy={className}>
|
||||||
<TopologyIcon />
|
<TopologyIcon />
|
||||||
<Progress
|
<Progress
|
||||||
value={progress}
|
value={progress}
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
import * as d3 from 'd3';
|
|
||||||
import { MESH_FORCE_LAYOUT } from '../../constants';
|
|
||||||
|
|
||||||
onmessage = function calculateLayout({ data: { nodes, links } }) {
|
|
||||||
const simulation = d3
|
|
||||||
.forceSimulation(nodes)
|
|
||||||
.force(
|
|
||||||
'charge',
|
|
||||||
d3
|
|
||||||
.forceManyBody(MESH_FORCE_LAYOUT.defaultForceBody)
|
|
||||||
.strength(MESH_FORCE_LAYOUT.defaultForceStrength)
|
|
||||||
)
|
|
||||||
.force(
|
|
||||||
'link',
|
|
||||||
d3.forceLink(links).id((d) => d.hostname)
|
|
||||||
)
|
|
||||||
.force('collide', d3.forceCollide(MESH_FORCE_LAYOUT.defaultCollisionFactor))
|
|
||||||
.force('forceX', d3.forceX(MESH_FORCE_LAYOUT.defaultForceX))
|
|
||||||
.force('forceY', d3.forceY(MESH_FORCE_LAYOUT.defaultForceY))
|
|
||||||
.stop();
|
|
||||||
|
|
||||||
for (
|
|
||||||
let i = 0,
|
|
||||||
n = Math.ceil(
|
|
||||||
Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())
|
|
||||||
);
|
|
||||||
i < n;
|
|
||||||
++i
|
|
||||||
) {
|
|
||||||
postMessage({ type: 'tick', progress: i / n });
|
|
||||||
simulation.tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
postMessage({ type: 'end', nodes, links });
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user