From 20e2bdaf44235417c96efdb5cfdcf431497f858f Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Wed, 20 Jan 2016 14:29:26 -0800 Subject: [PATCH 1/2] Initial version of the inline powerbox It's still a bit rough around the edges, but the basic functionality works. --- shell/client/grainview.js | 14 ++ shell/client/shell.html | 1 + shell/client/shell.scss | 5 + shell/server/core.js | 34 +++ shell/server/drivers/external-ui-view.js | 266 +++++++++++++---------- shell/shared/grain.js | 89 +++++++- tests/apps/powerbox.js | 62 ++++++ 7 files changed, 351 insertions(+), 120 deletions(-) diff --git a/shell/client/grainview.js b/shell/client/grainview.js index 7bf8e051e5..f6ee1ab0f6 100644 --- a/shell/client/grainview.js +++ b/shell/client/grainview.js @@ -42,6 +42,8 @@ GrainView = class GrainView { this.revealIdentity(); } + this.enableInlinePowerbox = new ReactiveVar(false); + // We manage our Blaze view directly in order to get more control over when iframes get // re-rendered. E.g. if we were to instead use a template with {{#each grains}} iterating over // the list of open grains, all grains might get re-rendered whenever a grain is removed from the @@ -617,6 +619,18 @@ GrainView = class GrainView { this._generatedApiToken = newApiToken; this._dep.changed(); } + + startInlinePowerbox(inlinePowerboxState) { + this.inlinePowerboxState = inlinePowerboxState; + if (inlinePowerboxState.isForeground) { + this.enableInlinePowerbox.set(true); + } else { + state.source.postMessage({ + rpcId: inlinePowerboxState.rpcId, + error: "Cannot start inline powerbox when app is not in foreground", + }, inlinePowerboxState.origin); + } + } }; const onceConditionIsTrue = (condition, continuation) => { diff --git a/shell/client/shell.html b/shell/client/shell.html index 9343663632..af64ae8bf0 100644 --- a/shell/client/shell.html +++ b/shell/client/shell.html @@ -155,6 +155,7 @@

Notice from Admin

{{/if}} {{/with}} +