Skip to content

Commit 8c47de3

Browse files
fix: incorrect drag / drop for steps in aggregation pipeline (#1978)
* Improvement: started to fix aggregation configurations * remove monaco editor --------- Co-authored-by: Antoine Hurard <antoine.reliefapps@gmail.com>
1 parent 2494ff3 commit 8c47de3

File tree

6 files changed

+57
-23
lines changed

6 files changed

+57
-23
lines changed

libs/shared/src/lib/components/navbar/navbar.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@
135135
<a
136136
class="group flex flex-row gap-x-3 text-sm leading-6 items-center font-semibold"
137137
>
138-
<ui-icon variant="grey" [icon]="item.icon"></ui-icon>
138+
<ui-icon
139+
variant="grey"
140+
[icon]="item.icon"
141+
[fontFamily]="item.fontFamily"
142+
></ui-icon>
139143
<div class="pl-2">{{ item.name }}</div>
140144
</a>
141145
</li>

libs/shared/src/lib/components/ui/aggregation-builder/pipeline/pipeline.component.html

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
1-
<cdk-accordion cdkDropList (cdkDropListDropped)="drop($event)">
1+
<cdk-accordion
2+
cdkDropList
3+
(cdkDropListDropped)="drop($event)"
4+
cdkDropListOrientation="vertical"
5+
>
26
<ui-expansion-panel
3-
cdkDrag
47
*ngFor="let stageForm of pipelineForm.controls; let index = index"
58
[index]="index"
69
class="bg-white"
10+
cdkDrag
11+
[cdkDragDisabled]="!dragEnabled"
712
>
813
<ng-container ngProjectAs="title">
9-
{{
10-
'components.aggregationBuilder.stages.' + stageForm.value.type
11-
| translate
12-
}}
13-
<ui-icon
14-
icon="info_outline"
15-
variant="grey"
16-
[size]="18"
17-
[uiTooltip]="
18-
'components.aggregationBuilder.tooltip.' + stageForm.value.type
19-
| translate
20-
"
21-
></ui-icon>
14+
<div class="flex items-center">
15+
<p>
16+
{{
17+
'components.aggregationBuilder.stages.' + stageForm.value.type
18+
| translate
19+
}}
20+
</p>
21+
<ui-icon
22+
class="ml-0.5"
23+
icon="info_outline"
24+
variant="grey"
25+
[size]="18"
26+
[uiTooltip]="
27+
'components.aggregationBuilder.tooltip.' + stageForm.value.type
28+
| translate
29+
"
30+
></ui-icon>
31+
<ui-button
32+
(mouseenter)="dragEnabled = true"
33+
cdkDragHandle
34+
(mouseleave)="dragEnabled = false"
35+
[isIcon]="true"
36+
variant="grey"
37+
icon="drag_indicator"
38+
class="nav-item-handle"
39+
[uiTooltip]="'models.page.tooltip.drag' | translate"
40+
>
41+
</ui-button>
42+
</div>
2243
</ng-container>
2344
<ng-container [ngSwitch]="stageForm.value.type">
2445
<ng-container *ngSwitchCase="stageType.FILTER">
@@ -55,11 +76,12 @@
5576
<div uiFormFieldDirective>
5677
<label>{{ 'common.input.rawJson' | translate }}</label>
5778
<ui-textarea
79+
#monacoEditor
80+
class="!h-full"
5881
[formControl]="$any(stageForm).controls.form.controls.raw"
5982
[minRows]="4"
6083
[maxRows]="20"
61-
>
62-
</ui-textarea>
84+
></ui-textarea>
6385
</div>
6486
</ng-container>
6587
</ng-container>
@@ -74,6 +96,7 @@
7496
</div>
7597
</ui-expansion-panel>
7698
</cdk-accordion>
99+
77100
<div class="flex justify-center">
78101
<ui-button
79102
icon="add"

libs/shared/src/lib/components/ui/aggregation-builder/pipeline/pipeline.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313
padding: 16px 8px 16px 24px;
1414
margin-top: 1em;
1515
}
16+
17+
.cdk-drag-preview {
18+
display: block;
19+
}

libs/shared/src/lib/components/ui/aggregation-builder/pipeline/pipeline.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class PipelineComponent extends UnsubscribeComponent implements OnInit {
2222
public stageType = PipelineStage;
2323
/** Array to hold the list of stages. */
2424
public stageList: string[] = Object.values(PipelineStage);
25-
2625
/** Input decorator for fields$. */
2726
@Input() public fields$!: Observable<any[]>;
2827
/** Input decorator for metaFields$. */
@@ -33,7 +32,8 @@ export class PipelineComponent extends UnsubscribeComponent implements OnInit {
3332
public initialFields: any[] = [];
3433
/** Array to hold the fields per stage. */
3534
public fieldsPerStage: any[] = [];
36-
35+
/** Enabled drag behavior, needed to set the drag on run time so cdkDragHandle directive works in the table */
36+
public dragEnabled = false;
3737
/** Input decorator for pipelineForm. */
3838
@Input() pipelineForm!: UntypedFormArray;
3939

@@ -110,6 +110,7 @@ export class PipelineComponent extends UnsubscribeComponent implements OnInit {
110110
* @param event positions to move.
111111
*/
112112
drop(event: CdkDragDrop<string[]>) {
113+
console.log('drop');
113114
const temp = this.pipelineForm.at(event.previousIndex);
114115

115116
this.pipelineForm.removeAt(event.previousIndex);

libs/shared/src/lib/components/ui/tagbox/tagbox.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<div class="flex-1 pb-4">
2-
<div class="flex">
2+
<div class="flex items-center">
33
<label class="block text-sm font-medium leading-6 text-gray-900">{{
44
label
55
}}</label>
66
<ui-icon
7-
class="cursor-pointer ml-2"
7+
class="cursor-help ml-2"
88
icon="info"
99
variant="grey"
1010
[uiTooltip]="
1111
'components.aggregationBuilder.tooltip.selectedFields' | translate
1212
"
13+
uiTooltipPosition="right"
1314
></ui-icon>
1415
</div>
1516
<ng-container *ngIf="showInput">

libs/ui/src/lib/expansion-panel/expansion-panel.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { ExpansionPanelComponent } from './expansion-panel.component';
44
import { CdkAccordionModule } from '@angular/cdk/accordion';
5+
import { DragDropModule } from '@angular/cdk/drag-drop';
56

67
/**
78
* UI Expansion Panel module
89
*/
910
@NgModule({
1011
declarations: [ExpansionPanelComponent],
11-
imports: [CommonModule, CdkAccordionModule],
12+
imports: [CommonModule, CdkAccordionModule, DragDropModule],
1213
exports: [ExpansionPanelComponent, CdkAccordionModule],
1314
})
1415
export class ExpansionPanelModule {}

0 commit comments

Comments
 (0)