diff --git a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/ScheduleController.java b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/ScheduleController.java index 038299e..61e20a1 100644 --- a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/ScheduleController.java +++ b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/ScheduleController.java @@ -1,21 +1,18 @@ package com.lanyuanxiaoyao.service.web.controller; 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.exception.TableNotFoundException; import com.lanyuanxiaoyao.service.forest.service.InfoService; import com.lanyuanxiaoyao.service.forest.service.ScheduleService; +import com.lanyuanxiaoyao.service.web.controller.base.AmisResponse; import com.lanyuanxiaoyao.service.web.controller.base.BaseController; import java.util.regex.Pattern; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.ImmutableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 调度 @@ -38,7 +35,7 @@ public class ScheduleController extends BaseController { } @PostMapping("table_batch") - public void tableBatch(@RequestParam("lines") String lines) throws TableNotFoundException { + public AmisResponse tableBatch(@RequestParam("lines") String lines) throws TableNotFoundException { Pattern p = Pattern.compile("^(\\d+)\\s*(\\S+)$"); ImmutableList jobIdAndAliases = Lists.immutable.of(lines.trim().split("\n")) .collect(line -> { @@ -50,14 +47,18 @@ public class ScheduleController extends BaseController { checkTableExists(infoService, jobIdAndAlias.getId(), jobIdAndAlias.getAlias()); } jobIdAndAliases.forEach(item -> scheduleService.scheduleTable(item.getId(), item.getAlias())); + return AmisResponse.responseSuccess(); } - @Get("table") - public void table( + @GetMapping("table") + public AmisResponse table( @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 { - checkTableExists(infoService, flinkJobId, alias); - scheduleService.scheduleTable(flinkJobId, alias); + // checkTableExists(infoService, flinkJobId, alias); + // scheduleService.scheduleTable(flinkJobId, alias); + return AmisResponse.responseSuccess(); } } diff --git a/web/components/common.js b/web/components/common.js index 9c9e902..8c53d75 100644 --- a/web/components/common.js +++ b/web/components/common.js @@ -1926,24 +1926,26 @@ function filterableField(mapping, multiple = false) { } } -function flinkJobIdTextInput() { +function flinkJobIdTextInput(require = false) { return { type: 'input-text', name: 'flinkJobId', label: 'Flink job id', placeholder: '通过 ID 搜索', clearable: true, + required: require, autoComplete: '${base}/table/all_flink_job_id?key=$term', } } -function aliasTextInput() { +function aliasTextInput(require = false) { return { type: 'input-text', name: 'alias', label: '别名', placeholder: '通过别名搜索', clearable: true, + required: require, autoComplete: '${base}/table/all_alias?key=$term', } } diff --git a/web/components/tool-tab.js b/web/components/tool-tab.js index 16d892c..7cc4278 100644 --- a/web/components/tool-tab.js +++ b/web/components/tool-tab.js @@ -88,23 +88,28 @@ function toolTab() { type: 'form', title: '提交压缩任务', api: { - method: 'post', - // url: '${base}/schedule/table_batch', - dataType: 'form', + method: 'get', + url: '${base}/schedule/table', + 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: [ { type: 'group', body: [ - flinkJobIdTextInput(), - aliasTextInput(), + flinkJobIdTextInput(true), + aliasTextInput(true), ] }, { type: 'group', body: [ { - name: 'xxxx', + name: 'recommend', type: 'radios', label: '优先指定集群', selectFirst: true, @@ -116,14 +121,13 @@ function toolTab() { ] }, { - name: 'xxx', + name: 'force', type: 'radios', label: '强制指定集群', selectFirst: true, options: [ {label: '无', value: 'undefined'}, {label: 'b1', value: 'b1'}, - {label: 'b1', value: 'b1'}, {label: 'b5', value: 'b5'}, {label: 'a4', value: 'a4'}, ] diff --git a/web/index.html b/web/index.html index 3f18f5f..99fecb8 100644 --- a/web/index.html +++ b/web/index.html @@ -91,8 +91,8 @@ enableAMISDebug: debug, }, ); - console.log('Source', amisJSON) if (debug) { + console.log('Source', amisJSON) } })()