mirror of
https://github.com/nextcloud/passman.git
synced 2024-09-20 23:06:24 +08:00
added notification which tells the user when the fetching failed
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
parent
81cc7a9978
commit
8938ff76a0
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue