Skip to content

Commit ab07359

Browse files
committed
[ZEPPELIN-6294] fix: Ensure the execution order of EDITOR_SETTING
1 parent 1d9f3a1 commit ab07359

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

zeppelin-web-angular/src/app/core/paragraph-base/paragraph-base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { NoteStatusService, ParagraphStatus } from '@zeppelin/services/note-stat
3131
import * as DiffMatchPatch from 'diff-match-patch';
3232
import { isEmpty, isEqual } from 'lodash';
3333

34+
import { NotebookParagraphCodeEditorComponent } from '@zeppelin/pages/workspace/notebook/paragraph/code-editor/code-editor.component';
3435
import { NotebookParagraphResultComponent } from '@zeppelin/pages/workspace/share/result/result.component';
3536
import { ParagraphConfigResults, ParagraphResults } from '../../../../projects/zeppelin-sdk/src';
3637
import { MessageListener, MessageListenersManager } from '../message-listener/message-listener';
@@ -54,6 +55,7 @@ export abstract class ParagraphBase extends MessageListenersManager {
5455

5556
// Initialized by `ViewChildren` in the class which extends ParagraphBase
5657
notebookParagraphResultComponents!: QueryList<NotebookParagraphResultComponent>;
58+
notebookParagraphCodeEditorComponent!: NotebookParagraphCodeEditorComponent;
5759

5860
constructor(
5961
public messageService: MessageService,
@@ -142,6 +144,8 @@ export abstract class ParagraphBase extends MessageListenersManager {
142144
}
143145
this.cdr.markForCheck();
144146
});
147+
this.notebookParagraphCodeEditorComponent.editorSettingTriggerAllowed = true;
148+
this.notebookParagraphCodeEditorComponent.getEditorSetting();
145149
this.cdr.markForCheck();
146150
}
147151
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export class NotebookComponent extends MessageListenersManager implements OnInit
109109

110110
@MessageListener(OP.INTERPRETER_BINDINGS)
111111
loadInterpreterBindings(data: MessageReceiveDataTypeMap[OP.INTERPRETER_BINDINGS]) {
112+
this.listOfNotebookParagraphComponent.forEach(item => {
113+
item.notebookParagraphCodeEditorComponent.editorSettingTriggerAllowed = true;
114+
item.notebookParagraphCodeEditorComponent.getEditorSetting();
115+
});
112116
this.interpreterBindings = data.interpreterBindings;
113117
if (!this.interpreterBindings.some(item => item.selected)) {
114118
this.activatedExtension = 'interpreter';

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class NotebookParagraphCodeEditorComponent implements OnChanges, OnDestro
6161
private monacoDisposables: IDisposable[] = [];
6262
height = 18;
6363
interpreterName?: string;
64+
editorSettingTriggerAllowed: boolean = false;
6465

6566
autoAdjustEditorHeight() {
6667
const editor = this.editor;
@@ -193,14 +194,15 @@ export class NotebookParagraphCodeEditorComponent implements OnChanges, OnDestro
193194
const interpreterName = this.getInterpreterName(this.text);
194195
if (this.interpreterName !== interpreterName) {
195196
this.interpreterName = interpreterName;
196-
setTimeout(() => {
197-
this.getEditorSetting();
198-
}, 200);
197+
this.getEditorSetting();
199198
}
200199
}
201200
}
202201

203202
getEditorSetting() {
203+
if (!this.editorSettingTriggerAllowed) {
204+
return;
205+
}
204206
this.messageService.editorSetting(this.pid, this.text);
205207
}
206208

0 commit comments

Comments
 (0)