Skip to content

Commit eed276c

Browse files
committed
clean diff
1 parent 88449f4 commit eed276c

File tree

5 files changed

+38
-21
lines changed

5 files changed

+38
-21
lines changed

src/app/components/Chart.jsx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import React, { Component } from 'react';
1515
import * as d3 from 'd3';
1616

17-
const colors = ['#2C4870','#519331','#AA5039','#8B2F5F','#C5B738','#858DFF', '#FF8D02','#FFCD51','#ACDAE6','#FC997E','#CF93AD','#AA3939','#AA6C39','#226666',]
17+
const colors = ['#95B6B7', '#475485', '#519331', '#AA5039', '#8B2F5F', '#C5B738', '#858DFF', '#FF8D02', '#FFCD51', '#ACDAE6', '#FC997E', '#CF93AD', '#AA3939', '#AA6C39', '#226666', '#2C4870'];
1818

1919
let root = {};
2020
class Chart extends Component {
@@ -34,7 +34,7 @@ class Chart extends Component {
3434
componentDidUpdate() {
3535
const { hierarchy } = this.props;
3636
root = JSON.parse(JSON.stringify(hierarchy));
37-
console.log("Chart -> componentDidUpdate -> hierarchy", hierarchy);
37+
console.log('Chart -> componentDidUpdate -> hierarchy', hierarchy);
3838
this.maked3Tree();
3939
}
4040

@@ -46,7 +46,6 @@ class Chart extends Component {
4646
}
4747

4848
maked3Tree() {
49-
5049
this.removed3Tree();
5150
const margin = {
5251
top: 0,
@@ -76,9 +75,9 @@ class Chart extends Component {
7675
const tree = d3.tree()
7776
// this assigns width of tree to be 2pi
7877
// .size([2 * Math.PI, radius / 1.3])
79-
.nodeSize([width/10, height/10])
78+
.nodeSize([width / 10, height / 10])
8079
// .separation(function (a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; });
81-
.separation(function (a, b) { return (a.parent == b.parent ? 2 : 2)});
80+
.separation(function (a, b) { return (a.parent == b.parent ? 2 : 2); });
8281

8382
const d3root = tree(hierarchy);
8483

@@ -92,9 +91,7 @@ class Chart extends Component {
9291
.append('path')
9392
.attr('class', 'link')
9493
.attr('d', d3.linkRadial()
95-
.angle(d => {
96-
return d.x
97-
})
94+
.angle(d => d.x)
9895
.radius(d => d.y));
9996

10097
const node = g.selectAll('.node')
@@ -103,15 +100,14 @@ class Chart extends Component {
103100
.enter()
104101
.append('g')
105102
.style('fill', function (d) {
106-
if(d.data.branch < colors.length){
107-
return colors[d.data.branch]
108-
} else {
109-
let indexColors = d.data.branch - colors.length;
110-
while(indexColors > colors.length){
111-
indexColors = indexColors - colors.length;
112-
}
113-
return colors[indexColors]
103+
if (d.data.branch < colors.length) {
104+
return colors[d.data.branch];
105+
}
106+
let indexColors = d.data.branch - colors.length;
107+
while (indexColors > colors.length) {
108+
indexColors -= colors.length;
114109
}
110+
return colors[indexColors];
115111
})
116112
.attr('class', 'node--internal')
117113
// })
@@ -176,7 +172,7 @@ class Chart extends Component {
176172

177173
chartContainer.call(d3.zoom()
178174
.extent([[0, 0], [width, height]])
179-
.scaleExtent([0, 8]) //scaleExtent([minimum scale factor, maximum scale factor])
175+
.scaleExtent([0, 8]) // scaleExtent([minimum scale factor, maximum scale factor])
180176
.on('zoom', zoomed));
181177

182178
function dragstarted() {

src/app/components/Diff.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function Diff({ snapshot, show }) {
3232
if (newObj.componentData) {
3333
delete newObj.componentData;
3434
}
35+
if (newObj.parent || newObj.parent === null) {
36+
delete newObj.parent;
37+
}
3538
if (newObj.state === 'stateless') {
3639
delete newObj.state;
3740
}

src/app/components/PerfView.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const PerfView = ({ snapshots, viewIndex }) => {
4343
// set up color scaling function
4444
const color = d3.scaleLinear()
4545
.domain([0, 7])
46-
.range(['hsl(152,80%,80%)', 'hsl(228,30%,40%)'])
46+
.range(['hsl(152,30%,80%)', 'hsl(228,30%,40%)'])
47+
// .range(['hsl(210,30%,80%)', 'hsl(152,30%,40%)'])
4748
.interpolate(d3.interpolateHcl);
4849

4950
// set up circle-packing layout function

src/app/containers/MainContainer.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ function MainContainer() {
9494
if (newObj.componentData) {
9595
delete newObj.componentData;
9696
}
97+
if (newObj.parent || newObj.parent === null){
98+
delete newObj.parent;
99+
}
97100
if (newObj.state === 'stateless') {
98101
delete newObj.state;
99102
}

src/extension/background.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ chrome.runtime.onConnect.addListener(port => {
154154
// gabi :: reset hierarchy
155155
tabsObj[tabId].hierarchy.children = [];
156156
// gabi :: reset hierarchy to page last state recorded
157-
tabsObj[tabId].hierarchy.stateSnapshot = tabsObj[tabId].snapshots[0];
157+
tabsObj[tabId].hierarchy.stateSnapshot = { ...tabsObj[tabId].snapshots[0] };
158158
// gabi :: reset currLocation to page last state recorded
159159
tabsObj[tabId].currLocation = tabsObj[tabId].hierarchy;
160160
// gabi :: reset index
@@ -216,7 +216,6 @@ chrome.runtime.onMessage.addListener((request, sender) => {
216216
}
217217
// this case causes d3 graph to display 1 instead of 0
218218
case 'tabReload': {
219-
220219
console.log('ran execute script to inject backend');
221220
chrome.tabs.executeScript(tabId, {
222221
code: `
@@ -231,7 +230,7 @@ chrome.runtime.onMessage.addListener((request, sender) => {
231230
injectScript(chrome.runtime.getURL('bundles/backend.bundle.js'), 'body');
232231
`,
233232
});
234-
233+
console.log('this is from tabReload', request);
235234
tabsObj[tabId].mode.locked = false;
236235
tabsObj[tabId].mode.paused = false;
237236
// dont remove snapshots if persisting
@@ -241,14 +240,29 @@ chrome.runtime.onMessage.addListener((request, sender) => {
241240
tabsObj[tabId].snapshots = tabsObj[tabId].initialSnapshot;
242241
// gabi :: reset hierarchy to page initial state recorded when empted
243242
tabsObj[tabId].hierarchy = tabsObj[tabId].initialHierarchy;
243+
// gabi :: resolve no initial state
244+
// tabsObj[tabId].hierarchy = null;
244245
} else {
246+
// tabsObj[tabId].snapshots = null;
245247
// gabi :: reset snapshots to page initial state
246248
tabsObj[tabId].snapshots.splice(1);
249+
// gabi :: resolve no initial state
250+
// tabsObj[tabId].snapshots = [{
251+
// state: {"@@INIT":"Inicial State"},
252+
// name: "nameless",
253+
// componentData: {},
254+
// children: [],
255+
// parent: null,
256+
// }]
247257
// gabi :: reset hierarchy to page initial state
248258
if (tabsObj[tabId].hierarchy) {
249259
tabsObj[tabId].hierarchy.children = [];
260+
// gabi :: resolve no initial state
261+
// tabsObj[tabId].hierarchy = null;
250262
// gabi :: reset currParent plus current state
251263
tabsObj[tabId].currParent = 1;
264+
// gabi :: resolve no initial state
265+
tabsObj[tabId].currParent = 0;
252266
} else {
253267
// gabi :: reset currParent
254268
tabsObj[tabId].currParent = 0;

0 commit comments

Comments
 (0)