diff --git a/spug_web/src/pages/config/app/Rel.js b/spug_web/src/pages/config/app/Rel.js index dc45af1..93ce491 100644 --- a/spug_web/src/pages/config/app/Rel.js +++ b/spug_web/src/pages/config/app/Rel.js @@ -5,7 +5,7 @@ */ import React from 'react'; import { observer } from 'mobx-react'; -import { Modal, Form, Transfer, message, Tabs, Alert } from 'antd'; +import { Modal, Form, Transfer, message, Tabs } from 'antd'; import { http, hasPermission } from 'libs'; import serviceStore from '../service/store'; import store from './store'; diff --git a/spug_web/src/pages/config/setting/DiffConfig.js b/spug_web/src/pages/config/setting/DiffConfig.js index ff79f3f..0001118 100644 --- a/spug_web/src/pages/config/setting/DiffConfig.js +++ b/spug_web/src/pages/config/setting/DiffConfig.js @@ -76,9 +76,8 @@ class Record extends React.Component { onClick={() => this.handleEnvCheck(item)} style={{cursor: 'pointer', borderTop: index ? '1px solid #e8e8e8' : ''}}> x.id).includes(item.id)}/> - {item.key} - {item.name} - {item.desc} + {item.key} + {item.name} ))} diff --git a/spug_web/src/pages/config/setting/Form.js b/spug_web/src/pages/config/setting/Form.js index d262848..2646c7a 100644 --- a/spug_web/src/pages/config/setting/Form.js +++ b/spug_web/src/pages/config/setting/Form.js @@ -77,23 +77,25 @@ export default observer(function () { name="is_public" valuePropName="checked" initialValue={store.record.is_public === undefined || store.record.is_public} - tooltip={什么是公共/私有配置?}> + tooltip={什么是公共/私有配置?}> )} - - {envStore.records.map((item, index) => ( - handleEnvCheck(item.id)} - style={{cursor: 'pointer', borderTop: index ? '1px solid #e8e8e8' : ''}}> - - {item.key} - {item.name} - {item.desc} - - ))} - + {isModify ? null : ( + + {envStore.records.map((item, index) => ( + handleEnvCheck(item.id)} + style={{cursor: 'pointer', borderTop: index ? '1px solid #e8e8e8' : ''}}> + + {item.key} + {item.name} + + ))} + + )} ) diff --git a/spug_web/src/pages/config/setting/index.js b/spug_web/src/pages/config/setting/index.js index 64a3097..82b392d 100644 --- a/spug_web/src/pages/config/setting/index.js +++ b/spug_web/src/pages/config/setting/index.js @@ -5,7 +5,7 @@ */ import React from 'react'; import { observer } from 'mobx-react'; -import { Menu, Input, Button, PageHeader, Modal, Space, Radio, Form } from 'antd'; +import { Menu, Input, Button, PageHeader, Modal, Space, Radio, Form, Alert } from 'antd'; import { DiffOutlined, HistoryOutlined, @@ -24,8 +24,6 @@ import TextView from './TextView'; import JSONView from './JSONView'; import Record from './Record'; import store from './store'; -import appStore from '../app/store'; -import srcStore from '../service/store'; @observer class Index extends React.Component { @@ -40,22 +38,23 @@ class Index extends React.Component { componentDidMount() { const {type, id} = this.props.match.params; - store.type = type; - store.id = id; - if (envStore.records.length === 0) { - envStore.fetchRecords().then(() => { + store.initial(type, id) + .then(() => { if (envStore.records.length === 0) { - Modal.error({ - title: '无可用环境', - content:
配置依赖应用的运行环境,请在 环境管理 中创建环境。
+ envStore.fetchRecords().then(() => { + if (envStore.records.length === 0) { + Modal.error({ + title: '无可用环境', + content:
配置依赖应用的运行环境,请在 环境管理 中创建环境。
+ }) + } else { + this.updateEnv() + } }) } else { this.updateEnv() } }) - } else { - this.updateEnv() - } } updateEnv = (env) => { @@ -73,13 +72,12 @@ class Index extends React.Component { render() { const {view} = this.state; const isApp = store.type === 'app'; - const record = isApp ? appStore.record : srcStore.record; return ( - + }> 配置中心 history.goBack()}>{isApp ? '应用配置' : '服务配置'} - {record.name} + {store.obj.name}
@@ -108,7 +106,8 @@ class Index extends React.Component { - store.f_name = e.target.value} placeholder="请输入"/> + store.f_name = e.target.value} + placeholder="请输入"/> { + this.type = type + this.id = id + const url = type === 'app' ? '/api/app/' : '/api/config/service/' + this.isFetching = true + return http.get(url, {params: {id}}) + .then(res => this.obj = res) + } + fetchRecords = () => { const params = {type: this.type, id: this.id, env_id: this.env.id}; this.isFetching = true;