Skip to content
Snippets Groups Projects
Commit a1dab37c authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #8887: disabled editing in webclient for rollout to users

parent 1c65bd8d
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,20 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http,
return dict;
};
self.applyChanges = function(existingObj, changedObj) {
for(var prop in changedObj) {
if(existingObj.hasOwnProperty(prop) &&
changedObj.hasOwnProperty(prop) &&
existingObj[prop] != changedObj[prop]) {
if(existingObj[prop] instanceof Date && changedObj[prop] instanceof String) {
existingObj[prop] = new Date(changedObj[prop]);
} else {
existingObj[prop] = changedObj[prop];
}
}
}
};
self.getTasks = function() {
var defer = $q.defer();
......@@ -79,6 +93,7 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http,
self.putTask = function(task) {
$http.put('/rest/tasks/' + task.id, task).error(function(result) {
console.log("Error. Could not update task. " + result);
//TODO: revert to old state
})
};
......@@ -309,20 +324,6 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http,
var changeNumbers = result.changes.map(function(item) { return item.changeNumber; });
self.lastUpdateChangeNumber = changeNumbers.reduce(function(a, b, idx, arr) { return a > b ? a : b; }, undefined);
function applyChanges(existingObj, changedObj) {
for(var prop in changedObj) {
if(existingObj.hasOwnProperty(prop) &&
changedObj.hasOwnProperty(prop) &&
existingObj[prop] != changedObj[prop]) {
if(existingObj[prop] instanceof Date) {
existingObj[prop] = new Date(changedObj[prop]);
} else {
existingObj[prop] = changedObj[prop];
}
}
}
};
var anyResourceClaims = false;
for(var i in result.changes) {
try {
......@@ -333,7 +334,7 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http,
if(change.changeType == 'update') {
var task = self.taskDict[changedTask.id];
if(task) {
applyChanges(task, changedTask);
self.applyChanges(task, changedTask);
}
} else if(change.changeType == 'insert') {
var task = self.taskDict[changedTask.id];
......@@ -358,7 +359,7 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http,
if(change.changeType == 'update') {
var claim = self.resourceClaimDict[changedClaim.id];
if(claim) {
applyChanges(claim, changedClaim);
self.applyChanges(claim, changedClaim);
}
} else if(change.changeType == 'insert') {
var claim = self.resourceClaimDict[changedClaim.id];
......
......@@ -73,6 +73,7 @@ gridControllerMod.controller('GridController', ['$scope', 'dataService', 'uiGrid
enableGridMenu: false,
enableSorting: true,
enableFiltering: true,
enableCellEdit: false,
enableColumnResize: true,
enableRowSelection: true,
enableRowHeaderSelection: true,
......
......@@ -78,8 +78,8 @@
column-magnet="options.columnMagnet">
<gantt-tree enabled="true"></gantt-tree>
<gantt-movable enabled="true"
allow-moving="true"
allow-resizing="true"
allow-moving="false"
allow-resizing="false"
allow-row-switching="false">
</gantt-movable>
<gantt-tooltips enabled="true" date-format="'YYYY-MM-DD HH:mm'"></gantt-tooltips>
......@@ -98,8 +98,8 @@
column-magnet="options.columnMagnet">
<gantt-tree enabled="true"></gantt-tree>
<gantt-movable enabled="true"
allow-moving="true"
allow-resizing="true"
allow-moving="false"
allow-resizing="false"
allow-row-switching="false"></gantt-movable>
<gantt-tooltips enabled="true" date-format="'YYYY-MM-DD HH:mm'"></gantt-tooltips>
</div>
......
......@@ -176,6 +176,8 @@ def getTask(task_id):
@app.route('/rest/tasks/<int:task_id>', methods=['PUT'])
def putTask(task_id):
abort(403, 'Editing of tasks is by users is not yet approved')
if 'Content-Type' in request.headers and \
request.headers['Content-Type'].startswith('application/json'):
updatedTask = json.loads(request.data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment