mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Support IpCondition in omega-web. Fix #705.
This commit is contained in:
parent
56d1e8c4d6
commit
8dcad1697e
@ -68,6 +68,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -69,6 +69,20 @@ msgstr ""
|
||||
"název domény).<br>Příklad: <code>www.example.com</code> je na úrovni "
|
||||
"hostitele 3, zatímco <code>vnitřní</code> hostitele úrovně 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -73,6 +73,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -69,6 +69,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -72,6 +72,20 @@ msgstr ""
|
||||
"<code>www.ejemplo.com</code> tiene un nivel 3 de host, mientras que "
|
||||
"<code>interno</code> es un host de nivel 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "Comodín de URL"
|
||||
|
||||
|
@ -72,6 +72,20 @@ msgstr ""
|
||||
"دارای سطح میزابن سه میباشد ، در حالی که <code>داخل</code> سطح میزبان یک را "
|
||||
"دارد."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "فرانویسه ادرس (URL)"
|
||||
|
||||
|
@ -70,6 +70,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -53,6 +53,20 @@ msgstr ""
|
||||
msgid "condition_help_HostLevelsCondition"
|
||||
msgstr ""
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr ""
|
||||
|
||||
|
@ -66,6 +66,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URLワイルドカード"
|
||||
|
||||
|
@ -54,6 +54,20 @@ msgstr ""
|
||||
msgid "condition_help_HostLevelsCondition"
|
||||
msgstr ""
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr ""
|
||||
|
||||
|
@ -69,6 +69,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -73,6 +73,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -52,6 +52,20 @@ msgstr ""
|
||||
msgid "condition_help_HostLevelsCondition"
|
||||
msgstr ""
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr ""
|
||||
|
||||
|
@ -54,6 +54,20 @@ msgstr ""
|
||||
msgid "condition_help_HostLevelsCondition"
|
||||
msgstr ""
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr ""
|
||||
|
||||
|
@ -72,6 +72,20 @@ msgstr ""
|
||||
"the host (domain name).<br>Example: <code>www.example.com</code> is with a "
|
||||
"host level of 3, while <code>internal</code> is of host level 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP Literals"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"Matches the request if and only if the host is a <b>literal</b> IP address and"
|
||||
" in the subnet as specified by <a href='"
|
||||
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation'>"
|
||||
"CIDR notation</a>.<br>For example, given the rule <code>127.0.0.1/16</code>, "
|
||||
"it matches all IP addresses like <code>127.0.*.*</code>.<br>"
|
||||
"So <code>127.0.0.1</code> matches while <code>127.1.0.0</code> does not. "
|
||||
"Host names like <code>localhost</code> will never match because they are "
|
||||
"<b>not</b> IP literals."
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "URL wildcard"
|
||||
|
||||
|
@ -62,6 +62,20 @@ msgstr ""
|
||||
"如果域名层数在设定的范围内则匹配,否则不匹配。<br>域名层数是指 <b>域名共有几段(以点分隔)</b>.<br>例如: <code>www."
|
||||
"example.com</code> 的域名层数为 3,而 <code>internal</code> 的域名层数为 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP 地址字面量"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"当且仅当主机是<b>字面的</b> IP 地址,且地址处于某个子网内时匹配。"
|
||||
"子网使用 <a href='"
|
||||
"http://www.ibm.com/support/knowledgecenter/zh/SS2MBL_9.0.2/PCAAdmin/PCA/Cfg/CIDRFormat_47.html'"
|
||||
">CIDR 格式</a>表示。<br>例如,规则 <code>127.0.0.1/16</code> 会匹配所有类似 "
|
||||
"<code>127.0.*.*</code> 的地址。<br>"
|
||||
"因此地址 <code>127.0.0.1</code> 匹配而地址 <code>127.1.0.0</code> 不匹配。"
|
||||
"主机名称,例如 <code>localhost</code> 不会被此类规则匹配,因为它们<b>不是</b> "
|
||||
"IP 地址字面量。"
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "网址通配符"
|
||||
|
||||
|
@ -62,6 +62,20 @@ msgstr ""
|
||||
"如果域名層數在設定的範圍內則匹配,否則不匹配。<br>域名層數是指 <b>域名共有幾段(以點分隔)</b>.<br>例如: <code>www."
|
||||
"example.com</code> 的域名層數為 3,而 <code>internal</code> 的域名層數為 1."
|
||||
|
||||
msgid "condition_IpCondition"
|
||||
msgstr "IP 地址字面量"
|
||||
|
||||
msgid "condition_help_IpCondition"
|
||||
msgstr ""
|
||||
"當且僅當主機是<b>字面的</b> IP 地址,且地址處於某個子網內時匹配。"
|
||||
"子網使用 <a href='"
|
||||
"http://www.ibm.com/support/knowledgecenter/zh/SS2MBL_9.0.2/PCAAdmin/PCA/Cfg/CIDRFormat_47.html'"
|
||||
">CIDR 格式</a>表示。<br>例如,規則 <code>127.0.0.1/16</code> 會匹配所有類似"
|
||||
"<code>127.0.*.*</code> 的地址。<br>"
|
||||
"因此地址 <code>127.0.0.1</code> 匹配而地址 <code>127.1.0.0</code> 不匹配。"
|
||||
"主機名稱,例如 <code>localhost</code> 不會被此類規則匹配,因為它們<b>不是</b> "
|
||||
"IP 地址字面量。"
|
||||
|
||||
msgid "condition_UrlWildcardCondition"
|
||||
msgstr "網址通配符"
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
"uglify-js-real": "./uglifyjs.js"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "npm link"
|
||||
"dev": "npm link",
|
||||
"test": "TZ=Europe/London grunt test"
|
||||
}
|
||||
}
|
||||
|
@ -549,12 +549,13 @@ module.exports = exports =
|
||||
)
|
||||
str: (condition) -> condition.ip + '/' + condition.prefixLength
|
||||
fromStr: (str, condition) ->
|
||||
[ip, prefixLength] = str.split('/')
|
||||
condition.ip = ip
|
||||
addr = @parseIp ip
|
||||
condition.ip = '0.0.0.0' unless addr?
|
||||
condition.prefixLength = parseInt(prefixLength, 10)
|
||||
condition.prefixLength = 0 unless condition.prefixLength >= 0
|
||||
addr = @parseIp str
|
||||
if addr?
|
||||
condition.ip = addr.addressMinusSuffix
|
||||
condition.prefixLength = addr.subnetMask
|
||||
else
|
||||
condition.ip = '0.0.0.0'
|
||||
condition.prefixLength = 0
|
||||
condition
|
||||
|
||||
'HostLevelsCondition':
|
||||
|
@ -582,6 +582,20 @@ describe 'Conditions', ->
|
||||
ip: '0.0.0.0'
|
||||
prefixLength: 0
|
||||
)
|
||||
it 'should assume full match for IpCondition without prefixLength', ->
|
||||
cond = Conditions.fromStr('Ip: 127.0.0.1')
|
||||
cond.should.eql(
|
||||
conditionType: 'IpCondition'
|
||||
ip: '127.0.0.1'
|
||||
prefixLength: 32
|
||||
)
|
||||
|
||||
cond = Conditions.fromStr('Ip: ::1')
|
||||
cond.should.eql(
|
||||
conditionType: 'IpCondition'
|
||||
ip: '::1'
|
||||
prefixLength: 128
|
||||
)
|
||||
it 'should provide sensible fallbacks for invalid IpCondition', ->
|
||||
cond = Conditions.fromStr('Ip: 0.0.0.0/-233')
|
||||
cond.should.eql(
|
||||
|
@ -77,6 +77,7 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $rootScope,
|
||||
'HostWildcardCondition'
|
||||
'HostRegexCondition'
|
||||
'HostLevelsCondition'
|
||||
'IpCondition'
|
||||
]
|
||||
}
|
||||
{
|
||||
@ -193,6 +194,11 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $rootScope,
|
||||
return pattern.indexOf(':') >= 0 || pattern.indexOf('/') >= 0
|
||||
return false
|
||||
|
||||
$scope.validateIpCondition = (condition, input) ->
|
||||
return false unless input
|
||||
ip = OmegaPac.Conditions.parseIp(input)
|
||||
return ip?
|
||||
|
||||
$scope.getWeekdayList = OmegaPac.Conditions.getWeekdayList
|
||||
$scope.updateDay = (condition, i, selected) ->
|
||||
condition.days ||= '-------'
|
||||
|
@ -46,3 +46,18 @@ angular.module('omega').directive 'omegaInt2str', ->
|
||||
parseInt(value)
|
||||
ngModel.$formatters.push (value) ->
|
||||
'' + value
|
||||
angular.module('omega').directive 'omegaIp2str', ->
|
||||
restrict: 'A'
|
||||
priority: 2 # Run post-link after input directive (0) and ngModel (1).
|
||||
require: 'ngModel'
|
||||
link: (scope, element, attr, ngModel) ->
|
||||
ngModel.$parsers.push (value) ->
|
||||
if value
|
||||
OmegaPac.Conditions.fromStr('Ip: ' + value)
|
||||
else
|
||||
({conditionType: 'IpCondition', ip: '0.0.0.0', prefixLength: 0})
|
||||
ngModel.$formatters.push (value) ->
|
||||
if value?.ip
|
||||
OmegaPac.Conditions.str(value).split(' ', 2)[1]
|
||||
else
|
||||
''
|
||||
|
@ -67,6 +67,10 @@ div(ng-controller='SwitchProfileCtrl')
|
||||
span {{'options_hostLevelsBetween' | tr}}
|
||||
= ' '
|
||||
input.form-control(type='number' max='99' min='1' ng-model='rule.condition.maxValue' required)
|
||||
span(ng-switch-when='IpCondition')
|
||||
input.form-control(type='text' ng-model='rule.condition' required
|
||||
omega-ip2str placeholder='127.0.0.1/8'
|
||||
ui-validate='{pattern: "validateIpCondition(rule.condition, $value)"}')
|
||||
span.host-levels-details(ng-switch-when='TimeCondition')
|
||||
input.form-control(type='number' min='0' max='23' ng-model='rule.condition.startHour' required)
|
||||
= ' '
|
||||
|
Loading…
Reference in New Issue
Block a user