88import React from 'react'
99import MyFrame from './frame'
1010import classnames from 'classnames'
11+ import { Icon , Input , Radio , Select } from 'antd'
1112import Group from './group'
1213import Agent from '../Agent'
1314import makeId from '../../app/libs/make-id'
1415import './edit.less'
1516
17+ const RadioButton = Radio . Button
18+ const RadioGroup = Radio . Group
19+ const Option = Select . Option
20+
1621export default class EditPrompt extends React . Component {
1722 constructor ( props ) {
1823 super ( props )
@@ -175,7 +180,7 @@ export default class EditPrompt extends React.Component {
175180 }
176181 return k . map ( ( [ v , n ] , idx ) => {
177182 return (
178- < option value = { v } key = { idx } > { n } </ option >
183+ < Option value = { v } key = { idx } > { n } </ Option >
179184 )
180185 } )
181186 }
@@ -229,30 +234,30 @@ export default class EditPrompt extends React.Component {
229234 < div className = "ln" >
230235 < div className = "title" > { lang . url } </ div >
231236 < div className = "cnt" >
232- < input
233- type = "text"
237+ < Input
234238 ref = "url"
235239 value = { this . state . url }
236240 placeholder = "http://"
237- onChange = { ( e ) => this . setState ( { url : e . target . value } ) }
238- onKeyDown = { ( e ) => ( e . keyCode === 13 && this . onOK ( ) ) || ( e . keyCode === 27 && this . onCancel ( ) ) }
241+ onChange = { e => this . setState ( { url : e . target . value } ) }
242+ onKeyDown = { e => ( e . keyCode === 13 && this . onOK ( ) ) || ( e . keyCode === 27 && this . onCancel ( ) ) }
239243 />
240244 </ div >
241245 </ div >
242246 < div className = "ln" >
243247 < div className = "title" > { lang . auto_refresh } </ div >
244248 < div className = "cnt" >
245- < select
249+ < Select
246250 value = { this . state . refresh_interval }
247- onChange = { ( e ) => this . setState (
248- { refresh_interval : parseFloat ( e . target . value ) || 0 } ) }
251+ style = { { width : 120 } }
252+ onChange = { v => this . setState ( { refresh_interval : parseFloat ( v ) || 0 } ) }
249253 >
250254 { this . getRefreshOptions ( ) }
251- </ select >
255+ </ Select >
252256
253- < i
257+ < Icon
258+ type = "reload"
254259 className = { classnames ( {
255- iconfont : 1 ,
260+ ' iconfont' : 1 ,
256261 'icon-refresh' : 1 ,
257262 'invisible' : ! this . current_hosts || this . state . url !== this . current_hosts . url ,
258263 'loading' : this . state . is_loading
@@ -276,29 +281,18 @@ export default class EditPrompt extends React.Component {
276281 return (
277282 < div ref = "body" >
278283 < div className = "ln" >
279- < input id = "ipt-local" type = "radio" name = "where" value = "local"
280- checked = { this . state . where === 'local' }
281- onChange = { ( e ) => this . setState ( { where : e . target . value } ) }
282- />
283- < label htmlFor = "ipt-local" > { lang . where_local } </ label >
284- < input id = "ipt-remote" type = "radio" name = "where" value = "remote"
285- checked = { this . state . where === 'remote' }
286- onChange = { ( e ) => this . setState ( { where : e . target . value } ) }
287- />
288- < label htmlFor = "ipt-remote" > { lang . where_remote } </ label >
289- < input id = "ipt-group" type = "radio" name = "where" value = "group"
290- checked = { this . state . where === 'group' }
291- onChange = { ( e ) => this . setState ( { where : e . target . value } ) }
292- />
293- < label htmlFor = "ipt-group" > { lang . where_group } </ label >
284+ < RadioGroup onChange = { e => this . setState ( { where : e . target . value } ) } value = { this . state . where } >
285+ < RadioButton value = "local" > { lang . where_local } </ RadioButton >
286+ < RadioButton value = "remote" > { lang . where_remote } </ RadioButton >
287+ < RadioButton value = "group" > { lang . where_group } </ RadioButton >
288+ </ RadioGroup >
294289 </ div >
290+
295291 < div className = "ln" >
296292 < div className = "title" > { lang . hosts_title } </ div >
297293 < div className = "cnt" >
298- < input
299- type = "text"
294+ < Input
300295 ref = "title"
301- name = "text"
302296 value = { this . state . title }
303297 onChange = { ( e ) => this . setState ( { title : e . target . value } ) }
304298 onKeyDown = { ( e ) => ( e . keyCode === 13 && this . onOK ( ) || e . keyCode === 27 && this . onCancel ( ) ) }
@@ -318,7 +312,7 @@ export default class EditPrompt extends React.Component {
318312 return (
319313 < MyFrame
320314 show = { this . state . show }
321- head = { lang [ this . state . is_add ? 'add_hosts' : 'edit_hosts' ] }
315+ title = { lang [ this . state . is_add ? 'add_hosts' : 'edit_hosts' ] }
322316 body = { this . body ( ) }
323317 onOK = { ( ) => this . onOK ( ) }
324318 onCancel = { ( ) => this . onCancel ( ) }
0 commit comments