Skip to content

Commit

Permalink
Merge pull request #7 from bioinformatics-ua/imp/zip
Browse files Browse the repository at this point in the history
Capability to support web zip plugins
  • Loading branch information
bastiao committed Jan 14, 2016
2 parents 655c9d1 + 3957056 commit 6d144df
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
<resource>
<directory>src/main/resources/html5/</directory>
</resource>
<resource>
<directory>src/main/resources/webplugin-sample</directory>
<targetPath>WebPlugins/webplugin-sample</targetPath>
<filtering>false</filtering>
<includes>
<include>package.json</include>
<include>module.js</include>
</includes>
</resource>
</resources>

<plugins>
Expand Down Expand Up @@ -140,5 +149,7 @@
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>


</dependencies>
</project>
3 changes: 3 additions & 0 deletions src/main/resources/webplugin-sample/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
1 change: 1 addition & 0 deletions src/main/resources/webplugin-sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
14 changes: 14 additions & 0 deletions src/main/resources/webplugin-sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# demo
> demo
This is a web UI menu plugin for Dicoogle.

## Building

```bash
npm install
```

## Deploying

Place `module.js` and `package.json` in a folder in the WebPlugins directory.
87 changes: 87 additions & 0 deletions src/main/resources/webplugin-sample/module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

/******/ // The require function
/******/ function __webpack_require__(moduleId) {

/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;

/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };

/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ // Flag the module as loaded
/******/ module.loaded = true;

/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }


/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;

/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {

'use strict';

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; }; }();

Object.defineProperty(exports, "__esModule", {
value: true
});

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* global Dicoogle */

var MyPlugin = function () {
function MyPlugin() {
_classCallCheck(this, MyPlugin);
}
// TODO initialize plugin here

/**
* @param {DOMElement} parent
* @param {DOMElement} slot
*/

_createClass(MyPlugin, [{
key: 'render',
value: function render(parent, slot) {
// TODO mount a new web component here
var div = document.createElement('div');
div.innerHTML = 'Hello, Dicoogle!';
parent.appendChild(div);
}
}]);

return MyPlugin;
}();

exports.default = MyPlugin;

/***/ }
/******/ ]);
34 changes: 34 additions & 0 deletions src/main/resources/webplugin-sample/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "demo",
"version": "0.1.0",
"description": "demo",
"files": [
"module.js"
],
"scripts": {
"build": "webpack",
"build-debug": "webpack --devtool inline-source-map",
"prepublish": "npm run build"
},
"author": "Luís A. Bastião Silva <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "bastiao/demo"
},
"keywords": [
"dicoogle",
"dicoogle-plugin"
],
"dicoogle": {
"slot-id": "menu",
"caption": "Webplugin-Sample",
"module-file": "module.js"
},
"devDependencies": {
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-preset-es2015": "^6.3.13",
"webpack": "^1.12.11"
}
}
21 changes: 21 additions & 0 deletions src/main/resources/webplugin-sample/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* global Dicoogle */

export default class MyPlugin {

constructor() {
// TODO initialize plugin here
}

/**
* @param {DOMElement} parent
* @param {DOMElement} slot
*/
render(parent, slot) {
// TODO mount a new web component here
const div = document.createElement('div');
div.innerHTML = 'Hello, Dicoogle!';
parent.appendChild(div);

}

}
20 changes: 20 additions & 0 deletions src/main/resources/webplugin-sample/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
entry: './src/index.js',
output: {
filename: 'module.js',
libraryTarget: 'commonjs2'
},
module: {
loaders: [
{
test: /src\/.*\.js?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015']
}
}
]
},
externals: ['react', 'dicoogle-client', 'dicoole-webcore']
};

0 comments on commit 6d144df

Please sign in to comment.