Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/workflowengine/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
],
'ocs-resources' => [
'global_workflows' => ['url' => '/api/v1/workflows/global'],
'user_workflows' => ['url' => '/api/v1/workflows/user'],
],
];
86 changes: 0 additions & 86 deletions apps/workflowengine/css/admin.scss

This file was deleted.

12 changes: 0 additions & 12 deletions apps/workflowengine/css/multiselect.css

This file was deleted.

38 changes: 19 additions & 19 deletions apps/workflowengine/js/workflowengine.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/workflowengine/js/workflowengine.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ public function show(string $id): DataResponse {
* @throws OCSBadRequestException
* @throws OCSForbiddenException
*/
public function create(string $class, string $name, array $checks, string $operation): DataResponse {
return parent::create($class, $name, $checks, $operation);
public function create(string $class, string $name, array $checks, string $operation, string $entity, array $events): DataResponse {
return parent::create($class, $name, $checks, $operation, $entity, $events);
}

/**
* @NoAdminRequired
* @throws OCSBadRequestException
* @throws OCSForbiddenException
*/
public function update(int $id, string $name, array $checks, string $operation): DataResponse {
return parent::update($id, $name, $checks, $operation);
public function update(int $id, string $name, array $checks, string $operation, string $entity, array $events): DataResponse {
return parent::update($id, $name, $checks, $operation, $entity, $events);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions apps/workflowengine/lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ public function formatOperation(array $operation): array {

$operation['checks'][] = $check;
}
$operation['events'] = json_decode($operation['events'], true);


return $operation;
}
Expand Down
5 changes: 1 addition & 4 deletions apps/workflowengine/lib/Service/RuleMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@

namespace OCA\WorkflowEngine\Service;

use OCA\WorkflowEngine\AppInfo\Application;
use OCA\WorkflowEngine\Entity\File;
use OCA\WorkflowEngine\Helper\ScopeContext;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\QueryException;
use OCP\Files\Node;
use OCP\Files\Storage\IStorage;
use OCP\IL10N;
use OCP\IServerContainer;
Expand Down Expand Up @@ -128,7 +125,7 @@ public function check(array $check) {
list($entity, $subject) = $entityInfo;
$checkInstance->setEntitySubject($entity, $subject);
}
} else {
} else if(!$checkInstance instanceof ICheck) {
// Check is invalid
throw new \UnexpectedValueException($this->l->t('Check %s is invalid or does not exist', $check['class']));
}
Expand Down
51 changes: 31 additions & 20 deletions apps/workflowengine/src/components/Check.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Multiselect v-model="currentOperator"
:disabled="!currentOption"
:options="operators"
class="comparator"
label="name"
track-by="operator"
:allow-empty="false"
Expand All @@ -21,6 +22,7 @@
v-model="check.value"
:disabled="!currentOption"
:check="check"
class="option"
@input="updateCheck"
@valid="(valid=true) && validate()"
@invalid="(valid=false) && validate()" />
Expand All @@ -30,9 +32,10 @@
:class="{ invalid: !valid }"
:disabled="!currentOption"
:placeholder="valuePlaceholder"
class="option"
@input="updateCheck">
<Actions v-if="deleteVisible || !currentOption">
<ActionButton icon="icon-delete" @click="$emit('remove')" />
<ActionButton icon="icon-close" @click="$emit('remove')" />
</Actions>
</div>
</template>
Expand Down Expand Up @@ -73,17 +76,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) {
Expand All @@ -98,8 +100,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: {
Expand All @@ -111,13 +113,8 @@ 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
},
updateCheck() {
Expand All @@ -128,7 +125,7 @@ export default {
this.check.operator = this.currentOperator.operator

if (!this.validate()) {
return
this.check.invalid = !this.valid
}
this.$emit('update', this.check)
}
Expand All @@ -142,29 +139,43 @@ export default {
flex-wrap: wrap;
width: 100%;
padding-right: 20px;
& > *:not(.icon-delete) {
& > *:not(.close) {
width: 180px;
}
& > .comparator {
min-width: 130px;
width: 130px;
}
& > .option {
min-width: 230px;
width: 230px;
}
& > .multiselect,
& > input[type=text] {
margin-right: 5px;
margin-bottom: 5px;
}

.multiselect::v-deep .multiselect__content-wrapper li>span,
.multiselect::v-deep .multiselect__single {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
input[type=text] {
margin: 0;
}
::placeholder {
font-size: 10px;
}
.icon-delete {
button.action-item.action-item--single.icon-close {
height: 44px;
width: 44px;
margin-top: -5px;
margin-bottom: -5px;
}
button.action-item.action-item--single.icon-delete {
height: 34px;
width: 34px;
}
.invalid {
border: 1px solid var(--color-error) !important;
}
Expand Down
23 changes: 19 additions & 4 deletions apps/workflowengine/src/components/Checks/FileMimeType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,20 @@
:tagging="false"
@input="setValue">
<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>
</template>
<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>
</template>
</Multiselect>
<input v-if="!isPredefined"
type="text"
:value="currentValue.pattern"
:placeholder="t('workflowengine', 'e.g. httpd/unix-directory')"
@input="updateCustom">
</div>
</template>
Expand All @@ -68,12 +71,12 @@ export default {
pattern: '/image\\/.*/'
},
{
icon: 'icon-category-office',
iconUrl: OC.imagePath('core', 'filetypes/x-office-document'),
label: t('workflowengine', 'Office documents'),
pattern: '/(vnd\\.(ms-|openxmlformats-).*))$/'
},
{
icon: 'icon-filetype-file',
iconUrl: OC.imagePath('core', 'filetypes/application-pdf'),
label: t('workflowengine', 'PDF documents'),
pattern: 'application/pdf'
}
Expand Down Expand Up @@ -130,3 +133,15 @@ export default {
}
}
</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>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<template>
<MultiselectTag v-model="newValue"
:multiple="false"
label="Select a tag"
:label="t('workflowengine', 'Select a tag')"
@input="update" />
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ export default {
required: true
},
value: {
type: Array,
default() {
return []
}
type: [String, Array],
default: null
},
disabled: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: true
default: false
}
},
data() {
Expand Down
Loading