Skip to content

Commit

Permalink
[ZEPPELIN-6105] add 'reload note' button to the new interface
Browse files Browse the repository at this point in the history
### What is this PR for?
Add missing button to action bar to reload note. This button exists in the old interface, but is missing in /next

### What type of PR is it?
Bug Fix

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6105

### Screenshots (if appropriate)
![image](https://github.com/user-attachments/assets/199b69f5-c19d-497e-aa33-1ab29d22ad50)



Closes apache#4845 from Charlie91/add-reload-note-button.

Signed-off-by: Cheng Pan <[email protected]>
  • Loading branch information
Charlie91 authored Sep 29, 2024
1 parent 9a28960 commit b9ff26f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
ParagraphMoved,
RemoveFolder,
RemoveNoteForms,
ReloadNote,
RestoreFolder,
RestoreNote,
SaveNoteFormsReceived,
Expand Down Expand Up @@ -121,6 +122,7 @@ export interface MessageSendDataTypeMap {
[OP.RESTORE_ALL]: undefined;
[OP.EMPTY_TRASH]: undefined;
[OP.RELOAD_NOTES_FROM_REPO]: undefined;
[OP.RELOAD_NOTE]: ReloadNote;
[OP.GET_NOTE]: GetNode;
[OP.NEW_NOTE]: NewNote;
[OP.MOVE_NOTE_TO_TRASH]: MoveNoteToTrash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Name {
export type GetNode = ID;
export type MoveNoteToTrash = ID;
export type MoveFolderToTrash = ID;
export type ReloadNote = ID;
export type RestoreNote = ID;
export type RestoreFolder = ID;
export type DeleteNote = ID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export enum OP {
*/
RELOAD_NOTES_FROM_REPO = 'RELOAD_NOTES_FROM_REPO',

/**
* [c-s]
* reload note
* @param id note id
*/
RELOAD_NOTE = 'RELOAD_NOTE',

/**
* [s-c]
* list of note infos
Expand Down
4 changes: 4 additions & 0 deletions zeppelin-web-angular/projects/zeppelin-sdk/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ export class Message {
this.send<OP.RELOAD_NOTES_FROM_REPO>(OP.RELOAD_NOTES_FROM_REPO);
}

reloadNote(noteId: string): void {
this.send<OP.RELOAD_NOTE>(OP.RELOAD_NOTE, { id: noteId })
}

getNote(noteId: string): void {
this.send<OP.GET_NOTE>(OP.GET_NOTE, { id: noteId });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
[disabled]="revisionView">
<i nz-icon nzType="download" nzTheme="outline"></i>
</button>
<button nz-button
nz-tooltip
nzTitle="Reload from note file"
(click)="reloadNote()"
*ngIf="!viewOnly"
[disabled]="revisionView">
<i nz-icon nzType="reload" nzTheme="outline"></i>
</button>
<ng-container *ngIf="principal && principal !== 'anonymous' && !viewOnly">
<ng-container [ngSwitch]="note.config.personalizedMode">
<button *ngSwitchCase="'true'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export class NotebookActionBarComponent extends MessageListenersManager implemen
}
}

reloadNote() {
this.messageService.reloadNote(this.note.id);
}

toggleAllEditor() {
this.editorHide = !this.editorHide;
this.editorHideChange.emit(this.editorHide);
Expand Down
4 changes: 4 additions & 0 deletions zeppelin-web-angular/src/app/services/message.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export class MessageService extends Message implements OnDestroy {
super.reloadAllNotesFromRepo();
}

reloadNote(noteId: string): void {
super.reloadNote(noteId);
}

getNote(noteId: string): void {
super.getNote(noteId);
}
Expand Down

0 comments on commit b9ff26f

Please sign in to comment.