Skip to content

Commit 5c35ad9

Browse files
authored
[ZEPPELIN-6358] Fix notebook UI bugs and add aria attributes and test IDs for selectors #5101
### What is this PR for? This PR fixes several notebook-related UI issues and improves testability and accessibility. ### Changes - Fix an issue where the search menu trigger did not work correctly. - Prevent folder renaming when the input is empty by disabling the confirm button. - Add accessibility (ARIA) attributes and test-specific attributes to improve usability and E2E test stability. ### What type of PR is it? Bug Fix Refactoring ### Todos ### What is the Jira issue? ZEPPELIN-6358 ### How should this be tested? ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Closes #5133 from dididy/e2e/notebook-bug. Signed-off-by: ChanHo Lee <chanholee@apache.org>
1 parent c9fa525 commit 5c35ad9

9 files changed

Lines changed: 25 additions & 9 deletions

File tree

zeppelin-web-angular/src/app/pages/workspace/notebook/action-bar/action-bar.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
-->
1212

1313
<div class="bar" [class.simple]="looknfeel !== 'default'">
14-
<div class="title">
14+
<div class="title" role="heading" aria-level="1">
1515
<zeppelin-elastic-input
1616
nz-tooltip
1717
[nzTooltipTitle]="note.path"
@@ -182,6 +182,7 @@
182182
<button
183183
nz-button
184184
nz-dropdown
185+
[(nzVisible)]="isSearchMenuVisible"
185186
[nzDropdownMenu]="searchMenu"
186187
nzTrigger="click"
187188
nz-tooltip

zeppelin-web-angular/src/app/pages/workspace/notebook/action-bar/action-bar.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class NotebookActionBarComponent extends MessageListenersManager implemen
6969
editorHide = false;
7070
commitVisible = false;
7171
tableHide = false;
72+
isSearchMenuVisible = false;
7273
searchText = '';
7374
replaceText = '';
7475
cronOption = [
@@ -259,6 +260,11 @@ export class NotebookActionBarComponent extends MessageListenersManager implemen
259260
this.handleSearch.emit(searchText);
260261
}
261262

263+
openSearchMenu() {
264+
this.isSearchMenuVisible = true;
265+
this.cdr.markForCheck();
266+
}
267+
262268
deleteNote() {
263269
this.messageService.deleteNote(this.note.id);
264270
}

zeppelin-web-angular/src/app/pages/workspace/notebook/notebook.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
(selected)="onParagraphSelect($event)"
9595
(triggerSaveParagraph)="saveParagraph($event)"
9696
(saveNoteTimer)="startSaveTimer()"
97-
(searchCode)="actionBar.searchCode()"
97+
(openSearchMenu)="actionBar.openSearchMenu()"
9898
></zeppelin-notebook-paragraph>
9999
</div>
100100
</div>

zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
(sizeChange)="onSizeChange($event)"
108108
(configChange)="onConfigChange($event, i)"
109109
[result]="result"
110+
[attr.data-testid]="'paragraph-result'"
110111
></zeppelin-notebook-paragraph-result>
111112
</ng-container>
112113
<zeppelin-notebook-paragraph-footer

zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class NotebookParagraphComponent
9797
@Output() readonly triggerSaveParagraph = new EventEmitter<string>();
9898
@Output() readonly selected = new EventEmitter<string>();
9999
@Output() readonly selectAtIndex = new EventEmitter<number>();
100-
@Output() readonly searchCode = new EventEmitter();
100+
@Output() readonly openSearchMenu = new EventEmitter();
101101

102102
private destroy$ = new Subject();
103103

@@ -700,7 +700,7 @@ export class NotebookParagraphComponent
700700
}
701701

702702
handleFindInCode() {
703-
this.searchCode.emit();
703+
this.openSearchMenu.emit();
704704
}
705705

706706
ngOnChanges(changes: SimpleChanges): void {

zeppelin-web-angular/src/app/pages/workspace/notebook/sidebar/sidebar.component.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@
1515
<button
1616
[class.sidebar-button-active]="sidebarState === SidebarState.TOC"
1717
class="sidebar-button"
18+
aria-label="Toggle Table of Contents"
1819
(click)="setOrToggleSidebarState(SidebarState.TOC)"
1920
>
2021
<i nz-icon nzType="unordered-list" nzTheme="outline"></i>
2122
</button>
2223
<button
2324
[class.sidebar-button-active]="sidebarState === SidebarState.FILE_TREE"
2425
class="sidebar-button"
26+
aria-label="Toggle File Tree"
2527
(click)="setOrToggleSidebarState(SidebarState.FILE_TREE)"
2628
>
2729
<i nz-icon nzType="folder" nzTheme="outline"></i>
2830
</button>
2931
</div>
30-
<button class="sidebar-button sidebar-close" (click)="setOrToggleSidebarState(SidebarState.CLOSED)">
32+
<button
33+
class="sidebar-button sidebar-close"
34+
aria-label="Close Sidebar"
35+
(click)="setOrToggleSidebarState(SidebarState.CLOSED)"
36+
>
3137
<i *ngIf="sidebarState !== SidebarState.CLOSED" nz-icon nzType="close" nzTheme="outline"></i>
3238
</button>
3339
<div class="sidebar-main" *ngIf="sidebarState !== SidebarState.CLOSED">

zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
~ See the License for the specific language governing permissions and
1010
~ limitations under the License.
1111
-->
12-
1312
<div *ngIf="useReact" #reactContainer></div>
1413
<div *ngIf="!useReact">
1514
<zeppelin-notebook-paragraph-dynamic-forms
@@ -28,6 +27,7 @@
2827
[currentCol]="paragraph.config.colWidth"
2928
[config]="configs[i]"
3029
[result]="result"
30+
data-testid="paragraph-result"
3131
></zeppelin-notebook-paragraph-result>
3232
</ng-container>
3333
</div>

zeppelin-web-angular/src/app/share/folder-rename/folder-rename.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
</nz-form-control>
3131
</nz-form-item>
3232
<div class="modal-footer ant-modal-footer">
33-
<button nz-button nzType="primary" (click)="rename()">Rename</button>
33+
<button nz-button nzType="primary" (click)="rename()" [disabled]="!newFolderPath || !newFolderPath.trim()">
34+
Rename
35+
</button>
3436
</div>
3537
</form>
3638

zeppelin-web-angular/src/app/share/node-list/node-list.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h4>
3636
(click)="activeNote(node.origin.id)"
3737
>
3838
<span class="folder" *ngSwitchCase="'folder'">
39-
<a class="name" (click)="toggleFolder(node)">
39+
<a class="name" (click)="toggleFolder(node)" [attr.data-testid]="'folder-' + node.title">
4040
<i nz-icon [nzType]="node.isExpanded ? 'folder-open' : 'folder'" nzTheme="fill"></i>
4141
{{ node.title }}
4242
</a>
@@ -122,7 +122,7 @@ <h4>
122122
</span>
123123
</span>
124124
<span class="folder" *ngSwitchCase="'trash'">
125-
<a class="name" (click)="toggleFolder(node)">
125+
<a class="name" (click)="toggleFolder(node)" [attr.data-testid]="'folder-' + node.title">
126126
<i nz-icon nzType="delete" nzTheme="fill"></i>
127127
{{ node.title }}
128128
</a>

0 commit comments

Comments
 (0)