Unverified Commit e0cb9b7b authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Fix] [Web] Fix debug (#2720)

* fix_debug * fix_debug * fix_debug
parent e9c59e24
......@@ -190,20 +190,21 @@ const HeaderContainer = (props: connect) => {
const handlerDebug = async () => {
if (!currentData) return;
// @ts-ignore
const editor = currentTab.monacoInstance.editor.getEditors().find((x:any)=>x["id"]===currentData.id);
let selectsql = null;
if (currentTab.editorInstance) {
selectsql = currentTab.editorInstance
.getModel()
.getValueInRange(currentTab.editorInstance.getSelection());
//
let selectSql = '';
if (editor) {
selectSql = editor.getModel().getValueInRange(editor.getSelection());
}
if (selectsql == null || selectsql == '') {
selectsql = currentData.statement;
if (selectSql == null || selectSql == '') {
selectSql = currentData.statement;
}
const res = await debugTask(
l('pages.datastudio.editor.debugging', '', { jobName: currentData.name }),
{ ...currentData, statement: selectsql }
{ ...currentData, statement: selectSql }
);
if (!res) return;
......@@ -402,7 +403,7 @@ const HeaderContainer = (props: connect) => {
currentTab?.type == TabsPageType.project &&
!isRunning(currentData) &&
(currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL ||
isSql(currentTab?.subType?.toLowerCase())),
isSql(currentTab?.subType?.toLowerCase()??"")),
props: {
style: { background: '#52c41a' },
type: 'primary'
......
......@@ -86,7 +86,7 @@ const LeftContainer: React.FC<LeftContainerProps> = (props: any) => {
handlerMaxsize: handleMaxsize,
visible: leftContainer.selectKey !== '',
defaultSize: { width: leftContainer.width, height: leftContainer.height },
minWidth: 160,
minWidth: 225,
maxWidth: MAX_WIDTH,
enable: { right: true },
btnGroup: btn[leftContainer.selectKey]
......
......@@ -39,6 +39,7 @@ import { Monaco } from '@monaco-editor/react';
import { Button, Spin } from 'antd';
import { editor } from 'monaco-editor';
import React, { memo, useEffect, useRef, useState } from 'react';
import {getCurrentData, getCurrentTab} from "@/pages/DataStudio/function";
export type EditorProps = {
tabsItem: DataStudioTabsItemType;
......@@ -105,10 +106,12 @@ const StudioEditor: React.FC<EditorProps & connect> = (props) => {
editor.layout();
editor.focus();
editorInstance.current = editor;
// @ts-ignore
editor['id']=getCurrentTab(tabs.panes,tabs.activeKey)?.params.taskId
tabsItem.monacoInstance = monaco;
tabsItem.editorInstance = editor;
editor.onDidChangeCursorPosition((e) => {
props.footContainer.codePosition = [e.position.lineNumber, e.position.column];
dispatch({
type: STUDIO_MODEL.saveFooterValue,
......@@ -144,7 +147,6 @@ const StudioEditor: React.FC<EditorProps & connect> = (props) => {
/>
<CodeEdit
monacoRef={tabsItem?.monacoInstance}
editorRef={tabsItem?.editorInstance}
code={tabsItem?.params?.taskData?.statement}
language={matchLanguage(tabsItem?.subType)}
editorDidMount={editorDidMount}
......
......@@ -164,7 +164,6 @@ export interface TabsItemType {
closable: boolean;
path: string[];
monacoInstance: React.RefObject<Monaco | undefined>;
editorInstance: editor.IStandaloneCodeEditor | undefined;
console: ConsoleType;
isModified: boolean;
}
......@@ -184,6 +183,7 @@ export interface DataStudioTabsItemType extends TabsItemType {
export type TabsType = {
activeKey: string;
activeBreadcrumbTitle: string;
selectedStatement?: string;
panes: TabsItemType[];
};
......@@ -868,7 +868,7 @@ const Model: ModelType = {
...state,
suggestions: payload
};
}
},
}
};
......
......@@ -32,7 +32,8 @@ const operatorType = {
CANCEL_JOB: 'canceljob',
SAVEPOINT_CANCEL: 'cancel',
SAVEPOINT_TRIGGER: 'trigger',
SAVEPOINT_STOP: 'stop'
SAVEPOINT_STOP: 'stop',
AUTO_STOP: 'autostop'
};
export type OperatorType = {
jobDetail: Jobs.JobInfoDetail;
......@@ -59,6 +60,21 @@ const JobOperator = (props: OperatorType) => {
id: jobDetail?.instance?.taskId,
isOnLine: jobDetail?.instance?.step == JOB_LIFE_CYCLE.PUBLISH
});
} else if (key == operatorType.SAVEPOINT_CANCEL) {
getData(API_CONSTANTS.SAVEPOINT, {
taskId: jobDetail?.instance?.taskId,
savePointType: "cancel"
});
} else if (key == operatorType.SAVEPOINT_STOP) {
getData(API_CONSTANTS.SAVEPOINT, {
taskId: jobDetail?.instance?.taskId,
savePointType: "stop"
});
} else if (key == operatorType.SAVEPOINT_TRIGGER) {
getData(API_CONSTANTS.SAVEPOINT, {
taskId: jobDetail?.instance?.taskId,
savePointType: "trigger"
});
} else {
cancelTask('', jobDetail?.instance?.taskId);
}
......@@ -91,7 +107,7 @@ const JobOperator = (props: OperatorType) => {
<Button
key='autostop'
type='primary'
onClick={() => handleJobOperator(operatorType.SAVEPOINT_STOP)}
onClick={() => handleJobOperator(operatorType.AUTO_STOP)}
danger
>
{jobDetail?.instance?.step == 5
......
......@@ -244,6 +244,7 @@ export enum API_CONSTANTS {
// /api/jobInstance/getLineage
JOB_INSTANCE_GET_LINEAGE = '/api/jobInstance/getLineage',
RESTART_TASK = '/api/task/restartTask',
SAVEPOINT = '/api/task/savepoint',
RESTART_TASK_FROM_CHECKPOINT = '/api/task/selectSavePointRestartTask',
GET_SAVEPOINTS = '/api/savepoints',
ALERT_HISTORY_LIST = '/api/alertHistory/list',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment