add settings in task detail page
This commit is contained in:
parent
221eb72f7d
commit
57aeffcf52
|
@ -559,7 +559,10 @@
|
|||
rpcOptions: ['enable-rpc', 'pause-metadata', 'rpc-allow-origin-all', 'rpc-listen-all', 'rpc-listen-port', 'rpc-max-request-size', 'rpc-save-upload-metadata', 'rpc-secure'],
|
||||
advancedOptions: ['allow-overwrite', 'allow-piece-length-change', 'always-resume', 'async-dns', 'auto-file-renaming', 'auto-save-interval', 'conditional-get', 'conf-path', 'console-log-level', 'daemon', 'deferred-input', 'disable-ipv6', 'disk-cache', 'download-result', 'dscp', 'rlimit-nofile', 'enable-color', 'enable-mmap', 'event-poll', 'file-allocation', 'force-save', 'hash-check-only', 'human-readable', 'max-download-result', 'max-mmap-limit', 'max-resume-failure-tries', 'min-tls-version', 'log-level', 'piece-length', 'optimize-concurrent-downloads', 'show-console-readout', 'summary-interval', 'max-overall-download-limit', 'max-download-limit', 'no-conf', 'no-file-allocation-limit', 'parameterized-uri', 'quiet', 'realtime-chunk-checksum', 'remove-control-file', 'save-session', 'save-session-interval', 'socket-recv-buffer-size', 'stop', 'truncate-console-readout']
|
||||
}).constant('aria2TaskAvailableOptions', {
|
||||
activeBtOptions: ['max-download-limit', 'max-upload-limit', 'bt-max-peers', 'bt-request-peer-speed-limit', 'bt-remove-unselected-file', 'force-save'],
|
||||
activeOtherOptions: ['max-download-limit', 'max-upload-limit', 'force-save']
|
||||
activeNormalTaskOptions: ['max-download-limit', 'max-upload-limit', 'force-save'],
|
||||
activeBtTaskOptions: ['max-download-limit', 'max-upload-limit', 'bt-max-peers', 'bt-request-peer-speed-limit', 'bt-remove-unselected-file', 'force-save'],
|
||||
inactiveNormalTaskOptions: ['max-download-limit', 'max-upload-limit', 'split', 'min-split-size', 'max-connection-per-server', 'force-save'],
|
||||
inactiveBtTaskOptions: ['max-download-limit', 'max-upload-limit', 'split', 'min-split-size', 'max-connection-per-server', 'bt-max-peers', 'bt-request-peer-speed-limit', 'bt-remove-unselected-file', 'force-save'],
|
||||
activeTaskReadonlyOptions: ['split', 'min-split-size', 'max-connection-per-server']
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
return aria2SettingService.getSpecifiedOptions(keys);
|
||||
var options = [];
|
||||
ariaNgCommonService.pushArrayTo(options, aria2SettingService.getSpecifiedOptions(keys.readwrite));
|
||||
ariaNgCommonService.pushArrayTo(options, aria2SettingService.getSpecifiedOptions(keys.readonly, true));
|
||||
|
||||
return options;
|
||||
};
|
||||
|
||||
var refreshBtPeers = function (task, silent) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'aria2RpcService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, aria2RpcService) {
|
||||
angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'ariaNgCommonService', 'aria2RpcService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, ariaNgCommonService, aria2RpcService) {
|
||||
var processStatResult = function (stat) {
|
||||
if (!stat) {
|
||||
return stat;
|
||||
|
@ -40,18 +40,30 @@
|
|||
},
|
||||
getAvailableTaskOptionKeys: function (status, isBittorrent) {
|
||||
if (status == 'active' && isBittorrent) {
|
||||
return aria2TaskAvailableOptions.activeBtOptions;
|
||||
return {
|
||||
readwrite: aria2TaskAvailableOptions.activeBtTaskOptions,
|
||||
readonly: aria2TaskAvailableOptions.activeTaskReadonlyOptions
|
||||
};
|
||||
} else if (status == 'active' && !isBittorrent) {
|
||||
return aria2TaskAvailableOptions.activeOtherOptions;
|
||||
return {
|
||||
readwrite: aria2TaskAvailableOptions.activeNormalTaskOptions,
|
||||
readonly: aria2TaskAvailableOptions.activeTaskReadonlyOptions
|
||||
};
|
||||
} else if ((status == 'waiting' || status == 'paused') && isBittorrent) {
|
||||
return aria2TaskAvailableOptions.activeBtOptions;
|
||||
return {
|
||||
readwrite: aria2TaskAvailableOptions.inactiveBtTaskOptions,
|
||||
readonly: []
|
||||
};
|
||||
} else if ((status == 'waiting' || status == 'paused') && !isBittorrent) {
|
||||
return aria2TaskAvailableOptions.activeOtherOptions;
|
||||
return {
|
||||
readwrite: aria2TaskAvailableOptions.inactiveNormalTaskOptions,
|
||||
readonly: []
|
||||
};
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getSpecifiedOptions: function (keys) {
|
||||
getSpecifiedOptions: function (keys, readonly) {
|
||||
var options = [];
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
|
@ -72,6 +84,10 @@
|
|||
option.options = ['true', 'false'];
|
||||
}
|
||||
|
||||
if (!!readonly) {
|
||||
option.readonly = true;
|
||||
}
|
||||
|
||||
if (option.options) {
|
||||
var availableOptions = [];
|
||||
|
||||
|
|
|
@ -90,6 +90,34 @@
|
|||
|
||||
return to;
|
||||
},
|
||||
pushArrayTo: function (array, items) {
|
||||
if (!angular.isArray(array)) {
|
||||
array = [];
|
||||
}
|
||||
|
||||
if (!angular.isArray(items) || items.length < 1) {
|
||||
return array;
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
array.push(items[i]);
|
||||
}
|
||||
|
||||
return array;
|
||||
},
|
||||
combineArray: function () {
|
||||
var result = [];
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (angular.isArray(arguments[i])) {
|
||||
this.pushArrayTo(result, arguments[i]);
|
||||
} else {
|
||||
result.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
parseOrderType: function (value) {
|
||||
var values = value.split(':');
|
||||
|
||||
|
|
Reference in a new issue