Skip to content

Commit

Permalink
only suppress restart/die events due to licensing
Browse files Browse the repository at this point in the history
If already licensed these events should be processed as they would be
for any other kernel type
  • Loading branch information
jhanna-kx committed Feb 4, 2019
1 parent d707a6b commit a47a9fc
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions jupyterq_licensemgr/jupyterq_licensemgr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $.fn.bindFirst = function(name, fn) {

var IFRAME = null
var DIALOG = null;
var NEEDLICENSE = false;
var LICSTATUS = 'unknown'; // unknown, licensed, unlicensed

var BASE = location.protocol + "//" + location.host;
function close() {
Expand All @@ -34,7 +34,7 @@ window.J=J;
var actions = {
"license": function(text) {
if(IFRAME != null) return;
NEEDLICENSE=true;
LICSTATUS='unlicensed';

close();

Expand All @@ -50,11 +50,11 @@ window.J=J;
},

"ready": function() {
if(NEEDLICENSE) {
J.notebook.session.restart()
NEEDLICENSE = false;
if(LICSTATUS === 'unlicensed') {
J.notebook.session.restart();
close();
}
LICSTATUS = 'licensed';
}
}

Expand All @@ -78,22 +78,18 @@ window.J=J;

function suppress(evt,info) {
if(J.notebook.kernel_selector.current_selection == 'qpk') {
info.attempt=69;

then_check_kdb();
evt.stopImmediatePropagation();
evt.preventDefault();
if(LICSTATUS !== 'licensed') {
info.attempt = 42;
evt.stopImmediatePropagation();
evt.preventDefault();
}
}

return true;
}

window.addEventListener("message", function(x) {
if(IFRAME != null){
console.log(x.source);
console.log(IFRAME.get(0).contentWindow);
}

if(IFRAME != null && x.source == IFRAME.get(0).contentWindow) {
if(typeof x.data == 'string') x= JSON.parse(x.data); else x=x.data;
var h = new Image();
Expand Down

0 comments on commit a47a9fc

Please sign in to comment.