Skip to content

Commit

Permalink
improving server-settings.json UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mroote committed Oct 31, 2016
1 parent 54c6396 commit 76a4060
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 9 deletions.
Empty file modified ui/App/App.jsx
100644 → 100755
Empty file.
70 changes: 62 additions & 8 deletions ui/App/components/ConfigContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ConfigContent extends React.Component {
this.getServerSettings = this.getServerSettings.bind(this);
this.updateServerSettings = this.updateServerSettings.bind(this);
this.handleServerSettingsChange = this.handleServerSettingsChange.bind(this);
this.formTypeField = this.formTypeField.bind(this);
this.state = {
config: {},
serverSettings: {}
Expand Down Expand Up @@ -49,6 +50,7 @@ class ConfigContent extends React.Component {
success: (resp) => {
if (resp.success === true) {
this.setState({serverSettings: resp.data})
console.log(this.state)
}
},
error: (xhr, status, err) => {
Expand All @@ -74,6 +76,65 @@ class ConfigContent extends React.Component {
})
}

formTypeField(key, setting) {
if (typeof setting === "number") {
return (
<input
key={key}
ref={key}
id={key}
className="form-control"
defaultValue={setting}
type="number"
onChange={this.handleServerSettingsChange.bind(this, key)}
/>
)
} else if (typeof setting === "string") {
return (
<input
key={key}
ref={key}
id={key}
className="form-control"
defaultValue={setting}
type="text"
onChange={this.handleServerSettingsChange.bind(this, key)}
/>
)
} else if (typeof setting === "boolean") {
return (
<select key={key} ref={key} id={key} className="form-control" onChange={this.handleServerSettingsChange.bind(this, key)}>
<option value={true}>True</option>
<option value={false}>False</option>
</select>
)
} else if (Array.isArray(setting)) {
return (
<input
key={key}
ref={key}
id={key}
className="form-control"
defaultValue={setting}
type="password"
onChange={this.handleServerSettingsChange.bind(this, key)}
/>
)
} else {
return (
<input
key={key}
ref={key}
id={key}
className="form-control"
defaultValue={setting}
type="text"
onChange={this.handleServerSettingsChange.bind(this, key)}
/>
)
}
}


render() {
return(
Expand Down Expand Up @@ -108,14 +169,7 @@ class ConfigContent extends React.Component {
<div className="form-group">
<label for={key} className="control-label col-md-3">{setting_key}</label>
<div className="col-md-6">
<input
ref={key}
id={key}
className="form-control"
defaultValue={setting}
type="text"
onChange={this.handleServerSettingsChange.bind(this, key)}
/>
{this.formTypeField(key, setting)}
</div>
</div>
)
Expand Down
1 change: 0 additions & 1 deletion ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import LoginContent from './App/components/LoginContent.jsx';
import UsersContent from './App/components/UsersContent.jsx';
import Index from './App/components/Index.jsx';


ReactDOM.render((
<Router history={browserHistory}>
<Route path="/login" component={LoginContent}/>
Expand Down
40 changes: 40 additions & 0 deletions ui/npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
0 info it worked if it ends with ok
1 verbose cli [ '/home/mitch/.nvm/versions/node/v4.2.6/bin/node',
1 verbose cli '/home/mitch/.nvm/versions/node/v4.2.6/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info predev [email protected]
6 info dev [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec dev script
9 verbose stack Error: [email protected] dev: `NODE_ENV=production ./node_modules/webpack/bin/webpack.js -w --progress --profile --colors`
9 verbose stack Exit status 126
9 verbose stack at EventEmitter.<anonymous> (/home/mitch/.nvm/versions/node/v4.2.6/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (/home/mitch/.nvm/versions/node/v4.2.6/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:821:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /home/mitch/prog/go/src/github.com/majormjr/factorio-server-manager/ui
12 error Linux 4.4.0-45-generic
13 error argv "/home/mitch/.nvm/versions/node/v4.2.6/bin/node" "/home/mitch/.nvm/versions/node/v4.2.6/bin/npm" "run" "dev"
14 error node v4.2.6
15 error npm v2.14.12
16 error code ELIFECYCLE
17 error [email protected] dev: `NODE_ENV=production ./node_modules/webpack/bin/webpack.js -w --progress --profile --colors`
17 error Exit status 126
18 error Failed at the [email protected] dev script 'NODE_ENV=production ./node_modules/webpack/bin/webpack.js -w --progress --profile --colors'.
18 error This is most likely a problem with the factorio-mod-manager package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error NODE_ENV=production ./node_modules/webpack/bin/webpack.js -w --progress --profile --colors
18 error You can get their info via:
18 error npm owner ls factorio-mod-manager
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

0 comments on commit 76a4060

Please sign in to comment.