hide browser notification setting when protocol is http or https
This commit is contained in:
parent
754580db42
commit
7cd76f5571
|
@ -6,12 +6,16 @@
|
|||
languages: ariaNgLanguages,
|
||||
availableTime: ariaNgCommonService.getTimeOptions([1000, 2000, 3000, 5000, 10000, 30000, 60000], true),
|
||||
trueFalseOptions: [{name: 'True', value: true}, {name: 'False', value: false}],
|
||||
settings: ariaNgSettingService.getAllOptions(),
|
||||
supportBrowserNotification: ariaNgNotificationService.isSupportBrowserNotification()
|
||||
settings: ariaNgSettingService.getAllOptions()
|
||||
};
|
||||
|
||||
$scope.settingService = ariaNgSettingService;
|
||||
|
||||
$scope.isSupportNotification = function () {
|
||||
return ariaNgNotificationService.isSupportBrowserNotification() &&
|
||||
ariaNgSettingService.isUseWebSocket($scope.context.settings.protocol);
|
||||
};
|
||||
|
||||
$scope.setEnableBrowserNotification = function (value) {
|
||||
ariaNgSettingService.setBrowserNotification(value);
|
||||
|
||||
|
|
|
@ -132,8 +132,11 @@
|
|||
setProtocol: function (value) {
|
||||
setOption('protocol', value);
|
||||
},
|
||||
isUseWebSocket: function () {
|
||||
var protocol = this.getProtocol();
|
||||
isUseWebSocket: function (protocol) {
|
||||
if (!protocol) {
|
||||
protocol = this.getProtocol();
|
||||
}
|
||||
|
||||
return protocol == 'ws' || protocol == 'wss';
|
||||
},
|
||||
getSecret: function () {
|
||||
|
|
|
@ -33,17 +33,6 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-if="context.supportBrowserNotification">
|
||||
<div class="setting-key setting-key-without-desc col-sm-4">
|
||||
<span translate>Enable Browser Notification</span>
|
||||
</div>
|
||||
<div class="setting-value col-sm-8">
|
||||
<select class="form-control" style="width: 100%;" ng-model="context.settings.browserNotification"
|
||||
ng-change="setEnableBrowserNotification(context.settings.browserNotification)"
|
||||
ng-options="option.value as (option.name | translate) for option in context.trueFalseOptions">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="setting-key setting-key-without-desc col-sm-4">
|
||||
<span translate>Aria2 RPC Host</span>
|
||||
|
@ -90,6 +79,17 @@
|
|||
<input class="form-control" type="password" ng-model="context.settings.secret" ng-change="settingService.setSecret(context.settings.secret)"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-if="isSupportNotification()">
|
||||
<div class="setting-key setting-key-without-desc col-sm-4">
|
||||
<span translate>Enable Browser Notification</span>
|
||||
</div>
|
||||
<div class="setting-value col-sm-8">
|
||||
<select class="form-control" style="width: 100%;" ng-model="context.settings.browserNotification"
|
||||
ng-change="setEnableBrowserNotification(context.settings.browserNotification)"
|
||||
ng-options="option.value as (option.name | translate) for option in context.trueFalseOptions">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="setting-key setting-key-without-desc col-sm-4">
|
||||
<span translate>Global Stat Refresh Interval</span>
|
||||
|
|
Reference in a new issue