mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 05:38:12 +00:00
[Persistence] Show user, modification time
Show user name and modification time in dialog when revision-checking detects modifications. WTD-1033.
This commit is contained in:
@ -31,6 +31,12 @@
|
|||||||
"key": "persistence-failure-dialog",
|
"key": "persistence-failure-dialog",
|
||||||
"templateUrl": "templates/persistence-failure-dialog.html"
|
"templateUrl": "templates/persistence-failure-dialog.html"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"controllers": [
|
||||||
|
{
|
||||||
|
"key": "PersistenceFailureController",
|
||||||
|
"implementation": "PersistenceFailureController.js"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
<span ng-controller="PersistenceFailureController as controller">
|
||||||
|
|
||||||
<div ng-if="ngModel.revised.length > 0">
|
<div ng-if="ngModel.revised.length > 0">
|
||||||
External changes have been made to the following objects:
|
External changes have been made to the following objects:
|
||||||
<ul>
|
<ul>
|
||||||
@ -5,6 +7,10 @@
|
|||||||
<mct-representation key="'label'"
|
<mct-representation key="'label'"
|
||||||
mct-object="failure.domainObject">
|
mct-object="failure.domainObject">
|
||||||
</mct-representation>
|
</mct-representation>
|
||||||
|
was modified at
|
||||||
|
<b>{{controller.formatTimestamp(failure.error.model.modified)}}</b>
|
||||||
|
by
|
||||||
|
<i>{{controller.formatUsername(failure.error.model.modifier)}}</i>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
You may overwrite these objects, or discard your changes to keep
|
You may overwrite these objects, or discard your changes to keep
|
||||||
@ -22,3 +28,4 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</span>
|
@ -2,5 +2,7 @@
|
|||||||
|
|
||||||
define({
|
define({
|
||||||
REVISION_ERROR_KEY: "revision",
|
REVISION_ERROR_KEY: "revision",
|
||||||
OVERWRITE_KEY: "overwrite"
|
OVERWRITE_KEY: "overwrite",
|
||||||
|
TIMESTAMP_FORMAT: "YYYY-MM-DD HH:mm:ss\\Z",
|
||||||
|
UNKNOWN_USER: "unknown user"
|
||||||
});
|
});
|
@ -0,0 +1,32 @@
|
|||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
['moment', './PersistenceFailureConstants'],
|
||||||
|
function (moment, Constants) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller to support the template to be shown in the
|
||||||
|
* dialog shown for persistence failures.
|
||||||
|
*/
|
||||||
|
function PersistenceFailureController() {
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Format a timestamp for display in the dialog.
|
||||||
|
*/
|
||||||
|
formatTimestamp: function (timestamp) {
|
||||||
|
return moment.utc(timestamp)
|
||||||
|
.format(Constants.TIMESTAMP_FORMAT);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Format a user name for display in the dialog.
|
||||||
|
*/
|
||||||
|
formatUsername: function (username) {
|
||||||
|
return username || Constants.UNKNOWN_USER;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return PersistenceFailureController;
|
||||||
|
}
|
||||||
|
);
|
@ -0,0 +1,27 @@
|
|||||||
|
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||||
|
|
||||||
|
|
||||||
|
define(
|
||||||
|
["../src/PersistenceFailureController"],
|
||||||
|
function (PersistenceFailureController) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
describe("The persistence failure controller", function () {
|
||||||
|
var controller;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
controller = new PersistenceFailureController();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("converts timestamps to human-readable dates", function () {
|
||||||
|
expect(controller.formatTimestamp(402514331000))
|
||||||
|
.toEqual("1982-10-03 17:32:11Z");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("provides default user names", function () {
|
||||||
|
expect(controller.formatUsername(undefined))
|
||||||
|
.toEqual(jasmine.any(String));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
@ -1,5 +1,6 @@
|
|||||||
[
|
[
|
||||||
"PersistenceFailureConstants",
|
"PersistenceFailureConstants",
|
||||||
|
"PersistenceFailureController",
|
||||||
"PersistenceFailureDialog",
|
"PersistenceFailureDialog",
|
||||||
"PersistenceFailureHandler",
|
"PersistenceFailureHandler",
|
||||||
"PersistenceQueue",
|
"PersistenceQueue",
|
||||||
|
Reference in New Issue
Block a user