Unverified Commit 28b7440c authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Refactor][Web]Add catalog (#2386)

* optimize_version * optimize_version * add_structure * add_catalog * add_catalog * add_catalog * add_catalog * add_catalog * add_catalog * add_catalog
parent 3cbe7ed7
......@@ -27,7 +27,7 @@ import org.dinky.data.dto.StudioMetaStoreDTO;
import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status;
import org.dinky.data.model.Catalog;
import org.dinky.data.model.FlinkColumn;
import org.dinky.data.model.Column;
import org.dinky.data.model.Schema;
import org.dinky.data.result.IResult;
import org.dinky.data.result.Result;
......@@ -176,7 +176,7 @@ public class StudioController {
paramType = "query"),
@ApiImplicitParam(name = "table", value = "table", required = true, dataType = "String", paramType = "query")
})
public Result<List<FlinkColumn>> getMSFlinkColumns(
public Result<List<Column>> getMSFlinkColumns(
@RequestParam Integer envId,
@RequestParam String catalog,
@RequestParam String database,
......
......@@ -23,7 +23,7 @@ import org.dinky.data.dto.StudioCADTO;
import org.dinky.data.dto.StudioDDLDTO;
import org.dinky.data.dto.StudioMetaStoreDTO;
import org.dinky.data.model.Catalog;
import org.dinky.data.model.FlinkColumn;
import org.dinky.data.model.Column;
import org.dinky.data.model.Schema;
import org.dinky.data.result.IResult;
import org.dinky.data.result.SelectResult;
......@@ -41,67 +41,19 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public interface StudioService {
/**
* Execute a DDL statement and return the result.
*
* @param studioDDLDTO A {@link StudioDDLDTO} object representing the DDL statement to execute.
* @return An {@link IResult} object representing the result of the DDL statement execution.
*/
IResult executeDDL(StudioDDLDTO studioDDLDTO);
/**
* Get common SQL data based on the specified task ID.
*
* @param taskId The ID of the task to get the common SQL data for.
* @return A {@link JdbcSelectResult} object representing the common SQL data for the specified task ID.
*/
JdbcSelectResult getCommonSqlData(Integer taskId);
/**
* Get job data based on the specified job ID.
*
* @param jobId The ID of the job to get the job data for.
* @return A {@link SelectResult} object representing the job data for the specified job ID.
*/
SelectResult getJobData(String jobId);
/**
* Get the lineage information for a specified studio CAD.
*
* @param studioCADTO A {@link StudioCADTO} object representing the studio CAD to get the lineage information for.
* @return A {@link LineageResult} object representing the lineage information for the specified studio CAD.
*/
LineageResult getLineage(StudioCADTO studioCADTO);
/**
* Get a list of Flink jobs based on the specified cluster ID.
*
* @param clusterId The ID of the cluster to get the Flink jobs for.
* @return A list of {@link JsonNode} objects representing the Flink jobs for the specified cluster ID.
*/
List<JsonNode> listFlinkJobs(Integer clusterId);
/**
* Get MS catalogs based on the specified studio meta store DTO.
*
* @param studioMetaStoreDTO A {@link StudioMetaStoreDTO} object representing the studio meta store DTO to get the MS catalogs for.
* @return A list of {@link Catalog} objects representing the MS catalogs for the specified studio meta store DTO.
*/
List<Catalog> getMSCatalogs(StudioMetaStoreDTO studioMetaStoreDTO);
/**
* Get the schema information for a specified MS catalog.
*
* @param studioMetaStoreDTO A {@link StudioMetaStoreDTO} object representing the MS catalog to get the schema information for.
* @return A {@link Schema} object representing the schema information for the specified MS catalog.
*/
Schema getMSSchemaInfo(StudioMetaStoreDTO studioMetaStoreDTO);
/**
* Get a list of Flink columns based on the specified MS catalog.
*
* @param studioMetaStoreDTO A {@link StudioMetaStoreDTO} object representing the MS catalog to get the Flink columns for.
* @return A list of {@link FlinkColumn} objects representing the Flink columns for the specified MS catalog.
*/
List<FlinkColumn> getMSFlinkColumns(StudioMetaStoreDTO studioMetaStoreDTO);
List<Column> getMSFlinkColumns(StudioMetaStoreDTO studioMetaStoreDTO);
}
......@@ -27,14 +27,15 @@ import org.dinky.data.dto.StudioDDLDTO;
import org.dinky.data.dto.StudioMetaStoreDTO;
import org.dinky.data.model.Catalog;
import org.dinky.data.model.Cluster;
import org.dinky.data.model.Column;
import org.dinky.data.model.DataBase;
import org.dinky.data.model.FlinkColumn;
import org.dinky.data.model.Schema;
import org.dinky.data.model.Table;
import org.dinky.data.result.DDLResult;
import org.dinky.data.result.IResult;
import org.dinky.data.result.ResultPool;
import org.dinky.data.result.SelectResult;
import org.dinky.executor.CustomTableEnvironment;
import org.dinky.explainer.lineage.LineageBuilder;
import org.dinky.explainer.lineage.LineageResult;
import org.dinky.job.JobConfig;
......@@ -49,6 +50,7 @@ import org.dinky.service.DataBaseService;
import org.dinky.service.StudioService;
import org.dinky.service.TaskService;
import org.dinky.sql.FlinkQuery;
import org.dinky.utils.FlinkTableMetadataUtil;
import org.dinky.utils.RunTimeUtil;
import java.util.ArrayList;
......@@ -60,10 +62,14 @@ import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/** StudioServiceImpl */
/**
* StudioServiceImpl
*/
@Service
@RequiredArgsConstructor
@Slf4j
......@@ -72,6 +78,7 @@ public class StudioServiceImpl implements StudioService {
private final ClusterInstanceService clusterInstanceService;
private final DataBaseService dataBaseService;
private final TaskService taskService;
private final Cache<String, JobManager> jobManagerCache = CacheUtil.newTimedCache(1000 * 60 * 2);
private IResult executeMSFlinkSql(StudioMetaStoreDTO studioMetaStoreDTO) {
String envSql = taskService.buildEnvSql(studioMetaStoreDTO);
......@@ -153,116 +160,65 @@ public class StudioServiceImpl implements StudioService {
catalogs.add(defaultCatalog);
}
} else {
studioMetaStoreDTO.setStatement(FlinkQuery.showCatalogs());
IResult result = executeMSFlinkSql(studioMetaStoreDTO);
if (result instanceof DDLResult) {
DDLResult ddlResult = (DDLResult) result;
ddlResult.getColumns().stream().findFirst().ifPresent(key -> {
for (Map<String, Object> item : ddlResult.getRowData()) {
catalogs.add(Catalog.build(item.get(key).toString()));
}
});
for (Catalog catalog : catalogs) {
String statement = FlinkQuery.useCatalog(catalog.getName())
+ FlinkQuery.separator()
+ FlinkQuery.showDatabases();
studioMetaStoreDTO.setStatement(statement);
IResult tableResult = executeMSFlinkSql(studioMetaStoreDTO);
DDLResult tableDDLResult = (DDLResult) tableResult;
tableDDLResult.getColumns().stream().findFirst().ifPresent(key -> {
List<Map<String, Object>> rowData = tableDDLResult.getRowData();
List<Schema> schemas = new ArrayList<>();
for (Map<String, Object> item : rowData) {
schemas.add(Schema.build(item.get(key).toString()));
}
catalog.setSchemas(schemas);
});
}
}
String envSql = taskService.buildEnvSql(studioMetaStoreDTO);
JobManager jobManager = getJobManager(studioMetaStoreDTO, envSql);
CustomTableEnvironment customTableEnvironment =
jobManager.getExecutor().getCustomTableEnvironment();
catalogs.addAll(FlinkTableMetadataUtil.getCatalog(customTableEnvironment));
}
return catalogs;
}
@Override
public Schema getMSSchemaInfo(StudioMetaStoreDTO studioMetaStoreDTO) {
Schema schema = Schema.build(studioMetaStoreDTO.getDatabase());
String database = studioMetaStoreDTO.getDatabase();
Schema schema = Schema.build(database);
List<Table> tables = new ArrayList<>();
if (Dialect.isCommonSql(studioMetaStoreDTO.getDialect())) {
DataBase dataBase = dataBaseService.getById(studioMetaStoreDTO.getDatabaseId());
if (Asserts.isNotNull(dataBase)) {
Driver driver = Driver.build(dataBase.getDriverConfig());
tables.addAll(driver.listTables(studioMetaStoreDTO.getDatabase()));
tables.addAll(driver.listTables(database));
}
} else {
String baseStatement = FlinkQuery.useCatalog(studioMetaStoreDTO.getCatalog())
+ FlinkQuery.separator()
+ FlinkQuery.useDatabase(studioMetaStoreDTO.getDatabase())
+ FlinkQuery.separator();
// show tables
String tableStatement = baseStatement + FlinkQuery.showTables();
studioMetaStoreDTO.setStatement(tableStatement);
IResult result = executeMSFlinkSql(studioMetaStoreDTO);
if (result instanceof DDLResult) {
DDLResult ddlResult = (DDLResult) result;
ddlResult.getColumns().stream().findFirst().ifPresent(key -> {
List<Map<String, Object>> rowData = ddlResult.getRowData();
for (Map<String, Object> item : rowData) {
Table table = Table.build(item.get(key).toString(), studioMetaStoreDTO.getDatabase());
table.setCatalog(studioMetaStoreDTO.getCatalog());
tables.add(table);
}
});
}
// show views
schema.setViews(showInfo(studioMetaStoreDTO, baseStatement, FlinkQuery.showViews()));
// show functions
schema.setFunctions(showInfo(studioMetaStoreDTO, baseStatement, FlinkQuery.showFunctions()));
// show user functions
schema.setUserFunctions(showInfo(studioMetaStoreDTO, baseStatement, FlinkQuery.showUserFunctions()));
// show modules
schema.setModules(showInfo(studioMetaStoreDTO, baseStatement, FlinkQuery.showModules()));
String envSql = taskService.buildEnvSql(studioMetaStoreDTO);
JobManager jobManager = getJobManager(studioMetaStoreDTO, envSql);
CustomTableEnvironment customTableEnvironment =
jobManager.getExecutor().getCustomTableEnvironment();
FlinkTableMetadataUtil.setSchemaInfo(
customTableEnvironment, studioMetaStoreDTO.getCatalog(), database, schema, tables);
}
schema.setTables(tables);
return schema;
}
@Override
public List<FlinkColumn> getMSFlinkColumns(StudioMetaStoreDTO studioMetaStoreDTO) {
List<FlinkColumn> columns = new ArrayList<>();
public List<Column> getMSFlinkColumns(StudioMetaStoreDTO studioMetaStoreDTO) {
List<Column> columns = new ArrayList<>();
if (!Dialect.isCommonSql(studioMetaStoreDTO.getDialect())) {
String baseStatement = FlinkQuery.useCatalog(studioMetaStoreDTO.getCatalog())
+ FlinkQuery.separator()
+ FlinkQuery.useDatabase(studioMetaStoreDTO.getDatabase())
+ FlinkQuery.separator();
// desc tables
String tableStatement = baseStatement + FlinkQuery.descTable(studioMetaStoreDTO.getTable());
studioMetaStoreDTO.setStatement(tableStatement);
IResult result = executeMSFlinkSql(studioMetaStoreDTO);
if (result instanceof DDLResult) {
DDLResult ddlResult = (DDLResult) result;
List<Map<String, Object>> rowData = ddlResult.getRowData();
int i = 1;
for (Map<String, Object> item : rowData) {
FlinkColumn column = FlinkColumn.build(
i,
item.get(FlinkQuery.columnName()).toString(),
item.get(FlinkQuery.columnType()).toString(),
item.get(FlinkQuery.columnKey()).toString(),
item.get(FlinkQuery.columnNull()).toString(),
item.get(FlinkQuery.columnExtras()).toString(),
item.get(FlinkQuery.columnWatermark()).toString());
columns.add(column);
i++;
}
}
String catalogName = studioMetaStoreDTO.getCatalog();
String database = studioMetaStoreDTO.getDatabase();
String tableName = studioMetaStoreDTO.getTable();
String envSql = taskService.buildEnvSql(studioMetaStoreDTO);
JobManager jobManager = getJobManager(studioMetaStoreDTO, envSql);
CustomTableEnvironment customTableEnvironment =
jobManager.getExecutor().getCustomTableEnvironment();
columns.addAll(
FlinkTableMetadataUtil.getColumnList(customTableEnvironment, catalogName, database, tableName));
}
return columns;
}
private JobManager getJobManager(StudioMetaStoreDTO studioMetaStoreDTO, String envSql) {
JobManager jobManager = jobManagerCache.get(envSql, () -> {
JobConfig config = studioMetaStoreDTO.getJobConfig();
JobManager jobManagerTmp = JobManager.build(config);
jobManagerTmp.executeDDL(envSql);
return jobManagerTmp;
});
return jobManager;
}
private List<String> showInfo(StudioMetaStoreDTO studioMetaStoreDTO, String baseStatement, String statement) {
List<String> infos = new ArrayList<>();
studioMetaStoreDTO.setStatement(baseStatement + statement);
......
......@@ -1766,7 +1766,7 @@ INSERT INTO `dinky_sys_menu` VALUES (32, 1, '作业监控', '/home/jobOverView',
INSERT INTO `dinky_sys_menu` VALUES (33, 1, '数据开发', '/home/devOverView', 'DevOverView', 'home:devOverView', 'AimOutlined', 'F', 0, 3, '2023-08-15 16:54:47', '2023-09-26 14:49:00', null);
INSERT INTO `dinky_sys_menu` VALUES (34, 5, '项目列表', '/datastudio/left/project', null, 'datastudio:left:project', 'ConsoleSqlOutlined', 'F', 0, 5, '2023-09-01 18:00:39', '2023-09-26 14:49:31', null);
INSERT INTO `dinky_sys_menu` VALUES (35, 5, '元数据', '/datastudio/left/metadata', null, 'datastudio:left:metadata', 'TableOutlined', 'F', 0, 7, '2023-09-01 18:01:09', '2023-09-26 14:49:42', null);
INSERT INTO `dinky_sys_menu` VALUES (36, 5, '结构', '/datastudio/left/structure', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO `dinky_sys_menu` VALUES (36, 5, 'catalog', '/datastudio/left/catalog', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO `dinky_sys_menu` VALUES (37, 5, '作业配置', '/datastudio/right/jobConfig', null, 'datastudio:right:jobConfig', 'SettingOutlined', 'F', 0, 8, '2023-09-01 18:02:15', '2023-09-26 14:50:24', null);
INSERT INTO `dinky_sys_menu` VALUES (38, 5, '执行配置', '/datastudio/right/executeConfig', null, 'datastudio:right:executeConfig', 'ExperimentOutlined', 'F', 0, 9, '2023-09-01 18:03:08', '2023-09-26 14:50:54', null);
INSERT INTO `dinky_sys_menu` VALUES (39, 5, '版本历史', '/datastudio/right/historyVision', null, 'datastudio:right:historyVision', 'HistoryOutlined', 'F', 0, 10, '2023-09-01 18:03:29', '2023-09-26 14:51:03', null);
......
......@@ -27,8 +27,6 @@ public interface TableEnvironmentInstance {
TableEnvironment getTableEnvironment();
default void injectParser(CustomParser parser) {}
;
default void injectExtendedExecutor(CustomExtendedOperationExecutor extendedExecutor) {}
;
}
/*
*
* 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.
*
*/
package org.dinky.utils;
import org.dinky.data.enums.ColumnType;
import org.dinky.data.model.Catalog;
import org.dinky.data.model.Column;
import org.dinky.data.model.Schema;
import org.dinky.data.model.Table;
import org.dinky.executor.CustomTableEnvironment;
import org.apache.flink.table.catalog.ObjectIdentifier;
import org.apache.flink.table.types.logical.DecimalType;
import org.apache.flink.table.types.logical.LogicalType;
import org.apache.flink.table.types.logical.TimestampType;
import org.apache.flink.table.types.logical.VarCharType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class FlinkTableMetadataUtil {
public static List<Catalog> getCatalog(CustomTableEnvironment customTableEnvironment) {
List<Catalog> catalogs = new ArrayList<>();
for (String catalogName : customTableEnvironment.listCatalogs()) {
Catalog catalog = Catalog.build(catalogName);
List<Schema> schemas = new ArrayList<>();
customTableEnvironment.useCatalog(catalogName);
for (String database : customTableEnvironment.listDatabases()) {
Schema schema = Schema.build(database);
schemas.add(schema);
}
catalog.setSchemas(schemas);
catalogs.add(catalog);
}
return catalogs;
}
public static void setSchemaInfo(
CustomTableEnvironment customTableEnvironment,
String catalogName,
String database,
Schema schema,
List<Table> tables) {
customTableEnvironment.useCatalog(catalogName);
customTableEnvironment.useDatabase(database);
for (String tableName : customTableEnvironment.getCatalogManager().listTables(catalogName, database)) {
Table table = Table.build(tableName, catalogName);
tables.add(table);
}
schema.setTables(tables);
// show views
schema.setViews(Arrays.asList(customTableEnvironment.listViews()));
// show functions
schema.setFunctions(Arrays.asList(customTableEnvironment.listFunctions()));
// show user functions
schema.setUserFunctions(Arrays.asList(customTableEnvironment.listUserDefinedFunctions()));
// show modules
schema.setModules(Arrays.asList(customTableEnvironment.listModules()));
}
public static List<Column> getColumnList(
CustomTableEnvironment customTableEnvironment, String catalogName, String database, String tableName) {
List<Column> columns = new ArrayList<>();
customTableEnvironment
.getCatalogManager()
.getTable(ObjectIdentifier.of(catalogName, database, tableName))
.ifPresent(t -> {
for (int i = 0; i < t.getResolvedSchema().getColumns().size(); i++) {
org.apache.flink.table.catalog.Column flinkColumn =
t.getResolvedSchema().getColumns().get(i);
AtomicBoolean isPrimaryKey = new AtomicBoolean(false);
t.getResolvedSchema().getPrimaryKey().ifPresent(k -> {
isPrimaryKey.set(k.getColumns().contains(flinkColumn.getName()));
});
LogicalType logicalType = flinkColumn.getDataType().getLogicalType();
Column column = Column.builder()
.name(flinkColumn.getName())
.type(logicalType.getTypeRoot().name())
.keyFlag(isPrimaryKey.get())
.isNullable(logicalType.isNullable())
.position(i)
.build();
if (logicalType instanceof VarCharType) {
column.setLength(((VarCharType) logicalType).getLength());
} else if (logicalType instanceof TimestampType) {
column.setLength(((TimestampType) logicalType).getPrecision());
} else if (logicalType instanceof DecimalType) {
column.setLength(((DecimalType) logicalType).getPrecision());
column.setScale(((DecimalType) logicalType).getScale());
}
for (ColumnType columnType : ColumnType.values()) {
if (columnType
.getJavaType()
.equals(flinkColumn
.getDataType()
.getConversionClass()
.getName())) {
column.setJavaType(columnType);
break;
}
}
// FlinkColumn flinkColumn = FlinkColumn.build(i,
// column.getName(), column.getDataType().getConversionClass().getName(),
// isPrimaryKey.get(), column.getDataType().getLogicalType().isNullable(),
// column.explainExtras().orElse(""), "", column.getComment().orElse(""));
columns.add(column);
}
});
return columns;
}
}
......@@ -19,6 +19,8 @@
package org.dinky.data.enums;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* ColumnType
*
......@@ -63,6 +65,7 @@ public enum ColumnType {
this.flinkType = flinkType;
}
@JsonValue
public String getJavaType() {
return javaType;
}
......
......@@ -38,15 +38,23 @@ public class FlinkColumn implements Serializable {
private int position;
private String name;
private String type;
private String key;
private String nullable;
private Boolean key;
private Boolean nullable;
private String extras;
private String watermark;
private String comment;
public FlinkColumn() {}
public FlinkColumn(
int position, String name, String type, String key, String nullable, String extras, String watermark) {
int position,
String name,
String type,
boolean key,
boolean nullable,
String extras,
String watermark,
String comment) {
this.position = position;
this.name = name;
this.type = type;
......@@ -54,10 +62,18 @@ public class FlinkColumn implements Serializable {
this.nullable = nullable;
this.extras = extras;
this.watermark = watermark;
this.comment = comment;
}
public static FlinkColumn build(
int position, String name, String type, String key, String nullable, String extras, String watermark) {
return new FlinkColumn(position, name, type, key, nullable, extras, watermark);
int position,
String name,
String type,
boolean key,
boolean nullable,
String extras,
String watermark,
String comment) {
return new FlinkColumn(position, name, type, key, nullable, extras, watermark, comment);
}
}
......@@ -21,7 +21,7 @@
<parent>
<groupId>org.dinky</groupId>
<artifactId>dinky</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<artifactId>dinky-web</artifactId>
......@@ -31,6 +31,15 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<filtering>true</filtering>
<directory>/src/services/</directory>
<includes>
<include>constants.tsx</include>
</includes>
</resource>
</resources>
<plugins>
<!-- 调用npm命令插件 -->
<plugin>
......
......@@ -78,7 +78,7 @@ export default {
'menu.version': 'Version: {version}',
'menu.datastudio.project': 'Project',
'menu.datastudio.structure': 'Structure',
'menu.datastudio.catalog': 'Catalog',
'menu.datastudio.metadata': 'Metadata',
'menu.datastudio.console': 'Console',
'menu.datastudio.jobConfig': 'Job Config',
......
......@@ -78,7 +78,7 @@ export default {
'menu.version': '版本:{version}',
'menu.datastudio.project': '项目',
'menu.datastudio.structure': '结构',
'menu.datastudio.catalog': 'Catalog',
'menu.datastudio.metadata': '元数据',
'menu.datastudio.console': '控制台',
'menu.datastudio.jobConfig': '作业配置',
......
......@@ -390,6 +390,13 @@ export default {
'pages.datastudio.label.version.rollback.flinksql': '回滚Flink SQL版本',
'pages.datastudio.label.version.rollback.flinksqlConfirm':
'确定回滚Flink SQL版本至【{versionId}】吗?',
'pages.datastudio.catalog.flinkSqlEnvSelect':'请选择 FlinkSqlEnv',
'pages.datastudio.catalog.catalogSelect':'请选择 catalog & database',
'pages.datastudio.catalog.tableInfo':'表信息',
'pages.datastudio.catalog.fieldInformation':'字段信息',
'pages.datastudio.print.table.inputTableName': '请选择表名',
'pages.devops.jobinfo.localenv': '本地环境',
'pages.metadata.DataSearch': '数据查询',
......
import {DataNode} from "antd/es/tree";
import {DataSources} from "@/types/RegCenter/data";
export type StudioMetaStoreParam = {
statement?: string,
fragment?: boolean,
dialect?: string,
envId?: number,
databaseId?: number,
catalog?: string,
database?: string,
table?: string,
}
export type TableDataNode = {
isTable: boolean,
} & DataNode &DataSources.Table
\ No newline at end of file
This diff is collapsed.
import {postAll} from "@/services/api";
import {StudioMetaStoreParam} from "@/pages/DataStudio/LeftContainer/Catalog/data";
import {getDataByParams, getDataByParamsReturnResult, queryDataByParams} from "@/services/BusinessCrud";
export async function getMSSchemaInfo(params: StudioMetaStoreParam) {
return (await postAll('/api/studio/getMSSchemaInfo',params)).datas;
}
export async function getMSCatalogs(params: StudioMetaStoreParam) {
return (await postAll('/api/studio/getMSCatalogs',params)).datas;
}
export async function getMSFlinkColumns(params: StudioMetaStoreParam) {
return (await getDataByParamsReturnResult('/api/studio/getMSFlinkColumns',params)).datas;
}
\ No newline at end of file
......@@ -70,7 +70,7 @@ const JobModal: React.FC<JobModalProps> = (props) => {
};
useEffect(() => {
if (isUDF(jobType)) queryUdfTemplate();
isUDF(jobType) && queryUdfTemplate();
}, [jobType, form]);
/**
......@@ -102,7 +102,7 @@ const JobModal: React.FC<JobModalProps> = (props) => {
onSubmit({ ...values, ...formData } as Catalogue);
};
const RenderForm = () => {
const renderForm = () => {
return (
<>
<ProFormSelect
......@@ -110,7 +110,6 @@ const JobModal: React.FC<JobModalProps> = (props) => {
label={l('catalog.type')}
tooltip={l('catalog.type.tip')}
options={JOB_TYPE}
initialValue={JOB_TYPE[0]['options'][0]['value']}
disabled={!!values.id}
placeholder={l('catalog.type.placeholder')}
rules={[{ required: true, message: l('catalog.type.placeholder') }]}
......@@ -164,24 +163,26 @@ const JobModal: React.FC<JobModalProps> = (props) => {
};
return (
<ModalForm<Catalogue>
title={title}
form={form}
width={'30%'}
initialValues={{ ...values }}
open={modalVisible}
layout={'horizontal'}
autoFocusFirstInput
onValuesChange={onValuesChange}
modalProps={{
destroyOnClose: true,
maskClosable: false,
onCancel: handleCancel
}}
onFinish={async (values) => submitForm(values)}
>
{RenderForm()}
</ModalForm>
<>
<ModalForm<Catalogue>
title={title}
form={form}
width={'30%'}
initialValues={{ ...values }}
open={modalVisible}
layout={'horizontal'}
autoFocusFirstInput
onValuesChange={onValuesChange}
modalProps={{
destroyOnClose: true,
maskClosable: false,
onCancel: handleCancel
}}
onFinish={async (values) => submitForm(values)}
>
{renderForm()}
</ModalForm>
</>
);
};
......
......@@ -55,6 +55,7 @@ import {
} from '@ant-design/icons';
import { DiffEditor } from '@monaco-editor/react';
import { ReactNode } from 'react';
import {Catalog} from "@/pages/DataStudio/LeftContainer/Catalog";
export const LeftSide = [
{
......@@ -65,11 +66,11 @@ export const LeftSide = [
children: <Project />
},
{
auth: '/datastudio/left/structure',
key: 'menu.datastudio.structure',
auth: '/datastudio/left/catalog',
key: 'menu.datastudio.catalog',
icon: <TableOutlined />,
label: l('menu.datastudio.structure'),
children: <div>structure</div>
label: l('menu.datastudio.catalog'),
children: <Catalog />
},
{
auth: '/datastudio/left/metadata',
......@@ -252,6 +253,13 @@ export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
onClick: () => {}
}
],
'menu.datastudio.catalog': [
{
icon: <ReloadOutlined />,
title: l('button.refresh'),
onClick: () => {}
}
],
'menu.datastudio.project': [
{
icon: <PlusCircleOutlined />,
......
/*
* 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 { DataSources } from '@/types/RegCenter/data';
import { transformTreeData } from '@/utils/function';
import { l } from '@/utils/intl';
import { CheckSquareOutlined, KeyOutlined } from '@ant-design/icons';
import { ProTable } from '@ant-design/pro-components';
import { ProColumns } from '@ant-design/pro-table/es/typing';
import React from 'react';
type ColumnInfoProps = {
columnInfo: Partial<DataSources.Column[]>;
};
const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
const { columnInfo } = props;
const columns: ProColumns<DataSources.Column>[] = [
{
title: l('rc.ds.no'),
dataIndex: 'position',
width: '4%'
},
{
title: l('rc.ds.columnName'),
dataIndex: 'name',
width: '10%',
ellipsis: true
},
{
title: l('rc.ds.columnType'),
dataIndex: 'type',
width: '6%'
},
{
title: l('rc.ds.primarykey'),
dataIndex: 'keyFlag',
width: '4%',
render: (_, record) => {
return record.keyFlag ? <KeyOutlined style={{ color: '#FAA100' }} /> : undefined;
}
},
{
title: l('rc.ds.autoIncrement'),
dataIndex: 'autoIncrement',
width: '4%',
render: (_, record) => {
return record.autoIncrement ? (
<CheckSquareOutlined style={{ color: '#1296db' }} />
) : undefined;
}
},
{
title: l('rc.ds.isNull'),
dataIndex: 'nullable',
width: '4%',
render: (_, record) => {
return !record.nullable ? <CheckSquareOutlined style={{ color: '#1296db' }} /> : undefined;
}
},
{
title: l('rc.ds.default'),
dataIndex: 'defaultValue',
ellipsis: true,
width: '8%'
},
{
title: l('rc.ds.length'),
dataIndex: 'length',
width: '4%'
},
{
title: l('rc.ds.precision'),
dataIndex: 'precision',
width: '4%'
},
{
title: l('rc.ds.decimalDigits'),
dataIndex: 'scale',
ellipsis: true,
width: '6%'
},
{
title: l('rc.ds.character'),
dataIndex: 'characterSet',
width: '6%',
ellipsis: true
},
{
title: l('rc.ds.collationRule'),
dataIndex: 'collation',
width: '10%',
ellipsis: true
},
{
title: l('rc.ds.javaType'),
dataIndex: 'javaType',
ellipsis: true,
width: '8%'
},
{
title: l('rc.ds.comment'),
dataIndex: 'comment',
ellipsis: true
}
];
return (
<>
<ProTable<DataSources.Column>
toolBarRender={false}
pagination={{
defaultPageSize: 14,
hideOnSinglePage: true
}}
search={false}
options={false}
size={'small'}
bordered
columns={columns}
dataSource={transformTreeData(columnInfo) as DataSources.Column[]}
/>
</>
);
};
export default ColumnInfo;
......@@ -21,7 +21,7 @@ import { DataSources } from '@/types/RegCenter/data';
import { l } from '@/utils/intl';
import { Empty } from 'antd';
import React from 'react';
import ColumnInfo from './ColumnInfo/Index';
import ColumnInfo from "@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo";
type SchemaDescProps = {
tableInfo: Partial<DataSources.Table>;
......
......@@ -1184,7 +1184,7 @@ INSERT INTO `dinky_sys_menu` VALUES (32, 1, '作业监控', '/home/jobOverView',
INSERT INTO `dinky_sys_menu` VALUES (33, 1, '数据开发', '/home/devOverView', 'DevOverView', 'home:devOverView', 'AimOutlined', 'F', 0, 3, '2023-08-15 16:54:47', '2023-09-26 14:49:00', null);
INSERT INTO `dinky_sys_menu` VALUES (34, 5, '项目列表', '/datastudio/left/project', null, 'datastudio:left:project', 'ConsoleSqlOutlined', 'F', 0, 5, '2023-09-01 18:00:39', '2023-09-26 14:49:31', null);
INSERT INTO `dinky_sys_menu` VALUES (35, 5, '元数据', '/datastudio/left/metadata', null, 'datastudio:left:metadata', 'TableOutlined', 'F', 0, 7, '2023-09-01 18:01:09', '2023-09-26 14:49:42', null);
INSERT INTO `dinky_sys_menu` VALUES (36, 5, '结构', '/datastudio/left/structure', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO `dinky_sys_menu` VALUES (36, 5, 'catalog', '/datastudio/left/catalog', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO `dinky_sys_menu` VALUES (37, 5, '作业配置', '/datastudio/right/jobConfig', null, 'datastudio:right:jobConfig', 'SettingOutlined', 'F', 0, 8, '2023-09-01 18:02:15', '2023-09-26 14:50:24', null);
INSERT INTO `dinky_sys_menu` VALUES (38, 5, '执行配置', '/datastudio/right/executeConfig', null, 'datastudio:right:executeConfig', 'ExperimentOutlined', 'F', 0, 9, '2023-09-01 18:03:08', '2023-09-26 14:50:54', null);
INSERT INTO `dinky_sys_menu` VALUES (39, 5, '版本历史', '/datastudio/right/historyVision', null, 'datastudio:right:historyVision', 'HistoryOutlined', 'F', 0, 10, '2023-09-01 18:03:29', '2023-09-26 14:51:03', null);
......
......@@ -2228,7 +2228,7 @@ INSERT INTO "public"."dinky_sys_menu" VALUES (32, 1, '作业监控', '/home/job
INSERT INTO "public"."dinky_sys_menu" VALUES (33, 1, '数据开发', '/home/devOverView', 'DevOverView', 'home:devOverView', 'AimOutlined', 'F', 0, 3, '2023-08-15 16:54:47', '2023-09-26 14:49:00', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (34, 5, '项目列表', '/datastudio/left/project', null, 'datastudio:left:project', 'ConsoleSqlOutlined', 'F', 0, 5, '2023-09-01 18:00:39', '2023-09-26 14:49:31', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (35, 5, '元数据', '/datastudio/left/metadata', null, 'datastudio:left:metadata', 'TableOutlined', 'F', 0, 7, '2023-09-01 18:01:09', '2023-09-26 14:49:42', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (36, 5, '结构', '/datastudio/left/structure', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (36, 5, 'catalog', '/datastudio/left/catalog', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (37, 5, '作业配置', '/datastudio/right/jobConfig', null, 'datastudio:right:jobConfig', 'SettingOutlined', 'F', 0, 8, '2023-09-01 18:02:15', '2023-09-26 14:50:24', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (38, 5, '执行配置', '/datastudio/right/executeConfig', null, 'datastudio:right:executeConfig', 'ExperimentOutlined', 'F', 0, 9, '2023-09-01 18:03:08', '2023-09-26 14:50:54', null);
INSERT INTO "public"."dinky_sys_menu" VALUES (39, 5, '版本历史', '/datastudio/right/historyVision', null, 'datastudio:right:historyVision', 'HistoryOutlined', 'F', 0, 10, '2023-09-01 18:03:29', '2023-09-26 14:51:03', null);
......
......@@ -100,7 +100,7 @@ INSERT INTO `dinky_sys_menu` VALUES (32, 1, '作业监控', '/home/jobOverView',
INSERT INTO `dinky_sys_menu` VALUES (33, 1, '数据开发', '/home/devOverView', 'DevOverView', 'home:devOverView', 'AimOutlined', 'F', 0, 3, '2023-08-15 16:54:47', '2023-09-26 14:49:00', null);
INSERT INTO `dinky_sys_menu` VALUES (34, 5, '项目列表', '/datastudio/left/project', null, 'datastudio:left:project', 'ConsoleSqlOutlined', 'F', 0, 5, '2023-09-01 18:00:39', '2023-09-26 14:49:31', null);
INSERT INTO `dinky_sys_menu` VALUES (35, 5, '元数据', '/datastudio/left/metadata', null, 'datastudio:left:metadata', 'TableOutlined', 'F', 0, 7, '2023-09-01 18:01:09', '2023-09-26 14:49:42', null);
INSERT INTO `dinky_sys_menu` VALUES (36, 5, '结构', '/datastudio/left/structure', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO `dinky_sys_menu` VALUES (36, 5, 'catalog', '/datastudio/left/catalog', null, 'datastudio:left:structure', 'DatabaseOutlined', 'F', 0, 6, '2023-09-01 18:01:30', '2023-09-26 14:49:54', null);
INSERT INTO `dinky_sys_menu` VALUES (37, 5, '作业配置', '/datastudio/right/jobConfig', null, 'datastudio:right:jobConfig', 'SettingOutlined', 'F', 0, 8, '2023-09-01 18:02:15', '2023-09-26 14:50:24', null);
INSERT INTO `dinky_sys_menu` VALUES (38, 5, '执行配置', '/datastudio/right/executeConfig', null, 'datastudio:right:executeConfig', 'ExperimentOutlined', 'F', 0, 9, '2023-09-01 18:03:08', '2023-09-26 14:50:54', null);
INSERT INTO `dinky_sys_menu` VALUES (39, 5, '版本历史', '/datastudio/right/historyVision', null, 'datastudio:right:historyVision', 'HistoryOutlined', 'F', 0, 10, '2023-09-01 18:03:29', '2023-09-26 14:51:03', null);
......
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