Skip to content

Commit 6d144df

Browse files
committed
Merge pull request #7 from bioinformatics-ua/imp/zip
Capability to support web zip plugins
2 parents 655c9d1 + 3957056 commit 6d144df

8 files changed

Lines changed: 191 additions & 0 deletions

File tree

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
<resource>
2424
<directory>src/main/resources/html5/</directory>
2525
</resource>
26+
<resource>
27+
<directory>src/main/resources/webplugin-sample</directory>
28+
<targetPath>WebPlugins/webplugin-sample</targetPath>
29+
<filtering>false</filtering>
30+
<includes>
31+
<include>package.json</include>
32+
<include>module.js</include>
33+
</includes>
34+
</resource>
2635
</resources>
2736

2837
<plugins>
@@ -140,5 +149,7 @@
140149
<artifactId>jetty-webapp</artifactId>
141150
<version>${jetty.version}</version>
142151
</dependency>
152+
153+
143154
</dependencies>
144155
</project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# demo
2+
> demo
3+
4+
This is a web UI menu plugin for Dicoogle.
5+
6+
## Building
7+
8+
```bash
9+
npm install
10+
```
11+
12+
## Deploying
13+
14+
Place `module.js` and `package.json` in a folder in the WebPlugins directory.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
module.exports =
2+
/******/ (function(modules) { // webpackBootstrap
3+
/******/ // The module cache
4+
/******/ var installedModules = {};
5+
6+
/******/ // The require function
7+
/******/ function __webpack_require__(moduleId) {
8+
9+
/******/ // Check if module is in cache
10+
/******/ if(installedModules[moduleId])
11+
/******/ return installedModules[moduleId].exports;
12+
13+
/******/ // Create a new module (and put it into the cache)
14+
/******/ var module = installedModules[moduleId] = {
15+
/******/ exports: {},
16+
/******/ id: moduleId,
17+
/******/ loaded: false
18+
/******/ };
19+
20+
/******/ // Execute the module function
21+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22+
23+
/******/ // Flag the module as loaded
24+
/******/ module.loaded = true;
25+
26+
/******/ // Return the exports of the module
27+
/******/ return module.exports;
28+
/******/ }
29+
30+
31+
/******/ // expose the modules object (__webpack_modules__)
32+
/******/ __webpack_require__.m = modules;
33+
34+
/******/ // expose the module cache
35+
/******/ __webpack_require__.c = installedModules;
36+
37+
/******/ // __webpack_public_path__
38+
/******/ __webpack_require__.p = "";
39+
40+
/******/ // Load entry module and return exports
41+
/******/ return __webpack_require__(0);
42+
/******/ })
43+
/************************************************************************/
44+
/******/ ([
45+
/* 0 */
46+
/***/ function(module, exports) {
47+
48+
'use strict';
49+
50+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
51+
52+
Object.defineProperty(exports, "__esModule", {
53+
value: true
54+
});
55+
56+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
57+
58+
/* global Dicoogle */
59+
60+
var MyPlugin = function () {
61+
function MyPlugin() {
62+
_classCallCheck(this, MyPlugin);
63+
}
64+
// TODO initialize plugin here
65+
66+
/**
67+
* @param {DOMElement} parent
68+
* @param {DOMElement} slot
69+
*/
70+
71+
_createClass(MyPlugin, [{
72+
key: 'render',
73+
value: function render(parent, slot) {
74+
// TODO mount a new web component here
75+
var div = document.createElement('div');
76+
div.innerHTML = 'Hello, Dicoogle!';
77+
parent.appendChild(div);
78+
}
79+
}]);
80+
81+
return MyPlugin;
82+
}();
83+
84+
exports.default = MyPlugin;
85+
86+
/***/ }
87+
/******/ ]);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "demo",
3+
"version": "0.1.0",
4+
"description": "demo",
5+
"files": [
6+
"module.js"
7+
],
8+
"scripts": {
9+
"build": "webpack",
10+
"build-debug": "webpack --devtool inline-source-map",
11+
"prepublish": "npm run build"
12+
},
13+
"author": "Luís A. Bastião Silva <bastiao@bmd-software.com>",
14+
"license": "MIT",
15+
"repository": {
16+
"type": "git",
17+
"url": "bastiao/demo"
18+
},
19+
"keywords": [
20+
"dicoogle",
21+
"dicoogle-plugin"
22+
],
23+
"dicoogle": {
24+
"slot-id": "menu",
25+
"caption": "Webplugin-Sample",
26+
"module-file": "module.js"
27+
},
28+
"devDependencies": {
29+
"babel-core": "^6.4.0",
30+
"babel-loader": "^6.2.1",
31+
"babel-preset-es2015": "^6.3.13",
32+
"webpack": "^1.12.11"
33+
}
34+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* global Dicoogle */
2+
3+
export default class MyPlugin {
4+
5+
constructor() {
6+
// TODO initialize plugin here
7+
}
8+
9+
/**
10+
* @param {DOMElement} parent
11+
* @param {DOMElement} slot
12+
*/
13+
render(parent, slot) {
14+
// TODO mount a new web component here
15+
const div = document.createElement('div');
16+
div.innerHTML = 'Hello, Dicoogle!';
17+
parent.appendChild(div);
18+
19+
}
20+
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
entry: './src/index.js',
3+
output: {
4+
filename: 'module.js',
5+
libraryTarget: 'commonjs2'
6+
},
7+
module: {
8+
loaders: [
9+
{
10+
test: /src\/.*\.js?$/,
11+
exclude: /node_modules/,
12+
loader: 'babel',
13+
query: {
14+
presets: ['es2015']
15+
}
16+
}
17+
]
18+
},
19+
externals: ['react', 'dicoogle-client', 'dicoole-webcore']
20+
};

0 commit comments

Comments
 (0)