1+ import PropTypes from 'prop-types' ;
2+ import React from 'react' ;
3+
4+ import Mconfig from '../../model/Mconfig' ;
5+
6+ import Vproperty from '../Vproperty' ;
7+
8+ export default class VconfigTokens extends React . Component {
9+
10+ static propTypes = {
11+ config :PropTypes . object ,
12+ handle : PropTypes . object ,
13+ match : PropTypes . object
14+ }
15+
16+ constructor ( props ) {
17+ super ( props ) ;
18+ const { handle} = props ;
19+
20+ this . state = { focus :'mapboxToken' } ;
21+
22+ this . handle = {
23+ ...handle ,
24+ change :( field ) => {
25+ Mconfig . setIn ( [ field . name ] , field . value ) ;
26+ }
27+ } ;
28+
29+ for ( let i in this . handle ) {
30+ this . handle [ i ] = this . handle [ i ] . bind ( this ) ;
31+ }
32+ }
33+
34+ render ( ) {
35+ const { config, error, handle} = this . props ;
36+
37+ return < div className = "p-1" >
38+ < h2 className = "px-2 py-1 m-0 text-nav bg-light" >
39+ API Access Tokens
40+ < div className = "float-right" >
41+
42+ </ div >
43+ </ h2 >
44+ < div className = "p-2" >
45+ < div className = "row" >
46+ < div className = "col-sm-6" >
47+ < Vproperty property = { {
48+ name :'mapboxToken' ,
49+ label :'mapbox token' ,
50+ spec :{ doc :'token used to authenticate with Mapbox' } ,
51+ value :config . get ( 'mapboxToken' ) ,
52+ error :error && error . get && error . get ( 'mapboxToken' ) ,
53+ hideOptions :true
54+ } } focus = { this . state . focus } handle = { this . handle } />
55+ </ div >
56+ < div className = "col-sm-6" >
57+ < Vproperty property = { {
58+ name :'olToken' ,
59+ label :'open layers token' ,
60+ spec :{ doc :'token used to authenticate with Open Layers' } ,
61+ value :config . get ( 'olToken' ) ,
62+ error :error && error . get && error . get ( 'olToken' ) ,
63+ hideOptions :true
64+ } } focus = { this . state . focus } handle = { this . handle } />
65+ </ div >
66+ </ div >
67+ </ div >
68+ </ div > ;
69+ }
70+ } ;
0 commit comments