A web update

pull/22/head
雷二猛 2019-12-08 13:40:51 +08:00
parent 5ec88738d0
commit c2685a35fe
2 changed files with 16 additions and 6 deletions

View File

@ -37,7 +37,8 @@ class JSONView extends React.Component {
const formData = {type: store.type, o_id: store.id, env_id: store.env.id, data};
http.post('/api/config/parse/json/', formData)
.then(res => {
message.success('保存成功')
message.success('保存成功');
this.updateValue()
})
.finally(() => this.setState({loading: false}))
} catch (err) {
@ -61,12 +62,16 @@ class JSONView extends React.Component {
onChange={v => this.setState({body: v})}/>
{readOnly && <Button
icon="edit"
style={{position: 'absolute', top: 20, right: 0}}
type="link"
size="large"
style={{position: 'absolute', top: 0, right: 0}}
onClick={() => this.setState({readOnly: false})}>编辑</Button>}
{readOnly || <Button
icon="save"
type="link"
size="large"
loading={loading}
style={{position: 'absolute', top: 20, right: 0}}
style={{position: 'absolute', top: 0, right: 0}}
onClick={this.handleSubmit}>保存</Button>}
</div>
)

View File

@ -35,7 +35,8 @@ class TextView extends React.Component {
const formData = {type: store.type, o_id: store.id, env_id: store.env.id, data: this.state.body};
http.post('/api/config/parse/text/', formData)
.then(res => {
message.success('保存成功')
message.success('保存成功');
this.updateValue()
})
.finally(() => this.setState({loading: false}))
};
@ -55,12 +56,16 @@ class TextView extends React.Component {
onChange={v => this.setState({body: v})}/>
{readOnly && <Button
icon="edit"
style={{position: 'absolute', top: 20, right: 10}}
type="link"
size="large"
style={{position: 'absolute', top: 0, right: 0}}
onClick={() => this.setState({readOnly: false})}>编辑</Button>}
{readOnly || <Button
icon="save"
type="link"
size="large"
loading={loading}
style={{position: 'absolute', top: 20, right: 10}}
style={{position: 'absolute', top: 0, right: 0}}
onClick={this.handleSubmit}>保存</Button>}
</div>
)