mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Allow quick enable/disable attached rule lists.
This commit is contained in:
parent
21f0eedf83
commit
f062e04290
@ -351,6 +351,9 @@
|
||||
"options_switchAttachedProfileInConditionDetails": {
|
||||
"message": "(Any request matching the rule list below)"
|
||||
},
|
||||
"options_switchAttachedProfileInConditionDisabled": {
|
||||
"message": "(Rule list rules are DISABLED)"
|
||||
},
|
||||
"options_switchDefaultProfile": {
|
||||
"message": "Default"
|
||||
},
|
||||
|
@ -351,6 +351,9 @@
|
||||
"options_switchAttachedProfileInConditionDetails": {
|
||||
"message": "(按照规则列表匹配请求)"
|
||||
},
|
||||
"options_switchAttachedProfileInConditionDisabled": {
|
||||
"message": "(规则列表已禁用!)"
|
||||
},
|
||||
"options_switchDefaultProfile": {
|
||||
"message": "默认情景模式"
|
||||
},
|
||||
|
@ -130,6 +130,15 @@ ul.list-style-none, li.list-style-none {
|
||||
display: none; // Prevent not loaded directive from showing.
|
||||
}
|
||||
|
||||
.disabled .btn {
|
||||
background-color: #ddd !important;
|
||||
border-color: #ccc !important;
|
||||
cursor: not-allowed !important;
|
||||
pointer-events: none !important;
|
||||
opacity: .65 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
/* body */
|
||||
|
||||
h1 {
|
||||
|
@ -81,16 +81,35 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $modal,
|
||||
return profile
|
||||
$scope.omegaWatchAndChange 'options[attachedKey]', onAttachedChange, true
|
||||
|
||||
$scope.attachedOptions = {enabled: false}
|
||||
$scope.$watch 'profile.defaultProfileName', (name) ->
|
||||
if not $scope.attached
|
||||
$scope.attachedOptions.enabled = (name == $scope.attachedName)
|
||||
if not $scope.attached or not $scope.attachedOptions.enabled
|
||||
$scope.defaultProfileName = name
|
||||
|
||||
$scope.$watch 'attachedOptions.enabled', (enabled, oldValue) ->
|
||||
return if enabled == oldValue
|
||||
if enabled
|
||||
if $scope.profile.defaultProfileName != $scope.attachedName
|
||||
$scope.profile.defaultProfileName = $scope.attachedName
|
||||
else
|
||||
if $scope.profile.defaultProfileName == $scope.attachedName
|
||||
if $scope.attached
|
||||
$scope.profile.defaultProfileName = $scope.attached.defaultProfileName
|
||||
$scope.defaultProfileName = $scope.attached.defaultProfileName
|
||||
else
|
||||
$scope.profile.defaultProfileName = 'direct'
|
||||
$scope.defaultProfileName = 'direct'
|
||||
|
||||
$scope.$watch 'attached.defaultProfileName', (name) ->
|
||||
if name
|
||||
if name and $scope.attachedOptions.enabled
|
||||
$scope.defaultProfileName = name
|
||||
|
||||
$scope.$watch 'defaultProfileName', (name) ->
|
||||
($scope.attached || $scope.profile).defaultProfileName = name
|
||||
if $scope.attached and $scope.attachedOptions.enabled
|
||||
$scope.attached.defaultProfileName = name
|
||||
else
|
||||
$scope.profile.defaultProfileName = name
|
||||
|
||||
$scope.attachNew = ->
|
||||
$scope.attached = OmegaPac.Profiles.create(
|
||||
@ -101,6 +120,7 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $modal,
|
||||
)
|
||||
OmegaPac.Profiles.updateRevision($scope.attached)
|
||||
$scope.options[$scope.attachedKey] = $scope.attached
|
||||
$scope.attachedOptions.enabled = true
|
||||
$scope.profile.defaultProfileName = $scope.attachedName
|
||||
|
||||
$scope.removeAttached = ->
|
||||
|
@ -46,12 +46,19 @@ div(ng-controller='SwitchProfileCtrl')
|
||||
tr
|
||||
td(style='border-right: none;')
|
||||
span.glyphicon(class='{{profileIcons["RuleListProfile"]}}')
|
||||
td(style='border-left: none;') {{'options_switchAttachedProfileInCondition' | tr}}
|
||||
td(style='border-left: none;')
|
||||
span.checkbox
|
||||
label
|
||||
input(type='checkbox' ng-model='attachedOptions.enabled')
|
||||
| {{'options_switchAttachedProfileInCondition' | tr}}
|
||||
td
|
||||
span {{'options_switchAttachedProfileInConditionDetails' | tr}}
|
||||
span(ng-show='!!attachedOptions.enabled')
|
||||
| {{'options_switchAttachedProfileInConditionDetails' | tr}}
|
||||
span(ng-show='!attachedOptions.enabled')
|
||||
| {{'options_switchAttachedProfileInConditionDisabled' | tr}}
|
||||
td
|
||||
div.form-control(omega-profile-select='options | profiles:profile' ng-model='attached.matchProfileName'
|
||||
disp-name='$profile.name | dispName')
|
||||
disp-name='$profile.name | dispName' ng-class='{disabled: !attachedOptions.enabled}')
|
||||
td
|
||||
button.btn.btn-danger.btn-sm(title="{{'options_deleteAttached' | tr}}" ng-click='removeAttached()')
|
||||
span.glyphicon.glyphicon-trash
|
||||
|
Loading…
Reference in New Issue
Block a user