Skip to content

Commit

Permalink
Creates directories and placeholder files for new PLUGIN design
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerceo committed Apr 20, 2022
1 parent 6312258 commit b6c9b4d
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 1 deletion.
3 changes: 2 additions & 1 deletion i2b2_config_cells.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
{ "code": "ONT" },
{ "code": "CRC" },
{ "code": "LEGACYPLUGIN", "forceLoading": true},
{ "code": "WORK"}
{ "code": "PLUGIN", "forceLoading": true },
{ "code": "WORK" }
]
74 changes: 74 additions & 0 deletions js-i2b2/cells/PLUGIN/PLUGIN_ctrlr_general.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* @projectDescription View controller for ONT's "Terms" tab.
* @inherits i2b2.PLUGIN
* @namespace i2b2.PLUGIN.
* @author Nick Benik, Griffin Weber MD PhD
* @version 2.0
**/
console.group('Load & Execute component file: PLUGIN');
console.time('execute time');




i2b2.events.afterAllCellsLoaded.add((function() {
// Build the configure object that goes to the plugin-side i2b2 libraries
// Get cells and their known AJAX calls
let ajaxTree = {};
for (let idx in i2b2) {
if (!idx.includes("PLUGIN") && i2b2[idx].ajax !== undefined) {
// found a cell
ajaxTree[idx] = [];
console.log(idx);
for (let funcName in i2b2[idx].ajax) {
if (funcName.substr(0,1) !== '_' && typeof i2b2[idx].ajax[funcName] === 'function') {
ajaxTree[idx].push(funcName);
}
}
}
}
i2b2.PLUGIN.model.config = {};
i2b2.PLUGIN.model.config.ajax = ajaxTree;

// add the list of all known SDX data types
i2b2.PLUGIN.model.config.sdx = Object.keys(i2b2.sdx.TypeControllers);
}));
















// Below code is executed once the entire cell has been loaded
//================================================================================================== //
i2b2.events.afterCellInit.add((function(cell){
if (cell.cellCode === "PLUGIN") {
console.debug('[EVENT CAPTURED i2b2.events.afterCellInit]');
// ___ Register this view with the layout manager ____________________
i2b2.layout.registerWindowHandler("i2b2.PLUGIN.view",
(function (container, scope) {
// THIS IS THE MASTER FUNCTION THAT IS USED TO INITIALIZE THE WORK CELL'S MAIN VIEW
i2b2.PLUGIN.view.lm_view = container;

// add the cellWhite flare
let treeTarget = $('<div class="cellWhite" id="i2b2TreeviewOntNav"></div>').appendTo(container._contentElement);

}).bind(this)
);
}
}));


// ================================================================================================== //
console.timeEnd('execute time');
console.groupEnd();
14 changes: 14 additions & 0 deletions js-i2b2/cells/PLUGIN/cell_config_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"files": [
"PLUGIN_ctrlr_general.js"
],
"preload": [],
"css": [],
"config": {
"name": "Plugins Manager",
"description": "Manager component for modern i2b2v2 plugins.",
"icons": {},
"category": ["core","plugins"],
"paramTranslation": []
}
}
4 changes: 4 additions & 0 deletions js-i2b2/cells/PLUGIN/libs/i2b2-ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* This file is the library that is loaded into a plugin to allow
* communications with the i2b2 cells.
**/
4 changes: 4 additions & 0 deletions js-i2b2/cells/PLUGIN/libs/i2b2-sdx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* This file is the library that is loaded into a plugin to allow
* SDX-style drag and drop with the main i2b2 UI.
**/
5 changes: 5 additions & 0 deletions js-i2b2/cells/PLUGIN/libs/i2b2-state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* This file is the library that is loaded into a plugin to allow
* plugins to manage a state which handles iframe contents destruction
* upon iframe movement within the DOM (as performed by Golden Layout)
**/
13 changes: 13 additions & 0 deletions plugins/edu/harvard/hms/catalyst/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Plugin Example</title>

<script type="text/javascript" src="i2b2-ajax.js" ></script>

</head>
<body>

</body>
</html>
4 changes: 4 additions & 0 deletions plugins/edu/harvard/hms/catalyst/example/js/i2b2-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* This is the loader library that handshakes with its iframe parent to get locations for additional library files
* and handles the initialization process (and state restoration)
*/

0 comments on commit b6c9b4d

Please sign in to comment.