Unverified Commit 44511d4f authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

improve some feature & added `flinksql` language for editor (#2533)

* Spotless Apply * improve some feature * improve some feature * Spotless Apply * format code * format code * format code * format code --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent ca88bace
......@@ -19,7 +19,6 @@
package org.dinky.data.dto;
import org.dinky.config.Dialect;
import org.dinky.data.model.Task;
import org.dinky.data.model.ext.TaskExtConfig;
import org.dinky.job.JobConfig;
......@@ -231,7 +230,6 @@ public class TaskDTO extends AbstractStatementDTO {
JobConfig jobConfig = new JobConfig();
BeanUtil.copyProperties(this, jobConfig);
jobConfig.setConfigJson(parsedConfig);
jobConfig.setJarTask(isJarTask());
jobConfig.setTaskId(id);
jobConfig.setJobName(name);
......@@ -243,8 +241,4 @@ public class TaskDTO extends AbstractStatementDTO {
BeanUtil.copyProperties(this, task);
return task;
}
public boolean isJarTask() {
return Dialect.isJarDialect(dialect);
}
}
......@@ -387,9 +387,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
JobManager jobManager = JobManager.build(config);
if (config.isJarTask()) {
return "";
}
return jobManager.exportSql(task.getStatement());
}
......
......@@ -61,7 +61,7 @@
<!--这个是输出日志的格式,如果对里面的参数不理解,可以去看我的这篇文章,网址是:“https://blog.csdn.net/qq_42449963/article/details/104617356”-->
<!--<PatternLayout pattern="[dinky] %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>-->
<PatternLayout
pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%15.15t] %c{20}(%L): %m"/>
pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %p %c{20}(%L): %m"/>
</LogSseAppender>
</appenders>
......
......@@ -80,9 +80,6 @@ public class JobConfig {
notes = "Cluster configuration ID")
private Integer clusterConfigurationId;
@ApiModelProperty(value = "JAR file ID", dataType = "Integer", example = "101", notes = "JAR file ID")
private Integer jarId;
@ApiModelProperty(value = "Task JobLifeCycle", dataType = "Integer", example = "2", notes = "Task JobLifeCycle")
private Integer step;
......@@ -128,13 +125,6 @@ public class JobConfig {
notes = "Flag indicating whether to use remote execution")
private boolean useRemote;
@ApiModelProperty(
value = "Flag indicating whether it's a JAR task",
dataType = "boolean",
example = "false",
notes = "Flag indicating whether it's a JAR task")
private boolean isJarTask;
@ApiModelProperty(
value = "Job manager address",
dataType = "String",
......
......@@ -37,30 +37,30 @@
"dependencies": {
"@ant-design/charts": "^1.4.2",
"@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.27",
"@ant-design/pro-layout": "^7.17.6",
"@ant-design/pro-table": "^3.12.11",
"@ant-design/pro-components": "^2.6.41",
"@ant-design/pro-layout": "^7.17.15",
"@ant-design/pro-table": "^3.13.9",
"@ant-design/use-emotion-css": "^1.0.4",
"@antv/x6": "^2.15.1",
"@antv/x6": "^2.15.6",
"@antv/x6-plugin-selection": "^2.2.1",
"@antv/x6-react-shape": "^2.2.2",
"@monaco-editor/react": "^4.5.2",
"@monaco-editor/react": "^4.6.0",
"@umijs/route-utils": "^4.0.1",
"antd": "^5.9.3",
"antd": "^5.11.1",
"butterfly-dag": "^4.3.28",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
"million": "^2.6.1",
"million": "^2.6.4",
"moment": "^2.29.4",
"monaco-editor": "^0.44.0",
"omit.js": "^2.0.2",
"rc-menu": "^9.12.0",
"rc-util": "^5.37.0",
"rc-menu": "^9.12.2",
"rc-util": "^5.38.1",
"re-resizable": "^6.9.11",
"react": "^18.2.0",
"react-countup": "^6.4.2",
"react-countup": "^6.5.0",
"react-dom": "^18.0.0",
"react-helmet-async": "^1.3.0",
"react-lineage-dag": "^2.0.36",
......@@ -70,8 +70,8 @@
"redux-persist": "^6.0.0",
"remark-gfm": "^4.0.0",
"screenfull": "^6.0.2",
"sql-formatter": "^13.0.2",
"styled-components": "^6.0.8",
"sql-formatter": "^13.1.0",
"styled-components": "^6.1.1",
"use-sse": "^2.0.1"
},
"devDependencies": {
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
......@@ -16,7 +17,7 @@
*
*/
import { TabsItemType } from '@/pages/DataStudio/types';
import { TabsItemType } from '@/pages/DataStudio/model';
import { Button } from 'antd';
import React from 'react';
......
......@@ -22,13 +22,14 @@ import { editor, languages, Position } from 'monaco-editor';
import { buildAllSuggestionsToEditor } from '@/components/CustomEditor/CodeEdit/function';
import EditorFloatBtn from '@/components/CustomEditor/EditorFloatBtn';
import { LoadCustomEditorLanguage } from '@/components/CustomEditor/languages';
import { StateType } from '@/pages/DataStudio/model';
import { MonacoEditorOptions } from '@/types/Public/data';
import { convertCodeEditTheme } from '@/utils/function';
import { Editor, Monaco, OnChange } from '@monaco-editor/react';
import { Editor, Monaco, OnChange, useMonaco } from '@monaco-editor/react';
import { connect } from '@umijs/max';
import useMemoCallback from 'rc-menu/es/hooks/useMemoCallback';
import { memo, useCallback, useRef } from 'react';
import { memo, useCallback, useEffect, useRef } from 'react';
import ITextModel = editor.ITextModel;
import CompletionItem = languages.CompletionItem;
import CompletionContext = languages.CompletionContext;
......@@ -94,6 +95,15 @@ const CodeEdit = (props: CodeEditFormProps & connect) => {
const { ScrollType } = editor;
// 使用编辑器钩子, 拿到编辑器实例
const monacoHook = useMonaco();
useEffect(() => {
convertCodeEditTheme(monacoHook?.editor);
// 需要调用 手动注册下自定义语言
LoadCustomEditorLanguage(monacoHook);
}, [monacoHook]);
// todo: 已知 bug , 切换 tab 时 , 会造成buildAllSuggestions 的重复调用 , 造成建议项重复 ,但不影响原有数据, 编辑器会将建议项自动缓存,不会进行去重
/**
* build all suggestions
......
......@@ -18,7 +18,7 @@
*/
import EditorFloatBtn from '@/components/CustomEditor/EditorFloatBtn';
import { LogLanguage } from '@/components/CustomEditor/languages/javalog';
import { LoadCustomEditorLanguage } from '@/components/CustomEditor/languages';
import { Loading } from '@/pages/Other/Loading';
import { MonacoEditorOptions } from '@/types/Public/data';
import { convertCodeEditTheme } from '@/utils/function';
......@@ -94,7 +94,7 @@ const CodeShow = (props: CodeShowFormProps) => {
useEffect(() => {
convertCodeEditTheme(monaco?.editor);
// 需要调用 手动注册下自定义语言
LogLanguage(monaco);
LoadCustomEditorLanguage(monaco);
}, [monaco]);
/**
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export const TokenClassConsts = {
BINARY: 'binary',
BINARY_ESCAPE: 'binary.escape',
COMMENT: 'comment',
COMMENT_QUOTE: 'comment.quote',
DELIMITER: 'delimiter',
DELIMITER_CURLY: 'delimiter.curly',
DELIMITER_PAREN: 'delimiter.paren',
DELIMITER_SQUARE: 'delimiter.square',
IDENTIFIER: 'identifier',
IDENTIFIER_QUOTE: 'identifier.quote',
KEYWORD: 'keyword',
KEYWORD_SCOPE: 'keyword.scope',
NUMBER: 'number',
NUMBER_FLOAT: 'number.float',
NUMBER_BINARY: 'number.binary',
NUMBER_OCTAL: 'number.octal',
NUMBER_HEX: 'number.hex',
OPERATOR: 'operators',
OPERATOR_KEYWORD: 'operators.keyword',
OPERATOR_SYMBOL: 'operators.symbol',
PREDEFINED: 'predefined',
STRING: 'string',
STRING_ESCAPE: 'string.escape',
STRING_ESCAPE_CHAR: 'string.escape.char',
TYPE: 'type',
VARIABLE: 'variable',
WHITE: 'white'
};
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { TokenClassConsts } from '@/components/CustomEditor/languages/flinksql/constants';
import {
EXTEND_SQL_KEYWORD,
FLINK_SQL_BUILTIN_FUNCTIONS,
FLINK_SQL_KEYWORD,
FLINK_SQL_OPERATORS,
FLINK_SQL_SCOPE_KEYWORDS,
FLINK_SQL_TYPE_KEYWORDS
} from '@/components/CustomEditor/languages/flinksql/keyword';
import { Monaco } from '@monaco-editor/react';
export function FlinkSQLLanguage(monaco: Monaco | null) {
// Register a new language
monaco?.languages.register({
id: 'flinksql',
extensions: ['.sql'],
aliases: ['flinksql', 'fsql', 'flinksql', 'flinkSQL', 'FlinkSQL']
});
monaco?.languages.setMonarchTokensProvider('flinksql', {
defaultToken: '',
tokenPostfix: '.sql',
keywords: [...FLINK_SQL_KEYWORD, ...EXTEND_SQL_KEYWORD],
operators: FLINK_SQL_OPERATORS,
ignoreCase: true, // 忽略大小写
builtinFunctions: FLINK_SQL_BUILTIN_FUNCTIONS,
builtinVariables: [],
typeKeywords: FLINK_SQL_TYPE_KEYWORDS,
scopeKeywords: FLINK_SQL_SCOPE_KEYWORDS,
pseudoColumns: [],
comments: {
lineComment: '--',
blockComment: ['/*', '*/']
},
brackets: [
{ open: '{', close: '}', token: 'delimiter.curly' },
{ open: '[', close: ']', token: 'delimiter.bracket' },
{ open: '(', close: ')', token: 'delimiter.parenthesis' }
],
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: '`', close: '`' }
],
surroundingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: '`', close: '`' }
],
folding: {
markers: {
start:
/((create|alter|drop|rename\s+)?(TABLE|DATABASE|STREAM|FUNCTION|PROCEDURE|PACKAGE|TYPE|TRIGGER|INDEX|SCHEMA|VIEW)\b)|((EXECUTE\s+)?(JAR|CDCSOURCE)?\b)/i,
end: /\)\\;\b/i
}
},
tokenizer: {
root: [
{ include: '@comments' },
{ include: '@whitespace' },
{ include: '@pseudoColumns' },
{ include: '@numbers' },
{ include: '@strings' },
{ include: '@complexIdentifiers' },
{ include: '@scopes' },
{ include: '@complexDataTypes' },
[
/[\w@#$]+/,
{
cases: {
'@scopeKeywords': TokenClassConsts.KEYWORD_SCOPE,
'@operators': TokenClassConsts.OPERATOR_KEYWORD,
'@typeKeywords': TokenClassConsts.TYPE,
'@builtinVariables': TokenClassConsts.VARIABLE,
'@builtinFunctions': TokenClassConsts.PREDEFINED,
'@keywords': TokenClassConsts.KEYWORD,
'@default': TokenClassConsts.IDENTIFIER,
fontWeight: 'normal'
}
}
]
],
whitespace: [[/[\s\t\r\n]+/, TokenClassConsts.WHITE]],
comments: [
[/--+.*/, TokenClassConsts.COMMENT],
[/\/\*/, { token: TokenClassConsts.COMMENT_QUOTE, next: '@comment' }]
],
comment: [
[/[^*/]+/, TokenClassConsts.COMMENT],
[/\/\*/, { token: TokenClassConsts.COMMENT_QUOTE, next: '@push' }], // nested comment not allowed :-(
[/\*\//, { token: TokenClassConsts.COMMENT_QUOTE, next: '@pop' }],
[/./, TokenClassConsts.COMMENT]
],
pseudoColumns: [
[
/[$][A-Za-z_][\w@#$]*/,
{
cases: {
'@pseudoColumns': TokenClassConsts.PREDEFINED,
'@default': TokenClassConsts.IDENTIFIER
}
}
]
],
numbers: [
[/0[xX][0-9a-fA-F]*/, TokenClassConsts.NUMBER_HEX],
[/[$][+-]*\d*(\.\d*)?/, TokenClassConsts.NUMBER],
[/((\d+(\.\d*)?)|(\.\d+))([eE][\\\-+]?\d+)?/, TokenClassConsts.NUMBER]
],
strings: [[/'/, { token: 'custom-error', next: '@string' }]],
string: [
[/[^']+/, TokenClassConsts.STRING],
[/''/, TokenClassConsts.STRING],
[/'/, { token: TokenClassConsts.STRING, next: '@pop' }]
],
complexIdentifiers: [
[/`/, { token: TokenClassConsts.IDENTIFIER_QUOTE, next: '@quotedIdentifier' }]
],
quotedIdentifier: [
[/[^`]+/, TokenClassConsts.IDENTIFIER_QUOTE],
[/``/, TokenClassConsts.IDENTIFIER_QUOTE],
[/`/, { token: TokenClassConsts.IDENTIFIER_QUOTE, next: '@pop' }]
],
scopes: [
[/(EXECUTE\s+)?JAR\s+/i, TokenClassConsts.KEYWORD_SCOPE],
[/(EXECUTE\s+)?CDCSOURCE\s/i, TokenClassConsts.KEYWORD_SCOPE],
[/(PRINT\s+)?\s/i, TokenClassConsts.KEYWORD_SCOPE]
],
complexDataTypes: [
[/DOUBLE\s+PRECISION\b/i, { token: TokenClassConsts.TYPE }],
[/WITHOUT\s+TIME\s+ZONE\b/i, { token: TokenClassConsts.TYPE }],
[/WITH\s+LOCAL\s+TIME\s+ZONE\b/i, { token: TokenClassConsts.TYPE }]
]
},
unicode: true
});
monaco?.languages?.registerCompletionItemProvider('flinksql', {
provideCompletionItems: function (model, position) {
const word = model.getWordUntilPosition(position);
const range = {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: word.startColumn,
endColumn: word.endColumn
};
return {
suggestions: FLINK_SQL_KEYWORD.map((item) => {
return {
label: item,
range: range,
kind: monaco.languages.CompletionItemKind.Keyword,
insertText: item
};
})
};
}
});
monaco?.languages?.setLanguageConfiguration('flinksql', {
comments: {
lineComment: '--',
blockComment: ['/*', '*/']
},
brackets: [
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: '`', close: '`' }
],
indentationRules: {
increaseIndentPattern: /^\s*(\w+\s+)+\w/,
decreaseIndentPattern: /^\s*(\w+\s+)+\w/
},
onEnterRules: [
{
beforeText: /^\s*(\/\*)/,
afterText: /^\s*\*\/$/,
action: { indentAction: monaco.languages.IndentAction.IndentOutdent, appendText: ' * ' }
}
],
surroundingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: '`', close: '`' }
],
colorizedBracketPairs: [
['{', '}'],
['[', ']'],
['(', ')']
],
folding: {
offSide: true,
markers: {
start:
/((create|alter|drop|rename\s+)?(TABLE|DATABASE|STREAM|FUNCTION|PROCEDURE|PACKAGE|TYPE|TRIGGER|INDEX|SCHEMA|VIEW)\b)|((EXECUTE\s+)?(JAR|CDCSOURCE)?\b)/i,
end: /\)\\;\b/i
}
}
});
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { FlinkSQLLanguage } from '@/components/CustomEditor/languages/flinksql';
import { LogLanguage } from '@/components/CustomEditor/languages/javalog';
import { Monaco } from '@monaco-editor/react';
/**
* 加载自定义语言 关键字
* @param monaco
* @constructor
*/
// function LoadLanguagesKeyWord(monaco: Monaco | null) {
// if (!monaco) {
// return;
// }
// monaco?.languages?.getLanguages().forEach((language) => {
// return monaco?.languages?.registerCompletionItemProvider(language.id , {
// provideCompletionItems: function (model, position) {
// const word = model.getWordUntilPosition(position);
// const range = {
// startLineNumber: position.lineNumber,
// endLineNumber: position.lineNumber,
// startColumn: word.startColumn,
// endColumn: word.endColumn
// };
// return {
// suggestions: FLINK_SQL_KEYWORD.map((item) => {
// return {
// label: item,
// range: range,
// kind: monaco.languages.CompletionItemKind.Keyword,
// insertText: item
// };
// })
// };
// }
// });
// })
// }
export function LoadCustomEditorLanguage(monaco: Monaco | null) {
// LoadLanguagesKeyWord(monaco);
LogLanguage(monaco);
FlinkSQLLanguage(monaco);
}
// todo 自定义语言不生效
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export function LogLanguage(monaco: any) {
// Register a new language
monaco?.languages.register({
......@@ -7,7 +25,6 @@ export function LogLanguage(monaco: any) {
aliases: ['javalog', 'Javalog', 'Javalog', 'jl', 'log']
});
monaco?.languages.setMonarchTokensProvider('javalog', {
// todo: 如果需要分段展示不同的颜色 则需要在这里添加规则, 且正则必须是严格模式, 否则会匹配一整行,无法达到预期效果
tokenizer: {
root: [
// 默认不区分大小写 //
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
......@@ -81,6 +81,8 @@ export default class LineageDagExt extends LineageDag {
result.edges = result.edges.map((item) => {
return {
...item,
// 线条的类型: Bezier/Flow/Straight/Manhattan/AdvancedBezier/Bezier2-1/Bezier2-2/Bezier2-3/BrokenLine , 新版本可以指定 但是布局调整了
// https://github.com/zhu-mingye/butterfly/blob/master/docs/zh-CN/edge.md#shapetype--string----%E9%80%89%E5%A1%AB
shapeType: 'AdvancedBezier'
};
});
......
......@@ -608,3 +608,8 @@ h5 {
.card-list-item:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
// 自定义语言会把 '' 中间的内容加粗 , 在这里重置 不加粗
span .mtkb {
font-weight: inherit;
}
......@@ -1052,7 +1052,8 @@ export default {
'user.request.type': 'Type',
'user.reset': 'Are you sure to Reset this User Password?',
'user.resetPassword': 'Reset your password',
'user.resetPasswordSuccess': 'User',
'user.resetPasswordSuccess':
'User [{username}] reset password successfully, new password: {password}',
'user.role': 'Role',
'user.status': 'Is Deleted',
'user.superAdminFlag': 'Super Admin',
......
......@@ -1010,7 +1010,7 @@ export default {
'user.request.type': '请求类型',
'user.reset': '您确定要重置此用户密码吗?',
'user.resetPassword': '重置密码',
'user.resetPasswordSuccess': '用户',
'user.resetPasswordSuccess': '用户 [{username}] 重置密码成功, 新密码: {password}',
'user.role': '角色',
'user.status': '是否删除',
'user.superAdminFlag': '超级管理员',
......
......@@ -23,7 +23,7 @@ import { NORMAL_MODAL_OPTIONS } from '@/services/constants';
import { UserBaseInfo } from '@/types/AuthCenter/data';
import { l } from '@/utils/intl';
import { Form, Modal } from 'antd';
import React, { useEffect, useState } from 'react';
import React, { useEffect } from 'react';
type PasswordModalFormProps = {
onCancel: (flag?: boolean) => void;
......@@ -59,10 +59,6 @@ const PasswordModal: React.FC<PasswordModalFormProps> = (props) => {
form.setFieldsValue(values);
}, [modalVisible, values, form]);
const [formVals, setFormVals] = useState<Partial<UserBaseInfo.ChangePasswordParams>>({
...values
});
/**
* handle cancel
*/
......@@ -76,9 +72,8 @@ const PasswordModal: React.FC<PasswordModalFormProps> = (props) => {
*/
const submitForm = async () => {
const fieldsValue = await form.validateFields();
setFormVals({ ...formVals, ...fieldsValue });
await handleSubmit({ ...formVals, ...fieldsValue });
await handleCancel();
handleSubmit({ ...values, ...fieldsValue });
handleCancel();
};
/**
......@@ -92,7 +87,7 @@ const PasswordModal: React.FC<PasswordModalFormProps> = (props) => {
onCancel={() => handleCancel()}
onOk={() => submitForm()}
>
<PasswordForm values={values as any} form={form} />
<PasswordForm values={values as UserBaseInfo.User} form={form} />
</Modal>
);
};
......
......@@ -23,7 +23,7 @@ import { EditBtn } from '@/components/CallBackButton/EditBtn';
import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn';
import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn';
import { BackIcon } from '@/components/Icons/CustomIcons';
import { Authorized, useAccess } from '@/hooks/useAccess';
import { Authorized, HasAuthority, useAccess } from '@/hooks/useAccess';
import { UserType, USER_TYPE_ENUM } from '@/pages/AuthCenter/User/components/constants';
import PasswordModal from '@/pages/AuthCenter/User/components/PasswordModal';
import UserModalForm from '@/pages/AuthCenter/User/components/UserModalForm';
......@@ -225,6 +225,7 @@ const UserProTable = () => {
<EnableSwitchBtn
key={`${record.id}_enable`}
record={record}
disabled={!HasAuthority('/auth/user/edit')}
onChange={() => handleChangeEnable(record)}
/>
// </Authorized>
......
......@@ -34,11 +34,12 @@ export type DiffModalProps = {
diffs: any[];
open: boolean;
fileName?: string;
language?: string;
onUse: (server: boolean) => void;
};
const DiffModal: React.FC<DiffModalProps> = (props) => {
const { diffs, open, fileName, onUse } = props;
const { diffs, open, fileName, language = 'sql', onUse } = props;
// Find the diff object with key 'statement'
const statementDiff = diffs.find((diff) => diff.key === 'statement');
// Filter out the diff objects with key other than 'statement'
......@@ -60,6 +61,7 @@ const DiffModal: React.FC<DiffModalProps> = (props) => {
</Row>
<DiffEditor
{...DIFF_EDITOR_PARAMS}
language={language}
original={statementDiff?.server}
modified={statementDiff?.cache}
theme={convertCodeEditTheme()}
......
......@@ -30,6 +30,7 @@ import {
TaskDataType
} from '@/pages/DataStudio/model';
import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants';
import { DIALECT } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints';
import { l } from '@/utils/intl';
import { connect, useRequest } from '@@/exports';
......@@ -147,6 +148,11 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
<DiffModal
diffs={diff}
open={isModalOpen}
language={
currentTab?.params?.taskData?.dialect?.toLowerCase() === DIALECT.FLINK_SQL
? 'flinksql'
: 'sql'
}
fileName={currentData?.name}
onUse={upDateTask}
/>
......@@ -154,7 +160,12 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
monacoRef={monacoInstance}
editorRef={editorInstance}
code={currentTab?.params?.taskData?.statement}
language={'sql'}
language={
currentTab?.params?.taskData?.dialect?.toLowerCase() === DIALECT.FLINK_SQL
? 'flinksql'
: 'sql'
}
// language={'sql'}
editorDidMount={editorDidMount}
onChange={handleEditChange}
enableSuggestions={true}
......
......@@ -109,7 +109,7 @@ const MiddleContainer = (props: any) => {
};
const updateActiveKey = (item: TabsItemType) => {
const { key, value, treeKey } = item;
const { key, label } = item;
if (key === activeKey) {
return;
}
......@@ -133,7 +133,7 @@ const MiddleContainer = (props: any) => {
if (item.type === TabsPageType.metadata) {
// 替换掉 . 为 /, 因为再 tree 里选中的 key 是 / 分割的
const name = value.toString().replace('.', '/');
const name = label.replace('.', '/');
dispatch({
type: STUDIO_MODEL.updateDatabaseSelectKey,
payload: [name]
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { TagAlignLeft } from '@/components/StyledComponents';
import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function';
import { RUN_MODE } from '@/services/constants';
import { Alert, Cluster } from '@/types/RegCenter/data';
import { Alert, ALERT_TYPE, Cluster } from '@/types/RegCenter/data.d';
import { l } from '@/utils/intl';
import { PaperClipOutlined } from '@ant-design/icons';
import { Badge, Tag } from 'antd';
......@@ -150,13 +151,24 @@ export const buildEnvOptions = (env: any[]) => {
export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => {
const alertGroupOptions: DefaultOptionType[] = [
{
label: l('button.disable'),
value: -1
label: (
<TagAlignLeft>
{getAlertIcon(ALERT_TYPE.GROUP, 20)}
{l('button.disable')}
</TagAlignLeft>
),
value: -1,
key: -1
}
];
for (const item of alertGroups) {
alertGroupOptions.push({
label: item.name,
label: (
<TagAlignLeft>
{getAlertIcon(ALERT_TYPE.GROUP, 20)}
{item.name}
</TagAlignLeft>
),
value: item.id,
key: item.id
});
......
......@@ -23,7 +23,7 @@ import {
getCurrentTab,
isDataStudioTabsItemType
} from '@/pages/DataStudio/function';
import { SessionType, StateType, STUDIO_MODEL } from '@/pages/DataStudio/model';
import { SessionType, StateType, STUDIO_MODEL, STUDIO_MODEL_ASYNC } from '@/pages/DataStudio/model';
import {
buildAlertGroupOptions,
buildClusterConfigOptions,
......@@ -32,7 +32,7 @@ import {
buildRunModelOptions,
calculatorWidth
} from '@/pages/DataStudio/RightContainer/JobConfig/function';
import { AlertStateType } from '@/pages/RegCenter/Alert/AlertInstance/model';
import { AlertStateType, ALERT_MODEL_ASYNC } from '@/pages/RegCenter/Alert/AlertInstance/model';
import { RUN_MODE, SWITCH_OPTIONS } from '@/services/constants';
import { l } from '@/utils/intl';
import { InfoCircleOutlined } from '@ant-design/icons';
......@@ -78,7 +78,10 @@ const JobConfig = (props: any) => {
useEffect(() => {
dispatch({
type: 'Studio/queryFlinkConfigOptions'
type: STUDIO_MODEL_ASYNC.queryFlinkConfigOptions
});
dispatch({
type: ALERT_MODEL_ASYNC.queryAlertGroup
});
form.setFieldsValue(current);
}, [current]);
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
......@@ -26,7 +26,7 @@ import { RocketOutlined } from '@ant-design/icons';
import { ProCard } from '@ant-design/pro-components';
import { Descriptions, Tag, Typography } from 'antd';
const { Text, Paragraph } = Typography;
const { Text } = Typography;
/**
* Renders the JobConfigTab component.
......@@ -64,13 +64,13 @@ const JobDesc = (props: JobProps) => {
* @param {object} config - The user configuration object.
* @returns {JSX.Element[]} - An array of Descriptions.Item components representing the user configuration.
*/
const getUserConfig = (config: any) => {
let formList = [];
for (let configKey in config) {
formList.push(<Descriptions.Item label={configKey}>{config[configKey]}</Descriptions.Item>);
}
return formList;
};
// const getUserConfig = (config: any) => {
// let formList = [];
// for (let configKey in config) {
// formList.push(<Descriptions.Item label={configKey}>{config[configKey]}</Descriptions.Item>);
// }
// return formList;
// };
return (
<>
......@@ -93,7 +93,7 @@ const JobDesc = (props: JobProps) => {
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.ClusterInstanceName')}>
<Link to={'/registration/cluster/instance'}>{jobDetail?.cluster?.alias}</Link>
<Link to={'/registration/cluster/instance'}>{jobDetail?.clusterInstance?.alias}</Link>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobId')}>
......@@ -120,10 +120,6 @@ const JobDesc = (props: JobProps) => {
{jobDetail?.history?.config?.useSqlFragment ? l('button.enable') : l('button.disable')}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobType')}>
{jobDetail?.history?.config?.isJarTask ? 'Jar' : 'FlinkSQL'}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.execmode')}>
{jobDetail?.history?.config?.useBatchModel
? l('global.table.execmode.batch')
......
......@@ -21,6 +21,7 @@ import CodeShow from '@/components/CustomEditor/CodeShow';
import VersionList from '@/components/VersionList';
import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { handleRemoveById } from '@/services/BusinessCrud';
import { DIALECT } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints';
import { TaskVersionListItem } from '@/types/Studio/data';
import { l } from '@/utils/intl';
......@@ -85,7 +86,13 @@ const JobVersionTab = (props: JobProps) => {
</>
}
>
<CodeShow code={currentVersion?.statement ?? ''} height={500} language={'sql'} />
<CodeShow
code={currentVersion?.statement ?? ''}
height={500}
language={
currentVersion?.dialect?.toLowerCase() === DIALECT.FLINK_SQL ? 'flinksql' : 'sql'
}
/>
</Card>
</Col>
</Row>
......
......@@ -67,7 +67,8 @@ const JobHistoryList = (props: HistoryProps) => {
render: (text: any, record: Jobs.JobInstance) => [
<a
key={'history-detail'}
onClick={() => history.push(`/devops/job-detail?id=${record.id}`)}>
onClick={() => history.push(`/devops/job-detail?id=${record.id}`)}
>
{l('devops.joblist.detail')}
</a>
]
......
......@@ -17,7 +17,11 @@
*
*/
import { buildFormData, getFormData } from '@/pages/RegCenter/Alert/AlertGroup/function';
import {
buildAlertInstanceSelect,
buildFormData,
getFormData
} from '@/pages/RegCenter/Alert/AlertGroup/function';
import { AlertStateType } from '@/pages/RegCenter/Alert/AlertInstance/model';
import { MODAL_FORM_STYLE, SWITCH_OPTIONS } from '@/services/constants';
import { Alert } from '@/types/RegCenter/data';
......@@ -30,7 +34,7 @@ import {
ProFormTextArea
} from '@ant-design/pro-components';
import { connect } from '@umijs/max';
import { Button, Form, Tag } from 'antd';
import { Button, Form } from 'antd';
import React, { useState } from 'react';
/**
......@@ -41,10 +45,9 @@ type AlertGroupFormProps = {
onSubmit: (values: Partial<Alert.AlertGroup>) => void;
modalVisible: boolean;
values: Partial<Alert.AlertGroup>;
instance: Alert.AlertInstance[];
};
const AlertGroupForm: React.FC<AlertGroupFormProps> = (props) => {
const AlertGroupForm: React.FC<AlertGroupFormProps & connect> = (props) => {
/**
* extract props
*/
......@@ -52,7 +55,7 @@ const AlertGroupForm: React.FC<AlertGroupFormProps> = (props) => {
onSubmit: handleSubmit,
onCancel: handleModalVisible,
modalVisible,
instance,
alertInstance,
values
} = props;
/**
......@@ -61,26 +64,6 @@ const AlertGroupForm: React.FC<AlertGroupFormProps> = (props) => {
const [form] = Form.useForm();
const [formVals, setFormVals] = useState<Partial<Alert.AlertGroup>>({ ...values });
/**
* build alert instance select options
*/
const buildAlertInstanceSelect = () => {
const itemList = [];
for (const item of instance) {
const tag = (
<>
<Tag color='processing'>{item.type}</Tag>
{item.name}
</>
);
itemList.push({
label: tag,
value: item.id.toString()
});
}
return itemList;
};
/**
* submit form
*/
......@@ -108,7 +91,7 @@ const AlertGroupForm: React.FC<AlertGroupFormProps> = (props) => {
label={l('rc.ag.alertInstanceIds')}
rules={[{ required: true, message: l('rc.ag.chooseAlertInstanceIds') }]}
mode='multiple'
options={buildAlertInstanceSelect()}
options={buildAlertInstanceSelect(alertInstance ?? [])}
/>
<ProFormTextArea
......@@ -158,5 +141,5 @@ const AlertGroupForm: React.FC<AlertGroupFormProps> = (props) => {
};
export default connect(({ Alert }: { Alert: AlertStateType }) => ({
instance: Alert.instance
alertInstance: Alert.instance
}))(AlertGroupForm);
......@@ -17,7 +17,8 @@
*
*/
import { Alert } from '@/types/RegCenter/data';
import { Alert } from '@/types/RegCenter/data.d';
import { Tag } from 'antd';
/**
* parse alertInstanceIds to array and rebuild form data
......@@ -44,3 +45,19 @@ export const buildFormData = (values: Partial<Alert.AlertGroup>, params: any) =>
}
return { ...newValue, ...params };
};
export const buildAlertInstanceSelect = (alertInstance: Alert.AlertInstance[]) => {
return alertInstance.map((item) => {
const tag = (
<>
{' '}
<Tag color='processing'>{item.type}</Tag>
{item.name}
</>
);
return {
label: tag,
value: item.id.toString()
};
});
};
......@@ -79,7 +79,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
* execute and refresh loading
* @param callback
*/
const exexuteWithRefreshLoading = async (callback: any) => {
const executeWithRefreshLoading = async (callback: any) => {
setAlertGroupState((prevState) => ({ ...prevState, loading: true }));
await callback();
await queryAlertGroupList();
......@@ -97,7 +97,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () =>
exexuteWithRefreshLoading(async () =>
executeWithRefreshLoading(async () =>
handleRemoveById(API_CONSTANTS.ALERT_GROUP_DELETE, id)
)
});
......@@ -108,7 +108,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
* @param item
*/
const handleEnable = async (item: Alert.AlertGroup) => {
await exexuteWithRefreshLoading(async () =>
await executeWithRefreshLoading(async () =>
updateDataByParam(API_CONSTANTS.ALERT_GROUP_ENABLE, { id: item.id })
);
};
......@@ -129,7 +129,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
* handle add alert instance
*/
const handleSubmit = async (value: Alert.AlertGroup) => {
await exexuteWithRefreshLoading(async () =>
await executeWithRefreshLoading(async () =>
handleAddOrUpdate(
API_CONSTANTS.ALERT_GROUP_ADD_OR_UPDATE,
value,
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*--- get alert instance ---*/
import { getData } from '@/services/api';
import { queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
export function showAlertInstance() {
return getData(API_CONSTANTS.ALERT_INSTANCE_LIST_ENABLE_ALL);
return queryDataByParams(API_CONSTANTS.ALERT_INSTANCE_LIST_ENABLE_ALL) ?? [];
}
export function showAlertGroup() {
return queryDataByParams(API_CONSTANTS.ALERT_GROUP_LIST_ENABLE_ALL) ?? [];
}
......@@ -17,7 +17,7 @@
*
*/
import { showAlertInstance } from '@/pages/RegCenter/Alert/AlertGroup/service';
import { showAlertGroup, showAlertInstance } from '@/pages/RegCenter/Alert/AlertGroup/service';
import { Alert } from '@/types/RegCenter/data.d';
import { Reducer } from 'umi';
......@@ -34,6 +34,7 @@ export type AlertModelType = {
state: AlertStateType;
effects: {
queryInstance: Effect;
queryAlertGroup: Effect;
};
reducers: {
saveInstance: Reducer<AlertStateType>;
......@@ -50,8 +51,12 @@ const AlertModel: AlertModelType = {
effects: {
*queryInstance({}, { call, put }) {
const { data } = yield call(showAlertInstance);
const data: Alert.AlertInstance[] = yield call(showAlertInstance);
yield put({ type: 'saveInstance', payload: data });
},
*queryAlertGroup({}, { call, put }) {
const data: Alert.AlertGroup[] = yield call(showAlertGroup);
yield put({ type: 'saveGroup', payload: data });
}
},
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import CodeShow from '@/components/CustomEditor/CodeShow';
......@@ -21,6 +23,7 @@ import { queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
import { DataSources } from '@/types/RegCenter/data';
import { l } from '@/utils/intl';
import { ProCardTabsProps } from '@ant-design/pro-card/es/typing';
import { ProCard } from '@ant-design/pro-components';
import { Empty, Typography } from 'antd';
import React, { useCallback, useEffect, useState } from 'react';
......@@ -53,7 +56,7 @@ const GenSQL: React.FC<GenSQLProps> = (props) => {
const genSQLData = await queryDataByParams(API_CONSTANTS.DATASOURCE_GET_GEN_SQL, {
...queryParams
});
setGenSQL(genSQLData);
setGenSQL(genSQLData as DataSources.SqlGeneration);
}, [queryParams]);
/**
......@@ -70,7 +73,7 @@ const GenSQL: React.FC<GenSQLProps> = (props) => {
* @param code
*/
const renderContent = (code = '') => {
return <CodeShow {...CodeShowProps} code={tagDisabled ? '' : code} />;
return <CodeShow {...CodeShowProps} language={'flinksql'} code={tagDisabled ? '' : code} />;
};
/**
......@@ -108,7 +111,7 @@ const GenSQL: React.FC<GenSQLProps> = (props) => {
];
// tab props
const restTabProps = {
const restTabProps: ProCardTabsProps = {
activeKey,
onChange: (key: string) => setActiveKey(key),
tabPosition: 'left',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import CodeEdit from '@/components/CustomEditor/CodeEdit';
import CodeShow from '@/components/CustomEditor/CodeShow';
import { renderLanguage, unSupportView } from '@/utils/function';
import { l } from '@/utils/intl';
import { Empty, Space, Typography } from 'antd';
......@@ -103,7 +103,7 @@ const FileShow: React.FC<FileShowProps> = (props) => {
</>
);
} else {
return <CodeEdit {...restCodeShowProps} {...CodeEditProps} />;
return <CodeShow {...restCodeShowProps} {...CodeEditProps} />;
}
};
......
......@@ -147,7 +147,7 @@ export enum API_CONSTANTS {
// ---- alert instance ----
// alert instance list
ALERT_INSTANCE = '/api/alertInstance/list',
ALERT_INSTANCE_ADD_OR_UPDATE = '/api/alertInstance/addOrUpdate',
ALERT_INSTANCE_ADD_OR_UPDATE = '/api/alertInstance/saveOrUpdate',
// delete alert instance by id
ALERT_INSTANCE_DELETE = '/api/alertInstance/delete',
// alert instance enable or disable
......@@ -159,6 +159,7 @@ export enum API_CONSTANTS {
// ---- alert group ----
ALERT_GROUP = '/api/alertGroup/list',
ALERT_GROUP_LIST_ENABLE_ALL = '/api/alertGroup/listEnabledAll',
ALERT_GROUP_ADD_OR_UPDATE = '/api/alertGroup/addOrUpdate',
// delete alert group by id
ALERT_GROUP_DELETE = '/api/alertGroup/delete',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
......@@ -45,7 +45,6 @@ declare namespace Jobs {
savePointStrategy: string;
savePointPath: string;
useSqlFragment: string;
isJarTask: string;
useBatchModel: string;
};
......
......@@ -141,7 +141,7 @@ export function convertCodeEditTheme(editorInstance?: any) {
rules: [
// 注意,默认的不做修改 因为上边继承了父主题, 只添加自己定义的 , 否则会覆盖默认的 , 导致编辑器样式不一致
{ token: 'custom-info', foreground: '#808080' },
{ token: 'custom-thread', foreground: '#07f313' },
{ token: 'custom-thread', foreground: '#9fa19f' },
{ token: 'custom-class', foreground: '#1060d9' },
{ token: 'custom-error', foreground: '#ff0000', fontStyle: 'bold' },
{ token: 'custom-warning', foreground: '#FFA500', fontStyle: 'bold' },
......@@ -161,7 +161,7 @@ export function convertCodeEditTheme(editorInstance?: any) {
rules: [
// 注意,默认的不做修改 因为上边继承了父主题, 只添加自己定义的 , 否则会覆盖默认的 , 导致编辑器样式不一致
{ token: 'custom-info', foreground: '#008800' },
{ token: 'custom-thread', foreground: '#07f313' },
{ token: 'custom-thread', foreground: '#9fa19f' },
{ token: 'custom-class', foreground: '#1060d9' },
{ token: 'custom-error', foreground: '#ff0000', fontStyle: 'bold' },
{ token: 'custom-warning', foreground: '#FFA500', fontStyle: 'bold' },
......
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