Skip to content

Commit

Permalink
[CE-620]Add AgentList in Agent management
Browse files Browse the repository at this point in the history
In Agent management,can see Agent list.

Signed-off-by: fengyang_sy <[email protected]>
Change-Id: I4f913a8bff040eed69b968c2abe5b568c84c3f07
  • Loading branch information
fengyangsy committed Jul 2, 2019
1 parent 92bc663 commit a68a6f3
Show file tree
Hide file tree
Showing 16 changed files with 569 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dashboard/config/router.config.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default [
{
path: '/operator/agent',
name: 'agent',
component: './Operator/Agent',
component: './Operator/Agent/Agent',
},
{
path: '/operator/userManagement',
Expand Down
36 changes: 36 additions & 0 deletions src/dashboard/mock/agent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Mock from 'mockjs';
import faker from 'faker';
import { paginator } from './_utils';

const agents = Mock.mock({
'data|11': [{
id: function () {
return Mock.Random.guid()
},
name: function () {
return faker.company.companyName();
},
created_at: '@datetime',
worker_api: function () { return Mock.Random.ip() },
capacity: function () { return Math.ceil(Math.random()*10) },
node_capacity: function () { return Math.ceil(Math.random()*10) },
status: function () { return Mock.Random.pick(['inactive', 'active']) },
log_level: function () { return Mock.Random.pick(['info', 'debug']) },
type: function () { return Mock.Random.pick(['docker', 'kubernetes']) },
schedulable: function () { return Mock.Random.pick([true, false]) },
organization_id: function () { return Mock.Random.guid() },
}],
});

function getAgents(req, res) {
const { page = 1, per_page = 10 } = req.query;
const result = paginator(agents.data, parseInt(page), parseInt(per_page));
res.send({
total: result.total,
data: result.data,
});
}

export default {
'GET /api/agents': getAgents,
};
28 changes: 28 additions & 0 deletions src/dashboard/mock/organization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Mock from 'mockjs';
import faker from 'faker';
import { paginator } from './_utils';

const organizations = Mock.mock({
'data|11': [{
id: function () {
return Mock.Random.guid()
},
name: function () {
return faker.company.companyName();
},
created_at: '@datetime',
}],
});

function getOrgs(req, res) {
const { page = 1, per_page = 10 } = req.query;
const result = paginator(organizations.data, parseInt(page), parseInt(per_page));
res.send({
total: result.total,
data: result.data,
});
}

export default {
'GET /api/organizations': getOrgs,
};
2 changes: 1 addition & 1 deletion src/dashboard/package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
],
"dependencies": {
"@antv/data-set": "^0.10.1",
"antd": "^3.16.1",
"antd": "3.16.1",
"bizcharts": "3.5.2-beta.1",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"classnames": "^2.2.6",
Expand Down
2 changes: 2 additions & 0 deletions src/dashboard/src/locales/en-US.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import component from './en-US/component';
import operatorOrganization from './en-US/operatorOrganization';
import operatorUser from './en-US/operatorUser';
import form from './en-US/form';
import operatorAgent from './en-US/operatorAgent';

export default {
'navBar.lang': 'Languages',
Expand All @@ -27,6 +28,7 @@ export default {
...pwa,
...component,
...operatorOrganization,
...operatorAgent,
...operatorUser,
...form,
};
3 changes: 3 additions & 0 deletions src/dashboard/src/locales/en-US/form.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ export default {
'form.button.confirm': 'Confirm',
'form.button.cancel': 'Cancel',
'form.button.moreActions': 'More Actions',
'form.button.submit': 'Submit',
'form.button.add': 'Add',
'form.button.back': 'Back'
};
2 changes: 2 additions & 0 deletions src/dashboard/src/locales/en-US/menu.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export default {
'menu.operator': 'Operator',
'menu.operator.overview': 'Overview',
'menu.operator.agent': 'Agent',
'menu.operator.newAgent': 'New Agent',
'menu.operator.organization': 'Organization',
'menu.operator.userManagement': 'User Management',
'menu.operator.node': 'Node',
'menu.exception': 'Exception',
'menu.exception.not-permission': '403',
'menu.exception.not-find': '404',
Expand Down
53 changes: 53 additions & 0 deletions src/dashboard/src/locales/en-US/operatorAgent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export default {
'app.operator.agent.title': 'Agent Management',
'app.operator.agent.table.header.name': 'Name',
'app.operator.agent.table.header.createTime': 'Create Time',
'app.operator.agent.table.header.type': 'Type',
'app.operator.agent.form.new.title': 'New Agent',
'app.operator.agent.form.update.title': 'Update Agent',
'app.operator.agent.form.name.label': 'Agent Name',
'app.operator.agent.form.name.required': 'Please input organization name',
'app.operator.agent.create.success': 'Create agent {name} success',
'app.operator.agent.create.fail': 'Create agent {name} failed',
'app.operator.agent.update.success': 'Update agent {name} success',
'app.operator.agent.update.fail': 'Update agent {name} failed',
'app.operator.agent.form.delete.title': 'Delete Agent',
'app.operator.agent.form.delete.content': 'Confirm to delete agent {name}',
'app.operator.agent.delete.fail': 'Delete Agent {name} failed',
'app.operator.agent.delete.success': 'Delete Agent {name} success',
'app.operator.agent.listItem.organization': 'Organization',
'app.operator.agent.type': 'Type',
'app.operator.newAgent.error.workerApi': 'Please input validate worker api.',
'app.operator.newAgent.error.NFSServer': 'Please input validate NFS Server address.',
'app.operator.newAgent.title': 'Create Agent',
'app.operator.editAgent.title': 'Edit Agent',
'app.operator.newAgent.label.name': 'Name',
'app.operator.newAgent.required.name': 'Please input name.',
'app.operator.newAgent.label.daemonUrl': 'Daemon Url',
'app.operator.newAgent.required.daemonUrl': 'Please input daemon url.',
'app.operator.newAgent.label.type': 'Type',
'app.operator.newAgent.required.type': 'Please select a type.',
'app.operator.newAgent.label.credentialType': 'Credential Type',
'app.operator.newAgent.required.credentialType': 'Please select a credential type.',
'app.operator.newAgent.label.certificateContent': 'Certificate Content',
'app.operator.newAgent.required.certificateContent': 'Please input certificate content.',
'app.operator.newAgent.label.certificateKey': 'Certificate Key',
'app.operator.newAgent.required.certificateKey': 'Please input certificate key.',
'app.operator.newAgent.label.configurationContent': 'Configuration Content',
'app.operator.newAgent.required.configurationContent': 'Please input configuration content.',
'app.operator.newAgent.label.username': 'Username',
'app.operator.newAgent.required.username': 'Please input username.',
'app.operator.newAgent.label.password': 'Password',
'app.operator.newAgent.required.password': 'Please input password.',
'app.operator.newAgent.label.extraParameters': 'Extra Parameters',
'app.operator.newAgent.label.useSSL': 'Use SSL Verification',
'app.operator.newAgent.label.SSLCa': 'SSL CA',
'app.operator.newAgent.required.SSLCa': 'Please input ssl ca cert.',
'app.operator.newAgent.label.logLevel': 'Log Level',
'app.operator.newAgent.required.logLevel': 'Please select a log level.',
'app.operator.newAgent.label.schedulable': 'Schedulable',
'app.operator.newAgent.label.capacity': 'Capacity',
'app.operator.newAgent.required.capacity': 'Please input capacity.',
'app.operator.newAgent.label.NFSServer': 'NFS Server Address',
'app.operator.newAgent.required.NFSServer': 'Please input NFS server address.',
};
2 changes: 2 additions & 0 deletions src/dashboard/src/locales/zh-CN.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import component from './zh-CN/component';
import operatorOrganization from './zh-CN/operatorOrganization';
import operatorUser from './zh-CN/operatorUser';
import form from './zh-CN/form';
import operatorAgent from './zh-CN/operatorAgent';

export default {
'navBar.lang': '语言',
Expand All @@ -27,6 +28,7 @@ export default {
...pwa,
...component,
...operatorOrganization,
...operatorAgent,
...operatorUser,
...form,
};
3 changes: 3 additions & 0 deletions src/dashboard/src/locales/zh-CN/form.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ export default {
'form.button.confirm': '确认',
'form.button.cancel': '取消',
'form.button.moreActions': '更多操作',
'form.button.submit': '提交',
'form.button.add': '添加',
'form.button.back': '返回'
};
2 changes: 2 additions & 0 deletions src/dashboard/src/locales/zh-CN/menu.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export default {
'menu.operator': '管理员',
'menu.operator.overview': '概况',
'menu.operator.agent': '代理',
'menu.operator.newAgent': '新建代理',
'menu.operator.organization': '组织',
'menu.operator.userManagement': '用户管理',
'menu.operator.node': '节点',
'menu.exception': '异常页',
'menu.exception.not-permission': '403',
'menu.exception.not-find': '404',
Expand Down
53 changes: 53 additions & 0 deletions src/dashboard/src/locales/zh-CN/operatorAgent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export default {
'app.operator.agent.title': '代理管理',
'app.operator.agent.table.header.name': '名称',
'app.operator.agent.table.header.createTime': '创建时间',
'app.operator.agent.table.header.type': '类型',
'app.operator.agent.form.new.title': '新建代理',
'app.operator.agent.form.update.title': '更新代理',
'app.operator.agent.form.name.label': '代理名称',
'app.operator.agent.form.name.required': '请输入代理名称',
'app.operator.agent.create.success': '创建代理 {name} 成功',
'app.operator.agent.create.fail': '创建代理 {name} 失败',
'app.operator.agent.update.success': '更新代理 {name} 成功',
'app.operator.agent.update.fail': '更新代理 {name} 失败',
'app.operator.agent.form.delete.title': '删除代理',
'app.operator.agent.form.delete.content': '确认删除代理 {name}',
'app.operator.agent.delete.success': '删除代理 {name} 成功',
'app.operator.agent.delete.fail': '删除代理 {name} 失败',
'app.operator.agent.listItem.organization': '所属组织',
'app.operator.agent.type': '类型',
'app.operator.newAgent.error.workerApi': '请输入有效的地址。',
'app.operator.newAgent.error.NFSServer': '请输入有效的NFS服务地址。',
'app.operator.newAgent.title': '新建代理',
'app.operator.editAgent.title': '编辑代理',
'app.operator.newAgent.label.name': '名称',
'app.operator.newAgent.required.name': '请输入用户名。',
'app.operator.newAgent.label.daemonUrl': '服务地址',
'app.operator.newAgent.required.daemonUrl': '请输入地址。',
'app.operator.newAgent.label.type': '类型',
'app.operator.newAgent.required.type': '请选择一个类型。',
'app.operator.newAgent.label.credentialType': '凭证类型',
'app.operator.newAgent.required.credentialType': '请选择一个凭证类型。',
'app.operator.newAgent.label.certificateContent': '证书内容',
'app.operator.newAgent.required.certificateContent': '请输入证书内容。',
'app.operator.newAgent.label.certificateKey': '密钥',
'app.operator.newAgent.required.certificateKey': '请输入密钥内容。',
'app.operator.newAgent.label.configurationContent': '配置内容',
'app.operator.newAgent.required.configurationContent': '请输入配置内容。',
'app.operator.newAgent.label.username': '用户名',
'app.operator.newAgent.required.username': '请输入用户名。',
'app.operator.newAgent.label.password': '密码',
'app.operator.newAgent.required.password': '请输入密码。',
'app.operator.newAgent.label.extraParameters': '额外参数',
'app.operator.newAgent.label.useSSL': '使用 SSL 验证',
'app.operator.newAgent.label.SSLCa': 'SSL CA证书',
'app.operator.newAgent.required.SSLCa': '请输入ssl CA证书。',
'app.operator.newAgent.label.logLevel': '日志级别',
'app.operator.newAgent.required.logLevel': '请选择一个日志级别。',
'app.operator.newAgent.label.schedulable': '可调度',
'app.operator.newAgent.label.capacity': '容量',
'app.operator.newAgent.required.capacity': '请输入容量。',
'app.operator.newAgent.label.NFSServer': 'NFS 服务地址',
'app.operator.newAgent.required.NFSServer': '请输入NFS服务的地址。',
};
Loading

0 comments on commit a68a6f3

Please sign in to comment.