-
-
{{transition.to}}
+
+
+
+
+
0">
+
+
+
+
+
+
+ {{target.name}}
+
+
+
+
+
-
- when
-
-
-
-
-
- for
-
-
-
-
-
-
-
-
-
-
0">
-
-
-
-
-
-
- {{target.name}}
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.scss b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.scss
index c266d2fe5..2c81bc704 100644
--- a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.scss
+++ b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.scss
@@ -1,48 +1,49 @@
@import '_vars';
@import '_mixins';
-.color {
- line-height: 2.8rem;
-}
+:host ::ng-deep {
+ .color {
+ line-height: 2.8rem;
+ }
-.color-circle {
- @include circle(12px);
- border: 1px solid $color-border-dark;
- background: $color-border;
- display: inline-block;
-}
+ .color-circle {
+ @include circle(12px);
+ border: 1px solid $color-border-dark;
+ background: $color-border;
+ display: inline-block;
+ }
-.dashed {
- border-style: dashed;
-}
+ .col-label {
+ padding: 0 .5rem;
+ }
-.transition {
- & {
- padding-left: 1rem;
- margin-top: .25rem;
- margin-bottom: .5rem;
- line-height: 2.2rem;
+ .col-step {
+ min-width: 10rem;
+ max-width: 10rem;
+ padding-left: .5rem;
}
- &-to {
- padding: .5rem .75rem;
- padding-right: 0;
- line-height: 1.2rem;
+ .transition {
+ & {
+ margin-top: .25rem;
+ margin-bottom: .5rem;
+ line-height: 2.2rem;
+ }
+
+ &-to {
+ padding: .5rem .75rem;
+ padding-right: 0;
+ line-height: 1.2rem;
+ }
}
}
-
.step {
& {
margin-bottom: 1rem;
}
-}
-.col-label {
- padding: 0 .5rem;
-}
+ &-inner {
+ padding-left: 1rem;
+ }
-.col-step {
- min-width: 10rem;
- max-width: 10rem;
- padding-left: .5rem;
}
\ No newline at end of file
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts
index afbb45169..ebb5b79f8 100644
--- a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts
+++ b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts
@@ -8,10 +8,12 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import {
+ RoleDto,
WorkflowDto,
WorkflowStep,
WorkflowStepValues,
WorkflowTransition,
+ WorkflowTransitionValues,
WorkflowTransitionView
} from '@app/shared';
@@ -27,12 +29,18 @@ export class WorkflowStepComponent implements OnChanges {
@Input()
public step: WorkflowStep;
+ @Input()
+ public roles: RoleDto[];
+
@Output()
public transitionAdd = new EventEmitter
();
@Output()
public transitionRemove = new EventEmitter();
+ @Output()
+ public transitionUpdate = new EventEmitter<{ transition: WorkflowTransition, values: WorkflowTransitionValues }>();
+
@Output()
public update = new EventEmitter();
@@ -58,6 +66,10 @@ export class WorkflowStepComponent implements OnChanges {
}
}
+ public changeTransition(transition: WorkflowTransition, values: WorkflowTransitionValues) {
+ this.transitionUpdate.emit({ transition, values });
+ }
+
public changeName(name: string) {
this.rename.emit(name);
}
@@ -65,5 +77,13 @@ export class WorkflowStepComponent implements OnChanges {
public changeColor(color: string) {
this.update.emit({ color });
}
+
+ public changeNoUpdate(noUpdate: boolean) {
+ this.update.emit({ noUpdate });
+ }
+
+ public trackByTransition(index: number, transition: WorkflowTransition) {
+ return transition.to;
+ }
}
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html
new file mode 100644
index 000000000..c69109c4a
--- /dev/null
+++ b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+ when
+
+
+
+
+
+
+
+
+
+
+
+ for
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.scss b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.scss
new file mode 100644
index 000000000..768bb4358
--- /dev/null
+++ b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.scss
@@ -0,0 +1,6 @@
+@import '_vars';
+@import '_mixins';
+
+.dashed {
+ border-style: dashed;
+}
\ No newline at end of file
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts
new file mode 100644
index 000000000..83bc18aea
--- /dev/null
+++ b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts
@@ -0,0 +1,84 @@
+/*
+ * Squidex Headless CMS
+ *
+ * @license
+ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
+ */
+
+import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
+
+import {
+ RoleDto,
+ WorkflowTransitionValues,
+ WorkflowTransitionView
+} from '@app/shared';
+
+@Component({
+ selector: 'sqx-workflow-transition',
+ styleUrls: ['./workflow-transition.component.scss'],
+ templateUrl: './workflow-transition.component.html'
+})
+export class WorkflowTransitionComponent implements OnChanges {
+ @Input()
+ public transition: WorkflowTransitionView;
+
+ @Input()
+ public roles: RoleDto[];
+
+ @Output()
+ public update = new EventEmitter();
+
+ @Output()
+ public remove = new EventEmitter();
+
+ public elementsActive: { [name: string]: boolean } = {};
+ public elementsFocused: { [name: string]: boolean } = {};
+ public elementsValid: { [name: string]: boolean } = {};
+
+ public onBlur = { updateOn: 'blur' };
+
+ public ngOnChanges(changes: SimpleChanges) {
+ if (changes['transition']) {
+ if (this.transition.expression) {
+ this.elementsValid['expression'] = true;
+ this.elementsActive['expression'] = true;
+ }
+
+ if (this.transition.role) {
+ this.elementsValid['role'] = true;
+ this.elementsActive['role'] = true;
+ }
+ }
+ }
+
+ public changeExpression(expression: string) {
+ this.update.emit({ expression });
+ }
+
+ public changeRole(role: string) {
+ this.update.emit({ role });
+ }
+
+ public showElement(name: string) {
+ this.elementsActive[name] = true;
+ }
+
+ public focusElement(name: string) {
+ this.elementsFocused[name] = true;
+ }
+
+ public blurElement(name: string) {
+ this.elementsFocused[name] = false;
+
+ setTimeout(() => {
+ if (!this.elementsFocused[name] && !this.elementsValid[name]) {
+ this.elementsActive[name] = false;
+ }
+ }, 2000);
+ }
+
+ public trackByRole(index: number, role: RoleDto) {
+ return role.name;
+ }
+}
+
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html b/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html
index c5782052b..9ce5b1278 100644
--- a/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html
+++ b/src/Squidex/app/features/settings/pages/workflows/workflows-page.component.html
@@ -20,15 +20,19 @@
-
-
+
+
+
+