Fix remaining comments from #16706

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-10-10 10:09:51 +02:00 committed by Arthur Schiwon
parent 327be375e1
commit 71470463c6
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
4 changed files with 14 additions and 19 deletions

View File

@ -73,17 +73,16 @@ export default {
}
},
computed: {
Checks() {
checks() {
return this.$store.getters.getChecksForEntity(this.rule.entity)
},
operators() {
if (!this.currentOption) { return [] }
return this.Checks[this.currentOption.class].operators
return this.checks[this.currentOption.class].operators
},
currentComponent() {
if (!this.currentOption) { return [] }
const currentComponent = this.Checks[this.currentOption.class].component
return currentComponent
return this.checks[this.currentOption.class].component
},
valuePlaceholder() {
if (this.currentOption && this.currentOption.placeholder) {
@ -98,8 +97,8 @@ export default {
}
},
mounted() {
this.options = Object.values(this.Checks)
this.currentOption = this.Checks[this.check.class]
this.options = Object.values(this.checks)
this.currentOption = this.checks[this.check.class]
this.currentOperator = this.operators.find((operator) => operator.operator === this.check.operator)
},
methods: {
@ -111,11 +110,7 @@ export default {
},
validate() {
if (this.currentOption && this.currentOption.validate) {
if (this.currentOption.validate(this.check)) {
this.valid = true
} else {
this.valid = false
}
this.valid = !!this.currentOption.validate(this.check);
}
this.$store.dispatch('setValid', { rule: this.rule, valid: this.rule.valid && this.valid })
return this.valid

View File

@ -23,7 +23,7 @@
<template>
<MultiselectTag v-model="newValue"
:multiple="false"
label="Select a tag"
label="{{ t('workflowengine', 'Select a tag') }}"
@input="update" />
</template>

View File

@ -19,11 +19,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
const scopeValue = OCP.InitialState.loadState('workflowengine', 'scope') === 0 ? 'global' : 'user'
import { loadState } from '@nextcloud/initial-state'
const getApiUrl = (url) => {
const scopeValue = loadState('workflowengine', 'scope') === 0 ? 'global' : 'user'
return OC.linkToOCS('apps/workflowengine/api/v1/workflows', 2) + scopeValue + url + '?format=json'
}

View File

@ -19,22 +19,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
const regexRegex = /^\/(.*)\/([gui]{0,3})$/
const regexIPv4 = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[1-2][0-9]|[1-9])$/
const regexIPv6 = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(1([01][0-9]|2[0-8])|[1-9][0-9]|[0-9])$/
const validateRegex = function(string) {
var regexRegex = /^\/(.*)\/([gui]{0,3})$/
var result = regexRegex.exec(string)
const result = regexRegex.exec(string)
return result !== null
}
const validateIPv4 = function(string) {
var regexRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[1-2][0-9]|[1-9])$/
var result = regexRegex.exec(string)
const result = regexIPv4.exec(string)
return result !== null
}
const validateIPv6 = function(string) {
var regexRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(1([01][0-9]|2[0-8])|[1-9][0-9]|[0-9])$/
var result = regexRegex.exec(string)
const result = regexIPv6.exec(string)
return result !== null
}