Skip to content

Commit

Permalink
Merge branch 'master' into dev4
Browse files Browse the repository at this point in the history
  • Loading branch information
luchunliang authored Aug 27, 2024
2 parents e618055 + 171eb76 commit b1b96df
Show file tree
Hide file tree
Showing 63 changed files with 2,944 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
@I18n('meta.Sources.Name')
sourceName: string;

@ColumnDecorator()
@I18n('meta.Sources.ClusterName')
readonly inlongClusterName: string;

@FieldDecorator({
type: 'select',
props: {
Expand Down
1 change: 1 addition & 0 deletions inlong-dashboard/src/ui/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"basic.SuccessfullyRestart": "重启成功",
"basic.SuccessfullyStop": "停止成功",
"meta.Sources.Name": "数据源名称",
"meta.Sources.ClusterName": "集群名",
"meta.Sources.NameRule": "只能包含英文字母、数字、点号(.)、中划线(-)、下划线(_)",
"meta.Sources.Type": "类型",
"meta.Sources.File.SerializationType": "文件类型",
Expand Down
1 change: 1 addition & 0 deletions inlong-dashboard/src/ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"basic.SuccessfullyRestart": "Successfully restart",
"basic.SuccessfullyStop": "Successfully stop",
"meta.Sources.Name": "Source name",
"meta.Sources.ClusterName": "Cluster Name",
"meta.Sources.NameRule": "Only English letters, numbers, dots(.), minus(-), and underscores(_)",
"meta.Sources.Type": "Type",
"meta.Sources.File.SerializationType": "File type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly }: Props, ref) => {
{
title: i18n.t('basic.Operating'),
dataIndex: 'action',
fixed: 'right',
width: 200,
render: (text, record) =>
readonly ? (
'-'
Expand All @@ -235,7 +237,7 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly }: Props, ref) => {
},
]);
}, [entityColumns, onDelete, onEdit, readonly]);

const scroll = { x: 850 };
return (
<>
<Card
Expand Down Expand Up @@ -330,6 +332,7 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly }: Props, ref) => {
pagination,
loading,
onChange,
scroll,
}}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useRequest, useUpdateEffect } from '@/ui/hooks';
import i18n from '@/i18n';
import { ColumnsType } from 'antd/es/table';
import dayjs from 'dayjs';
import { SortOrder } from 'antd/es/table/interface';

export interface Props extends ModalProps {
inlongGroupId: string;
Expand Down Expand Up @@ -87,18 +88,26 @@ const Comp: React.FC<Props> = ({ inlongGroupId, inlongStreamId, ...modalProps })
}
return;
};
const timestampSorter = (a, b) => {
const dateA = dayjs(a.dt, 'YYYY-MM-DD HH:mm:ss');
const dateB = dayjs(b.dt, 'YYYY-MM-DD HH:mm:ss');
return dateA.isBefore(dateB) ? -1 : dateA.isAfter(dateB) ? 1 : 0;
};
const sortOrder: SortOrder = 'descend';

