Skip to content

Commit

Permalink
[ISSUE alibaba#12483] Configuration list adds configuration format (a…
Browse files Browse the repository at this point in the history
…libaba#12491)

* ✨Configuration type display and advanced search by type added to configuration list

* ✨Generate static files

* ✨Add license
  • Loading branch information
tonycody authored Aug 19, 2024
1 parent 9efee81 commit c2e5ee6
Show file tree
Hide file tree
Showing 20 changed files with 1,211 additions and 846 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed 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 com.alibaba.nacos.common.constant;

/**
* Symbols.
*
* @author haiqi.wang
* @date 2024/08/13
*/
public final class Symbols {

/**
* Comma.
*/
public static final String COMMA = ",";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed 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 com.alibaba.nacos.config.server.constant;

/**
* Parameters Field.
*
* @author haiqi.wang
* @date 2024/08/13
*/
public final class ParametersField {

/**
* Types.
*/
public static final String TYPES = "types";
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.alibaba.nacos.common.utils.Pair;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.config.server.constant.Constants;
import com.alibaba.nacos.config.server.constant.ParametersField;
import com.alibaba.nacos.config.server.controller.parameters.SameNamespaceCloneConfigBean;
import com.alibaba.nacos.config.server.model.ConfigAdvanceInfo;
import com.alibaba.nacos.config.server.model.ConfigAllInfo;
Expand Down Expand Up @@ -418,6 +419,7 @@ public Page<ConfigInfo> fuzzySearchConfig(@RequestParam("dataId") String dataId,
@RequestParam("group") String group, @RequestParam(value = "appName", required = false) String appName,
@RequestParam(value = "tenant", required = false, defaultValue = StringUtils.EMPTY) String tenant,
@RequestParam(value = "config_tags", required = false) String configTags,
@RequestParam(value = "types", required = false) String types,
@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
MetricsMonitor.getFuzzySearchMonitor().incrementAndGet();
Map<String, Object> configAdvanceInfo = new HashMap<>(50);
Expand All @@ -427,6 +429,9 @@ public Page<ConfigInfo> fuzzySearchConfig(@RequestParam("dataId") String dataId,
if (StringUtils.isNotBlank(configTags)) {
configAdvanceInfo.put("config_tags", configTags);
}
if (StringUtils.isNotBlank(types)) {
configAdvanceInfo.put(ParametersField.TYPES, types);
}
try {
return configInfoPersistService.findConfigInfoLike4Page(pageNo, pageSize, dataId, group, tenant,
configAdvanceInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.exception.runtime.NacosRuntimeException;
import com.alibaba.nacos.common.constant.Symbols;
import com.alibaba.nacos.common.notify.NotifyCenter;
import com.alibaba.nacos.common.utils.MD5Utils;
import com.alibaba.nacos.common.utils.Pair;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.config.server.constant.Constants;
import com.alibaba.nacos.config.server.constant.ParametersField;
import com.alibaba.nacos.config.server.enums.FileTypeEnum;
import com.alibaba.nacos.config.server.exception.NacosConfigException;
import com.alibaba.nacos.config.server.model.ConfigAdvanceInfo;
Expand Down Expand Up @@ -800,6 +802,7 @@ public Page<ConfigInfo> findConfigInfoLike4Page(final int pageNo, final int page
String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant;
final String appName = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("appName");
final String content = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("content");
final String types = Optional.ofNullable(configAdvanceInfo).map(e -> (String) e.get(ParametersField.TYPES)).orElse(null);
final String configTags = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("config_tags");
MapperResult sqlCountRows;
MapperResult sqlFetchRows;
Expand All @@ -819,6 +822,10 @@ public Page<ConfigInfo> findConfigInfoLike4Page(final int pageNo, final int page
if (!StringUtils.isBlank(content)) {
context.putWhereParameter(FieldConstant.CONTENT, generateLikeArgument(content));
}
if (StringUtils.isNotBlank(types)) {
String[] typesArr = types.split(Symbols.COMMA);
context.putWhereParameter(FieldConstant.TYPE, typesArr);
}

if (StringUtils.isNotBlank(configTags)) {
String[] tagArr = configTags.split(",");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
package com.alibaba.nacos.config.server.service.repository.extrnal;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.common.constant.Symbols;
import com.alibaba.nacos.common.utils.MD5Utils;
import com.alibaba.nacos.common.utils.Pair;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.config.server.constant.Constants;
import com.alibaba.nacos.config.server.constant.ParametersField;
import com.alibaba.nacos.config.server.enums.FileTypeEnum;
import com.alibaba.nacos.config.server.model.ConfigAdvanceInfo;
import com.alibaba.nacos.config.server.model.ConfigAllInfo;
Expand Down Expand Up @@ -77,6 +79,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

import static com.alibaba.nacos.config.server.service.repository.ConfigRowMapperInjector.CONFIG_ADVANCE_INFO_ROW_MAPPER;
import static com.alibaba.nacos.config.server.service.repository.ConfigRowMapperInjector.CONFIG_ALL_INFO_ROW_MAPPER;
Expand Down Expand Up @@ -836,6 +839,7 @@ public Page<ConfigInfo> findConfigInfoLike4Page(final int pageNo, final int page
String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant;
final String appName = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("appName");
final String content = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("content");
final String types = Optional.ofNullable(configAdvanceInfo).map(e -> (String) e.get(ParametersField.TYPES)).orElse(null);
final String configTags = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("config_tags");
PaginationHelper<ConfigInfo> helper = createPaginationHelper();
MapperResult sqlCountRows;
Expand All @@ -856,6 +860,10 @@ public Page<ConfigInfo> findConfigInfoLike4Page(final int pageNo, final int page
if (!StringUtils.isBlank(content)) {
context.putWhereParameter(FieldConstant.CONTENT, generateLikeArgument(content));
}
if (StringUtils.isNotBlank(types)) {
String[] typesArr = types.split(Symbols.COMMA);
context.putWhereParameter(FieldConstant.TYPE, typesArr);
}

if (StringUtils.isNotBlank(configTags)) {
String[] tagArr = configTags.split(",");
Expand Down
3 changes: 1 addition & 2 deletions console-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ yarn --registry=https://registry.npm.taobao.org

NodeJS提供了一些安装程序,都可以在[nodejs.org](https://nodejs.org/download/release/) 这里下载并安装。mac系统选择.pkg结尾的文件下载安装。
注意node版本号过高可能导致 `npm install` 时失败,建议版本:
- node:v8.16.0
- npm:6.4.1
- node:v14.20.1

## 安装依赖
```sh
Expand Down
4 changes: 2 additions & 2 deletions console-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@alifd/theme-design-pro": "0.x",
"@iarna/toml": "^3.0.0",
"axios": "^0.21.1",
"core-js": "^3.6.4",
"js-yaml": "^4.1.0",
"moment": "^2.23.0",
"prop-types": "^15.6.2",
Expand All @@ -81,7 +82,6 @@
"react-router-dom": "^5.1.2",
"react-router-redux": "^4.0.8",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"core-js": "^3.6.4"
"redux-thunk": "^2.3.0"
}
}
2 changes: 2 additions & 0 deletions console-ui/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ const I18N_CONF = {
app1: 'Enter App Name\n',
tags: 'Tags',
pleaseEnterTag: 'Enter Tag',
types: 'Type',
typeSelectedAlertContent: 'Please select the configuration type',
configDetailLabel: 'DetailSearch',
configDetailH: 'search config detail',
application: 'Application',
Expand Down
2 changes: 2 additions & 0 deletions console-ui/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ const I18N_CONF = {
app1: '请输入应用名',
tags: '标签',
pleaseEnterTag: '请输入标签',
types: '格式',
typeSelectedAlertContent: '请选择配置类型',
configDetailLabel: '配置项搜索',
configDetailH: '搜索具体配置项',
application: '归属应用',
Expand Down
Loading

0 comments on commit c2e5ee6

Please sign in to comment.