Skip to content

Commit ece3c41

Browse files
authored
feat: Registry config. (#541)
1 parent bc2d0c6 commit ece3c41

File tree

8 files changed

+853
-0
lines changed

8 files changed

+853
-0
lines changed

src/common/menu.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export const menuData = [
105105
path: "instance",
106106
locale: "SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE",
107107
},
108+
{
109+
name: getIntlContent("SHENYU.MENU.SYSTEM.MANAGMENT.REGISTRY"),
110+
path: "registry",
111+
locale: "SHENYU.MENU.SYSTEM.MANAGMENT.REGISTRY",
112+
},
108113
],
109114
},
110115
{

src/common/router.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ export const getRouterData = (app) => {
182182
() => import("../routes/System/Instance"),
183183
),
184184
},
185+
"/config/registry": {
186+
component: dynamicWrapper(
187+
app,
188+
["registry"],
189+
() => import("../routes/System/Registry"),
190+
),
191+
},
185192
"/config/namespacePlugin": {
186193
component: dynamicWrapper(
187194
app,

src/locales/en-US.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"SHENYU.MENU.SYSTEM.MANAGMENT.METADATA": "Metadata",
9595
"SHENYU.MENU.SYSTEM.MANAGMENT.DICTIONARY": "Dictionary",
9696
"SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE": "Instance",
97+
"SHENYU.MENU.SYSTEM.MANAGMENT.REGISTRY": "RegistryConfig",
9798
"SHENYU.MENU.SYSTEM.MANAGMENT.NAMESPACE": "Namespace",
9899
"SHENYU.MENU.CONFIG.MANAGMENT": "BasicConfig",
99100
"SHENYU.PLUGIN.SELECTOR.LIST.TITLE": "SelectorList",
@@ -368,6 +369,14 @@
368369
"SHENYU.INSTANCE.SELECT.TYPE": "Instance Type",
369370
"SHENYU.INSTANCE.SELECT.TYPE.BOOTSTRAP": "Bootstrap",
370371
"SHENYU.INSTANCE.SELECT.TYPE.CLIENT": "Client",
372+
"SHENYU.REGISTRY.NAMESPACE": "Namespace",
373+
"SHENYU.REGISTRY.REGISTRY_ID": "RegistryId",
374+
"SHENYU.REGISTRY.ADDRESS": "Address",
375+
"SHENYU.REGISTRY.PROTOCOL": "Protocol",
376+
"SHENYU.REGISTRY.USERNAME": "UserName",
377+
"SHENYU.REGISTRY.GROUP": "Group",
378+
"SHENYU.REGISTRY.MODAL.TITLE": "Add Registry Data",
379+
"SHENYU.REGISTRY.PASSPORT": "Passport",
371380
"SHENYU.PLUGIN.SELECT.STATUS": "Select Status",
372381
"SHENYU.PLUGIN.REQUEST.HEADER.KEY": "Header Key",
373382
"SHENYU.PLUGIN.REQUEST.HEADER.VALUE": "Header Value",

src/locales/zh-CN.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"SHENYU.MENU.SYSTEM.MANAGMENT.METADATA": "元数据管理",
9696
"SHENYU.MENU.SYSTEM.MANAGMENT.DICTIONARY": "字典管理",
9797
"SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE": "实例管理",
98+
"SHENYU.MENU.SYSTEM.MANAGMENT.REGISTRY":"注册中心管理",
9899
"SHENYU.MENU.CONFIG.MANAGMENT": "基础配置",
99100
"SHENYU.MENU.SYSTEM.MANAGMENT.NAMESPACE": "命名空间管理",
100101
"SHENYU.PLUGIN.SELECTOR.LIST.TITLE": "选择器列表",
@@ -372,6 +373,14 @@
372373
"SHENYU.INSTANCE.SELECT.TYPE": "实例类型",
373374
"SHENYU.INSTANCE.SELECT.TYPE.BOOTSTRAP": "网关实例",
374375
"SHENYU.INSTANCE.SELECT.TYPE.CLIENT": "客户端实例",
376+
"SHENYU.REGISTRY.MODAL.TITLE": "注册中心",
377+
"SHENYU.REGISTRY.REGISTRY_ID": "注册ID",
378+
"SHENYU.REGISTRY.ADDRESS": "注册地址",
379+
"SHENYU.REGISTRY.PROTOCOL": "协议类型",
380+
"SHENYU.REGISTRY.USERNAME": "用户名",
381+
"SHENYU.REGISTRY.NAMESPACE": "命名空间",
382+
"SHENYU.REGISTRY.GROUP": "分组",
383+
"SHENYU.REGISTRY.PASSPORT": "密码",
375384
"SHENYU.PLUGIN.SELECT.STATUS": "选择状态",
376385
"SHENYU.PLUGIN.REQUEST.HEADER.KEY": "Header Key",
377386
"SHENYU.PLUGIN.REQUEST.HEADER.VALUE": "Header Value",

src/models/registry.js

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { message } from "antd";
19+
import {
20+
getRegistryList,
21+
insertOrUpdateRegistry,
22+
getRegistryDetail,
23+
batchDeleteRegistry,
24+
} from "../services/api";
25+
import { getIntlContent } from "../utils/IntlUtils";
26+
27+
export default {
28+
namespace: "registry",
29+
30+
state: {
31+
registryList: [],
32+
total: 0,
33+
},
34+
35+
effects: {
36+
*fetch(params, { call, put }) {
37+
const { payload } = params;
38+
const json = yield call(getRegistryList, payload);
39+
if (json.code === 200) {
40+
let { dataList, page } = json.data;
41+
dataList = dataList.map((item) => {
42+
item.key = item.id;
43+
return item;
44+
});
45+
yield put({
46+
type: "saveRegistryList",
47+
payload: {
48+
total: page.totalCount,
49+
dataList,
50+
},
51+
});
52+
} else {
53+
message.destroy();
54+
message.error(json.message);
55+
}
56+
},
57+
58+
*add(params, { call, put }) {
59+
const { payload, callback, fetchValue } = params;
60+
const json = yield call(insertOrUpdateRegistry, payload);
61+
if (json.code === 200) {
62+
message.destroy();
63+
message.success(getIntlContent("SHENYU.COMMON.RESPONSE.ADD.SUCCESS"));
64+
callback();
65+
yield put({ type: "fetch", payload: fetchValue });
66+
} else {
67+
message.destroy();
68+
message.error(json.message);
69+
}
70+
},
71+
72+
*update(params, { call, put }) {
73+
const { payload, callback, fetchValue } = params;
74+
const json = yield call(insertOrUpdateRegistry, payload);
75+
if (json.code === 200) {
76+
message.destroy();
77+
message.success(
78+
getIntlContent("SHENYU.COMMON.RESPONSE.UPDATE.SUCCESS"),
79+
);
80+
callback();
81+
yield put({ type: "fetch", payload: fetchValue });
82+
} else {
83+
message.destroy();
84+
message.error(json.message);
85+
}
86+
},
87+
88+
*delete(params, { call, put }) {
89+
const { payload, fetchValue, callback } = params;
90+
const { list } = payload;
91+
const json = yield call(batchDeleteRegistry, { list });
92+
if (json.code === 200) {
93+
message.destroy();
94+
message.success(
95+
getIntlContent("SHENYU.COMMON.RESPONSE.DELETE.SUCCESS"),
96+
);
97+
callback();
98+
yield put({ type: "fetch", payload: fetchValue });
99+
} else {
100+
message.destroy();
101+
message.error(json.message);
102+
}
103+
},
104+
105+
*fetchItem(params, { call }) {
106+
const { payload, callback } = params;
107+
const json = yield call(getRegistryList, { id: payload.id });
108+
if (json.code === 200) {
109+
const registry = json.data.dataList[0];
110+
callback(registry);
111+
} else {
112+
message.destroy();
113+
message.error(json.message);
114+
}
115+
},
116+
*getDetail(params, { call }) {
117+
const { payload, callback } = params;
118+
const json = yield call(getRegistryDetail, payload);
119+
if (json.code === 200) {
120+
const registry = json.data;
121+
callback(registry);
122+
} else {
123+
message.destroy();
124+
message.error(json.message);
125+
}
126+
},
127+
},
128+
129+
reducers: {
130+
saveRegistryList(state, { payload }) {
131+
return {
132+
...state,
133+
registryList: payload.dataList,
134+
total: payload.total,
135+
};
136+
},
137+
},
138+
};

0 commit comments

Comments
 (0)