Skip to content

Commit f7b7332

Browse files
committed
Add a new plugin for customizing actions available on hits
1 parent 22aa5e9 commit f7b7332

6 files changed

Lines changed: 34 additions & 3 deletions

File tree

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = {
4343
moduleNameMapper: {
4444
'report_plugins': '<rootDir>/public/js/null_plugins/report_plugins.js',
4545
'download_links': '<rootDir>/public/js/null_plugins/download_links.js',
46+
'hit_buttons': '<rootDir>/public/js/null_plugins/hit_buttons.js',
4647
},
4748
watchPlugins: [
4849
'jest-watch-typeahead/filename',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
},
1111
"scripts": {
1212
"watch": "webpack --watch",
13-
"watch-cloud": "webpack --watch --env=reportPluginsPath='../sequence_server_js_extensions/report_plugins.js' --env=downloadLinks='../sequence_server_js_extensions/conserved_domains/download_links.js'",
13+
"watch-cloud": "webpack --watch --env=reportPluginsPath='../sequence_server_js_extensions/report_plugins.js' --env=downloadLinks='../sequence_server_js_extensions/conserved_domains/download_links.js' --env=hitButtons='../sequence_server_js_extensions/hit_buttons.js'",
1414
"test": "jest",
1515
"minify:css": "cleancss public/css/sequenceserver.css > public/css/sequenceserver.min.css",
1616
"build": "webpack && npm run minify:css",
17-
"build-cloud": "webpack --env=reportPluginsPath='../sequence_server_js_extensions/report_plugins.js' --env=downloadLinks='../sequence_server_js_extensions/conserved_domains/download_links.js' && npm run minify:css"
17+
"build-cloud": "webpack --env=reportPluginsPath='../sequence_server_js_extensions/report_plugins.js' --env=downloadLinks='../sequence_server_js_extensions/conserved_domains/download_links.js' --env=hitButtons='../sequence_server_js_extensions/hit_buttons.js' && npm run minify:css"
1818
},
1919
"dependencies": {
2020
"babel-plugin-transform-export-extensions": "^6.22.0",

public/js/hit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import _ from 'underscore';
44
import HSPOverview from './kablammo';
55
import downloadFASTA from './download_fasta';
66
import AlignmentExporter from './alignment_exporter'; // to download textual alignment
7+
import HitButtons from 'hit_buttons';
78

89
/**
910
* Component for each hit. Receives props from Report. Has no state.
@@ -26,6 +27,7 @@ export default class extends Component {
2627
this.hitLinks = this.hitLinks.bind(this);
2728
this.viewSequenceButton = this.viewSequenceButton.bind(this);
2829
this.downloadFASTAButton = this.downloadFASTAButton.bind(this);
30+
this.hit_buttons = new HitButtons(this);
2931
}
3032
shouldComponentUpdate() {
3133
return !this.props.hit;
@@ -142,6 +144,10 @@ export default class extends Component {
142144
}
143145
btns.push(this.downloadAlignmentButton());
144146

147+
this.hit_buttons.buttons().forEach((button) => {
148+
btns.push(button);
149+
});
150+
145151
return (
146152
<div className="hit-links">
147153
<label>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class HitButtons {
2+
constructor(hit) {
3+
this.hit = hit;
4+
}
5+
6+
buttons() {
7+
return [];
8+
}
9+
}
10+
11+
export default HitButtons;

public/sequenceserver-report.min.js

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

webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const webpack = require('webpack');
55
module.exports = (env, argv) => {
66
const reportPluginsPath = env.reportPluginsPath || './public/js/null_plugins/report_plugins.js';
77
const downloadLinks = env.downloadLinks || './public/js/null_plugins/download_links.js';
8+
const hitButtons = env.hitButtons || './public/js/null_plugins/hit_buttons.js';
89

910
return {
1011
entry: {
@@ -46,6 +47,7 @@ module.exports = (env, argv) => {
4647
alias: {
4748
'report_plugins': path.resolve(__dirname, reportPluginsPath),
4849
'download_links': path.resolve(__dirname, downloadLinks),
50+
'hit_buttons': path.resolve(__dirname, hitButtons),
4951
}
5052
}
5153
};

0 commit comments

Comments
 (0)