Skip to content

Commit 457113e

Browse files
committed
Feat(Grapher) ability to render nothing
1 parent 446149f commit 457113e

6 files changed

Lines changed: 37 additions & 12 deletions

File tree

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ module.exports = {
4242
'hit_buttons': '<rootDir>/public/js/null_plugins/hit_buttons.js',
4343
'search_header_plugin': '<rootDir>/public/js/null_plugins/search_header_plugin.js',
4444
'circos$': '<rootDir>/public/js/tests/mocks/circos.js',
45+
'grapher': '<rootDir>/public/js/grapher.js',
46+
'histogram': '<rootDir>/public/js/null_plugins/grapher/histogram.js',
4547
},
4648
watchPlugins: [
4749
'jest-watch-typeahead/filename',
4850
'jest-watch-typeahead/testname'
4951
],
5052
resetMocks: true
51-
};
53+
};

public/js/grapher.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ export default function Grapher(Graph) {
2929
}
3030

3131
render() {
32-
var cssClasses = Graph.className() + ' grapher';
33-
return (
34-
<div ref="grapher" className={cssClasses}>
35-
{this.header()}
36-
{this.svgContainerJSX()}
37-
</div>
38-
);
32+
// Do not render when Graph.name() is null
33+
if (Graph.name() === null) {
34+
return null;
35+
} else {
36+
var cssClasses = Graph.className() + ' grapher';
37+
return (
38+
<div ref="grapher" className={cssClasses}>
39+
{this.header()}
40+
{this.svgContainerJSX()}
41+
</div>
42+
);
43+
}
3944
}
4045

4146
header() {
@@ -123,4 +128,4 @@ $(window).resize(
123128
grapher.draw();
124129
});
125130
}, 125)
126-
);
131+
);

public/js/null_plugins/grapher/histogram.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class Graph {
1616
static dataName(_props) {
1717
return null;
1818
}
19+
20+
static graphId() {
21+
return null;
22+
}
1923
}
2024

2125
export default Grapher(Graph);

public/js/null_plugins/report_plugins.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Histogram from 'histogram';
2+
13
class ReportPlugins {
24
constructor(parent) {
35
this.parent = parent;
@@ -14,6 +16,7 @@ class ReportPlugins {
1416
}
1517

1618
generateStats() {
19+
return (<Histogram />)
1720
}
1821
}
1922

public/sequenceserver-report.min.js

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/sequenceserver-search.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)