refactor(web): 优化单表调度提交
This commit is contained in:
@@ -1,21 +1,18 @@
|
|||||||
package com.lanyuanxiaoyao.service.web.controller;
|
package com.lanyuanxiaoyao.service.web.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import com.dtflys.forest.annotation.Get;
|
|
||||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||||
import com.lanyuanxiaoyao.service.configuration.exception.TableNotFoundException;
|
import com.lanyuanxiaoyao.service.configuration.exception.TableNotFoundException;
|
||||||
import com.lanyuanxiaoyao.service.forest.service.InfoService;
|
import com.lanyuanxiaoyao.service.forest.service.InfoService;
|
||||||
import com.lanyuanxiaoyao.service.forest.service.ScheduleService;
|
import com.lanyuanxiaoyao.service.forest.service.ScheduleService;
|
||||||
|
import com.lanyuanxiaoyao.service.web.controller.base.AmisResponse;
|
||||||
import com.lanyuanxiaoyao.service.web.controller.base.BaseController;
|
import com.lanyuanxiaoyao.service.web.controller.base.BaseController;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调度
|
* 调度
|
||||||
@@ -38,7 +35,7 @@ public class ScheduleController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("table_batch")
|
@PostMapping("table_batch")
|
||||||
public void tableBatch(@RequestParam("lines") String lines) throws TableNotFoundException {
|
public AmisResponse<Object> tableBatch(@RequestParam("lines") String lines) throws TableNotFoundException {
|
||||||
Pattern p = Pattern.compile("^(\\d+)\\s*(\\S+)$");
|
Pattern p = Pattern.compile("^(\\d+)\\s*(\\S+)$");
|
||||||
ImmutableList<JobIdAndAlias> jobIdAndAliases = Lists.immutable.of(lines.trim().split("\n"))
|
ImmutableList<JobIdAndAlias> jobIdAndAliases = Lists.immutable.of(lines.trim().split("\n"))
|
||||||
.collect(line -> {
|
.collect(line -> {
|
||||||
@@ -50,14 +47,18 @@ public class ScheduleController extends BaseController {
|
|||||||
checkTableExists(infoService, jobIdAndAlias.getId(), jobIdAndAlias.getAlias());
|
checkTableExists(infoService, jobIdAndAlias.getId(), jobIdAndAlias.getAlias());
|
||||||
}
|
}
|
||||||
jobIdAndAliases.forEach(item -> scheduleService.scheduleTable(item.getId(), item.getAlias()));
|
jobIdAndAliases.forEach(item -> scheduleService.scheduleTable(item.getId(), item.getAlias()));
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("table")
|
@GetMapping("table")
|
||||||
public void table(
|
public AmisResponse<Object> table(
|
||||||
@RequestParam("flink_job_id") Long flinkJobId,
|
@RequestParam("flink_job_id") Long flinkJobId,
|
||||||
@RequestParam("alias") String alias
|
@RequestParam("alias") String alias,
|
||||||
|
@RequestParam(value = "force", required = false) String forceCluster,
|
||||||
|
@RequestParam(value = "recommend", required = false) String recommendCluster
|
||||||
) throws TableNotFoundException {
|
) throws TableNotFoundException {
|
||||||
checkTableExists(infoService, flinkJobId, alias);
|
// checkTableExists(infoService, flinkJobId, alias);
|
||||||
scheduleService.scheduleTable(flinkJobId, alias);
|
// scheduleService.scheduleTable(flinkJobId, alias);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1926,24 +1926,26 @@ function filterableField(mapping, multiple = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flinkJobIdTextInput() {
|
function flinkJobIdTextInput(require = false) {
|
||||||
return {
|
return {
|
||||||
type: 'input-text',
|
type: 'input-text',
|
||||||
name: 'flinkJobId',
|
name: 'flinkJobId',
|
||||||
label: 'Flink job id',
|
label: 'Flink job id',
|
||||||
placeholder: '通过 ID 搜索',
|
placeholder: '通过 ID 搜索',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
|
required: require,
|
||||||
autoComplete: '${base}/table/all_flink_job_id?key=$term',
|
autoComplete: '${base}/table/all_flink_job_id?key=$term',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function aliasTextInput() {
|
function aliasTextInput(require = false) {
|
||||||
return {
|
return {
|
||||||
type: 'input-text',
|
type: 'input-text',
|
||||||
name: 'alias',
|
name: 'alias',
|
||||||
label: '别名',
|
label: '别名',
|
||||||
placeholder: '通过别名搜索',
|
placeholder: '通过别名搜索',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
|
required: require,
|
||||||
autoComplete: '${base}/table/all_alias?key=$term',
|
autoComplete: '${base}/table/all_alias?key=$term',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,23 +88,28 @@ function toolTab() {
|
|||||||
type: 'form',
|
type: 'form',
|
||||||
title: '提交压缩任务',
|
title: '提交压缩任务',
|
||||||
api: {
|
api: {
|
||||||
method: 'post',
|
method: 'get',
|
||||||
// url: '${base}/schedule/table_batch',
|
url: '${base}/schedule/table',
|
||||||
dataType: 'form',
|
data: {
|
||||||
|
flink_job_id: '${flinkJobId|default:undefined}',
|
||||||
|
alias: '${alias|default:undefined}',
|
||||||
|
recommend: "${recommend === 'undefined' ? undefined : recommend|default:undefined}",
|
||||||
|
force: "${force === 'undefined' ? undefined : force|default:undefined}",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'group',
|
type: 'group',
|
||||||
body: [
|
body: [
|
||||||
flinkJobIdTextInput(),
|
flinkJobIdTextInput(true),
|
||||||
aliasTextInput(),
|
aliasTextInput(true),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'group',
|
type: 'group',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
name: 'xxxx',
|
name: 'recommend',
|
||||||
type: 'radios',
|
type: 'radios',
|
||||||
label: '优先指定集群',
|
label: '优先指定集群',
|
||||||
selectFirst: true,
|
selectFirst: true,
|
||||||
@@ -116,14 +121,13 @@ function toolTab() {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'xxx',
|
name: 'force',
|
||||||
type: 'radios',
|
type: 'radios',
|
||||||
label: '强制指定集群',
|
label: '强制指定集群',
|
||||||
selectFirst: true,
|
selectFirst: true,
|
||||||
options: [
|
options: [
|
||||||
{label: '无', value: 'undefined'},
|
{label: '无', value: 'undefined'},
|
||||||
{label: 'b1', value: 'b1'},
|
{label: 'b1', value: 'b1'},
|
||||||
{label: 'b1', value: 'b1'},
|
|
||||||
{label: 'b5', value: 'b5'},
|
{label: 'b5', value: 'b5'},
|
||||||
{label: 'a4', value: 'a4'},
|
{label: 'a4', value: 'a4'},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -91,8 +91,8 @@
|
|||||||
enableAMISDebug: debug,
|
enableAMISDebug: debug,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
console.log('Source', amisJSON)
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
console.log('Source', amisJSON)
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user