diff --git a/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/Item.java b/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/Item.java new file mode 100644 index 0000000..3182b11 --- /dev/null +++ b/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/entity/Item.java @@ -0,0 +1,45 @@ +package com.lanyuanxiaoyao.service.configuration.entity; + +/** + * 常见Item封装 + * + * @author lanyuanxiaoyao + * @date 2023-11-30 + */ +public class Item { + private final String label; + private final String value; + + public Item(String value) { + this(value, value); + } + + public Item(Number value) { + this(value, value); + } + + public Item(String label, String value) { + this.label = label; + this.value = value; + } + + public Item(Number label, Number value) { + this(label.toString(), value.toString()); + } + + public String getLabel() { + return label; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return "Item{" + + "label='" + label + '\'' + + ", value='" + value + '\'' + + '}'; + } +} diff --git a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java index c3b198e..81d78ac 100644 --- a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java +++ b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java @@ -115,6 +115,9 @@ public interface InfoService { @Get("/info/all_flink_job_id") ImmutableList allFlinkJobId(@Query("key") String key, @Query("alias") String alias); + @Get("/info/all_flink_job_id") + ImmutableList allFlinkJobIdByAlias(@Query("alias") String alias); + @Get("/info/all_alias") ImmutableList allAlias(); @@ -124,6 +127,9 @@ public interface InfoService { @Get("/info/all_alias") ImmutableList allAlias(@Query("key") String key, @Query("flink_job_id") String flinkJobId); + @Get("/info/all_alias") + ImmutableList allAliasByFlinkJobId(@Query("flink_job_id") String flinkJobId); + @Get("/info/all_hdfs") ImmutableList allHdfs(); diff --git a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/TableController.java b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/TableController.java index fe05512..6582112 100644 --- a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/TableController.java +++ b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/TableController.java @@ -8,9 +8,8 @@ import com.eshore.odcp.hudi.connector.entity.SyncState; import com.eshore.odcp.hudi.connector.entity.TableMeta; import com.eshore.odcp.hudi.connector.utils.NameHelper; import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; import com.lanyuanxiaoyao.service.configuration.ExecutorProvider; +import com.lanyuanxiaoyao.service.configuration.entity.Item; import com.lanyuanxiaoyao.service.configuration.entity.PageResponse; import com.lanyuanxiaoyao.service.configuration.entity.info.CompactionMetrics; import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias; @@ -24,9 +23,7 @@ import com.lanyuanxiaoyao.service.web.entity.CompactionMetricsVO; import com.lanyuanxiaoyao.service.web.entity.FlinkJobVO; import com.lanyuanxiaoyao.service.web.entity.SyncStateVO; import com.lanyuanxiaoyao.service.web.entity.TableVO; -import java.time.Duration; import java.util.List; -import java.util.Objects; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -197,42 +194,30 @@ public class TableController extends BaseController { @SuppressWarnings("DataFlowIssue") @GetMapping("all_flink_job_id") - public AmisCrudResponse allFlinkJobId( - @RequestParam(value = "key", required = false) String key, - @RequestParam(value = "alias", required = false) String alias - ) { - if (StrUtil.isBlank(key)) { - return AmisResponse.responseCrudData(Lists.immutable.empty()); - } + public AmisResponse> allFlinkJobId(@RequestParam(value = "alias", required = false) String alias) { if (StrUtil.isBlank(alias)) { - return AmisResponse.responseCrudData(infoService.allFlinkJobId(key).collect(Objects::toString)); + return AmisResponse.responseSuccess(infoService.allFlinkJobId().collect(Item::new)); } else { - return AmisResponse.responseCrudData(infoService.allFlinkJobId(key, alias).collect(Objects::toString)); + return AmisResponse.responseSuccess(infoService.allFlinkJobIdByAlias(alias).collect(Item::new)); } } @SuppressWarnings("DataFlowIssue") @GetMapping("all_alias") - public AmisCrudResponse allAlias( - @RequestParam(value = "key", required = false) String key, - @RequestParam(value = "flink_job_id", required = false) String flinkJobId - ) { - if (StrUtil.isBlank(key) && StrUtil.isBlank(flinkJobId)) { - return AmisResponse.responseCrudData(Lists.immutable.empty()); - } + public AmisResponse> allAlias(@RequestParam(value = "flink_job_id", required = false) String flinkJobId) { if (StrUtil.isBlank(flinkJobId)) { - return AmisResponse.responseCrudData(infoService.allAlias(key)); + return AmisResponse.responseSuccess(infoService.allAlias().collect(Item::new)); } else { - return AmisResponse.responseCrudData(infoService.allAlias(key, flinkJobId)); + return AmisResponse.responseSuccess(infoService.allAliasByFlinkJobId(flinkJobId).collect(Item::new)); } } @SuppressWarnings("DataFlowIssue") @GetMapping("all_hdfs") - public AmisCrudResponse allHdfs(@RequestParam(value = "key", required = false) String key) { + public AmisResponse> allHdfs(@RequestParam(value = "key", required = false) String key) { if (StrUtil.isBlank(key)) { - return AmisResponse.responseCrudData(Lists.immutable.empty()); + return AmisResponse.responseSuccess(infoService.allHdfs().collect(Item::new)); } - return AmisResponse.responseCrudData(infoService.allHdfs(key)); + return AmisResponse.responseSuccess(infoService.allHdfs(key).collect(Item::new)); } } diff --git a/test/test.http b/test/test.http index fbadde2..044d41b 100644 --- a/test/test.http +++ b/test/test.http @@ -65,3 +65,6 @@ GET {{url}}/hudi_services/hudi_api/api/message_id?flink_job_id=15420979841327063 ### GET http://132.122.116.149:35680/api/message_id?flink_job_id=1542097984132706304&alias=crm_cfguse_mkt_cam_strategy_rel + +### Deploy plan +GET {{web-url}}/cloud/deploy_plan diff --git a/web/components/common.js b/web/components/common.js index 32346b3..03c9968 100644 --- a/web/components/common.js +++ b/web/components/common.js @@ -1927,39 +1927,81 @@ function filterableField(mapping, multiple = false) { } } -function flinkJobIdTextInput(require = false) { +function formReloadFlinkJobIdTextInputAndAliasTextInput(id) { return { - type: 'input-text', + onEvent: { + change: { + actions: [ + { + actionType: 'reload', + componentId: `flink-job-id-input-select-${id}` + }, + { + actionType: 'reload', + componentId: `alias-input-select-${id}` + } + ] + } + } + } +} + +function flinkJobIdTextInput(id, require = false) { + return { + id: `flink-job-id-input-select-${id}`, + type: 'select', name: 'flinkJobId', label: 'Flink job id', placeholder: '通过 ID 搜索', clearable: true, required: require, - autoComplete: { + searchable: true, + source: { method: 'get', - url: '${base}/table/all_flink_job_id?key=$term', + url: '${base}/table/all_flink_job_id', data: { alias: '${alias|default:undefined}' } }, + /*onEvent: { + change: { + actions: [ + { + actionType: 'reload', + componentId: `alias-input-select-${id}`, + }, + ] + } + }*/ } } -function aliasTextInput(require = false) { +function aliasTextInput(id, require = false) { return { - type: 'input-text', + id: `alias-input-select-${id}`, + type: 'select', name: 'alias', label: '别名', placeholder: '通过别名搜索', clearable: true, required: require, - creatable: false, - autoComplete: { + searchable: true, + source: { method: 'get', - url: '${base}/table/all_alias?key=$term', + url: '${base}/table/all_alias', data: { flink_job_id: '${flinkJobId|default:undefined}' } }, + /*onEvent: { + change: { + actions: [ + { + actionType: 'reload', + componentId: `flink-job-id-input-select-${id}` + }, + ] + } + }*/ } } diff --git a/web/components/table-tab.js b/web/components/table-tab.js index 1b3e300..4332d42 100644 --- a/web/components/table-tab.js +++ b/web/components/table-tab.js @@ -28,17 +28,18 @@ function tableTab() { // interval: 10000, filter: { title: '表筛选', + ...formReloadFlinkJobIdTextInputAndAliasTextInput("58d0da94-1b3c-4234-948d-482ae3425e70"), body: [ { type: 'group', body: [ { - ...flinkJobIdTextInput(), - size: 'md', + ...flinkJobIdTextInput("58d0da94-1b3c-4234-948d-482ae3425e70"), + size: 'lg', }, { - ...aliasTextInput(), - size: 'md', + ...aliasTextInput("58d0da94-1b3c-4234-948d-482ae3425e70"), + size: 'lg', }, ] }, diff --git a/web/components/tool-tab.js b/web/components/tool-tab.js index 7cc70f4..804c158 100644 --- a/web/components/tool-tab.js +++ b/web/components/tool-tab.js @@ -97,12 +97,13 @@ function toolTab() { force: "${force === 'undefined' ? undefined : force|default:undefined}", } }, + ...formReloadFlinkJobIdTextInputAndAliasTextInput("0fe6a96c-6b6e-4346-b18e-c631c2389f48"), body: [ { type: 'group', body: [ - flinkJobIdTextInput(true), - aliasTextInput(true), + flinkJobIdTextInput("0fe6a96c-6b6e-4346-b18e-c631c2389f48", true), + aliasTextInput("0fe6a96c-6b6e-4346-b18e-c631c2389f48", true), ] }, { diff --git a/web/index.html b/web/index.html index 99fecb8..b724e5b 100644 --- a/web/index.html +++ b/web/index.html @@ -64,6 +64,7 @@ tabs: [ // logTab(), // runningTab(), + toolTab(), overviewTab(), tableTab(), queueTab(), @@ -72,11 +73,10 @@ yarnTab('b1,b5,a4', '压缩 b1 b5 a4', 'datalake,ten_iap.datalake', 'Compaction'), cloudTab(), yarnClusterTab(), - toolTab(), ] } } - let debug = false + let debug = true let server = amis.embed( '#root', amisJSON,