Compare commits

...

2 Commits

Author SHA1 Message Date
a11ab24a0c Adding support for realtime 2016-11-26 17:20:42 +00:00
9913a514b7 Electron API testing 2016-11-22 09:41:51 +00:00
8 changed files with 280 additions and 3 deletions

86
electron/bundle.js Normal file
View File

@ -0,0 +1,86 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2016, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/NewWindowAction",
"./src/ElectronInitializer",
'openmct'
], function (
NewWindowAction,
ElectronInitializer,
openmct
) {
function SyncedNewWindowAction () {
this.synced = true;
NewWindowAction.apply(this, arguments)
}
SyncedNewWindowAction.prototype = Object.create(NewWindowAction.prototype);
openmct.legacyRegistry.register("electron", {
"extensions": {
"routes": [{
"when": "/window/:ids*",
"templateUrl": "templates/browse-window.html",
"reloadOnSearch": false
}],
"runs": [{
"implementation": ElectronInitializer,
"depends": ["timeConductor", "$location"]
}],
"actions": [
{
"key": "newWindowAction",
"name": "Open in Synchronized Window",
"implementation": SyncedNewWindowAction,
"description": "Open in a new window which follows this time conductor",
"depends": [
"urlService"
],
"category": [
"view-control",
"contextual"
],
"group": "windowing",
"cssclass": "icon-new-window",
"priority": "preferred"
},
{
"key": "newWindowUnsynched",
"name": "Open in Non-synchronized Window",
"implementation": NewWindowAction,
"description": "Open in a new window with its own time conductor",
"depends": [
"urlService"
],
"category": [
"view-control",
"contextual"
],
"group": "windowing",
"cssclass": "icon-new-window",
"priority": "preferred"
}
]
}
});
});

View File

@ -0,0 +1,45 @@
<!--
Open MCT, Copyright (c) 2014-2016, United States Government
as represented by the Administrator of the National Aeronautics and Space
Administration. All rights reserved.
Open MCT is licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Open MCT includes source code licensed under additional open source
licenses. See the Open Source Licenses file (LICENSES.md) included with
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<style>
.primary-pane {
width: 100%;
height: 100%;
}
</style>
<div class="abs holder-all" ng-controller="BrowseController">
<div class="abs holder holder-main browse-area s-browse-area browse-wrapper">
<div class='abs contents'>
<div class='split-pane-component items pane primary-pane right'>
<div class='holder holder-object-and-inspector abs' id='content-area'
class="pane-inspect-hidden">
<div class='t-object pane primary-pane left'>
<mct-representation mct-object="navigatedObject"
key="'view-object'"
class="abs holder holder-object">
</mct-representation>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,75 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2016, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
var electron = nodeRequire('electron');
define(
[],
function () {
/**
* The new tab action allows a domain object to be opened
* into a new browser tab.
* @memberof platform/commonUI/browse
* @constructor
* @implements {Action}
*/
function ElectronInitializer(conductor, $location) {
var childWindow = $location.search().child === 'true';
// If child window, listen for conductor state updates from main thread.
if (childWindow) {
electron.ipcRenderer.on('conductor-bounds', function (event, bounds) {
var cBounds = conductor.bounds();
var synced = $location.search().synced === 'true';
if (synced) {
if (synced &&
(bounds.start !== cBounds.start || bounds.end !== cBounds.end)) {
conductor.bounds(bounds);
}
}
});
electron.ipcRenderer.on('conductor-follow', function (event, follow) {
var synced = $location.search().synced === 'true';
follow = !!follow;
if (synced && follow !== conductor.follow()) {
conductor.follow(follow);
}
});
}
// If parent window, listen to bounds changes and propogate them back to the main thread. From there they
// will be disseminated to child windows.
if (!childWindow) {
conductor.on('bounds', function (bounds) {
electron.ipcRenderer.send('conductor-bounds', bounds);
});
conductor.on('follow', function (follow) {
electron.ipcRenderer.send('conductor-follow', follow);
});
}
}
return ElectronInitializer;
}
);

View File

@ -0,0 +1,68 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2016, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
var electron = nodeRequire('electron');
/**
* Module defining NewWindowAction (Originally NewWindowAction). Created by vwoeltje on 11/18/14.
*/
define(
[],
function () {
/**
* The new tab action allows a domain object to be opened
* into a new browser tab.
* @memberof platform/commonUI/browse
* @constructor
* @implements {Action}
*/
function NewWindowAction(urlService, context) {
context = context || {};
var windae = undefined;
this.urlService = urlService;
this.open = function (url) {
windae = new electron.remote.BrowserWindow({width: 800, height: 600});
windae.on('close', function () {
windae = null;
});
var url = [
['file:/', __dirname, url].join('/'),
'synced=' + !!(this.synced),
'child=' + true
].join('&');
windae.loadURL(url);
};
this.open.bind(this);
// Choose the object to be opened into a new tab
this.domainObject = context.selectedObject || context.domainObject;
}
NewWindowAction.prototype.perform = function () {
this.open(
this.urlService.urlForNewTab("window", this.domainObject),
"_blank"
);
};
return NewWindowAction;
}
);

View File

@ -36,7 +36,7 @@ var gulp = require('gulp'),
reports: 'dist/reports',
scss: ['./platform/**/*.scss', './example/**/*.scss'],
assets: [
'./{example,platform}/**/*.{css,css.map,png,svg,ico,woff,eot,ttf}'
'./{example,platform}/**/*.{css,css.map,png,jpg,svg,ico,woff,eot,ttf}'
],
scripts: [ 'openmct.js', 'platform/**/*.js', 'src/**/*.js' ],
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],

View File

@ -219,7 +219,7 @@ define([
"$window"
]
},
{
/* {
"key": "window",
"name": "Open In New Tab",
"implementation": NewTabAction,
@ -235,7 +235,7 @@ define([
"group": "windowing",
"cssclass": "icon-new-window",
"priority": "preferred"
},
},*/
{
"key": "fullscreen",
"implementation": FullscreenAction,

View File

@ -59,5 +59,7 @@
</mct-representation>
</div>
</div>
<div ng-class="{'hide': synced}">
<mct-include key="'conductor'" class="abs holder flex-elem flex-fixed l-flex-row l-time-conductor-holder"></mct-include>
</div>
</div>

View File

@ -74,6 +74,7 @@ define(
return $scope[action] && $scope[action]();
};
$scope.synced = $location.search().synced === 'true';
}
return BrowseObjectController;