show notification after modifying configurations which need to reload page
This commit is contained in:
parent
6176de56e9
commit
fc54048d5d
|
@ -147,6 +147,8 @@ Downloading Count=正在下载数量
|
|||
Waiting Count=正在等待数量
|
||||
Stopped Count=已停止数量
|
||||
You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已经在浏览器中禁用通知功能. 如需使用此功能, 请修改您浏览器的设置.
|
||||
Configuration has been modified, please reload the page for the changes to take effect.=配置已经修改, 请重新加载页面使其生效.
|
||||
Refresh=立即刷新
|
||||
Show Secret=显示密钥
|
||||
Hide Secret=隐藏密钥
|
||||
Aria2 Version=Aria2 版本
|
||||
|
|
|
@ -151,6 +151,8 @@
|
|||
'Waiting Count': 'Waiting Count',
|
||||
'Stopped Count': 'Stopped Count',
|
||||
'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.': 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.',
|
||||
'Configuration has been modified, please reload the page for the changes to take effect.': 'Configuration has been modified, please reload the page for the changes to take effect.',
|
||||
'Refresh': 'Refresh',
|
||||
'Show Secret': 'Show Secret',
|
||||
'Hide Secret': 'Hide Secret',
|
||||
'Aria2 Version': 'Aria2 Version',
|
||||
|
|
|
@ -3,11 +3,28 @@
|
|||
|
||||
angular.module('ariaNg').controller('AriaNgSettingsController', ['$rootScope', '$scope', '$routeParams', '$window', '$interval', '$timeout', 'ariaNgLanguages', 'ariaNgCommonService', 'ariaNgSettingService', 'ariaNgMonitorService', 'ariaNgNotificationService', 'ariaNgTitleService', function ($rootScope, $scope, $routeParams, $window, $interval, $timeout, ariaNgLanguages, ariaNgCommonService, ariaNgSettingService, ariaNgMonitorService, ariaNgNotificationService, ariaNgTitleService) {
|
||||
var extendType = $routeParams.extendType;
|
||||
var lastRefreshPageNotification = null;
|
||||
|
||||
var getFinalTitle = function () {
|
||||
return ariaNgTitleService.getFinalTitleByGlobalStat(ariaNgMonitorService.getCurrentGlobalStat());
|
||||
};
|
||||
|
||||
var setNeedRefreshPage = function () {
|
||||
if (lastRefreshPageNotification) {
|
||||
return;
|
||||
}
|
||||
|
||||
lastRefreshPageNotification = ariaNgNotificationService.notifyInPage('', 'Configuration has been modified, please reload the page for the changes to take effect.', {
|
||||
delay: false,
|
||||
type: 'info',
|
||||
templateUrl: 'setting-changed-notification.html',
|
||||
scope: $scope,
|
||||
onClose: function () {
|
||||
lastRefreshPageNotification = null;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.context = {
|
||||
currentTab: 'global',
|
||||
languages: ariaNgLanguages,
|
||||
|
@ -88,6 +105,7 @@
|
|||
};
|
||||
|
||||
$scope.setTitleRefreshInterval = function (value) {
|
||||
setNeedRefreshPage();
|
||||
ariaNgSettingService.setTitleRefreshInterval(value);
|
||||
};
|
||||
|
||||
|
@ -110,14 +128,18 @@
|
|||
};
|
||||
|
||||
$scope.setGlobalStatRefreshInterval = function (value) {
|
||||
setNeedRefreshPage();
|
||||
ariaNgSettingService.setGlobalStatRefreshInterval(value);
|
||||
};
|
||||
|
||||
$scope.setDownloadTaskRefreshInterval = function (value) {
|
||||
setNeedRefreshPage();
|
||||
ariaNgSettingService.setDownloadTaskRefreshInterval(value);
|
||||
};
|
||||
|
||||
$scope.addNewRpcSetting = function () {
|
||||
setNeedRefreshPage();
|
||||
|
||||
var newRpcSetting = ariaNgSettingService.addNewRpcSetting();
|
||||
$scope.context.rpcSettings.push(newRpcSetting);
|
||||
|
||||
|
@ -125,6 +147,7 @@
|
|||
};
|
||||
|
||||
$scope.updateRpcSetting = function (setting, field) {
|
||||
setNeedRefreshPage();
|
||||
ariaNgSettingService.updateRpcSetting(setting, field);
|
||||
};
|
||||
|
||||
|
@ -132,6 +155,8 @@
|
|||
var rpcName = (setting.rpcAlias ? setting.rpcAlias : setting.rpcHost + ':' + setting.rpcPort);
|
||||
|
||||
ariaNgCommonService.confirm('Confirm Remove', 'Are you sure you want to remove rpc setting "{{rpcName}}"?', 'warning', function () {
|
||||
setNeedRefreshPage();
|
||||
|
||||
var index = $scope.context.rpcSettings.indexOf(setting);
|
||||
ariaNgSettingService.removeRpcSetting(setting);
|
||||
$scope.context.rpcSettings.splice(index, 1);
|
||||
|
@ -155,6 +180,10 @@
|
|||
$window.location.reload();
|
||||
};
|
||||
|
||||
$scope.refreshPage = function () {
|
||||
$window.location.reload();
|
||||
};
|
||||
|
||||
$('[data-toggle="popover"]').popover();
|
||||
|
||||
$rootScope.loadPromise = $timeout(function () {}, 100);
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
options.type = 'primary';
|
||||
}
|
||||
|
||||
Notification[options.type](options);
|
||||
return Notification[options.type](options);
|
||||
},
|
||||
notifyTaskComplete: function (task) {
|
||||
this.notifyViaBrowser('Download Completed', (task && task.taskName ? task.taskName : ''));
|
||||
|
|
|
@ -209,3 +209,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script id="setting-changed-notification.html" type="text/ng-template">
|
||||
<div class="ui-notification custom-template">
|
||||
<div class="message" ng-bind-html="message"></div>
|
||||
<div class="message">
|
||||
<a class="btn btn-small btn-primary close-notification" ng-click="refreshPage()" translate>Refresh</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
|
Reference in a new issue