Fixes: U4-7251 When changing a data type name to be the same as another we suffix the duplication with a number - this needs to be reflected in the UI
This commit is contained in:
@@ -24,6 +24,28 @@ function dataTypeHelper() {
|
||||
|
||||
return preValues;
|
||||
|
||||
},
|
||||
|
||||
rebindChangedProperties: function (origContent, savedContent) {
|
||||
|
||||
//a method to ignore built-in prop changes
|
||||
var shouldIgnore = function (propName) {
|
||||
return _.some(["notifications", "ModelState"], function (i) {
|
||||
return i === propName;
|
||||
});
|
||||
};
|
||||
//check for changed built-in properties of the content
|
||||
for (var o in origContent) {
|
||||
|
||||
//ignore the ones listed in the array
|
||||
if (shouldIgnore(o)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_.isEqual(origContent[o], savedContent[o])) {
|
||||
origContent[o] = savedContent[o];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @description
|
||||
* The controller for the content editor
|
||||
*/
|
||||
function DataTypeEditController($scope, $routeParams, $location, appState, navigationService, treeService, dataTypeResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, formHelper, editorState) {
|
||||
function DataTypeEditController($scope, $routeParams, $location, appState, navigationService, treeService, dataTypeResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, formHelper, editorState, dataTypeHelper) {
|
||||
|
||||
//setup scope vars
|
||||
$scope.page = {};
|
||||
@@ -158,6 +158,8 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
|
||||
|
||||
$scope.page.saveButtonState = "success";
|
||||
|
||||
dataTypeHelper.rebindChangedProperties($scope.content, data);
|
||||
|
||||
}, function(err) {
|
||||
|
||||
//NOTE: in the case of data type values we are setting the orig/new props
|
||||
@@ -171,6 +173,8 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
|
||||
|
||||
//share state
|
||||
editorState.set($scope.content);
|
||||
|
||||
dataTypeHelper.rebindChangedProperties($scope.content, data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user