add utility method
This commit is contained in:
parent
5cdee35f2f
commit
5027707dec
|
@ -8,7 +8,7 @@
|
||||||
var keys = aria2SettingService.getAvailableGlobalOptionsKeys(type);
|
var keys = aria2SettingService.getAvailableGlobalOptionsKeys(type);
|
||||||
|
|
||||||
if (!keys) {
|
if (!keys) {
|
||||||
ariaNgCommonService.alert('Type is illegal!');
|
ariaNgCommonService.showError('Type is illegal!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.message == 'Unauthorized') {
|
if (error.message == 'Unauthorized') {
|
||||||
ariaNgCommonService.alert('rpc.error.' + error.message);
|
ariaNgCommonService.showError('rpc.error.' + error.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,30 @@
|
||||||
|
|
||||||
return hashedId;
|
return hashedId;
|
||||||
},
|
},
|
||||||
alert: function (text) {
|
showDialog: function (title, text, type) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
SweetAlert.swal({
|
SweetAlert.swal({
|
||||||
title: $translate.instant('Error'),
|
title: $translate.instant(title),
|
||||||
text: $translate.instant(text),
|
text: $translate.instant(text),
|
||||||
type: 'error',
|
type: type,
|
||||||
confirmButtonText: $translate.instant('OK')
|
confirmButtonText: $translate.instant('OK')
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
confirm: function (title, text, type, callback) {
|
showError: function (text) {
|
||||||
|
this.showDialog('Error', text, 'error');
|
||||||
|
},
|
||||||
|
showOperationSucceeded: function (text) {
|
||||||
|
this.showDialog('Operation Succeeded', text, 'success');
|
||||||
|
},
|
||||||
|
confirm: function (title, text, type, callback, notClose) {
|
||||||
var options = {
|
var options = {
|
||||||
title: $translate.instant(title),
|
title: $translate.instant(title),
|
||||||
text: $translate.instant(text),
|
text: $translate.instant(text),
|
||||||
type: type,
|
type: type,
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
|
showLoaderOnConfirm: !!notClose,
|
||||||
|
closeOnConfirm: !notClose,
|
||||||
confirmButtonText: $translate.instant('OK'),
|
confirmButtonText: $translate.instant('OK'),
|
||||||
cancelButtonText: $translate.instant('Cancel')
|
cancelButtonText: $translate.instant('Cancel')
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue