added notification which tells the user when the fetching failed

Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
fnuesse 2018-12-30 21:06:23 +01:00
parent 81cc7a9978
commit 8938ff76a0
No known key found for this signature in database
GPG key ID: 2089A3431243E819
2 changed files with 8 additions and 9 deletions

View file

@ -145,6 +145,7 @@ class TranslationController extends ApiController {
'use.icon' => $this->trans->t('Use this icon'),
'use.icon.delete' => $this->trans->t('Delete current icon'),
'use.icon.refresh' => $this->trans->t('Get icon from page'),
'use.icon.refresh.error' => $this->trans->t('There was an error fetching the icon!'),
'selected.icon' => $this->trans->t('Selected icon'),
// templates/views/partials/edit_credential/custom_fields.html

View file

@ -30,7 +30,7 @@
* # passwordGen
*/
angular.module('passmanApp').directive('iconPicker', [
'$window', 'IconService', '$http', function($window, IconService, $http) {
'$window', 'IconService', '$http', 'NotificationService','$translate', function($window, IconService, $http, NotificationService, $translate) {
return {
templateUrl: 'views/partials/icon-picker.html',
restrict: 'A',
@ -118,14 +118,12 @@
scope.refreshUrlIcon = function(){
var queryUrl = OC.generateUrl('apps/passman/api/v2/geticon/'+btoa(scope.credential.url));
$http.get(queryUrl).then(function (response) {
scope.customIcon = {};
scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content;
if (response.data) {
return response.data;
} else {
return response;
}
if(typeof response.data.content !== 'undefined'){
scope.customIcon = {};
scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content;
}else{
NotificationService.showNotification($translate.instant('use.icon.refresh.error'), 5000);
}
});
};