Skip to content

Commit c7a1d97

Browse files
authored
add instance info (#524)
* instance info * instance info
1 parent 3f114cf commit c7a1d97

File tree

7 files changed

+459
-0
lines changed

7 files changed

+459
-0
lines changed

src/common/menu.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ export const menuData = [
100100
path: "dict",
101101
locale: "SHENYU.MENU.SYSTEM.MANAGMENT.DICTIONARY",
102102
},
103+
{
104+
name: getIntlContent("SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE"),
105+
path: "instance",
106+
locale: "SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE",
107+
},
103108
],
104109
},
105110
{

src/common/router.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ export const getRouterData = (app) => {
168168
() => import("../routes/System/Plugin"),
169169
),
170170
},
171+
"/config/instance": {
172+
component: dynamicWrapper(
173+
app,
174+
["instance"],
175+
() => import("../routes/System/Instance"),
176+
),
177+
},
171178
"/config/namespacePlugin": {
172179
component: dynamicWrapper(
173180
app,

src/locales/en-US.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"SHENYU.MENU.SYSTEM.MANAGMENT.AUTHEN": "Authentication",
7878
"SHENYU.MENU.SYSTEM.MANAGMENT.METADATA": "Metadata",
7979
"SHENYU.MENU.SYSTEM.MANAGMENT.DICTIONARY": "Dictionary",
80+
"SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE": "Instance",
8081
"SHENYU.MENU.SYSTEM.MANAGMENT.NAMESPACE": "Namespace",
8182
"SHENYU.MENU.CONFIG.MANAGMENT": "BasicConfig",
8283
"SHENYU.PLUGIN.SELECTOR.LIST.TITLE": "SelectorList",
@@ -336,6 +337,12 @@
336337
"SHENYU.BUTTON.DATA.PERMISSION.CONFIG": "ConfigureDataPermission",
337338
"SHENYU.MESSAGE.SESSION.INVALID": "Session is invalid",
338339
"SHENYU.MESSAGE.SESSION.RELOGIN": "Please login in again",
340+
"SHENYU.INSTANCE.IP": "Instance IP",
341+
"SHENYU.INSTANCE.PORT": "Instance Port",
342+
"SHENYU.INSTANCE.INFO": "Instance Info",
343+
"SHENYU.INSTANCE.SELECT.TYPE": "Instance Type",
344+
"SHENYU.INSTANCE.SELECT.TYPE.BOOTSTRAP": "Bootstrap",
345+
"SHENYU.INSTANCE.SELECT.TYPE.CLIENT": "Client",
339346
"SHENYU.PLUGIN.SELECT.STATUS": "Select Status",
340347
"SHENYU.PLUGIN.REQUEST.HEADER.KEY": "Header Key",
341348
"SHENYU.PLUGIN.REQUEST.HEADER.VALUE": "Header Value",

src/locales/zh-CN.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"SHENYU.MENU.SYSTEM.MANAGMENT.AUTHEN": "认证管理",
7979
"SHENYU.MENU.SYSTEM.MANAGMENT.METADATA": "元数据管理",
8080
"SHENYU.MENU.SYSTEM.MANAGMENT.DICTIONARY": "字典管理",
81+
"SHENYU.MENU.SYSTEM.MANAGMENT.INSTANCE": "实例管理",
8182
"SHENYU.MENU.CONFIG.MANAGMENT": "基础配置",
8283
"SHENYU.MENU.SYSTEM.MANAGMENT.NAMESPACE": "命名空间管理",
8384
"SHENYU.PLUGIN.SELECTOR.LIST.TITLE": "选择器列表",
@@ -340,6 +341,12 @@
340341
"SHENYU.BUTTON.DATA.PERMISSION.CONFIG": "配置数据权限",
341342
"SHENYU.MESSAGE.SESSION.INVALID": "会话超时",
342343
"SHENYU.MESSAGE.SESSION.RELOGIN": "会话超时,请重新登录",
344+
"SHENYU.INSTANCE.IP": "实例IP",
345+
"SHENYU.INSTANCE.PORT": "实例端口",
346+
"SHENYU.INSTANCE.INFO": "实例信息",
347+
"SHENYU.INSTANCE.SELECT.TYPE": "实例类型",
348+
"SHENYU.INSTANCE.SELECT.TYPE.BOOTSTRAP": "网关实例",
349+
"SHENYU.INSTANCE.SELECT.TYPE.CLIENT": "客户端实例",
343350
"SHENYU.PLUGIN.SELECT.STATUS": "选择状态",
344351
"SHENYU.PLUGIN.REQUEST.HEADER.KEY": "Header Key",
345352
"SHENYU.PLUGIN.REQUEST.HEADER.VALUE": "Header Value",

src/models/instance.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 { getInstancesByNamespace, findInstance } from "../services/api";
19+
20+
export default {
21+
namespace: "instance",
22+
23+
state: {
24+
instanceList: [],
25+
total: 0,
26+
},
27+
28+
effects: {
29+
*fetch(params, { call, put }) {
30+
const { payload } = params;
31+
const json = yield call(getInstancesByNamespace, payload);
32+
if (json.code === 200) {
33+
let { page, dataList } = json.data;
34+
dataList = dataList.map((item) => {
35+
item.key = item.id;
36+
return item;
37+
});
38+
yield put({
39+
type: "saveInstances",
40+
payload: {
41+
total: page.totalCount,
42+
dataList,
43+
},
44+
});
45+
}
46+
},
47+
*fetchItem(params, { call }) {
48+
const { payload, callback } = params;
49+
const json = yield call(findInstance, payload);
50+
if (json.code === 200) {
51+
const instance = json.data;
52+
callback(instance);
53+
}
54+
},
55+
*reload(params, { put }) {
56+
const { fetchValue } = params;
57+
const { name, currentPage, instanceType, instanceIp, pageSize } =
58+
fetchValue;
59+
const payload = {
60+
name,
61+
instanceType,
62+
instanceIp,
63+
currentPage,
64+
pageSize,
65+
};
66+
yield put({ type: "fetch", payload });
67+
},
68+
},
69+
70+
reducers: {
71+
saveInstances(state, { payload }) {
72+
return {
73+
...state,
74+
instanceList: payload.dataList,
75+
total: payload.total,
76+
};
77+
},
78+
},
79+
};

0 commit comments

Comments
 (0)