From bc9e32b0985748b70df9d5aac8480bb7bfcb1891 Mon Sep 17 00:00:00 2001 From: aiwenmo <32723967+aiwenmo@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:22:57 +0800 Subject: [PATCH 1/8] [Optimization-2703][studio] Optimize online debug task (#2704) * [Optimization-2703][studio] Optimize online debug task * add selection * optimize result refresh --------- Co-authored-by: wenmo <32723967+wenmo@users.noreply.github.com> --- .../org/dinky/controller/TaskController.java | 5 ++-- .../main/java/org/dinky/data/dto/TaskDTO.java | 8 +++--- .../java/org/dinky/service/TaskService.java | 5 ++-- .../dinky/service/impl/TaskServiceImpl.java | 25 +++++++++---------- .../org/dinky/service/task/FlinkSqlTask.java | 6 +++++ .../BottomContainer/Result/index.tsx | 5 ++-- .../DataStudio/HeaderContainer/function.tsx | 23 ++++++++++++++++- .../DataStudio/HeaderContainer/index.tsx | 22 ++++++++++++---- .../DataStudio/HeaderContainer/service.tsx | 22 ---------------- .../LeftContainer/Catalog/index.tsx | 2 +- .../LeftContainer/Project/function.tsx | 2 +- .../MiddleContainer/StudioEditor/index.tsx | 3 ++- dinky-web/src/pages/DataStudio/model.ts | 1 + dinky-web/src/pages/DataStudio/route.tsx | 2 +- 14 files changed, 73 insertions(+), 58 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/controller/TaskController.java b/dinky-admin/src/main/java/org/dinky/controller/TaskController.java index 540b452499..3b0ce31c68 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/TaskController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/TaskController.java @@ -22,7 +22,6 @@ import org.dinky.data.annotations.ExecuteProcess; import org.dinky.data.annotations.Log; import org.dinky.data.annotations.ProcessId; -import org.dinky.data.dto.DebugDTO; import org.dinky.data.dto.TaskDTO; import org.dinky.data.dto.TaskRollbackVersionDTO; import org.dinky.data.dto.TaskSaveDTO; @@ -96,8 +95,8 @@ public Result submitTask(@ProcessId @RequestParam Integer id) throws dataType = "DebugDTO", paramType = "body") @ExecuteProcess(type = ProcessType.FLINK_SUBMIT) - public Result debugTask(@RequestBody DebugDTO debugDTO) throws Exception { - JobResult result = taskService.debugTask(debugDTO); + public Result debugTask(@RequestBody TaskDTO task) throws Exception { + JobResult result = taskService.debugTask(task); if (result.isSuccess()) { return Result.succeed(result, Status.DEBUG_SUCCESS); } diff --git a/dinky-admin/src/main/java/org/dinky/data/dto/TaskDTO.java b/dinky-admin/src/main/java/org/dinky/data/dto/TaskDTO.java index cd588fb818..581dca4a04 100644 --- a/dinky-admin/src/main/java/org/dinky/data/dto/TaskDTO.java +++ b/dinky-admin/src/main/java/org/dinky/data/dto/TaskDTO.java @@ -57,7 +57,7 @@ public class TaskDTO extends AbstractStatementDTO { @ApiModelProperty( value = "Run Mode", dataType = "String", - example = "BATCH", + example = "Local", notes = "The execution mode for the SQL query") private String type; @@ -199,14 +199,14 @@ public class TaskDTO extends AbstractStatementDTO { dataType = "boolean", example = "false", notes = "Flagindicatingwhethertousechangelogs") - private boolean useChangeLog; + private boolean useChangeLog = false; @ApiModelProperty( value = "Use Auto Cancel", dataType = "boolean", example = "false", notes = "Flag indicating whether to use auto-canceling") - private boolean useAutoCancel; + private boolean useAutoCancel = true; @ApiModelProperty(value = "Session", dataType = "String", example = "session_id", notes = "The session identifier") private String session; @@ -219,7 +219,7 @@ public class TaskDTO extends AbstractStatementDTO { dataType = "Integer", example = "100", notes = "The maximum number of rows to return") - private Integer maxRowNum; + private Integer maxRowNum = 100; public JobConfig getJobConfig() { diff --git a/dinky-admin/src/main/java/org/dinky/service/TaskService.java b/dinky-admin/src/main/java/org/dinky/service/TaskService.java index 376503b5e8..0bad25193c 100644 --- a/dinky-admin/src/main/java/org/dinky/service/TaskService.java +++ b/dinky-admin/src/main/java/org/dinky/service/TaskService.java @@ -20,7 +20,6 @@ package org.dinky.service; import org.dinky.data.dto.AbstractStatementDTO; -import org.dinky.data.dto.DebugDTO; import org.dinky.data.dto.TaskDTO; import org.dinky.data.dto.TaskRollbackVersionDTO; import org.dinky.data.dto.TaskSubmitDto; @@ -75,11 +74,11 @@ public interface TaskService extends ISuperService { /** * Debug the given task and return the job result. * - * @param debugDTO The param of preview task. + * @param task The param of preview task. * @return A {@link JobResult} object representing the result of the submitted task. * @throws ExcuteException If there is an error debugging the task. */ - JobResult debugTask(DebugDTO debugDTO) throws Exception; + JobResult debugTask(TaskDTO task) throws Exception; /** * Restart the given task and return the job result. diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java index 59e40f6f36..6e6afedf4c 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java @@ -26,7 +26,6 @@ import org.dinky.data.app.AppParamConfig; import org.dinky.data.constant.CommonConstant; import org.dinky.data.dto.AbstractStatementDTO; -import org.dinky.data.dto.DebugDTO; import org.dinky.data.dto.TaskDTO; import org.dinky.data.dto.TaskRollbackVersionDTO; import org.dinky.data.dto.TaskSubmitDto; @@ -204,6 +203,9 @@ public JobResult executeJob(TaskDTO task) throws Exception { // Submit and export task @ProcessStep(type = ProcessStepType.SUBMIT_BUILD_CONFIG) public JobConfig buildJobSubmitConfig(TaskDTO task) { + if (Asserts.isNull(task.getType())) { + task.setType(GatewayType.LOCAL.getLongValue()); + } task.setStatement(buildEnvSql(task) + task.getStatement()); JobConfig config = task.getJobConfig(); Savepoints savepoints = savepointsService.getSavePointWithStrategy(task); @@ -238,6 +240,9 @@ public JobConfig buildJobSubmitConfig(TaskDTO task) { // Savepoint and cancel task @ProcessStep(type = ProcessStepType.SUBMIT_BUILD_CONFIG) public JobConfig buildJobConfig(TaskDTO task) { + if (Asserts.isNull(task.getType())) { + task.setType(GatewayType.LOCAL.getLongValue()); + } JobConfig config = task.getJobConfig(); if (GatewayType.get(task.getType()).isDeployCluster()) { log.info("Init gateway config, type:{}", task.getType()); @@ -317,24 +322,18 @@ public JobResult submitTask(TaskSubmitDto submitDto) throws Exception { @Override @ProcessStep(type = ProcessStepType.SUBMIT_TASK) - public JobResult debugTask(DebugDTO debugDTO) throws Exception { - initTenantByTaskId(debugDTO.getId()); - - TaskDTO taskDTO = this.getTaskInfoById(debugDTO.getId()); + public JobResult debugTask(TaskDTO task) throws Exception { // Debug mode need return result - taskDTO.setUseResult(true); - taskDTO.setUseChangeLog(debugDTO.isUseChangeLog()); - taskDTO.setUseAutoCancel(debugDTO.isUseAutoCancel()); - taskDTO.setMaxRowNum(debugDTO.getMaxRowNum()); + task.setUseResult(true); // Debug mode need execute - taskDTO.setStatementSet(false); + task.setStatementSet(false); // 注解自调用会失效,这里通过获取对象方法绕过此限制 TaskServiceImpl taskServiceBean = applicationContext.getBean(TaskServiceImpl.class); - JobResult jobResult = taskServiceBean.executeJob(taskDTO); + JobResult jobResult = taskServiceBean.executeJob(task); if (Job.JobStatus.SUCCESS == jobResult.getStatus()) { log.info("Job debug success"); - Task task = new Task(debugDTO.getId(), jobResult.getJobInstanceId()); - if (!this.updateById(task)) { + Task newTask = new Task(task.getId(), jobResult.getJobInstanceId()); + if (!this.updateById(newTask)) { throw new BusException(Status.TASK_UPDATE_FAILED.getMessage()); } } else { diff --git a/dinky-admin/src/main/java/org/dinky/service/task/FlinkSqlTask.java b/dinky-admin/src/main/java/org/dinky/service/task/FlinkSqlTask.java index 8dd44573b8..c11550228b 100644 --- a/dinky-admin/src/main/java/org/dinky/service/task/FlinkSqlTask.java +++ b/dinky-admin/src/main/java/org/dinky/service/task/FlinkSqlTask.java @@ -19,10 +19,12 @@ package org.dinky.service.task; +import org.dinky.assertion.Asserts; import org.dinky.config.Dialect; import org.dinky.data.annotations.SupportDialect; import org.dinky.data.dto.TaskDTO; import org.dinky.data.result.SqlExplainResult; +import org.dinky.gateway.enums.GatewayType; import org.dinky.job.JobManager; import org.dinky.job.JobResult; import org.dinky.service.impl.TaskServiceImpl; @@ -42,6 +44,10 @@ public class FlinkSqlTask extends BaseTask { public FlinkSqlTask(TaskDTO task) { super(task); + // Default run mode is local. + if (Asserts.isNull(task.getType())) { + task.setType(GatewayType.LOCAL.getLongValue()); + } this.jobManager = getJobManager(); } diff --git a/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx b/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx index d81c939b3f..6d1c5dc679 100644 --- a/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx +++ b/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx @@ -23,7 +23,7 @@ import { isDataStudioTabsItemType, mapDispatchToProps } from '@/pages/DataStudio/function'; -import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; +import { isSql } from '@/pages/DataStudio/HeaderContainer/function'; import { StateType } from '@/pages/DataStudio/model'; import { handleGetOption, handleGetOptionWithoutMsg } from '@/services/BusinessCrud'; import { DIALECT } from '@/services/constants'; @@ -126,7 +126,6 @@ const Result = (props: any) => { return; } - const params = currentTabs.params; const consoleData = currentTabs.console; if (consoleData.result && !isRefresh) { setData(consoleData.result); @@ -166,7 +165,7 @@ const Result = (props: any) => { useEffect(() => { setData({}); loadData(); - }, [currentTabs, currentTabs?.console?.result]); + }, [currentTabs?.console?.result]); const getColumns = (columns: string[]) => { return columns?.map((item) => { diff --git a/dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx b/dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx index 7e5be0a46c..4f718a57fb 100644 --- a/dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx +++ b/dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx @@ -17,7 +17,6 @@ * */ -import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; import { TabsPageType, TaskDataType } from '@/pages/DataStudio/model'; import { JOB_LIFE_CYCLE, JOB_STATUS } from '@/pages/DevOps/constants'; import { DIALECT } from '@/services/constants'; @@ -59,3 +58,25 @@ export const isCanPushDolphin = (data: TaskDataType | undefined) => { data?.dialect?.toLowerCase() !== DIALECT.PYTHON_LONG : false; }; + +export const isSql = (dialect: string) => { + if (!dialect) { + return false; + } + switch (dialect.toLowerCase()) { + case DIALECT.SQL: + case DIALECT.MYSQL: + case DIALECT.ORACLE: + case DIALECT.SQLSERVER: + case DIALECT.POSTGRESQL: + case DIALECT.CLICKHOUSE: + case DIALECT.PHOENIX: + case DIALECT.DORIS: + case DIALECT.HIVE: + case DIALECT.STARROCKS: + case DIALECT.PRESTO: + return true; + default: + return false; + } +}; diff --git a/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx b/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx index 26b2ded479..b4a0dfd906 100644 --- a/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx +++ b/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx @@ -28,7 +28,8 @@ import { isCanPushDolphin, isOnline, isRunning, - projectCommonShow + projectCommonShow, + isSql } from '@/pages/DataStudio/HeaderContainer/function'; import PushDolphin from '@/pages/DataStudio/HeaderContainer/PushDolphin'; import { @@ -36,8 +37,7 @@ import { changeTaskLife, debugTask, executeSql, - getJobPlan, - isSql + getJobPlan } from '@/pages/DataStudio/HeaderContainer/service'; import { DataStudioTabsItemType, @@ -189,9 +189,17 @@ const HeaderContainer = (props: connect) => { const handlerDebug = async () => { if (!currentData) return; + let selectsql = null; + if (currentTab.editorInstance) { + selectsql = currentTab.editorInstance.getModel().getValueInRange(currentTab.editorInstance.getSelection()); + } + if (selectsql == null || selectsql == '') { + selectsql = currentData.statement; + } + const res = await debugTask( l('pages.datastudio.editor.debugging', '', { jobName: currentData.name }), - currentData + {...currentData, statement: selectsql} ); if (!res) return; @@ -203,6 +211,10 @@ const HeaderContainer = (props: connect) => { }); await SuccessMessageAsync(l('pages.datastudio.editor.debug.success')); currentData.status = JOB_STATUS.RUNNING; + // Common sql task is synchronized, so it needs to automatically update the status to finished. + if (isSql(currentData.dialect)) { + currentData.status = JOB_STATUS.FINISHED; + } if (currentTab) currentTab.console.result = res.data.result; saveTabs({ ...props.tabs }); }; @@ -380,7 +392,7 @@ const HeaderContainer = (props: connect) => { currentTab?.type == TabsPageType.project && !isRunning(currentData) && (currentTab?.subType?.toLowerCase() === DIALECT.FLINK_SQL || - currentTab?.subType?.toLowerCase() === DIALECT.FLINKJAR), + isSql(currentTab?.subType?.toLowerCase())), props: { style: { background: '#52c41a' }, type: 'primary' diff --git a/dinky-web/src/pages/DataStudio/HeaderContainer/service.tsx b/dinky-web/src/pages/DataStudio/HeaderContainer/service.tsx index 7af2d60581..1eb283b9f7 100644 --- a/dinky-web/src/pages/DataStudio/HeaderContainer/service.tsx +++ b/dinky-web/src/pages/DataStudio/HeaderContainer/service.tsx @@ -43,25 +43,3 @@ export function cancelTask(title: string, id: number) { export function changeTaskLife(title = '', id: number, life: number) { return handleGetOption('api/task/changeTaskLife', title, { taskId: id, lifeCycle: life }); } - -export const isSql = (dialect: string) => { - if (!dialect) { - return false; - } - switch (dialect.toLowerCase()) { - case DIALECT.SQL: - case DIALECT.MYSQL: - case DIALECT.ORACLE: - case DIALECT.SQLSERVER: - case DIALECT.POSTGRESQL: - case DIALECT.CLICKHOUSE: - case DIALECT.PHOENIX: - case DIALECT.DORIS: - case DIALECT.HIVE: - case DIALECT.STARROCKS: - case DIALECT.PRESTO: - return true; - default: - return false; - } -}; diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx index e975b495b6..75b559d124 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx @@ -18,7 +18,7 @@ */ import { getCurrentData } from '@/pages/DataStudio/function'; -import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; +import { isSql } from '@/pages/DataStudio/HeaderContainer/function'; import { BtnRoute, useTasksDispatch } from '@/pages/DataStudio/LeftContainer/BtnContext'; import { TableDataNode } from '@/pages/DataStudio/LeftContainer/Catalog/data'; import { StateType } from '@/pages/DataStudio/model'; diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx index 523eb808e3..e3d76a29a8 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx @@ -18,7 +18,7 @@ */ import { LeftBottomKey, RightMenuKey } from '@/pages/DataStudio/data.d'; -import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; +import { isSql } from '@/pages/DataStudio/HeaderContainer/function'; import { getTabIcon } from '@/pages/DataStudio/MiddleContainer/function'; import { DIALECT } from '@/services/constants'; import { Catalogue } from '@/types/Studio/data.d'; diff --git a/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/index.tsx b/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/index.tsx index 76a24c0c9a..cc6ea7c7ed 100644 --- a/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/index.tsx +++ b/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/index.tsx @@ -106,6 +106,7 @@ const StudioEditor: React.FC = (props) => { editor.focus(); editorInstance.current = editor; tabsItem.monacoInstance = monaco; + tabsItem.editorInstance = editor; editor.onDidChangeCursorPosition((e) => { props.footContainer.codePosition = [e.position.lineNumber, e.position.column]; @@ -143,7 +144,7 @@ const StudioEditor: React.FC = (props) => { /> ; + editorInstance: editor.IStandaloneCodeEditor | undefined; console: ConsoleType; isModified: boolean; } diff --git a/dinky-web/src/pages/DataStudio/route.tsx b/dinky-web/src/pages/DataStudio/route.tsx index e1c029b406..a90c6578d4 100644 --- a/dinky-web/src/pages/DataStudio/route.tsx +++ b/dinky-web/src/pages/DataStudio/route.tsx @@ -25,7 +25,7 @@ import Result from '@/pages/DataStudio/BottomContainer/Result'; import JsonToSql from '@/pages/DataStudio/BottomContainer/Tools/JsonToSql'; import TextComparison from '@/pages/DataStudio/BottomContainer/Tools/TextComparison'; import { LeftBottomKey, LeftMenuKey, RightMenuKey } from '@/pages/DataStudio/data.d'; -import { isSql } from '@/pages/DataStudio/HeaderContainer/service'; +import { isSql } from '@/pages/DataStudio/HeaderContainer/function'; import Catalog from '@/pages/DataStudio/LeftContainer/Catalog'; import DataSource from '@/pages/DataStudio/LeftContainer/DataSource'; import GlobalVariable from '@/pages/DataStudio/LeftContainer/GlobaleVar'; From 217f60cc7b9d7340d49f6c60954f8a66dc5f02fa Mon Sep 17 00:00:00 2001 From: Zzm0809 <934230207@qq.com> Date: Thu, 21 Dec 2023 14:09:22 +0800 Subject: [PATCH 2/8] Support devops card checkstyle (#2702) * Spotless Apply * support-devops-card-checkstyle * Spotless Apply --------- Co-authored-by: Zzm0809 --- .../CustomEditor/CodeEdit/function.tsx | 2 +- .../CustomEditor/CodeEdit/index.tsx | 2 +- .../CustomEditor/CodeShow/index.tsx | 5 ++--- .../StudioEditor/DiffModal.tsx | 4 ++-- .../components/Overview/StatisticsCard.tsx | 20 +++++++++++++++++-- .../JobList/components/Overview/index.tsx | 7 +++++++ dinky-web/src/requestErrorConfig.ts | 1 - 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx b/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx index 934f0f385f..88f11a2d49 100644 --- a/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx +++ b/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx @@ -19,6 +19,7 @@ import { SuggestionInfo } from '@/types/Public/data'; +import { loader } from '@monaco-editor/react'; import * as monaco from 'monaco-editor'; import { editor, languages } from 'monaco-editor'; import keyWordJsonData from './keyword.json'; @@ -26,7 +27,6 @@ import ITextModel = editor.ITextModel; import ProviderResult = languages.ProviderResult; import CompletionList = languages.CompletionList; import CompletionItem = languages.CompletionItem; -import {loader} from "@monaco-editor/react"; // 导入 lodash loader.config({ monaco }); diff --git a/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx b/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx index fee34bcbe6..5b06eb2551 100644 --- a/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx +++ b/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx @@ -25,7 +25,7 @@ import { handleInitEditorAndLanguageOnBeforeMount } from '@/components/CustomEdi import { StateType } from '@/pages/DataStudio/model'; import { MonacoEditorOptions, SuggestionInfo } from '@/types/Public/data'; import { convertCodeEditTheme } from '@/utils/function'; -import {Editor, loader, Monaco, OnChange} from '@monaco-editor/react'; +import { Editor, loader, Monaco, OnChange } from '@monaco-editor/react'; import { connect } from '@umijs/max'; import useMemoCallback from 'rc-menu/es/hooks/useMemoCallback'; import { memo, useCallback, useRef } from 'react'; diff --git a/dinky-web/src/components/CustomEditor/CodeShow/index.tsx b/dinky-web/src/components/CustomEditor/CodeShow/index.tsx index b2a77e1107..6230f1f0b3 100644 --- a/dinky-web/src/components/CustomEditor/CodeShow/index.tsx +++ b/dinky-web/src/components/CustomEditor/CodeShow/index.tsx @@ -28,13 +28,12 @@ import { EditorLanguage } from 'monaco-editor/esm/metadata'; import FullscreenBtn from '@/components/CustomEditor/FullscreenBtn'; import { handleInitEditorAndLanguageOnBeforeMount } from '@/components/CustomEditor/function'; -import {Editor, loader, Monaco} from '@monaco-editor/react'; +import { Editor, loader, Monaco } from '@monaco-editor/react'; +import * as monaco from 'monaco-editor'; import { CSSProperties, useRef, useState } from 'react'; -import * as monaco from "monaco-editor"; loader.config({ monaco }); - export type CodeShowFormProps = { height?: string | number; width?: string; diff --git a/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx b/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx index c5f1df43ca..ce5f678e8e 100644 --- a/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx +++ b/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx @@ -24,11 +24,11 @@ import { } from '@/pages/DataStudio/MiddleContainer/StudioEditor/constants'; import { convertCodeEditTheme } from '@/utils/function'; import { l } from '@/utils/intl'; -import {DiffEditor, loader} from '@monaco-editor/react'; +import { DiffEditor, loader } from '@monaco-editor/react'; import { Col, Modal, Row, Space, Table, Tabs, Typography } from 'antd'; +import * as monaco from 'monaco-editor'; import React, { memo } from 'react'; import styles from './index.less'; -import * as monaco from "monaco-editor"; loader.config({ monaco }); diff --git a/dinky-web/src/pages/DevOps/JobList/components/Overview/StatisticsCard.tsx b/dinky-web/src/pages/DevOps/JobList/components/Overview/StatisticsCard.tsx index 18374e17a1..90fdff83c4 100644 --- a/dinky-web/src/pages/DevOps/JobList/components/Overview/StatisticsCard.tsx +++ b/dinky-web/src/pages/DevOps/JobList/components/Overview/StatisticsCard.tsx @@ -30,12 +30,28 @@ type StatisticsCardParams = { extra?: any; divider?: boolean; atClick?: () => void; + isChecked?: boolean; // 是否选中 }; const StatisticsCard = (props: StatisticsCardParams) => { - const { title, value, icon, extra = <>, divider = true, link, atClick } = props; + const { + title, + value, + isChecked = false, + icon, + extra = <>, + divider = true, + link, + atClick + } = props; return ( <> - (atClick ? atClick() : {})} hoverable={true}> + (atClick ? atClick() : {})} + hoverable={true} + > {icon} diff --git a/dinky-web/src/pages/DevOps/JobList/components/Overview/index.tsx b/dinky-web/src/pages/DevOps/JobList/components/Overview/index.tsx index f012a719c9..ecc9530983 100644 --- a/dinky-web/src/pages/DevOps/JobList/components/Overview/index.tsx +++ b/dinky-web/src/pages/DevOps/JobList/components/Overview/index.tsx @@ -63,6 +63,7 @@ const JobOverview = (props: any) => { atClick={() => { setStatusFilter(undefined); }} + isChecked={!statusFilter} extra={