mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
Resolved merge conflicts
This commit is contained in:
@ -39,6 +39,20 @@ define(
|
|||||||
this.domainObject.getCapability('status').set('editing', true);
|
this.domainObject.getCapability('status').set('editing', true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function isEditing (domainObject) {
|
||||||
|
return domainObject.getCapability('status').get('editing') ||
|
||||||
|
domainObject.hasCapability('context') && isEditing(domainObject.getCapability('context').getParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether this object, or any of its ancestors are
|
||||||
|
* currently being edited.
|
||||||
|
* @returns boolean
|
||||||
|
*/
|
||||||
|
EditorCapability.prototype.isEditing = function () {
|
||||||
|
return isEditing(this.domainObject);
|
||||||
|
};
|
||||||
|
|
||||||
EditorCapability.prototype.save = function () {
|
EditorCapability.prototype.save = function () {
|
||||||
var domainObject = this.domainObject;
|
var domainObject = this.domainObject;
|
||||||
return this.transactionService.commit().then(function() {
|
return this.transactionService.commit().then(function() {
|
||||||
@ -60,8 +74,10 @@ define(
|
|||||||
return this.dirtyModelCache.isDirty(this.domainObject);
|
return this.dirtyModelCache.isDirty(this.domainObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: add 'appliesTo'. EditorCapability should not be available
|
EditorCapability.prototype.appliesTo = function(context) {
|
||||||
// for objects that should not be edited
|
var domainObject = context.domainObject;
|
||||||
|
return domainObject && domainObject.getType().hasFeature("creation");
|
||||||
|
}
|
||||||
|
|
||||||
return EditorCapability;
|
return EditorCapability;
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,12 @@ define([], function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EditableLinkPolicy.prototype.allow = function (action, context) {
|
EditableLinkPolicy.prototype.allow = function (action, context) {
|
||||||
var key = action.getMetadata().key;
|
var key = action.getMetadata().key,
|
||||||
|
object;
|
||||||
|
|
||||||
if (key === 'link') {
|
if (key === 'link') {
|
||||||
return !((context.selectedObject || context.domainObject)
|
object = context.selectedObject || context.domainObject;
|
||||||
.hasCapability('editor'));
|
return !(object.hasCapability("editor") && object.getCapability("editor").isEditing());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like all policies, allow by default.
|
// Like all policies, allow by default.
|
||||||
|
@ -37,8 +37,8 @@ define([], function () {
|
|||||||
selectedObject = context.selectedObject,
|
selectedObject = context.selectedObject,
|
||||||
key = action.getMetadata().key;
|
key = action.getMetadata().key;
|
||||||
|
|
||||||
if (key === 'move' && domainObject.hasCapability('editor')) {
|
if (key === 'move' && domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()) {
|
||||||
return !!selectedObject && selectedObject.hasCapability('editor');
|
return !!selectedObject && selectedObject.hasCapability('editor') && selectedObject.getCapability('editor').isEditing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like all policies, allow by default.
|
// Like all policies, allow by default.
|
||||||
|
@ -37,7 +37,7 @@ define(
|
|||||||
// If a view is flagged as non-editable, only allow it
|
// If a view is flagged as non-editable, only allow it
|
||||||
// while we're not in Edit mode.
|
// while we're not in Edit mode.
|
||||||
if ((view || {}).editable === false) {
|
if ((view || {}).editable === false) {
|
||||||
return !domainObject.hasCapability('editor');
|
return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like all policies, allow by default.
|
// Like all policies, allow by default.
|
||||||
|
@ -32,7 +32,8 @@ define(
|
|||||||
*/
|
*/
|
||||||
function InspectorController($scope, policyService) {
|
function InspectorController($scope, policyService) {
|
||||||
var domainObject = $scope.domainObject,
|
var domainObject = $scope.domainObject,
|
||||||
typeCapability = domainObject.getCapability('type');
|
typeCapability = domainObject.getCapability('type'),
|
||||||
|
listener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters region parts to only those allowed by region policies
|
* Filters region parts to only those allowed by region policies
|
||||||
@ -46,7 +47,20 @@ define(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion());
|
function setRegions() {
|
||||||
|
$scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Listen for changes to object status that might necessitate
|
||||||
|
// recalculation of screen regions.
|
||||||
|
//listener =
|
||||||
|
// domainObject.getCapability("status").listen(setRegions);
|
||||||
|
|
||||||
|
setRegions();
|
||||||
|
|
||||||
|
$scope.$on("$destroy", function() {
|
||||||
|
listener();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return InspectorController;
|
return InspectorController;
|
||||||
|
@ -41,11 +41,8 @@ define(
|
|||||||
|
|
||||||
// Check if we are in edit mode (also check parents)
|
// Check if we are in edit mode (also check parents)
|
||||||
function inEditMode(swimlane) {
|
function inEditMode(swimlane) {
|
||||||
if (!swimlane.domainObject.getCapability("status").get("editing") && swimlane.parent) {
|
return swimlane.domainObject.hasCapability('editor') &&
|
||||||
return inEditMode(swimlane.parent);
|
swimlane.domainObject.getCapability('editor').isEditing();
|
||||||
} else {
|
|
||||||
return swimlane.domainObject.getCapability("status").get("editing");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean and (for reduce below)
|
// Boolean and (for reduce below)
|
||||||
|
@ -53,7 +53,8 @@ define(
|
|||||||
* @param {ViewDefinition[]} views an array of view extensions
|
* @param {ViewDefinition[]} views an array of view extensions
|
||||||
*/
|
*/
|
||||||
function MCTRepresentation(representations, views, representers, $q, templateLinker, $log) {
|
function MCTRepresentation(representations, views, representers, $q, templateLinker, $log) {
|
||||||
var representationMap = {};
|
var representationMap = {},
|
||||||
|
domainObjectListener;
|
||||||
|
|
||||||
// Assemble all representations and views
|
// Assemble all representations and views
|
||||||
// The distinction between views and representations is
|
// The distinction between views and representations is
|
||||||
@ -167,7 +168,7 @@ define(
|
|||||||
representation = lookup($scope.key, domainObject),
|
representation = lookup($scope.key, domainObject),
|
||||||
uses = ((representation || {}).uses || []),
|
uses = ((representation || {}).uses || []),
|
||||||
canRepresent = !!(representation && domainObject),
|
canRepresent = !!(representation && domainObject),
|
||||||
canEdit = !!(domainObject && domainObject.hasCapability('editor')),
|
canEdit = !!(domainObject && domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()),
|
||||||
idPath = getIdPath(domainObject),
|
idPath = getIdPath(domainObject),
|
||||||
key = $scope.key;
|
key = $scope.key;
|
||||||
|
|
||||||
@ -175,6 +176,8 @@ define(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("changed");
|
||||||
|
|
||||||
// Create an empty object named "representation", for this
|
// Create an empty object named "representation", for this
|
||||||
// representation to store local variables into.
|
// representation to store local variables into.
|
||||||
$scope.representation = {};
|
$scope.representation = {};
|
||||||
@ -237,7 +240,17 @@ define(
|
|||||||
|
|
||||||
// Also update when the represented domain object changes
|
// Also update when the represented domain object changes
|
||||||
// (to a different object)
|
// (to a different object)
|
||||||
$scope.$watch("domainObject", refresh);
|
//$scope.$watch("domainObject", refresh);
|
||||||
|
|
||||||
|
$scope.$watch("domainObject", function (domainObject) {
|
||||||
|
if (domainObjectListener) {
|
||||||
|
domainObjectListener();
|
||||||
|
}
|
||||||
|
if (domainObject) {
|
||||||
|
domainObjectListener = domainObject.getCapability('status').listen(refresh);
|
||||||
|
}
|
||||||
|
refresh();
|
||||||
|
});
|
||||||
|
|
||||||
// Finally, also update when there is a new version of that
|
// Finally, also update when there is a new version of that
|
||||||
// same domain object; these changes should be tracked in the
|
// same domain object; these changes should be tracked in the
|
||||||
|
@ -103,7 +103,6 @@ define(
|
|||||||
// the change.
|
// the change.
|
||||||
if (id) {
|
if (id) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (domainObjectType!=='folder') {
|
if (domainObjectType!=='folder') {
|
||||||
domainObject.getCapability('action').perform('edit');
|
domainObject.getCapability('action').perform('edit');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user