Skip to content

Commit 038ccce

Browse files
authored
Merge pull request #1157 from microting/copilot/change-actions-style-pattern
Refactor Actions column to use menu-based pattern following backend-configuration-plugin reference
2 parents 11b7837 + 7fb89bd commit 038ccce

File tree

3 files changed

+55
-37
lines changed

3 files changed

+55
-37
lines changed

eform-client/e2e/Page objects/Workflow/WorkflowCases.page.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export class WorkflowCaseRowObject {
195195
public actionPlan: string;
196196
public toBeSolvedBy: string;
197197
public status: string;
198+
public menuBtn: WebdriverIO.Element;
198199
public updateBtn: WebdriverIO.Element;
199200
public deleteBtn: WebdriverIO.Element;
200201

@@ -245,14 +246,18 @@ export class WorkflowCaseRowObject {
245246
this.actionPlan = await (await $$('tbody > tr > td.mat-column-actionPlan'))[rowNum].getText();
246247
this.toBeSolvedBy = await (await $$('tbody > tr > td.mat-column-solvedBy'))[rowNum].getText();
247248
this.status = await (await $$('tbody > tr > td.mat-column-status'))[rowNum].getText();
248-
this.updateBtn = (await $$('#editWorkflowCaseBtn'))[rowNum];
249-
this.deleteBtn = await $$('#deleteBtn')[rowNum];
249+
this.menuBtn = await $(`#actionMenu-${rowNum}`);
250+
this.updateBtn = await $(`#editWorkflowCaseBtn-${rowNum}`);
251+
this.deleteBtn = await $(`#deleteBtn-${rowNum}`);
250252
}
251253
return this;
252254
}
253255

254256

255257
public async openDelete() {
258+
await this.menuBtn.waitForClickable({ timeout: 20000 });
259+
await this.menuBtn.click();
260+
await browser.pause(500);
256261
await this.deleteBtn.waitForClickable({ timeout: 20000 });
257262
await this.deleteBtn.click();
258263
await (await workflowCasesPage.workflowCaseDeleteCancelBtn()).waitForDisplayed({
@@ -261,6 +266,10 @@ export class WorkflowCaseRowObject {
261266
}
262267

263268
public async openEdit(updateModel: WorkflowCaseForEdit) {
269+
await this.menuBtn.waitForClickable({ timeout: 20000 });
270+
await this.menuBtn.click();
271+
await browser.pause(500);
272+
await this.updateBtn.waitForClickable({ timeout: 20000 });
264273
await this.updateBtn.click();
265274
await (await workflowCasesPage.cancelEditBtn()).waitForDisplayed({
266275
timeout: 20000,

eform-client/src/app/plugins/modules/workflow-pn/components/workflow-cases/workflow-cases-page/workflow-cases-page.component.html

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,41 +44,47 @@
4444
[noResultText]="'No workflow cases found' | translate">
4545
</mtx-grid>
4646

47-
<ng-template #actionsTpl let-row>
48-
<div class="d-flex">
49-
<button
50-
mat-icon-button
51-
id="editWorkflowCaseBtn"
52-
matTooltip="{{ 'Edit Workflow Case' | translate }}"
53-
[routerLink]="['/plugins/workflow-pn/edit-workflow-case/', row.id]"
54-
>
55-
<mat-icon>edit</mat-icon>
56-
</button>
57-
<button
58-
mat-icon-button
59-
matTooltip="{{ 'Download PDF' | translate }}"
60-
(click)="downloadFile(row.id, 'pdf')"
61-
color="accent"
62-
>
63-
<mat-icon svgIcon="file-pdf"></mat-icon>
64-
</button>
65-
<button
66-
mat-icon-button
67-
color="primary"
68-
(click)="downloadFile(row.id, 'docx')"
69-
matTooltip="{{ 'Download Docx' | translate }}"
70-
>
71-
<mat-icon svgIcon="file-word"></mat-icon>
72-
</button>
73-
<button
74-
mat-icon-button
75-
color="warn"
76-
id="deleteBtn"
77-
(click)="showDeleteWorkflowCaseModal(row)"
78-
matTooltip="{{ 'Delete' | translate }}"
79-
>
80-
<mat-icon>delete</mat-icon>
47+
<ng-template #actionsTpl let-row let-i="index">
48+
<div class="workflow-case-actions" id="action-items-{{i}}">
49+
<button id="actionMenu-{{i}}" mat-icon-button [matMenuTriggerFor]="menu" matTooltip="{{ 'Actions' | translate }}">
50+
<mat-icon>more_vert</mat-icon>
8151
</button>
52+
53+
<mat-menu #menu="matMenu">
54+
<button
55+
mat-menu-item
56+
id="editWorkflowCaseBtn-{{i}}"
57+
[routerLink]="['/plugins/workflow-pn/edit-workflow-case/', row.id]"
58+
>
59+
<mat-icon>edit</mat-icon>
60+
<span>{{ 'Edit Workflow Case' | translate }}</span>
61+
</button>
62+
<button
63+
mat-menu-item
64+
id="downloadPdfBtn-{{i}}"
65+
(click)="downloadFile(row.id, 'pdf')"
66+
>
67+
<mat-icon svgIcon="file-pdf"></mat-icon>
68+
<span>{{ 'Download PDF' | translate }}</span>
69+
</button>
70+
<button
71+
mat-menu-item
72+
id="downloadDocxBtn-{{i}}"
73+
(click)="downloadFile(row.id, 'docx')"
74+
>
75+
<mat-icon svgIcon="file-word"></mat-icon>
76+
<span>{{ 'Download Docx' | translate }}</span>
77+
</button>
78+
<button
79+
mat-menu-item
80+
color="warn"
81+
id="deleteBtn-{{i}}"
82+
(click)="showDeleteWorkflowCaseModal(row)"
83+
>
84+
<mat-icon color="warn">delete</mat-icon>
85+
<span>{{ 'Delete' | translate }}</span>
86+
</button>
87+
</mat-menu>
8288
</div>
8389
</ng-template>
8490

eform-client/src/app/plugins/modules/workflow-pn/components/workflow-cases/workflow-cases-page/workflow-cases-page.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ export class WorkflowCasesPageComponent implements OnInit, OnDestroy {
8282
},
8383
{
8484
pinned: 'right',
85-
header: this.translateService.stream('Actions'), field: 'actions'},
85+
header: this.translateService.stream('Actions'),
86+
field: 'actions',
87+
width: '160px',
88+
},
8689
];
8790
workflowCaseDeletedSub$: Subscription;
8891
deleteWorkflowCase$: Subscription;

0 commit comments

Comments
 (0)