2014-02-11 17:39:32 +00:00
/ *
Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.
After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.
This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.
Also, this only moves the lru package to internal. More will move to
internal later.
Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.
This updates some docs, but not all.
devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).
Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 22:41:41 +00:00
Copyright 2014 The Perkeep Authors
2014-02-11 17:39:32 +00:00
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
http : //www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
goog . provide ( 'cam.MobileSetupView' ) ;
goog . require ( 'goog.Uri' ) ;
cam . MobileSetupView = React . createClass ( {
displayName : 'MobileSetupView' ,
propTypes : {
baseURL : React . PropTypes . object . isRequired ,
defaultUsername : React . PropTypes . string . isRequired ,
} ,
getInitialState : function ( ) {
var serverURL = this . props . baseURL . clone ( ) . setPath ( '' ) . setQuery ( '' ) ;
return {
autoUpload : false ,
// TODO(wathiede): autopopulate this, not sure how.
certFingerprint : '' ,
maxCacheSize : 256 ,
server : serverURL . toString ( )
} ;
} ,
getQRURL _ : function ( ) {
// TODO(wathiede): I'm not sure what the Android and iPhone requirements are for registering a URL handler are. If they can't be the same for both platforms, then we'll need this to be conditional based on a checkbox in the form.
var settingsURL = goog . Uri . parse ( 'camli://settings/' ) ;
if ( this . state . username != '' ) {
settingsURL . setParameterValue ( 'username' , this . state . username ) ;
}
if ( this . state . server != '' ) {
settingsURL . setParameterValue ( 'server' , this . state . server ) ;
}
if ( this . state . autoUpload ) {
settingsURL . setParameterValue ( 'autoUpload' , 1 ) ;
}
settingsURL . setParameterValue ( 'maxCacheSize' , this . state . maxCacheSize ) ;
if ( this . state . certFingerprint != '' ) {
settingsURL . setParameterValue ( 'certFingerprint' , this . state . certFingerprint ) ;
}
var qrURL = this . props . baseURL . clone ( ) ;
qrURL . setPath ( qrURL . getPath ( ) + '/qr/' ) . setParameterValue ( 'url' , settingsURL . toString ( ) ) ;
return qrURL . toString ( ) ;
} ,
handleServerChange _ : function ( e ) {
this . setState ( { server : e . target . value } ) ;
} ,
handleUsernameChange _ : function ( e ) {
this . setState ( { username : e . target . value } ) ;
} ,
handleAutoUploadChange _ : function ( e ) {
this . setState ( { autoUpload : e . target . checked } ) ;
} ,
handleMaxCacheSizeChange _ : function ( e ) {
this . setState ( { maxCacheSize : e . target . value } ) ;
} ,
handleCertFingerprintChange _ : function ( e ) {
this . setState ( { certFingerprint : e . target . value } ) ;
} ,
render : function ( ) {
return (
React . DOM . div ( { } ,
React . DOM . img ( { src : this . getQRURL _ ( ) } ) ,
React . DOM . form ( { ref : 'form' , onSubmit : this . handleChange _ } ,
2018-04-28 00:22:13 +00:00
React . DOM . label ( { } , 'Perkeep Server:' ,
2014-02-11 17:39:32 +00:00
React . DOM . input ( {
defaultValue : this . state . server ,
onChange : this . handleServerChange _ ,
placeholder : 'e.g. https://foo.example.com or example.com:3179' ,
type : 'text'
} ) ) ,
React . DOM . label ( { } , 'Username:' ,
React . DOM . input ( {
defaultValue : this . props . defaultUsername ,
onChange : this . handleUsernameChange _ ,
placeholder : '<unset>' ,
type : 'text'
} ) ) ,
React . DOM . label ( { className : 'mobile-setup-auto-upload' } ,
React . DOM . input ( {
onChange : this . handleAutoUploadChange _ ,
type : 'checkbox'
} ) ,
'Auto-Upload' ,
React . DOM . span ( { className : 'mobile-setup-helptext' } , 'Upload SD card files as created' ) ) ,
// TODO(wathiede): add suboptions to auto-upload?
React . DOM . label ( { className : 'mobile-setup-max-cache-size' } ,
'Maximum cache size' ,
React . DOM . input ( {
defaultValue : this . state . maxCacheSize ,
onChange : this . handleMaxCacheSizeChange _ ,
type : 'text'
} ) ,
'MB' ) ,
) ) ) ;
} ,
handleChange _ : function ( ) {
var u = this . getQRURL _ ( ) ;
console . log ( u ) ;
} ,
} ) ;