const detailColumns: ColumnsType<DataType> = [
{
title: i18n.t('pages.GroupDetail.Stream.Dt'),
key: 'dt',
width: 200,
dataIndex: 'dt',
sorter: timestampSorter,
defaultSortOrder: sortOrder,
},
].concat(
(getColumn() ? getColumn() : []).concat([
{
title: 'operation',
title: i18n.t('basic.Operating'),
key: 'operation',
fixed: 'right',
width: 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class DataNodeType {
public static final String SQLSERVER = "SQLSERVER";
public static final String MONGODB = "MONGODB";
public static final String DORIS = "DORIS";
public static final String HTTP = "HTTP";
public static final String OCEANBASE = "OCEANBASE";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public class SinkType extends StreamType {
@SupportSortType(sortType = SortType.SORT_FLINK)
public static final String TUBEMQ = "TUBEMQ";

@SupportSortType(sortType = SortType.SORT_STANDALONE)
public static final String HTTP = "HTTP";

@SupportSortType(sortType = SortType.SORT_FLINK)
public static final String OCEANBASE = "OCEANBASE";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class ClusterType {
public static final String DATAPROXY = "DATAPROXY";
public static final String KAFKA = "KAFKA";

public static final String SORT_HTTP = "SORT_HTTP";
public static final String SORT_ES = "SORT_ES";
public static final String SORT_CLS = "SORT_CLS";
public static final String SORT_PULSAR = "SORT_PULSAR";
Expand All @@ -48,6 +49,7 @@ public class ClusterType {
add(ClusterType.PULSAR);
add(ClusterType.DATAPROXY);
add(ClusterType.KAFKA);
add(ClusterType.SORT_HTTP);
add(ClusterType.SORT_ES);
add(ClusterType.SORT_CLS);
add(ClusterType.SORT_PULSAR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class InlongClusterNodeEntity implements Serializable {
private String protocolType;
private Integer nodeLoad;
private String extParams;
private String operateLog;
private String description;

private Integer status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ List<InlongClusterNodeEntity> selectByParentId(@Param("parentId") Integer parent
*/
int updateStatus(@Param("id") Integer id, @Param("nextStatus") Integer nextStatus, @Param("status") Integer status);

int updateOperateLogById(@Param("id") Integer id, @Param("operateLog") String operateLog);

int deleteById(Integer id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<result column="protocol_type" jdbcType="VARCHAR" property="protocolType"/>
<result column="node_load" jdbcType="INTEGER" property="nodeLoad"/>
<result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/>
<result column="operate_log" jdbcType="LONGVARCHAR" property="operateLog"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
Expand All @@ -42,22 +43,23 @@
<result column="version" jdbcType="INTEGER" property="version"/>
</resultMap>
<sql id="Base_Column_List">
id, parent_id, type, ip, port, username, password, ssh_port, protocol_type, node_load, ext_params, description,
status, is_deleted, creator, modifier, create_time, modify_time, version
id, parent_id, type, ip, port, username, password, ssh_port, protocol_type, node_load, ext_params, operate_log, description, status, is_deleted, creator, modifier, create_time, modify_time, version
</sql>

<insert id="insert" useGeneratedKeys="true" keyProperty="id"
parameterType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity">
insert into inlong_cluster_node (id, parent_id, type,
ip, port, username,
password, ssh_port, protocol_type,
node_load, ext_params, description,
status, creator, modifier)
node_load, ext_params, operate_log,
description, status, creator,
modifier)
values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR},
#{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{sshPort,jdbcType=INTEGER}, #{protocolType,jdbcType=VARCHAR},
#{nodeLoad,jdbcType=INTEGER}, #{extParams,jdbcType=LONGVARCHAR}, #{description, jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR})
#{nodeLoad,jdbcType=INTEGER}, #{extParams,jdbcType=LONGVARCHAR}, #{operateLog,jdbcType=LONGVARCHAR},
#{description, jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR},
#{modifier,jdbcType=VARCHAR})
</insert>

<insert id="insertOnDuplicateKeyUpdate" useGeneratedKeys="true" keyProperty="id"
Expand Down Expand Up @@ -173,6 +175,7 @@
protocol_type = #{protocolType,jdbcType=VARCHAR},
node_load = #{nodeLoad,jdbcType=INTEGER},
ext_params = #{extParams,jdbcType=LONGVARCHAR},
operate_log = #{operateLog,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
is_deleted = #{isDeleted,jdbcType=INTEGER},
Expand Down Expand Up @@ -214,6 +217,9 @@
<if test="extParams != null">
ext_params = #{extParams,jdbcType=LONGVARCHAR},
</if>
<if test="operateLog != null">
operate_log = #{operateLog,jdbcType=LONGVARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
Expand Down Expand Up @@ -248,6 +254,12 @@
</if>
</where>
</update>
<update id="updateOperateLogById">
update inlong_cluster_node
set operate_log = #{operateLog,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
and is_deleted = 0
</update>
<delete id="deleteById" parameterType="java.lang.Integer">
delete
from inlong_cluster_node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public class ClusterNodeRequest {
@Length(min = 1, max = 163840, message = "length must be between 1 and 163840")
private String extParams;

@ApiModelProperty(value = "Operate log")
private String operateLog;

@ApiModelProperty(value = "Description of the cluster node")
@Length(max = 256, message = "length must be less than or equal to 256")
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public class ClusterNodeResponse {
@ApiModelProperty(value = "Extended params")
private String extParams;

@ApiModelProperty(value = "Operate log")
private String operateLog;

@ApiModelProperty(value = "Description of the cluster node")
private String description;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.apache.inlong.manager.pojo.cluster.sort.http;

import org.apache.inlong.manager.common.enums.ClusterType;
import org.apache.inlong.manager.common.util.JsonTypeDefine;
import org.apache.inlong.manager.pojo.sort.BaseSortClusterInfo;

import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonTypeDefine(value = ClusterType.SORT_HTTP)
@ApiModel("Inlong cluster info for Sort http")
public class SortHttpClusterInfo extends BaseSortClusterInfo {

public SortHttpClusterInfo() {
this.setType(ClusterType.SORT_HTTP);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.apache.inlong.manager.pojo.cluster.sort.http;

import org.apache.inlong.manager.common.enums.ClusterType;
import org.apache.inlong.manager.common.util.JsonTypeDefine;
import org.apache.inlong.manager.pojo.sort.BaseSortClusterRequest;

import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonTypeDefine(value = ClusterType.SORT_HTTP)
@ApiModel("Inlong cluster request for Sort http")
public class SortHttpClusterRequest extends BaseSortClusterRequest {

public SortHttpClusterRequest() {
this.setType(ClusterType.SORT_HTTP);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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.apache.inlong.manager.pojo.node.http;

import org.apache.inlong.manager.common.enums.ErrorCodeEnum;
import org.apache.inlong.manager.common.exceptions.BusinessException;
import org.apache.inlong.manager.common.util.CommonBeanUtils;
import org.apache.inlong.manager.common.util.JsonUtils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;

/**
* Http service data node info
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("Http service data node info")
public class HttpDataNodeDTO {

@ApiModelProperty("HTTP base url")
private String baseUrl;

@ApiModelProperty("Whether to enable credential")
private Boolean enableCredential;

@ApiModelProperty("Max connect count")
private Integer maxConnect;
/**
* Get the dto instance from the request
*/
public static HttpDataNodeDTO getFromRequest(HttpDataNodeRequest request, String extParams) {
HttpDataNodeDTO dto = StringUtils.isNotBlank(extParams)
? HttpDataNodeDTO.getFromJson(extParams)
: new HttpDataNodeDTO();
return CommonBeanUtils.copyProperties(request, dto, true);
}

/**
* Get the dto instance from the JSON string.
*/
public static HttpDataNodeDTO getFromJson(@NotNull String extParams) {
try {
return JsonUtils.parseObject(extParams, HttpDataNodeDTO.class);
} catch (Exception e) {
throw new BusinessException(ErrorCodeEnum.GROUP_INFO_INCORRECT,
String.format("Failed to parse extParams for Cloud log service node: %s", e.getMessage()));
}
}

}
Loading

0 comments on commit b1b96df

Please sign in to comment.