From 042581902897f8e8814e223bff9436343c3d5348 Mon Sep 17 00:00:00 2001 From: medcl Date: Sun, 15 Nov 2020 18:47:58 +0800 Subject: [PATCH] init commit of setting pages --- README.md | 2 +- web/config/router.config.js | 35 +-- web/src/locales/en-US.js | 10 +- web/src/locales/zh-CN.js | 11 +- web/src/pages/Settings/Global/Global.js | 96 +++++++ web/src/pages/Settings/Security/General.js | 258 +++++++++++++++++++ web/src/pages/Settings/Security/General.less | 16 ++ 7 files changed, 402 insertions(+), 26 deletions(-) create mode 100644 web/src/pages/Settings/Global/Global.js create mode 100644 web/src/pages/Settings/Security/General.js create mode 100644 web/src/pages/Settings/Security/General.less diff --git a/README.md b/README.md index 4a3d5253..c914fc2c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 极限搜索中心 +# 极限企业搜索中心 INFINI Search Center diff --git a/web/config/router.config.js b/web/config/router.config.js index 93344ba1..f648edbf 100644 --- a/web/config/router.config.js +++ b/web/config/router.config.js @@ -160,28 +160,31 @@ export default [ path: '/settings', name: 'settings', icon: 'setting', - component: './List/TableList', + // component: './List/TableList', routes: [ { - path: '/list/table-list', - name: 'authentication', - component: './List/TableList', + path: '/settings/global', + name: 'global', + component: './Settings/Global/Global', }, { - path: '/list/table-list', - name: 'authorization', - component: './List/TableList', + path: '/settings/security', + name: 'security', + hideChildrenInMenu: true, + routes: [ + { + path: '/settings/security', + name: 'security', + component: './Settings/Security/General', + }, { + path: '/settings/security/general', + name: 'general', + component: './Forms/BasicForm', + }, + ] }, { - path: '/list/table-list', + path: '/settings/audit', name: 'audit', component: './List/TableList', - }, { - path: '/list/table-list', - name: 'certs', - component: './List/TableList', - }, { - path: '/list/table-list', - name: 'others', - component: './List/TableList', }, ] }, diff --git a/web/src/locales/en-US.js b/web/src/locales/en-US.js index bd22e03c..5824a4e6 100644 --- a/web/src/locales/en-US.js +++ b/web/src/locales/en-US.js @@ -96,11 +96,9 @@ export default { 'menu.search.nlp': 'NLP', 'menu.settings': 'SETTINGS', - 'menu.settings.authentication': 'AUTHENTICATION', - 'menu.settings.authorization': 'AUTHORIZATION', + 'menu.settings.global': 'GLOBAL', + 'menu.settings.security': 'SECURITY', 'menu.settings.audit': 'AUDIT', - 'menu.settings.certs': 'CERTS', - 'menu.settings.others': 'OTHERS', 'menu.form': 'Form', @@ -207,6 +205,10 @@ export default { 'app.setting.appname':"Search Center", + + 'app.settings.security.update':"Update Setting", + 'app.settings.global.update':"Update Setting", + 'app.settings.menuMap.basic': 'Basic Settings', 'app.settings.menuMap.security': 'Security Settings', 'app.settings.menuMap.binding': 'Account Binding', diff --git a/web/src/locales/zh-CN.js b/web/src/locales/zh-CN.js index 3fc58fe2..95a46ef5 100644 --- a/web/src/locales/zh-CN.js +++ b/web/src/locales/zh-CN.js @@ -104,12 +104,11 @@ export default { 'menu.search.nlp': '自然语言处理', 'menu.settings': '系统设置', - 'menu.settings.authentication': '认证管理', + 'menu.settings.global': '全局设置', + 'menu.settings.security': '安全设置', 'menu.settings.authorization': '授权管理', 'menu.settings.audit': '审计日志', - 'menu.settings.certs': '证书管理', - 'menu.settings.others': '其它设置', - + 'menu.form': '表单页', 'menu.form.basicform': '基础表单', @@ -214,7 +213,9 @@ export default { 'app.monitor.fund-surplus': '补贴资金剩余', 'app.setting.appname':"极限搜索中心", - + + 'app.settings.security.update':"更新设置", + 'app.settings.global.update':"更新设置", 'app.settings.menuMap.basic': '基本设置', 'app.settings.menuMap.security': '安全设置', diff --git a/web/src/pages/Settings/Global/Global.js b/web/src/pages/Settings/Global/Global.js new file mode 100644 index 00000000..548e31ca --- /dev/null +++ b/web/src/pages/Settings/Global/Global.js @@ -0,0 +1,96 @@ +import React, {Component, Fragment} from 'react'; +import {connect} from 'dva'; +import {Card, Form, Input, Select, Button, message, Divider, Drawer, Descriptions} from 'antd'; + +const {Option} = Select; +import {formatMessage, FormattedMessage} from 'umi/locale'; + +const FormItem = Form.Item; +const {TextArea} = Input; +import {Row, Col} from 'antd'; + +const operationTabList = [ + { + key: 'tab1', + tab: '全局设置', + }, +]; + +@Form.create() +class Global extends Component { + state = { + operationkey: 'tab1', + }; + + componentDidMount() { + } + + onOperationTabChange = key => { + this.setState({operationkey: key}); + }; + + globalSettings = () => { + const { + form: {getFieldDecorator}, + } = this.props; + return ( + < div > + < Row + type = "flex" + justify = "end" > + < Col + span = {16} > + < div > < Form + layout = "vertical" + hideRequiredMark > + + < FormItem + label = {formatMessage({id: 'app.settings.global.cluster_name'})} > + {getFieldDecorator('address', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.address-message'}, {}), + }, + ], + } + ) + ( < Input / >) + } + + < Button type = "primary" > + < FormattedMessage + id = "app.settings.global.update" + defaultMessage = "Update Setting" /> + < /Form> + < /Col> + < Col span = {8} >< /Col> + < /Row> + < /div> + ) + ; + }; + + render() { + const {operationkey} = this.state; + const contentList = { + tab1: ( < div > {this.globalSettings()} < /div>), + } + ; + return ( + < Fragment > + < Card + bordered = {false} + tabList = {operationTabList} + onTabChange = {this.onOperationTabChange} + > + {contentList[operationkey]} + < /Card> + < /Fragment> + ) + ; + } +} + +export default Global; diff --git a/web/src/pages/Settings/Security/General.js b/web/src/pages/Settings/Security/General.js new file mode 100644 index 00000000..bd90ddff --- /dev/null +++ b/web/src/pages/Settings/Security/General.js @@ -0,0 +1,258 @@ +import React, {Component, Fragment} from 'react'; +import {connect} from 'dva'; +import {Card, Form, Input, Select, Button, message, Divider, Drawer, Descriptions} from 'antd'; + +const {Option} = Select; +import {formatMessage, FormattedMessage} from 'umi/locale'; +import styles from './General.less'; +import PhoneView from "../../Account/Settings/PhoneView"; + +const FormItem = Form.Item; +const {TextArea} = Input; +import {Row, Col} from 'antd'; + +const operationTabList = [ + { + key: 'tab1', + tab: '基本设置', + }, + { + key: 'tab2', + tab: 'SSO 集成', + }, + { + key: 'tab3', + tab: '角色管理', + }, + { + key: 'tab4', + tab: '用户管理', + }, + { + key: 'tab5', + tab: '证书管理', + } +]; + +// @connect(({logstash,loading }) => ({ +// data: logstash.logstash, +// loading: loading.models.logstash, +// submitting: loading.effects['logstash/submitLogstashConfig'], +// })) + +@Form.create() +class General extends Component { + state = { + operationkey: 'tab1', + snapshotVisible: false, + repVisible: false, + }; + + componentDidMount() { + // message.loading('数据加载中..', 'initdata'); + // const { dispatch } = this.props; + // dispatch({ + // type: 'logstash/queryInitialLogstashConfig', + // }); + } + + onOperationTabChange = key => { + this.setState({operationkey: key}); + }; + + generalSettings = () => { + const { + form: {getFieldDecorator}, + } = this.props; + return ( + < div > + < Row + type = "flex" + justify = "end" > + < Col + span = {16} > + < div > < Form + layout = "vertical" + hideRequiredMark > + + < FormItem + label = {formatMessage({id: 'app.settings.security.auth2factor_enabled'})} > + {getFieldDecorator('profile', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.profile-message'}, {}), + }, + ], + } + ) + ( < Input /> ) + } + + + < FormItem + label = {formatMessage({id: 'app.settings.basic.email'})} > + {getFieldDecorator('email', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.email-message'}, {}), + }, + ], + } + ) + ( < Input / > + ) + } + < + /FormItem> + < FormItem + label = {formatMessage({id: 'app.settings.basic.nickname'})} > + {getFieldDecorator('name', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.nickname-message'}, {}), + }, + ], + } + ) + ( < Input / > + ) + } + < + /FormItem> + < FormItem + label = {formatMessage({id: 'app.settings.basic.profile'})} > + {getFieldDecorator('profile', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.profile-message'}, {}), + }, + ], + } + ) + ( + < Input.TextArea + placeholder = {formatMessage({id: 'app.settings.basic.profile-placeholder'})} + rows = {4} + /> + ) + } + < + /FormItem> + < FormItem + label = {formatMessage({id: 'app.settings.basic.country'})} > + {getFieldDecorator('country', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.country-message'}, {}), + }, + ], + } + ) + ( + < Select + style = { + { + maxWidth: 220 + } + }> + < + Option + value = "China" > 中国 < /Option> + < /Select> + ) + } + < + /FormItem> + + < FormItem + label = {formatMessage({id: 'app.settings.basic.address'})} > + {getFieldDecorator('address', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.address-message'}, {}), + }, + ], + } + ) + ( < Input / > + ) + } + < + /FormItem> + < FormItem + label = {formatMessage({id: 'app.settings.basic.phone'})} > + {getFieldDecorator('phone', + { + rules: [ + { + required: true, + message: formatMessage({id: 'app.settings.basic.phone-message'}, {}), + }, + // { validator: validatorPhone }, + ], + } + ) + ( < PhoneView / > + ) + } + < + /FormItem> + < Button + type = "primary" > + < FormattedMessage + id = "app.settings.security.update" + defaultMessage = "Update Setting" + / > + < /Button> + < /Form> + < /Col> + < Col + span = {8} > + + < /Col> + < /Row> + < /div> + ) + ; + }; + + render() { + const {operationkey} = this.state; + const contentList = { + tab1: ( < div > {this.generalSettings()} < /div>), + tab2: ( < div > SSO 集成 < /div>), + tab3: ( < div > 角色管理 < /div>), + tab4: ( < div > 用户管理 < /div>), + tab5: ( < div > 证书管理 < /div>), + } + ; + return ( + < Fragment > + < Card + className = {styles.tabsCard} + bordered = {false} + tabList = {operationTabList} + onTabChange = {this.onOperationTabChange} + > + {contentList[operationkey]} + < /Card> + < /Fragment> + ) + ; + } +} + +export default General; diff --git a/web/src/pages/Settings/Security/General.less b/web/src/pages/Settings/Security/General.less new file mode 100644 index 00000000..9a766c34 --- /dev/null +++ b/web/src/pages/Settings/Security/General.less @@ -0,0 +1,16 @@ + +.tabsCard { + :global { + .ant-card-head { + padding: 0 16px; + } + } +} +.btnRestore{ + position:absolute; + bottom: 20px; +} + +.right{ + float: right; +} \ No newline at end of file