show different error messages and UI reset after failed update
Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
committed by
Julius Härtl
parent
f01cd506f7
commit
e5d3c16a80
@@ -347,15 +347,19 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
$scope.status.createLabel = false;
|
$scope.status.createLabel = false;
|
||||||
$scope.newLabel = {};
|
$scope.newLabel = {};
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
OC.Notification.showTemporary('Duplicate label name is not allowed');
|
OC.Notification.showTemporary(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.labelUpdateBefore = function (label) {
|
||||||
|
label.renameTitle = label.title;
|
||||||
|
};
|
||||||
|
|
||||||
$scope.labelUpdate = function (label) {
|
$scope.labelUpdate = function (label) {
|
||||||
label.edit = false;
|
label.edit = false;
|
||||||
LabelService.update(label).catch(err => {
|
LabelService.update(label).catch(err => {
|
||||||
label.title('XXX');
|
label.title = label.renameTitle;
|
||||||
OC.Notification.showTemporary('Duplicate label name is not allowed');
|
OC.Notification.showTemporary(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
// update labels in UI
|
// update labels in UI
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ app.factory('ApiService', function ($http, $q) {
|
|||||||
self.add(response.data);
|
self.add(response.data);
|
||||||
deferred.resolve(response.data);
|
deferred.resolve(response.data);
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
deferred.reject('Fetching' + self.endpoint + ' failed');
|
deferred.reject(error.data.message);
|
||||||
});
|
});
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
@@ -131,7 +131,7 @@ app.factory('ApiService', function ($http, $q) {
|
|||||||
self.add(response.data);
|
self.add(response.data);
|
||||||
deferred.resolve(response.data);
|
deferred.resolve(response.data);
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
deferred.reject('Updating ' + self.endpoint + ' failed');
|
deferred.reject(error.data.message);
|
||||||
});
|
});
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class LabelService {
|
|||||||
throw new BadRequestException('label id must be a number');
|
throw new BadRequestException('label id must be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($title === false || $title === null) {
|
if ($title === false || $title === null || $title === "") {
|
||||||
throw new BadRequestException('title must be provided');
|
throw new BadRequestException('title must be provided');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a ng-if="boardservice.canManage() && label.edit" ng-click="labelUpdate(label)" class="icon" title="<?php p($l->t('Update tag')); ?>"><i class="icon icon-checkmark" ></i><span class="hidden-visually"><?php p($l->t('Update tag')); ?></span></a>
|
<a ng-if="boardservice.canManage() && label.edit" ng-click="labelUpdate(label)" class="icon" title="<?php p($l->t('Update tag')); ?>"><i class="icon icon-checkmark" ></i><span class="hidden-visually"><?php p($l->t('Update tag')); ?></span></a>
|
||||||
<a ng-if="boardservice.canManage() && !label.edit" ng-click="label.edit=true" class="icon" title="<?php p($l->t('Edit tag')); ?>"><i class="icon icon-rename"></i><span class="hidden-visually"><?php p($l->t('Edit tag')); ?></span></a>
|
<a ng-if="boardservice.canManage() && !label.edit" ng-click="labelUpdateBefore(label); label.edit=true" class="icon" title="<?php p($l->t('Edit tag')); ?>"><i class="icon icon-rename"></i><span class="hidden-visually"><?php p($l->t('Edit tag')); ?></span></a>
|
||||||
<a ng-if="boardservice.canManage()" ng-click="labelDelete(label)" class="icon" title="<?php p($l->t('Delete tag')); ?>"><i class="icon icon-delete" ></i><span class="hidden-visually"><?php p($l->t('Delete tag')); ?></span></a>
|
<a ng-if="boardservice.canManage()" ng-click="labelDelete(label)" class="icon" title="<?php p($l->t('Delete tag')); ?>"><i class="icon icon-delete" ></i><span class="hidden-visually"><?php p($l->t('Delete tag')); ?></span></a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-if="status.createLabel">
|
<li ng-if="status.createLabel">
|
||||||
|
|||||||
Reference in New Issue
Block a user