浏览代码

HUE-9456 [editor] Set initial handle optionals and add session verification in editor v2

Johan Ahlen 5 年之前
父节点
当前提交
d5d7211729

+ 12 - 12
desktop/core/src/desktop/js/apps/notebook2/execution/apiUtils.ts

@@ -100,22 +100,22 @@ export interface ExecutionJob {
 }
 
 export interface ExecutionHandle {
-  end: { row: number; col: number };
-  guid: string;
-  has_more_statements: boolean;
-  has_result_set: boolean;
+  end?: { row: number; col: number };
+  guid?: string;
+  has_more_statements?: boolean;
+  has_result_set?: boolean;
   log_context?: unknown;
   modified_row_count?: number;
-  operation_type: number;
+  operation_type?: number;
   previous_statement_hash?: string;
-  secret: string;
-  session_guid: string;
-  session_id: number;
-  session_type: string;
-  start: { row: number; col: number };
-  statement: string;
+  secret?: string;
+  session_guid?: string;
+  session_id?: number;
+  session_type?: string;
+  start?: { row: number; col: number };
+  statement?: string;
   statement_id: number;
-  statements_count: number;
+  statements_count?: number;
   sync?: boolean;
   result?: ResultApiResponse;
 }

+ 5 - 18
desktop/core/src/desktop/js/apps/notebook2/execution/executable.ts

@@ -74,23 +74,6 @@ interface hueWindow {
 }
 
 const INITIAL_HANDLE: ExecutionHandle = {
-  end: { col: 0, row: 0 },
-  guid: '',
-  has_more_statements: false,
-  has_result_set: false,
-  log_context: undefined,
-  modified_row_count: 0,
-  operation_type: 0,
-  previous_statement_hash: '',
-  result: undefined,
-  secret: '',
-  session_guid: '',
-  session_id: 0,
-  session_type: '',
-  start: { col: 0, row: 0 },
-  statement: '',
-  statements_count: 0,
-  sync: false,
   statement_id: 0
 };
 
@@ -232,7 +215,11 @@ export default abstract class Executable {
         if (response.history) {
           this.operationId = response.history.uuid;
         }
-        if (response.handle.session_id) {
+        if (
+          response.handle.session_id &&
+          response.handle.session_type &&
+          response.handle.session_guid
+        ) {
           sessionManager.updateSession({
             type: response.handle.session_type,
             id: response.handle.session_id,