Fix bugs with check plugins
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
6878d36e50
commit
e72f58b000
|
@ -32,17 +32,20 @@
|
||||||
:tagging="false"
|
:tagging="false"
|
||||||
@input="setValue">
|
@input="setValue">
|
||||||
<template slot="singleLabel" slot-scope="props">
|
<template slot="singleLabel" slot-scope="props">
|
||||||
<span class="option__icon" :class="props.option.icon" />
|
<span v-if="props.option.icon" class="option__icon" :class="props.option.icon" />
|
||||||
|
<img v-else :src="props.option.iconUrl" />
|
||||||
<span class="option__title option__title_single">{{ props.option.label }}</span>
|
<span class="option__title option__title_single">{{ props.option.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template slot="option" slot-scope="props">
|
<template slot="option" slot-scope="props">
|
||||||
<span class="option__icon" :class="props.option.icon" />
|
<span v-if="props.option.icon" class="option__icon" :class="props.option.icon" />
|
||||||
|
<img v-else :src="props.option.iconUrl" />
|
||||||
<span class="option__title">{{ props.option.label }}</span>
|
<span class="option__title">{{ props.option.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
</Multiselect>
|
</Multiselect>
|
||||||
<input v-if="!isPredefined"
|
<input v-if="!isPredefined"
|
||||||
type="text"
|
type="text"
|
||||||
:value="currentValue.pattern"
|
:value="currentValue.pattern"
|
||||||
|
:placeholder="t('workflowengine', 'e.g. httpd/unix-directory')"
|
||||||
@input="updateCustom">
|
@input="updateCustom">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -68,12 +71,12 @@ export default {
|
||||||
pattern: '/image\\/.*/'
|
pattern: '/image\\/.*/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon-category-office',
|
iconUrl: OC.imagePath('core', 'filetypes/x-office-document'),
|
||||||
label: t('workflowengine', 'Office documents'),
|
label: t('workflowengine', 'Office documents'),
|
||||||
pattern: '/(vnd\\.(ms-|openxmlformats-).*))$/'
|
pattern: '/(vnd\\.(ms-|openxmlformats-).*))$/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon-filetype-file',
|
iconUrl: OC.imagePath('core', 'filetypes/application-pdf'),
|
||||||
label: t('workflowengine', 'PDF documents'),
|
label: t('workflowengine', 'PDF documents'),
|
||||||
pattern: 'application/pdf'
|
pattern: 'application/pdf'
|
||||||
}
|
}
|
||||||
|
@ -130,3 +133,15 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.multiselect, input[type='text'] {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.multiselect >>> .multiselect__content-wrapper li>span,
|
||||||
|
.multiselect >>> .multiselect__single {
|
||||||
|
display: flex;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
<input v-model="newValue.startTime"
|
<input v-model="newValue.startTime"
|
||||||
type="text"
|
type="text"
|
||||||
class="timeslot--start"
|
class="timeslot--start"
|
||||||
placeholder="08:00"
|
placeholder="e.g. 08:00"
|
||||||
@input="update">
|
@input="update">
|
||||||
<input v-model="newValue.endTime"
|
<input v-model="newValue.endTime"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="18:00"
|
placeholder="e.g. 18:00"
|
||||||
@input="update">
|
@input="update">
|
||||||
|
<p v-if="!valid" class="invalid-hint">{{ t('workflowengine', 'Please enter a valid time span')}}</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '1 MB'
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -46,15 +47,16 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateInternalValue(value) {
|
updateInternalValue(value) {
|
||||||
var data = JSON.parse(value)
|
try {
|
||||||
var startTime = data[0].split(' ', 2)[0]
|
const data = JSON.parse(value)
|
||||||
var endTime = data[1].split(' ', 2)[0]
|
if (data.length === 2) {
|
||||||
var timezone = data[0].split(' ', 2)[1]
|
this.newValue = {
|
||||||
this.newValue = {
|
startTime: data[0].split(' ', 2)[0],
|
||||||
startTime: startTime,
|
endTime: data[1].split(' ', 2)[0],
|
||||||
endTime: endTime,
|
timezone: data[0].split(' ', 2)[1]
|
||||||
timezone: timezone
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {}
|
||||||
},
|
},
|
||||||
validate() {
|
validate() {
|
||||||
return this.newValue.startTime && this.newValue.startTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i) !== null
|
return this.newValue.startTime && this.newValue.startTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i) !== null
|
||||||
|
@ -90,10 +92,15 @@ export default {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
|
||||||
&.timeslot--start {
|
&.timeslot--start {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
width: calc(50% - 5px);
|
width: calc(50% - 5px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invalid-hint {
|
||||||
|
color: var(--color-text-maxcontrast);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -65,7 +65,7 @@ const FileChecks = [
|
||||||
{ operator: 'greater', name: t('workflowengine', 'greater') }
|
{ operator: 'greater', name: t('workflowengine', 'greater') }
|
||||||
],
|
],
|
||||||
placeholder: (check) => '5 MB',
|
placeholder: (check) => '5 MB',
|
||||||
validate: (check) => check.value.match(/^[0-9]+[ ]?[kmgt]?b$/i) !== null
|
validate: (check) => check.value ? check.value.match(/^[0-9]+[ ]?[kmgt]?b$/i) !== null : false
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,16 +24,25 @@ const regexIPv4 = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-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 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) {
|
const validateRegex = function(string) {
|
||||||
|
if (!string) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const result = regexRegex.exec(string)
|
const result = regexRegex.exec(string)
|
||||||
return result !== null
|
return result !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
const validateIPv4 = function(string) {
|
const validateIPv4 = function(string) {
|
||||||
|
if (!string) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const result = regexIPv4.exec(string)
|
const result = regexIPv4.exec(string)
|
||||||
return result !== null
|
return result !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
const validateIPv6 = function(string) {
|
const validateIPv6 = function(string) {
|
||||||
|
if (!string) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const result = regexIPv6.exec(string)
|
const result = regexIPv6.exec(string)
|
||||||
return result !== null
|
return result !== null
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue