Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: optimization of json field format in the form #292

Merged
merged 14 commits into from
Jul 18, 2023
Merged
2 changes: 1 addition & 1 deletion src/components/GlobalHeader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class GlobalHeader extends PureComponent {
</div>
</div>
<Modal
width="35%"
width="40%"
title={getIntlContent("SHENYU.GLOBALHEADER.CHANGE.PASSWORD")}
visible={visible}
forceRender
Expand Down
14 changes: 10 additions & 4 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"SHENYU.COMMON.CLOSE": "Close",
"SHENYU.COMMON.OPERAT": "Operation",
"SHENYU.COMMON.CHANGE": "Modify",
"SHENYU.COMMON.DELETE": "Are You Sure Delete?",
"SHENYU.COMMON.DELETE": "Are You Sure to Delete?",
"SHENYU.COMMON.DELETE.NAME": "Delete",
"SHENYU.COMMON.SURE": "Sure",
"SHENYU.COMMON.CALCEL": "Cancel",
Expand All @@ -52,6 +52,7 @@
"SHENYU.COMMON.RESPONSE.UPDATE.SUCCESS": "Update Success",
"SHENYU.COMMON.RESPONSE.DELETE.SUCCESS": "Delete Success",
"SHENYU.COMMON.RESPONSE.SYNC.SUCCESS": "Sync Success",
"SHENYU.COMMON.RESPONSE.REFRESH.SUCCESS": "Refresh Success",
"SHENYU.COMMON.WARN.INPUT_SELECTOR": "Please add selector first",
"SHENYU.COMMON.WARN.INPUT_NUMBER": "Please enter number",
"SHENYU.COMMON.PLEASEINPUT": "Please enter ",
Expand Down Expand Up @@ -296,7 +297,7 @@
"SHENYU.PLUGIN.PARAM.PATH": "Parameter Path",
"SHENYU.PLUGIN.PARAM.VALUE": "Parameter Value",
"SHENYU.MENU.DOCUMENT": "Document",
"SHENYU.MENU.DOCUMENT.APIDOC": "API Doc",
"SHENYU.MENU.DOCUMENT.APIDOC": "API Document",
"SHENYU.DOCUMENT.APIDOC.SEARCH.PLACEHOLDER":
"Support interface address and document title",
"SHENYU.DOCUMENT.APIDOC.INFO.INTERFACE.ADDRESS": "Interface Address",
Expand Down Expand Up @@ -364,9 +365,11 @@
"SHENYU.DISCOVERY.CONFIGURATION.SERVERLIST.INPUT": "Please input the register server url(,)",
"SHENYU.DISCOVERY.CONFIGURATION.PROPS": "Props",
"SHENYU.DISCOVERY.CONFIGURATION.PROPS.INPUT": "Please input the discovery props",
"SHENYU.DISCOVERY.CONFIGURATION.DELETE": "Are you sure to delete the plugin-level discovery configuration?",
"SHENYU.DISCOVERY.CONFIGURATION.DELETE.ERROR": "Discovery config is empty, deletion failed",
"SHENYU.DISCOVERY.SELECTOR.NAME": "Name",
"SHENYU.DISCOVERY.SELECTOR.NAME.INPUT": "Please input the name of the selector",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT": "ForwardProt",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT": "ForwardPort",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT.INPUT": "Please input the ForwardPort",
"SHENYU.DISCOVERY.SELECTOR.PROPS": "Props",
"SHENYU.DISCOVERY.SELECTOR.PROPS.INPUT": "Please input the proxy selector props",
Expand All @@ -380,5 +383,8 @@
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DELETE": "Sure to delete?",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.OPERATION": "operation",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateCreated": "DateCreated",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateUpdated": "DateUpdated"
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateUpdated": "DateUpdated",
"SHENYU.DISCOVERY.SELECTOR.CONFIG.BASIC": "Basic Config",
"SHENYU.DISCOVERY.SELECTOR.CONFIG.DISCOVERY": "Discovery Config",
"SHENYU.COMMON.REFRESH": "Refresh"
}
18 changes: 12 additions & 6 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"SHENYU.COMMON.RESPONSE.UPDATE.SUCCESS": "修改成功",
"SHENYU.COMMON.RESPONSE.DELETE.SUCCESS": "删除成功",
"SHENYU.COMMON.RESPONSE.SYNC.SUCCESS": "同步成功",
"SHENYU.COMMON.RESPONSE.REFRESH.SUCCESS": "刷新成功",
"SHENYU.COMMON.WARN.INPUT_SELECTOR": "请先添加选择器",
"SHENYU.COMMON.WARN.INPUT_NUMBER": "请输入数字",
"SHENYU.COMMON.PLEASEINPUT": "请输入",
Expand Down Expand Up @@ -341,7 +342,7 @@
"SHENYU.DOCUMENT.APIDOC.DEBUG.MOCK.ADD.HEADER": "添加请求头参数",
"SHENYU.DOCUMENT.APIDOC.DEBUG.MOCK.ADD.QUERY": "添加查询参数",
"SHENYU.DOCUMENT.APIDOC.DEBUG.MOCK.ADDRESS.VALIDATE": "请求地址格式错误.",
"SHENYU.PLUGIN.SELECTOR.LIST.CONFIGURATION": "插件级别服务发现配置",
"SHENYU.PLUGIN.SELECTOR.LIST.CONFIGURATION": "服务发现配置",
"SHENYU.COMMON.RESPONSE.CONFIGURATION.SUCCESS": "配置成功",
"SHENYU.DISCOVERY.CONFIGURATION.TYPE": "类型",
"SHENYU.DISCOVERY.CONFIGURATION.TYPE.INPUT": "请选择服务发现类型",
Expand All @@ -351,21 +352,26 @@
"SHENYU.DISCOVERY.CONFIGURATION.SERVERLIST.INPUT": "请填写注册服务器URL,以逗号分隔",
"SHENYU.DISCOVERY.CONFIGURATION.PROPS": "服务发现属性",
"SHENYU.DISCOVERY.CONFIGURATION.PROPS.INPUT": "请填写服务发现的属性",
"SHENYU.DISCOVERY.CONFIGURATION.DELETE": "确定删除该插件级别服务发现配置吗?",
"SHENYU.DISCOVERY.CONFIGURATION.DELETE.ERROR": "服务发现配置为空,删除失败",
"SHENYU.DISCOVERY.SELECTOR.NAME": "名称",
"SHENYU.DISCOVERY.SELECTOR.NAME.INPUT": "请填写选择器的名称",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT": "转发端口",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT.INPUT": "请填写转发端口",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT": "代理端口",
"SHENYU.DISCOVERY.SELECTOR.FORWARDPORT.INPUT": "请填写代理端口",
"SHENYU.DISCOVERY.SELECTOR.PROPS": "选择器属性",
"SHENYU.DISCOVERY.SELECTOR.PROPS.INPUT": "请填写选择器的属性",
"SHENYU.DISCOVERY.SELECTOR.LISTENERNODE": "监听节点",
"SHENYU.DISCOVERY.SELECTOR.LISTENERNODE.INPUT": "请填写监听节点",
"SHENYU.DISCOVERY.SELECTOR.HANDLER": "处理器",
"SHENYU.DISCOVERY.SELECTOR.HANDLER.INPUT": "请填写处理器内容",
"SHENYU.DISCOVERY.SELECTOR.HANDLER": "转换处理",
"SHENYU.DISCOVERY.SELECTOR.HANDLER.INPUT": "请填写转换处理内容",
"SHENYU.DISCOVERY.SELECTOR.CONFIGURATION": "服务发现配置",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM": "服务下游列表",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.ADD": "添加下游服务",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DELETE": "确定删除吗",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.OPERATION": "操作",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateCreated": "创建时间",
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateUpdated": "更新时间"
"SHENYU.DISCOVERY.SELECTOR.UPSTREAM.DateUpdated": "更新时间",
"SHENYU.DISCOVERY.SELECTOR.CONFIG.BASIC": "基本配置",
"SHENYU.DISCOVERY.SELECTOR.CONFIG.DISCOVERY": "服务发现",
"SHENYU.COMMON.REFRESH": "刷新"
}
37 changes: 29 additions & 8 deletions src/models/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ import {message} from "antd";
import {
addProxySelector,
deleteProxySelector,
fetchProxySelector, getDiscoveryTypeEnums,
fetchProxySelector,
getDiscoveryTypeEnums,
postDiscoveryInsertOrUpdate,
updateProxySelector,
getDiscovery
getDiscovery,
refreshProxySelector,
deleteDiscovery

} from "../services/api";
import {getIntlContent} from "../utils/IntlUtils";
Expand All @@ -34,20 +37,17 @@ export default {
typeEnums: [],
selectorList: [],
chosenType: '',
total: 0,
totalPage: 0,
currentPage: 1,
pageSize: 4
},

effects: {
* fetchSelector(params, {call, put}) {
const {payload, callback} = params;
const {payload} = params;
const json = yield call(fetchProxySelector, payload);
if (json.code === 200) {
const {page, dataList} = json.data;
if (callback) {
callback(dataList, page.totalCount);
}
yield put({
type: "saveProxySelectors",
payload: {total: page.totalCount, dataList}
Expand Down Expand Up @@ -141,14 +141,35 @@ export default {
}
},

* refresh(params, {call}) {
const {payload} = params;
const json = yield call(refreshProxySelector, payload);
if (json.code === 200) {
message.success(getIntlContent('SHENYU.COMMON.RESPONSE.REFRESH.SUCCESS'));
// callback();
} else {
message.warn(json.message);
}
},

* deleteConfig(params, {call}) {
const {payload} = params;
const json = yield call(deleteDiscovery, payload);
if (json.code === 200) {
message.success(getIntlContent('SHENYU.COMMON.RESPONSE.DELETE.SUCCESS'));
} else {
message.warn(json.message);
}
},

},

reducers: {
saveProxySelectors(state, {payload}) {
return {
...state,
totalPage: payload.total,
selectorList: payload.dataList,
total: payload.total
};
},

Expand Down
3 changes: 1 addition & 2 deletions src/routes/Plugin/Common/Selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class AddModal extends Component {

this.state = {
selectValue,

gray,
serviceId,
divideUpstreams,
Expand Down Expand Up @@ -458,7 +457,7 @@ class AddModal extends Component {
})(<InputNumber style={{ width: "100%" }} />)}
</Item>
</Col>
</Row>
</Row>
</div>
<div style={{ width: 64, textAlign: "right" }}>
<Icon
Expand Down
Loading