Skip to content

Commit

Permalink
feature: update dataservice config web
Browse files Browse the repository at this point in the history
  • Loading branch information
wangqi committed Feb 7, 2024
1 parent 90c07b7 commit 136cfbd
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class DataserviceConfigController {
@Logging
@GetMapping
@Operation(summary = "查询 config 列表", description = "查询 config 列表")
public ResponseEntity<ResponseVO<Page<DataserviceConfigDTO>>> get(@Valid DataserviceConfigListParam param) throws ParseException {
public ResponseEntity<Page<DataserviceConfigDTO>> get(@Valid DataserviceConfigListParam param) throws ParseException {
Page<DataserviceConfigDTO> result = dataserviceConfigService.list(param);
return new ResponseEntity<>(ResponseVO.success(result), HttpStatus.OK);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import cn.sliew.scaleph.common.dict.catalog.CatalogFunctionLanguage;
import cn.sliew.scaleph.common.dict.catalog.CatalogTableKind;
import cn.sliew.scaleph.common.dict.common.*;
import cn.sliew.scaleph.common.dict.dataservice.HttpMethod;
import cn.sliew.scaleph.common.dict.dataservice.QueryType;
import cn.sliew.scaleph.common.dict.ds.RedisMode;
import cn.sliew.scaleph.common.dict.flink.*;
import cn.sliew.scaleph.common.dict.flink.kubernetes.*;
Expand Down Expand Up @@ -116,6 +118,9 @@ public enum DictType implements DictDefinition {
SCHEDULE_STATUS("schedule_status", "Schedule Status", ScheduleStatus.class),

REDIS_MODE("redis_mode", "Redis Mode", RedisMode.class),

HTTP_METHOD("http_method", "Http Method", HttpMethod.class),
QUERY_TYPE("query_type", "Query Type", QueryType.class),
;

@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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 cn.sliew.scaleph.common.dict.dataservice;

import cn.sliew.scaleph.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum HttpMethod implements DictInstance {

GET("GET", "GET"),
POST("POST", "POST"),
;

@JsonCreator
public static HttpMethod of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(HttpMethod.class, value));
}

@EnumValue
private String value;
private String label;

HttpMethod(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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 cn.sliew.scaleph.common.dict.dataservice;

import cn.sliew.scaleph.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum QueryType implements DictInstance {

SELECT("SELECT", "SELECT"),
UPSERT("UPSERT", "UPSERT"),
INSERT("INSERT", "INSERT"),
UPDATE("UPDATE", "UPDATE"),
DELETE("DELETE", "DELETE"),
;

@JsonCreator
public static QueryType of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(QueryType.class, value));
}

@EnumValue
private String value;
private String label;

QueryType(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public class DataserviceConfig extends BaseDO {
@TableField(exist = false)
private DataserviceResultMap resultMap;

@TableField("`type`")
private String type;

@TableField("query")
private String query;

@TableField("remark")
private String remark;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<result column="status" property="status"/>
<result column="parameter_map_id" property="parameterMapId"/>
<result column="result_map_id" property="resultMapId"/>
<result column="type" property="type"/>
<result column="query" property="query"/>
<result column="remark" property="remark"/>
<association column="parameter_map_id" property="parameterMap"
select="cn.sliew.scaleph.dao.mapper.master.dataservice.DataserviceParameterMapMapper.selectById"/>
Expand All @@ -64,8 +66,8 @@
create_time,
editor,
update_time,
project_id, `name`, path, method, content_type, `status`,
parameter_map_id, result_map_id, remark
project_id, `name`, `path`, `method`, content_type, `status`,
parameter_map_id, result_map_id, `type`, query, remark
</sql>

<select id="getById" resultMap="DataserviceConfigMap">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
package cn.sliew.scaleph.dataservice.service;

import cn.sliew.scaleph.dataservice.service.dto.DataserviceConfigDTO;
import cn.sliew.scaleph.dataservice.service.param.DataserviceConfigAddParam;
import cn.sliew.scaleph.dataservice.service.param.DataserviceConfigListParam;
import cn.sliew.scaleph.dataservice.service.param.DataserviceConfigSaveParam;
import cn.sliew.scaleph.dataservice.service.param.DataserviceConfigUpdateParam;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public class DataserviceConfigDTO extends BaseDTO {
@Schema(description = "result map")
private DataserviceResultMapDTO resultMap;

@Schema(description = "type")
private String type;

@Schema(description = "query")
private String query;

@Schema(description = "备注")
private String remark;

Expand Down

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions scaleph-ui-react2/src/locales/zh-CN/pages/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ export default {
'pages.project.dataservice.config.steps.config.sql': 'SQL',
'pages.project.dataservice.config.steps.config.sql.type': '类型',
'pages.project.dataservice.config.steps.config.sql.query': '语句',
'pages.project.dataservice.config.detail': '配置详情',

'Run': '运行',
'Save': '保存',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ const DataServiceConfigWeb: React.FC = () => {
</Tooltip>
)}
{access.canAccess(PRIVILEGE_CODE.datadevJobEdit) && (
<Tooltip title={intl.formatMessage({id: 'pages.project.doris.template.detail'})}>
<Tooltip title={intl.formatMessage({id: 'pages.project.dataservice.config.detail'})}>
<Button
shape="default"
type="link"
icon={<NodeIndexOutlined/>}
onClick={() => {
history.push("/workspace/doris/template/detail", record)
// history.push("/workspace/doris/template/detail", record)
}}
/>
</Tooltip>
Expand Down
6 changes: 4 additions & 2 deletions tools/docker/mysql/init.d/scaleph-dataserivce-mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ create table dataservice_config
status varchar(4) not null comment 'status, disabled or enabled',
parameter_map_id bigint comment 'paramter map id',
result_map_id bigint comment 'result map id',
type varchar(8) comment 'query type',
query text comment 'query',
remark varchar(256) comment '备注',
creator varchar(32) comment '创建人',
create_time timestamp default current_timestamp comment '创建时间',
editor varchar(32) comment '修改人',
update_time timestamp default current_timestamp on update current_timestamp comment '修改时间',
primary key (id),
unique key uniq_name (project_id, name),
unique key uniq_path (project_id, path)
unique key uniq_name (project_id, `name`),
unique key uniq_path (project_id, `path`, `method`)
) engine = innodb comment = '数据服务 配置';

drop table if exists dataservice_parameter_map;
Expand Down

0 comments on commit 136cfbd

Please sign in to comment.