[Notifications] Added timestamp and object name to copy notifications (#2060)
* [Notifications] Added timestamp and object name to copy notifications \n -Fixes issue #331 -Added timestamps to all notifications -Added object name to copy success notification -Updated placement and style of notification timestamp as discussed with Charles.
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<div class="top-bar">
|
<div class="top-bar">
|
||||||
<div class="title">{{ngModel.title}}</div>
|
<div class="title">{{ngModel.title}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="hint" ng-hide="ngModel.hint === undefined">{{ngModel.hint}}</div>
|
<div class="hint" ng-hide="ngModel.hint === undefined">{{ngModel.hint + " [" + ngModel.timestamp + "]"}}</div>
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
<div class="message-action">
|
<div class="message-action">
|
||||||
{{ngModel.actionText}}
|
{{ngModel.actionText}}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
* @namespace platform/commonUI/notification
|
* @namespace platform/commonUI/notification
|
||||||
*/
|
*/
|
||||||
define(
|
define(
|
||||||
[],
|
['moment'],
|
||||||
function () {
|
function (moment) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A representation of a user action. Options are provided to
|
* A representation of a user action. Options are provided to
|
||||||
@@ -313,6 +313,7 @@ define(
|
|||||||
topic = this.topic();
|
topic = this.topic();
|
||||||
|
|
||||||
notificationModel.severity = notificationModel.severity || "info";
|
notificationModel.severity = notificationModel.severity || "info";
|
||||||
|
notificationModel.timestamp = moment.utc().format('YYYY-MM-DD hh:mm:ss.ms');
|
||||||
|
|
||||||
notification = {
|
notification = {
|
||||||
model: notificationModel,
|
model: notificationModel,
|
||||||
|
|||||||
@@ -111,9 +111,11 @@ define(
|
|||||||
CopyAction.prototype.perform = function () {
|
CopyAction.prototype.perform = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
function success() {
|
function success(domainObject) {
|
||||||
|
var domainObjectName = domainObject.model.name;
|
||||||
|
|
||||||
self.notification.dismiss();
|
self.notification.dismiss();
|
||||||
self.notificationService.info("Copying complete.");
|
self.notificationService.info(domainObjectName + " copied successfully.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function error(errorDetails) {
|
function error(errorDetails) {
|
||||||
@@ -160,4 +162,3 @@ define(
|
|||||||
return CopyAction;
|
return CopyAction;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ define(
|
|||||||
mockDialog,
|
mockDialog,
|
||||||
mockLog,
|
mockLog,
|
||||||
abstractComposePromise,
|
abstractComposePromise,
|
||||||
|
domainObject = {model: {name: "mockObject"}},
|
||||||
progress = {phase: "copying", totalObjects: 10, processed: 1};
|
progress = {phase: "copying", totalObjects: 10, processed: 1};
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@@ -108,7 +109,7 @@ define(
|
|||||||
|
|
||||||
abstractComposePromise.then.andCallFake(function (success, error, notify) {
|
abstractComposePromise.then.andCallFake(function (success, error, notify) {
|
||||||
notify(progress);
|
notify(progress);
|
||||||
success();
|
success(domainObject);
|
||||||
});
|
});
|
||||||
|
|
||||||
locationServicePromise.then.andCallFake(function (callback) {
|
locationServicePromise.then.andCallFake(function (callback) {
|
||||||
@@ -199,6 +200,10 @@ define(
|
|||||||
expect(notificationService.info).toHaveBeenCalled();
|
expect(notificationService.info).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("notifies the user with name of object copied", function () {
|
||||||
|
expect(notificationService.info)
|
||||||
|
.toHaveBeenCalledWith("mockObject copied successfully.");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user