Skip to content

Commit

Permalink
Merge branch 'master' into open1193
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Nov 9, 2016
2 parents fc36674 + dfa4591 commit a9ec8db
Show file tree
Hide file tree
Showing 43 changed files with 1,005 additions and 392 deletions.
18 changes: 6 additions & 12 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ Custom types may be registered via
[`openmct.types`]{@link module:openmct.MCT#types}:

```
openmct.types.addType('my-type', new openmct.Type({
openmct.types.addType('my-type', {
label: "My Type",
description: "This is a type that I added!"
description: "This is a type that I added!",
creatable: true
});
```

Expand Down Expand Up @@ -118,18 +119,11 @@ To do so, use the [`addRoot`]{@link module:openmct.ObjectAPI#addRoot} method
of the [object API]{@link module:openmct.ObjectAPI}:

```
openmct.objects.addRoot({
identifier: { key: "my-key", namespace: "my-namespace" }
name: "My Root-level Object",
type: "my-type"
});
openmct.objects.addRoot({ key: "my-key", namespace: "my-namespace" });
```

You can also remove this root-level object via its identifier:

```
openmct.objects.removeRoot({ key: "my-key", namespace: "my-namespace" });
```
Root objects are loaded just like any other objects, i.e. via an object
provider.

### Adding Composition Providers

Expand Down
6 changes: 3 additions & 3 deletions docs/src/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,10 @@ it in our bundle definition, as an extension of category `controllers`:
```diff
define([
'legacyRegistry',
'./src/controllers/TodoController'
+ './src/controllers/TodoController'
], function (
legacyRegistry,
TodoController
+ TodoController
) {
legacyRegistry.register("tutorials/todo", {
"name": "To-do Plugin",
Expand Down Expand Up @@ -2948,7 +2948,7 @@ will implement:
/*global define*/

define(
['./src/ExampleTelemetrySeries'],
['./ExampleTelemetrySeries'],
function (ExampleTelemetrySeries) {
"use strict";

Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ gulp.task('serve', function () {
var app = require('./app.js');
});

gulp.task('develop', ['serve', 'install', 'watch']);
gulp.task('develop', ['serve', 'stylesheets', 'watch']);

gulp.task('install', [ 'assets', 'scripts' ]);

Expand Down
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
[
'example/imagery',
'example/eventGenerator',
'example/generator'
'example/generator',
'platform/features/my-items',
'platform/persistence/local'
].forEach(
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
);
Expand Down
3 changes: 2 additions & 1 deletion platform/commonUI/edit/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ define([
"implementation": TransactionService,
"depends": [
"$q",
"$log"
"$log",
"cacheService"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion platform/commonUI/edit/src/actions/SaveAsAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ define([

function finishEditing(clonedObject) {
return domainObject.getCapability("editor").finish()
.then(resolveWith(clonedObject));
.then(function () {
return fetchObject(clonedObject.getId());
});
}

function onFailure() {
Expand Down
18 changes: 15 additions & 3 deletions platform/commonUI/edit/src/services/TransactionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ define(
* @param $q
* @constructor
*/
function TransactionService($q, $log) {
function TransactionService($q, $log, cacheService) {
this.$q = $q;
this.$log = $log;
this.cacheService = cacheService;
this.transactions = [];
}

Expand Down Expand Up @@ -87,14 +88,25 @@ define(

/**
* All persist calls deferred since the beginning of the transaction
* will be committed.
* will be committed. If this is the last transaction, clears the
* cache.
*
* @returns {Promise} resolved when all persist operations have
* completed. Will reject if any commit operations fail
*/
TransactionService.prototype.commit = function () {
var transaction = this.transactions.pop();
return transaction ? transaction.commit() : Promise.reject();
if (!transaction) {
return Promise.reject();
}
if (!this.isActive()) {
return transaction.commit()
.then(function (r) {
this.cacheService.flush();
return r;
}.bind(this));
}
return transaction.commit();
};

/**
Expand Down
1 change: 1 addition & 0 deletions platform/commonUI/general/res/sass/controls/_menus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@

.btn-bar.right .menu,
.menus-to-left .menu {
z-index: 79;
left: auto;
right: 0;
width: auto;
Expand Down
88 changes: 48 additions & 40 deletions platform/commonUI/notification/src/NotificationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ define(
* @property {boolean} [unknownProgress] a boolean indicating that the
* progress of the underlying task is unknown. This will result in a
* visually distinct progress bar.
* @property {boolean | number} [autoDismiss] If truthy, dialog will
* @property {boolean} [autoDismiss] If truthy, dialog will
* be automatically minimized or dismissed (depending on severity).
* Additionally, if the provided value is a number, it will be used
* as the delay period before being dismissed.
Expand Down Expand Up @@ -109,18 +109,18 @@ define(
* @memberof platform/commonUI/notification
* @constructor
* @param $timeout the Angular $timeout service
* @param DEFAULT_AUTO_DISMISS The period of time that an
* @param defaultAutoDismissTimeout The period of time that an
* auto-dismissed message will be displayed for.
* @param MINIMIZE_TIMEOUT When notifications are minimized, a brief
* @param minimizeAnimationTimeout When notifications are minimized, a brief
* animation is shown. This animation requires some time to execute,
* so a timeout is required before the notification is hidden
*/
function NotificationService($timeout, topic, DEFAULT_AUTO_DISMISS, MINIMIZE_TIMEOUT) {
function NotificationService($timeout, topic, defaultAutoDismissTimeout, minimizeAnimationTimeout) {
this.notifications = [];
this.$timeout = $timeout;
this.highest = { severity: "info" };
this.DEFAULT_AUTO_DISMISS = DEFAULT_AUTO_DISMISS;
this.MINIMIZE_TIMEOUT = MINIMIZE_TIMEOUT;
this.AUTO_DISMISS_TIMEOUT = defaultAutoDismissTimeout;
this.MINIMIZE_ANIMATION_TIMEOUT = minimizeAnimationTimeout;
this.topic = topic;

/*
Expand Down Expand Up @@ -162,7 +162,7 @@ define(
// in order to allow the minimize animation to run through.
service.$timeout(function () {
service.setActiveNotification(service.selectNextNotification());
}, service.MINIMIZE_TIMEOUT);
}, service.MINIMIZE_ANIMATION_TIMEOUT);
}
};

Expand Down Expand Up @@ -208,11 +208,16 @@ define(
* @private
*/
NotificationService.prototype.dismissOrMinimize = function (notification) {

//For now minimize everything, and have discussion around which
//kind of messages should or should not be in the minimized
//notifications list
notification.minimize();
var model = notification.model;
if (model.severity === "info") {
if (model.autoDismiss === false) {
notification.minimize();
} else {
notification.dismiss();
}
} else {
notification.minimize();
}
};

/**
Expand All @@ -226,7 +231,9 @@ define(
/**
* A convenience method for info notifications. Notifications
* created via this method will be auto-dismissed after a default
* wait period
* wait period unless explicitly forbidden by the caller through
* the {autoDismiss} property on the {NotificationModel}, in which
* case the notification will be minimized after the wait.
* @param {NotificationModel | string} message either a string for
* the title of the notification message, or a {@link NotificationModel}
* defining the options notification to display
Expand All @@ -235,7 +242,6 @@ define(
*/
NotificationService.prototype.info = function (message) {
var notificationModel = typeof message === "string" ? {title: message} : message;
notificationModel.autoDismiss = notificationModel.autoDismiss || true;
notificationModel.severity = "info";
return this.notify(notificationModel);
};
Expand Down Expand Up @@ -306,28 +312,29 @@ define(
activeNotification = self.active.notification,
topic = this.topic();

notificationModel.severity = notificationModel.severity || "info";

notification = {
model: notificationModel,

minimize: function () {
self.minimize(self, notification);
},

dismiss: function () {
self.dismiss(self, notification);
topic.notify();
},

dismissOrMinimize: function () {
self.dismissOrMinimize(notification);
},

onDismiss: function (callback) {
topic.listen(callback);
}
};

notificationModel.severity = notificationModel.severity || "info";
if (notificationModel.autoDismiss === true) {
notificationModel.autoDismiss = this.DEFAULT_AUTO_DISMISS;
}

//Notifications support a 'dismissable' attribute. This is a
// convenience to support adding a 'dismiss' option to the
// notification for the common case of dismissing a
Expand Down Expand Up @@ -366,38 +373,39 @@ define(
*/
this.active.timeout = this.$timeout(function () {
activeNotification.dismissOrMinimize();
}, this.DEFAULT_AUTO_DISMISS);
}, this.AUTO_DISMISS_TIMEOUT);
}

return notification;

};

/**
* Used internally by the NotificationService
* @private
*/
NotificationService.prototype.setActiveNotification =
function (notification) {
var timeout;
NotificationService.prototype.setActiveNotification = function (notification) {
var shouldAutoDismiss;
this.active.notification = notification;

this.active.notification = notification;
/*
If autoDismiss has been specified, OR there are other
notifications queued for display, setup a timeout to
dismiss the dialog.
*/
if (notification && (notification.model.autoDismiss ||
this.selectNextNotification())) {
if (!notification) {
delete this.active.timeout;
return;
}

timeout = notification.model.autoDismiss || this.DEFAULT_AUTO_DISMISS;
this.active.timeout = this.$timeout(function () {
notification.dismissOrMinimize();
}, timeout);
} else {
delete this.active.timeout;
}
};
if (notification.model.severity === "info") {
shouldAutoDismiss = true;
} else {
shouldAutoDismiss = notification.model.autoDismiss;
}

if (shouldAutoDismiss || this.selectNextNotification()) {
this.active.timeout = this.$timeout(function () {
notification.dismissOrMinimize();
}, this.AUTO_DISMISS_TIMEOUT);
} else {
delete this.active.timeout;
}
};

/**
* Used internally by the NotificationService
Expand Down
Loading

0 comments on commit a9ec8db

Please sign in to comment.