Skip to content

Commit

Permalink
Add warning to host wildcard conditions containing some invalid host …
Browse files Browse the repository at this point in the history
…chars.
  • Loading branch information
FelisCatus committed Jan 11, 2015
1 parent c2cc042 commit 0d99379
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions omega-web/src/omega/controllers/switch_profile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location,
return false
return true

$scope.conditionHasWarning = (condition) ->
if condition.conditionType == 'HostWildcardCondition'
pattern = condition.pattern
return pattern.indexOf(':') >= 0 || pattern.indexOf('/') >= 0
return false

$scope.removeRule = (index) ->
removeForReal = ->
$scope.profile.rules.splice index, 1
Expand Down
2 changes: 1 addition & 1 deletion omega-web/src/partials/profile_switch.jade
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ div(ng-controller='SwitchProfileCtrl')
td
select.form-control(ng-model='rule.condition.conditionType'
ng-options='type.type as ("condition_" + type.type | tr) group by (type.group | tr) for type in conditionTypes')
td(ng-switch='rule.condition.conditionType')
td(ng-switch='rule.condition.conditionType' ng-class='{"has-warning": conditionHasWarning(rule.condition)}')
span(ng-switch-when='FalseCondition')
span(ng-show='!!rule.condition.pattern')
input.form-control(ng-model='rule.condition.pattern' disabled title="{{'condition_details_FalseCondition' | tr}}")
Expand Down

0 comments on commit 0d99379

Please sign in to comment.