Skip to content

Commit

Permalink
[Improve] FE style minor improvement (#4020)
Browse files Browse the repository at this point in the history
* [Improve] FE style improvement
  • Loading branch information
wolfboys authored Sep 2, 2024
1 parent 5f4e145 commit 636db87
Show file tree
Hide file tree
Showing 44 changed files with 240 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.streampark.console.core.controller;

import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.domain.RestResponse;
import org.apache.streampark.console.base.exception.InternalException;
import org.apache.streampark.console.core.bean.ResponseResult;
Expand All @@ -26,15 +27,14 @@

import org.apache.shiro.authz.annotation.RequiresPermissions;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Validated
@RestController
Expand All @@ -46,8 +46,8 @@ public class FlinkClusterController {
@Autowired private ServiceHelper serviceHelper;

@PostMapping("list")
public RestResponse list() {
List<FlinkCluster> flinkClusters = flinkClusterService.listCluster();
public RestResponse list(FlinkCluster flinkCluster, RestRequest restRequest) {
IPage<FlinkCluster> flinkClusters = flinkClusterService.findPage(flinkCluster, restRequest);
return RestResponse.success(flinkClusters);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@

package org.apache.streampark.console.core.controller;

import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.domain.RestResponse;
import org.apache.streampark.console.base.exception.ApiDetailException;
import org.apache.streampark.console.core.entity.FlinkEnv;
import org.apache.streampark.console.core.service.FlinkEnvService;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Validated
@RestController
Expand All @@ -40,9 +40,9 @@ public class FlinkEnvController {
@Autowired private FlinkEnvService flinkEnvService;

@PostMapping("list")
public RestResponse list() {
List<FlinkEnv> list = flinkEnvService.list();
return RestResponse.success(list);
public RestResponse list(FlinkEnv flinkEnv, RestRequest restRequest) {
IPage<FlinkEnv> envs = flinkEnvService.findPage(flinkEnv, restRequest);
return RestResponse.success(envs);
}

@PostMapping("check")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

public interface FlinkClusterMapper extends BaseMapper<FlinkCluster> {

Boolean existsByClusterId(@Param("clusterId") String clusterId, @Param("id") Long id);

Boolean existsByClusterName(@Param("clusterName") String clusterName, @Param("id") Long id);

IPage<FlinkCluster> findPage(
Page<FlinkCluster> page, @Param("cluster") FlinkCluster flinkCluster);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
package org.apache.streampark.console.core.mapper;

import org.apache.streampark.console.core.entity.FlinkEnv;
import org.apache.streampark.console.core.entity.Project;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

public interface FlinkEnvMapper extends BaseMapper<FlinkEnv> {

FlinkEnv getByAppId(@Param("appId") Long appId);

void setDefault(@Param("id") Long id);

IPage<FlinkEnv> findPage(Page<Project> page, @Param("flinkEnv") FlinkEnv flinkEnv);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
package org.apache.streampark.console.core.service;

import org.apache.streampark.common.enums.ExecutionMode;
import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.core.bean.ResponseResult;
import org.apache.streampark.console.core.entity.FlinkCluster;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.Collection;
Expand Down Expand Up @@ -49,4 +51,6 @@ public interface FlinkClusterService extends IService<FlinkCluster> {
List<FlinkCluster> getByExecutionModes(Collection<ExecutionMode> executionModes);

List<FlinkCluster> listCluster();

IPage<FlinkCluster> findPage(FlinkCluster flinkCluster, RestRequest restRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

package org.apache.streampark.console.core.service;

import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.core.entity.FlinkEnv;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

import java.io.IOException;
Expand Down Expand Up @@ -93,4 +95,6 @@ public interface FlinkEnvService extends IService<FlinkEnv> {
void syncConf(Long id) throws IOException;

void validity(Long id);

IPage<FlinkEnv> findPage(FlinkEnv flinkEnv, RestRequest restRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import org.apache.streampark.common.util.ThreadUtils;
import org.apache.streampark.common.util.Utils;
import org.apache.streampark.common.util.YarnUtils;
import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.exception.ApiDetailException;
import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
import org.apache.streampark.console.core.bean.ResponseResult;
import org.apache.streampark.console.core.entity.FlinkCluster;
import org.apache.streampark.console.core.entity.FlinkEnv;
Expand All @@ -45,6 +47,8 @@
import org.apache.commons.lang3.exception.ExceptionUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.annotations.VisibleForTesting;
import io.fabric8.kubernetes.client.KubernetesClientException;
Expand Down Expand Up @@ -379,6 +383,12 @@ public List<FlinkCluster> listCluster() {
return clusters;
}

@Override
public IPage<FlinkCluster> findPage(FlinkCluster flinkCluster, RestRequest restRequest) {
Page<FlinkCluster> page = MybatisPager.getPage(restRequest);
return this.baseMapper.findPage(page, flinkCluster);
}

@Override
public void delete(Long id) {
FlinkCluster flinkCluster = getById(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@

package org.apache.streampark.console.core.service.impl;

import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
import org.apache.streampark.console.core.entity.FlinkEnv;
import org.apache.streampark.console.core.entity.Project;
import org.apache.streampark.console.core.mapper.FlinkEnvMapper;
import org.apache.streampark.console.core.service.ApplicationService;
import org.apache.streampark.console.core.service.FlinkClusterService;
import org.apache.streampark.console.core.service.FlinkEnvService;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -153,6 +158,12 @@ public void validity(Long id) {
checkOrElseAlert(flinkEnv);
}

@Override
public IPage<FlinkEnv> findPage(FlinkEnv flinkEnv, RestRequest restRequest) {
Page<Project> page = MybatisPager.getPage(restRequest);
return this.baseMapper.findPage(page, flinkEnv);
}

private void checkOrElseAlert(FlinkEnv flinkEnv) {

// 1.check exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,19 @@
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.apache.streampark.console.core.mapper.FlinkClusterMapper">
<resultMap id="BaseResultMap" type="org.apache.streampark.console.core.entity.FlinkCluster">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="cluster_id" jdbcType="VARCHAR" property="clusterId"/>
<result column="cluster_name" jdbcType="VARCHAR" property="clusterName"/>
<result column="options" jdbcType="LONGVARCHAR" property="options"/>
<result column="yarn_queue" jdbcType="VARCHAR" property="yarnQueue"/>
<result column="execution_mode" jdbcType="TINYINT" property="executionMode"/>
<result column="version_id" jdbcType="BIGINT" property="versionId"/>
<result column="k8s_namespace" jdbcType="VARCHAR" property="k8sNamespace"/>
<result column="service_account" jdbcType="VARCHAR" property="serviceAccount"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="flink_image" jdbcType="VARCHAR" property="flinkImage"/>
<result column="dynamic_properties" jdbcType="LONGVARCHAR" property="dynamicProperties"/>
<result column="k8s_rest_exposed_type" jdbcType="TINYINT" property="k8sRestExposedType"/>
<result column="k8s_hadoop_integration" jdbcType="BOOLEAN" property="k8sHadoopIntegration"/>
<result column="k8s_conf" jdbcType="VARCHAR" property="k8sConf"/>
<result column="resolve_order" jdbcType="INTEGER" property="resolveOrder"/>
<result column="exception" jdbcType="LONGVARCHAR" property="exception"/>
<result column="cluster_state" jdbcType="TINYINT" property="clusterState"/>
<result column="create_time" jdbcType="DATE" property="createTime"/>
</resultMap>
<select id="findPage" resultType="org.apache.streampark.console.core.entity.FlinkCluster">
select * from t_flink_cluster
<where>
<if test="cluster.clusterName != null and cluster.clusterName != ''">
<if test="_databaseId == 'mysql'">
and cluster_name like concat('%', #{cluster.clusterName},'%')
</if>
<if test="_databaseId == 'pgsql'">
and cluster_name like '%' || #{cluster.clusterName} || '%'
</if>
</if>
</where>
</select>

<select id="existsByClusterId" resultType="java.lang.Boolean" parameterType="java.lang.String">
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.apache.streampark.console.core.mapper.FlinkEnvMapper">
<resultMap id="BaseResultMap" type="org.apache.streampark.console.core.entity.FlinkEnv">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="flink_name" jdbcType="VARCHAR" property="flinkName"/>
<result column="flink_home" jdbcType="VARCHAR" property="flinkHome"/>
<result column="flink_conf" jdbcType="VARCHAR" property="flinkConf"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="version" jdbcType="VARCHAR" property="version"/>
<result column="scala_version" jdbcType="VARCHAR" property="scalaVersion"/>
<result column="is_default" jdbcType="BOOLEAN" property="isDefault"/>
<result column="create_time" jdbcType="DATE" property="createTime"/>
</resultMap>

<select id="findPage" resultType="org.apache.streampark.console.core.entity.FlinkEnv">
select * from t_flink_env
<where>
<if test="flinkEnv.flinkName != null and flinkEnv.flinkName != ''">
<if test="_databaseId == 'mysql'">
and flink_name like concat('%', #{flinkEnv.flinkName},'%')
</if>
<if test="_databaseId == 'pgsql'">
and flink_name like '%' || #{flinkEnv.flinkName} || '%'
</if>
</if>
</where>
</select>

<select id="getByAppId" resultType="org.apache.streampark.console.core.entity.FlinkEnv" parameterType="java.lang.Long">
select v.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { AxiosResponse } from 'axios';
import { FlinkCluster } from './types/flinkCluster.type';
import { Result } from '/#/axios';
import { defHttp } from '/@/utils/http/axios';
import { BasicTableParams } from '/@/api/model/baseModel';

enum FLINK_API {
LIST = '/flink/cluster/list',
Expand All @@ -34,9 +35,10 @@ enum FLINK_API {
* flink cluster
* @returns Promise<FlinkEnv[]>
*/
export function fetchFlinkCluster() {
export function fetchFlinkCluster(data: BasicTableParams) {
return defHttp.post<FlinkCluster[]>({
url: FLINK_API.LIST,
data,
});
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { AxiosResponse } from 'axios';
import { FlinkCreate, FlinkEnv } from './types/flinkEnv.type';
import { Result } from '/#/axios';
import { defHttp } from '/@/utils/http/axios';
import { BasicTableParams } from '/@/api/model/baseModel';

enum FLINK_API {
LIST = '/flink/env/list',
Expand All @@ -34,9 +35,10 @@ enum FLINK_API {
* flink environment data
* @returns Promise<FlinkEnv[]>
*/
export function fetchFlinkEnv() {
export function fetchFlinkEnv(data: BasicTableParams) {
return defHttp.post<FlinkEnv[]>({
url: FLINK_API.LIST,
data,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,11 @@
}
&-form-container {
// padding: 16px;
.ant-form {
padding: 12px 10px 6px;
margin-bottom: 16px;
padding: 20px 10px 0;
margin-bottom: 0;
background-color: @component-background;
border: none;
border-radius: 4px;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default {
add: 'Add',
success: ' successful',
fail: ' failed',
searchByCode: 'Search by var code',
searchByDesc: 'Search by description',
table: {
title: 'Variable List',
variableCode: 'Variable Code',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default {
start: 'Start Cluster',
edit: 'Edit Cluster',
delete: 'Are you sure delete this cluster ?',
searchByName: 'Search by cluster name',
form: {
clusterName: 'Cluster Name',
address: 'Cluster URL',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
flinkHome: 'Flink Home',
flinkHomePlaceholder: 'Please enter flink home',
flinkVersion: 'Flink Version',
searchByName: 'Search by flink name',
description: 'description',
descriptionPlaceholder: 'Please enter description',
operateMessage: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default {
fail: 'failed',
table: {
title: 'Member List',
userName: 'User',
roleName: 'Role',
userName: 'Search by username',
roleName: 'Search by role',
createTime: 'Create Time',
modifyTime: 'Modify Time',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
exist: 'Sorry, the role name already exists',
empty: 'Role name cannot be empty',
},
searchByRole: 'Search by role name',
roleInfo: 'Role Info',
tableTitle: 'Role List',
modifyTime: 'Not yet modified',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
add: 'Add',
success: 'successful',
fail: 'failed',
searchByTeam: 'Search by team name',
table: {
title: 'Team List',
teamName: 'Team',
Expand Down
Loading

0 comments on commit 636db87

Please sign in to comment.