Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL #52

Merged
merged 30 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
11d1668
refactor: add dependency of console module and move controllers into …
Lambert-Rao Jan 21, 2024
f81c0dd
fix: add logback config, fix application-dev.yml and move `</dependen…
Lambert-Rao Jan 21, 2024
d9cf419
FirstCommit
zzxxiansheng Jan 28, 2024
6bd0009
Merge remote-tracking branch 'eventmesh/dev' into dev
zzxxiansheng Jan 29, 2024
df369e7
remerge
zzxxiansheng Feb 1, 2024
1b82aad
Merge remote-tracking branch 'origin/dev' into dev
zzxxiansheng Feb 1, 2024
3391325
first improve
zzxxiansheng Feb 1, 2024
c7da0b9
Merge remote-tracking branch 'origin/dev' into dev
zzxxiansheng Feb 1, 2024
0b17293
second improve
zzxxiansheng Feb 1, 2024
22b8528
third improve
zzxxiansheng Feb 1, 2024
edb4005
fourth improve
zzxxiansheng Feb 1, 2024
c030859
fourth improve
zzxxiansheng Feb 1, 2024
a6b5caa
fourth improve
zzxxiansheng Feb 1, 2024
92b2953
Update and rename EventmeshConsoleApplication.java to EventMeshDashbo…
zzxxiansheng Feb 5, 2024
6dcb360
rename this starter class file to EventMeshDashboardApplication
zzxxiansheng Feb 5, 2024
7f5bf0d
rename this starter class file to EventMeshDashboardApplication
zzxxiansheng Feb 5, 2024
7f2e85b
change some resource file
zzxxiansheng Feb 5, 2024
b9718ed
improve name
zzxxiansheng Feb 5, 2024
b4ab687
improve name
zzxxiansheng Feb 5, 2024
bff80be
Modify the fields of the synchronized log table
zzxxiansheng Feb 5, 2024
e5765d0
improve name
zzxxiansheng Feb 5, 2024
390dd05
improve name
zzxxiansheng Feb 5, 2024
befb6ee
Merge remote-tracking branch 'origin/dev' into dev
Mar 3, 2024
ca26ec5
config basic function and config ,runtime,store,cluster sql
Mar 6, 2024
ab82d06
try to resolve build error
Mar 6, 2024
506023b
Merge branch 'apache:dev' into dev
zzxxiansheng Mar 6, 2024
886c754
Some changes in the specification
Mar 7, 2024
e6081f6
something rename
Mar 8, 2024
8b0db55
one sql update
Mar 8, 2024
3e01c42
tag something to do
Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.eventmesh.dashboard.console.entity.cluster;

import java.sql.Timestamp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClusterEntity {

private Long id;

private String name;

private String registerNameList;

private String bootstrapServers;

private String eventmeshVersion;

private String clientProperties;

private String jmxProperties;

private String regProperties;

private String description;

private Integer authType;

private Integer runState;

private Timestamp createTime;

private Timestamp updateTime;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.eventmesh.dashboard.console.entity.config;

import java.sql.Timestamp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class ConfigEntity {

private Long id;

private Long clusterId;

private String businessType;

private Integer instanceType;

private Long instanceId;

private String configName;

private String configValue;

private String startVersion;

private String eventmeshVersion;

private Integer status;

private String endVersion;

private Integer diffType;

private String description;

private Integer edit;

private Timestamp createTime;

private Timestamp updateTime;

private Integer isDefault;

private Integer isModify;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.eventmesh.dashboard.console.entity.runtime;

import java.sql.Timestamp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RuntimeEntity {

private Long id;

private Long clusterId;

private String host;

private Long storageClusterId;

private Integer port;

private Integer jmxPort;

private Long startTimestamp;

private String rack;

private Integer status;

private Timestamp createTime;

private Timestamp updateTime;

private String endpointMap;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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.eventmesh.dashboard.console.entity.storage;


import java.sql.Timestamp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class StoreEntity {

private Long id;

private Long clusterId;

private Integer storeId;

private String storeType;

private String host;

private Long runtimeId;

private String topicList;

private Short diffType;

private Integer port;

private Integer jmxPort;

private String rack;

private Short status;

private Timestamp createTime;

private Timestamp updateTime;

private String endpointMap;

private Long startTimestamp;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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.eventmesh.dashboard.console.mapper.cluster;

import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* cluster table operation
*/
@Mapper
public interface ClusterMapper {

@Select("select * from cluster where is_delete=0")
List<ClusterEntity> selectAllCluster();

@Select("select * from cluster where id=#{id} and is_delete=0")
ClusterEntity selectClusterById(ClusterEntity cluster);

@Insert("insert into cluster (name, register_name_list, bootstrap_servers, eventmesh_version, client_properties, "
+ "jmx_properties, reg_properties, description, auth_type, run_state) values (#{name},#{registerNameList},"
+ "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType},#{runState})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addCluster(ClusterEntity cluster);

@Update("update cluster set name =#{name},reg_properties=#{regProperties},bootstrap_servers=#{bootstrapServers},"
+ "eventmesh_version=#{eventmeshVersion},client_properties=#{clientProperties},jmx_properties=#{jmxProperties},"
+ "reg_properties=#{regProperties},description=#{description},auth_type=#{authType},run_state=#{runState} ,"
+ "register_name_list=#{registerNameList} where id=#{id}")
void updateClusterById(ClusterEntity cluster);

@Delete("update cluster set is_delete=1 where id=#{id}")
void deleteClusterById(ClusterEntity clusterEntity);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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.eventmesh.dashboard.console.mapper.config;

import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* config table operation
*/
@Mapper
public interface ConfigMapper {

@Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name,"
+ " config_value, start_version,eventmesh_version, description, edit,end_version,is_default,is_modify) VALUE "
+ "(#{clusterId},#{businessType},#{instanceType},#{instanceId},#{configName},"
+ "#{configValue},#{startVersion},#{eventmeshVersion},#{description},#{edit},#{endVersion},#{isDefault},#{isModify})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Integer addConfig(ConfigEntity configEntity);

@Update("update config set status=2 where id=#{id}")
Integer deleteConfig(ConfigEntity configEntity);

@Update("update config set config_value=#{configValue} where status=1 and edit=2")
void updateConfig(ConfigEntity configEntity);

@Select("select * from config where business_type=#{businessType} and instance_type=#{instanceType} "
+ "and instance_id=#{instanceId}")
List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity);

@Select("select * from config where cluster_id=-1 and business_type=#{businessType} and instance_type=#{instanceType}")
List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity);


@Select("select * from config where cluster_id=#{clusterId} and instance_type=#{instanceType} "
+ "and instance_id=#{instanceId} and config_name=#{configName} and status=1")
ConfigEntity selectByUnique(ConfigEntity configEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;
Expand All @@ -38,7 +38,7 @@ public interface OprLogMapper {
" select * from operation_log",
" <where>",
" <if test='targetType!=null'>",
" target_type=#{targetType}",
" target_type=#{operationType}",
" </if>",
" <if test='operationUser!=null'>",
" and operation_user=#{operationUser}",
Expand All @@ -51,11 +51,11 @@ public interface OprLogMapper {
"</script>"})
List<LogEntity> getLogList(LogEntity logEntity);

@Insert("insert into operation_log ( cluster_id, operation_type,target_Type, description,operation_user,result_content)"
+ "VALUE (#{clusterId},#{operationType},#{targetType},#{description},#{operationUser},#{resultContent})")
@SelectKey(keyColumn = "id", statement = {" select last_insert_id()"}, keyProperty = "id", before = false, resultType = Long.class)
@Insert("insert into operation_log ( cluster_id, operation_type,target_Type, content,operation_user,result)"
+ "VALUE (#{clusterId},#{operationType},#{targetType},#{content},#{operationUser},#{result})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Long addLog(LogEntity logEntity);

@Update("update operation_log set status=#{status} ,result_content=#{resultContent} where id=#{id}")
@Update("update operation_log set status=#{status} ,result=#{resultContent} where id=#{id}")
Integer updateLog(LogEntity logEntity);
}
Loading
Loading