mirror of
https://github.com/nasa/openmct.git
synced 2025-01-27 14:49:28 +00:00
Merge remote-tracking branch 'origin/master' into frontend-1047
This commit is contained in:
commit
fe3097707f
@ -1,4 +1,4 @@
|
||||
# Open MCT
|
||||
# Open MCT [![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Open MCT is a web-based platform for mission operations user interface
|
||||
software.
|
||||
@ -7,7 +7,7 @@ software.
|
||||
|
||||
A bundle is a group of software components (including source code, declared
|
||||
as AMD modules, as well as resources such as images and HTML templates)
|
||||
that are intended to be added or removed as a single unit. A plug-in for
|
||||
that is intended to be added or removed as a single unit. A plug-in for
|
||||
Open MCT will be expressed as a bundle; platform components are also
|
||||
expressed as bundles.
|
||||
|
||||
@ -133,6 +133,6 @@ documentation, may presume an understanding of these terms.
|
||||
it, and it is thereafter considered the _navigated_ object (until the
|
||||
user makes another such choice.)
|
||||
* _space_: A name used to identify a persistence store. Interactions with
|
||||
persistence with generally involve a `space` parameter in some form, to
|
||||
persistence will generally involve a `space` parameter in some form, to
|
||||
distinguish multiple persistence stores from one another (for cases
|
||||
where there are multiple valid persistence locations available.)
|
||||
|
8
app.js
8
app.js
@ -75,6 +75,8 @@
|
||||
// Expose everything else as static files
|
||||
app.use(express['static'](options.directory));
|
||||
|
||||
// Finally, open the HTTP server
|
||||
app.listen(options.port);
|
||||
}());
|
||||
// Finally, open the HTTP server and log the instance to the console
|
||||
app.listen(options.port, function() {
|
||||
console.log('Open MCT application running at localhost:' + options.port)
|
||||
});
|
||||
}());
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openmct",
|
||||
"version": "0.10.3-SNAPSHOT",
|
||||
"version": "0.11.0-SNAPSHOT",
|
||||
"description": "The Open MCT core platform",
|
||||
"dependencies": {
|
||||
"express": "^4.13.1",
|
||||
|
@ -208,7 +208,9 @@ define([
|
||||
"implementation": SaveAction,
|
||||
"name": "Save",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [],
|
||||
"depends": [
|
||||
"dialogService"
|
||||
],
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
|
@ -21,8 +21,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
['./SaveInProgressDialog'],
|
||||
function (SaveInProgressDialog) {
|
||||
|
||||
/**
|
||||
* The "Save" action; the action triggered by clicking Save from
|
||||
@ -33,9 +33,11 @@ define(
|
||||
* @memberof platform/commonUI/edit
|
||||
*/
|
||||
function SaveAction(
|
||||
dialogService,
|
||||
context
|
||||
) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.dialogService = dialogService;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,7 +48,8 @@ define(
|
||||
* @memberof platform/commonUI/edit.SaveAction#
|
||||
*/
|
||||
SaveAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject;
|
||||
var domainObject = this.domainObject,
|
||||
dialog = new SaveInProgressDialog(this.dialogService);
|
||||
|
||||
function resolveWith(object) {
|
||||
return function () {
|
||||
@ -72,8 +75,17 @@ define(
|
||||
return object;
|
||||
}
|
||||
|
||||
//return doSave().then(returnToBrowse);
|
||||
return doSave().then(returnToBrowse);
|
||||
function hideBlockingDialog(object) {
|
||||
dialog.hide();
|
||||
return object;
|
||||
}
|
||||
|
||||
dialog.show();
|
||||
|
||||
return doSave()
|
||||
.then(hideBlockingDialog)
|
||||
.then(returnToBrowse)
|
||||
.catch(hideBlockingDialog);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -21,9 +21,14 @@
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
['../creation/CreateWizard'],
|
||||
function (CreateWizard) {
|
||||
define([
|
||||
'../creation/CreateWizard',
|
||||
'./SaveInProgressDialog'
|
||||
],
|
||||
function (
|
||||
CreateWizard,
|
||||
SaveInProgressDialog
|
||||
) {
|
||||
|
||||
/**
|
||||
* The "Save" action; the action triggered by clicking Save from
|
||||
@ -105,7 +110,8 @@ define(
|
||||
SaveAsAction.prototype.save = function () {
|
||||
var self = this,
|
||||
domainObject = this.domainObject,
|
||||
copyService = this.copyService;
|
||||
copyService = this.copyService,
|
||||
dialog = new SaveInProgressDialog(this.dialogService);
|
||||
|
||||
function doWizardSave(parent) {
|
||||
var wizard = self.createWizard(parent);
|
||||
@ -116,6 +122,16 @@ define(
|
||||
).then(wizard.populateObjectFromInput.bind(wizard));
|
||||
}
|
||||
|
||||
function showBlockingDialog(object) {
|
||||
dialog.show();
|
||||
return object;
|
||||
}
|
||||
|
||||
function hideBlockingDialog(object) {
|
||||
dialog.hide();
|
||||
return object;
|
||||
}
|
||||
|
||||
function fetchObject(objectId) {
|
||||
return self.getObjectService().getObjects([objectId]).then(function (objects) {
|
||||
return objects[objectId];
|
||||
@ -140,14 +156,22 @@ define(
|
||||
.then(resolveWith(clonedObject));
|
||||
}
|
||||
|
||||
function onFailure() {
|
||||
hideBlockingDialog();
|
||||
return false;
|
||||
}
|
||||
|
||||
return getParent(domainObject)
|
||||
.then(doWizardSave)
|
||||
.then(showBlockingDialog)
|
||||
.then(getParent)
|
||||
.then(cloneIntoParent)
|
||||
.then(commitEditingAfterClone)
|
||||
.catch(resolveWith(false));
|
||||
.then(hideBlockingDialog)
|
||||
.catch(onFailure);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check if this action is applicable in a given context.
|
||||
* This will ensure that a domain object is present in the context,
|
||||
|
20
platform/commonUI/edit/src/actions/SaveInProgressDialog.js
Normal file
20
platform/commonUI/edit/src/actions/SaveInProgressDialog.js
Normal file
@ -0,0 +1,20 @@
|
||||
define([], function () {
|
||||
function SaveInProgressDialog(dialogService) {
|
||||
this.dialogService = dialogService;
|
||||
}
|
||||
|
||||
SaveInProgressDialog.prototype.show = function () {
|
||||
this.dialogService.showBlockingMessage({
|
||||
title: "Saving...",
|
||||
hint: "Do not navigate away from this page or close this browser tab while this message is displayed.",
|
||||
unknownProgress: true,
|
||||
severity: "info"
|
||||
});
|
||||
};
|
||||
|
||||
SaveInProgressDialog.prototype.hide = function () {
|
||||
this.dialogService.dismiss();
|
||||
};
|
||||
|
||||
return SaveInProgressDialog;
|
||||
});
|
@ -28,6 +28,7 @@ define(
|
||||
var mockDomainObject,
|
||||
mockEditorCapability,
|
||||
actionContext,
|
||||
dialogService,
|
||||
mockActionCapability,
|
||||
capabilities = {},
|
||||
action;
|
||||
@ -36,6 +37,9 @@ define(
|
||||
return {
|
||||
then: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
},
|
||||
catch: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -64,6 +68,10 @@ define(
|
||||
actionContext = {
|
||||
domainObject: mockDomainObject
|
||||
};
|
||||
dialogService = jasmine.createSpyObj(
|
||||
"dialogService",
|
||||
["showBlockingMessage", "dismiss"]
|
||||
);
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andCallFake(function (capability) {
|
||||
@ -73,8 +81,7 @@ define(
|
||||
mockEditorCapability.save.andReturn(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
|
||||
action = new SaveAction(actionContext);
|
||||
|
||||
action = new SaveAction(dialogService, actionContext);
|
||||
});
|
||||
|
||||
it("only applies to domain object with an editor capability", function () {
|
||||
@ -104,6 +111,19 @@ define(
|
||||
expect(mockActionCapability.perform).toHaveBeenCalledWith("navigate");
|
||||
});
|
||||
|
||||
it("shows a dialog while saving", function () {
|
||||
mockEditorCapability.save.andReturn(new Promise(function () {}));
|
||||
action.perform();
|
||||
expect(dialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
expect(dialogService.dismiss).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("hides a dialog when saving is complete", function () {
|
||||
action.perform();
|
||||
expect(dialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
expect(dialogService.dismiss).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -100,7 +100,9 @@ define(
|
||||
mockDialogService = jasmine.createSpyObj(
|
||||
"dialogService",
|
||||
[
|
||||
"getUserInput"
|
||||
"getUserInput",
|
||||
"showBlockingMessage",
|
||||
"dismiss"
|
||||
]
|
||||
);
|
||||
mockDialogService.getUserInput.andReturn(mockPromise(undefined));
|
||||
@ -169,6 +171,19 @@ define(
|
||||
expect(mockDialogService.getUserInput).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows a blocking dialog while waiting for save", function () {
|
||||
mockEditorCapability.save.andReturn(new Promise(function () {}));
|
||||
action.perform();
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
expect(mockDialogService.dismiss).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("hides the blocking dialog after saving", function () {
|
||||
action.perform();
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
expect(mockDialogService.dismiss).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -204,6 +204,7 @@ define([
|
||||
"implementation": TimeRangeController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"formatService",
|
||||
"DEFAULT_TIME_FORMAT",
|
||||
"now"
|
||||
|
@ -97,9 +97,8 @@ $plotLegendH: 20px;
|
||||
$plotSwatchD: 8px;
|
||||
// 1: Top, 2: right, 3: bottom, 4: left
|
||||
$plotDisplayArea: ($plotLegendH + $interiorMargin, 0, $plotXBarH + $interiorMargin, $plotYBarW);
|
||||
/* Based on current implementation of ~ 5 ticks per plot element;
|
||||
Include legend, plot-display-area and X ticks */
|
||||
$plotMinH: $plotLegendH + ($interiorMargin * 2) + ($plotYLabelMinH * 5) + nth($plotDisplayArea,3);
|
||||
/* min plot height is based on user testing to find minimum useful height */
|
||||
$plotMinH: 95px;
|
||||
/*************** Bubbles */
|
||||
$bubbleArwSize: 10px;
|
||||
$bubblePad: $interiorMargin;
|
||||
|
@ -53,7 +53,7 @@ define([
|
||||
* format has been otherwise specified
|
||||
* @param {Function} now a function to return current system time
|
||||
*/
|
||||
function TimeRangeController($scope, formatService, defaultFormat, now) {
|
||||
function TimeRangeController($scope, $timeout, formatService, defaultFormat, now) {
|
||||
this.$scope = $scope;
|
||||
this.formatService = formatService;
|
||||
this.defaultFormat = defaultFormat;
|
||||
@ -66,6 +66,7 @@ define([
|
||||
this.formatter = formatService.getFormat(defaultFormat);
|
||||
this.formStartChanged = false;
|
||||
this.formEndChanged = false;
|
||||
this.$timeout = $timeout;
|
||||
|
||||
this.$scope.ticks = [];
|
||||
|
||||
@ -259,18 +260,23 @@ define([
|
||||
};
|
||||
|
||||
TimeRangeController.prototype.updateBoundsFromForm = function () {
|
||||
if (this.formStartChanged) {
|
||||
this.$scope.ngModel.outer.start =
|
||||
this.$scope.ngModel.inner.start =
|
||||
this.$scope.formModel.start;
|
||||
this.formStartChanged = false;
|
||||
}
|
||||
if (this.formEndChanged) {
|
||||
this.$scope.ngModel.outer.end =
|
||||
this.$scope.ngModel.inner.end =
|
||||
this.$scope.formModel.end;
|
||||
this.formEndChanged = false;
|
||||
}
|
||||
var self = this;
|
||||
|
||||
//Allow Angular to trigger watches and determine whether values have changed.
|
||||
this.$timeout(function () {
|
||||
if (self.formStartChanged) {
|
||||
self.$scope.ngModel.outer.start =
|
||||
self.$scope.ngModel.inner.start =
|
||||
self.$scope.formModel.start;
|
||||
self.formStartChanged = false;
|
||||
}
|
||||
if (self.formEndChanged) {
|
||||
self.$scope.ngModel.outer.end =
|
||||
self.$scope.ngModel.inner.end =
|
||||
self.$scope.formModel.end;
|
||||
self.formEndChanged = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
TimeRangeController.prototype.onFormStartChange = function (
|
||||
|
@ -33,6 +33,7 @@ define(
|
||||
var mockScope,
|
||||
mockFormatService,
|
||||
testDefaultFormat,
|
||||
mockTimeout,
|
||||
mockNow,
|
||||
mockFormat,
|
||||
controller;
|
||||
@ -54,6 +55,10 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockTimeout = function (fn) {
|
||||
return fn();
|
||||
};
|
||||
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
["$apply", "$watch", "$watchCollection"]
|
||||
@ -78,6 +83,7 @@ define(
|
||||
|
||||
controller = new TimeRangeController(
|
||||
mockScope,
|
||||
mockTimeout,
|
||||
mockFormatService,
|
||||
testDefaultFormat,
|
||||
mockNow
|
||||
|
Loading…
x
Reference in New Issue
Block a user