Skip to content

Commit

Permalink
dashboard: tweaks for production builds
Browse files Browse the repository at this point in the history
Closes #601
  • Loading branch information
jeffomatic authored and iampogo committed Feb 24, 2017
1 parent 496a0d5 commit 8185e03
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
15 changes: 9 additions & 6 deletions dashboard/src/features/app/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ class Navigation extends React.Component {

<ul className={styles.navigation}>
<li className={styles.navigationTitle}>services</li>
<li>
<Link to='/mockhsms' activeClassName={styles.active}>
{navIcon('mockhsm', styles)}
MockHSM
</Link>
</li>
{!this.props.production &&
<li>
<Link to='/mockhsms' activeClassName={styles.active}>
{navIcon('mockhsm', styles)}
MockHSM
</Link>
</li>
}
<li>
<Link to='/transaction-feeds' activeClassName={styles.active}>
{navIcon('feed', styles)}
Expand Down Expand Up @@ -101,6 +103,7 @@ export default connect(
state => ({
routing: state.routing, // required for <Link>s to update active state on navigation
showSync: state.core.configured && !state.core.generator,
production: state.core.production,
}),
(dispatch) => ({
openTutorial: () => dispatch({ type: 'OPEN_TUTORIAL' })
Expand Down
20 changes: 14 additions & 6 deletions dashboard/src/features/configuration/components/Index/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,17 @@ class Index extends React.Component {
<input className={styles.choice_radio_button}
type='radio'
{...typeProps}
value='new' />
<div className={`${styles.choice} ${styles.new}`}>
value='new'
disabled={this.props.production} />
<div className={`${styles.choice} ${styles.new} ` + (this.props.production ? styles.disabled : '')}>
<span className={styles.choice_title}>Create new blockchain network</span>

<p>
Start a new blockchain network with this Chain Core as the block generator.
</p>
{this.props.production &&
<p>This core is compiled for production. Use <code>corectl</code> to configure as a generator.</p>
}
{!this.props.production &&
<p>Start a new blockchain network with this Chain Core as the block generator.</p>
}
</div>
</label>
</div>
Expand Down Expand Up @@ -180,6 +184,10 @@ class Index extends React.Component {
}
}

const mapStateToProps = state => ({
production: state.core.production,
})

const mapDispatchToProps = (dispatch) => ({
submitForm: (data) => dispatch(actions.configuration.submitConfiguration(data))
})
Expand All @@ -196,6 +204,6 @@ const config = {

export default reduxForm(
config,
() => {},
mapStateToProps,
mapDispatchToProps
)(Index)
10 changes: 10 additions & 0 deletions dashboard/src/features/configuration/components/Index/Index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
background-color: $background-emphasis-color;
}

&.disabled {
cursor: default;
background-color: $background-emphasis-color;
opacity: 0.75;

.choice_title {
color: $text-light-color;
}
}

p {
line-height: 1.4;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class CoreIndex extends React.Component {
<td className={styles.row_label}>Version:</td>
<td><code>{this.props.core.version}</code></td>
</tr>
<tr>
<td className={styles.row_label}>Production build:</td>
<td><code>{this.props.core.production.toString()}</code></td>
</tr>
<tr>
<td colSpan={2}><hr /></td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/features/core/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const configuredAt = (state, action) => {
}

export const production = (state, action) =>
coreConfigReducer('isproduction', state, false, action)
coreConfigReducer('isProduction', state, false, action)
export const blockHeight = (state, action) =>
coreConfigReducer('blockHeight', state, 0, action)
export const generatorBlockHeight = (state, action) => {
Expand Down

0 comments on commit 8185e03

Please sign in to comment.