-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lots of stuff going, here are the main features: - Moved the /run app to index - Added directory listing functionality - Implemented React-Router: changing urls no longer cause the entire app to refresh Some of the under-the-hood changes: - Restructured run app to use redux - Add font-awesome to app - Standardized error handler for api
- Loading branch information
Matt Nibecker
committed
Feb 2, 2016
1 parent
5dc6d39
commit d10d18e
Showing
26 changed files
with
703 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const NEW_BUNDLE = 'NEW_BUNDLE'; | ||
export const NEW_ERROR = 'NEW_ERROR'; | ||
export const FETCH_BUNDLE_ERROR = 'FETCH_BUNDLE_ERROR'; | ||
|
||
export function newBundle(bundle, inputs) { | ||
return { | ||
type: NEW_BUNDLE, | ||
bundle, | ||
inputs | ||
}; | ||
} | ||
|
||
export function newError(error) { | ||
return { | ||
type: NEW_ERROR, | ||
error | ||
}; | ||
} | ||
|
||
export function fetchBundleError(error) { | ||
return { | ||
type: FETCH_BUNDLE_ERROR, | ||
error | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
|
||
import DirectoryListing from '../client-lib/directory-listing'; | ||
import Dropdown from '../client-lib/dropdown'; | ||
|
||
class App extends React.Component { | ||
handleJuttleSelected = () => { | ||
this.refs.Dropdown.close(); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div className="app-wrapper"> | ||
<header> | ||
<div className='header-options'> | ||
<Dropdown ref="Dropdown"> | ||
<DirectoryListing onJuttleSelected={this.handleJuttleSelected}/> | ||
</Dropdown> | ||
</div> | ||
</header> | ||
{this.props.children} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<title>Jut Development</title> | ||
<link rel="stylesheet" type="text/css" href="/assets/main.css"> | ||
</head> | ||
<body class="app-body"> | ||
<div id="app"> | ||
</div> | ||
<script src="/assets/app.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/variables"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins"; | ||
|
||
// Reset and dependencies | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/normalize"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/print"; | ||
|
||
// Core CSS | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/type"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/code"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/grid"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/tables"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/forms"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/buttons"; | ||
|
||
// Components | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/component-animations"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/dropdowns"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/button-groups"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/input-groups"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/navs"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/navbar"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/breadcrumbs"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/pagination"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/pager"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/labels"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/badges"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/jumbotron"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/thumbnails"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/alerts"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/progress-bars"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/media"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/list-group"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/panels"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/responsive-embed"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/wells"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/close"; | ||
|
||
// Components w/ JavaScript | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/modals"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/tooltip"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/popovers"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/carousel"; | ||
|
||
// Utility classes | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/utilities"; | ||
@import "../../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/responsive-utilities"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.dir-list { | ||
.dir-list-item { | ||
display: block; | ||
padding: 10px 15px; | ||
} | ||
|
||
.dir-list-item.path { | ||
border-bottom: 1px solid $gray-pale; | ||
} | ||
|
||
.dir-entry:hover { | ||
text-decoration: none; | ||
background-color: $gray-pale; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Router, Route, IndexRoute, browserHistory } from 'react-router'; | ||
import { syncHistory } from 'react-router-redux'; | ||
import { createStore, applyMiddleware } from 'redux'; | ||
import { Provider } from 'react-redux'; | ||
|
||
import reducers from './reducers'; | ||
import { bundleMiddleware } from './middleware'; | ||
|
||
import App from './app'; | ||
import Run from './run'; | ||
|
||
|
||
// import sass | ||
import 'juttle-client-library/dist/juttle-client-library.css'; | ||
import 'font-awesome/css/font-awesome.css'; | ||
import './assets/sass/main.scss'; | ||
|
||
// setup redux | ||
const reduxRouterMiddeware = syncHistory(browserHistory); | ||
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddeware, bundleMiddleware)(createStore); | ||
const store = createStoreWithMiddleware(reducers); | ||
|
||
// setup main app | ||
ReactDOM.render(( | ||
<Provider store={store}> | ||
<Router history={browserHistory}> | ||
<Route path="/" component={App}> | ||
<IndexRoute component={Run} /> | ||
</Route> | ||
</Router> | ||
</Provider> | ||
), document.getElementById('app')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { UPDATE_LOCATION } from 'react-router-redux'; | ||
|
||
import { newBundle, fetchBundleError } from './actions'; | ||
import * as api from '../client-lib/api'; | ||
import RendezvousSocket from '../client-lib/rendezvous-socket'; | ||
|
||
// this should come from a config options, do this for now | ||
let outriggerHost = window.location.host; | ||
|
||
export const bundleMiddleware = store => { | ||
let rendezvous; | ||
|
||
function bundleReceived(bundle) { | ||
api.describe(bundle) | ||
.then(inputs => { | ||
store.dispatch(newBundle(bundle, inputs)); | ||
}) | ||
} | ||
|
||
function runModeChanged(runMode) { | ||
if (runMode.path) { | ||
api.getBundle(runMode.path) | ||
.then(res => { bundleReceived(res.bundle) }) | ||
.catch(err => { store.dispatch(fetchBundleError(err)) }) | ||
} else if (runMode.rendezvous) { | ||
if (rendezvous) { | ||
rendezvous.close(); | ||
} | ||
|
||
rendezvous = new RendezvousSocket(`ws://${outriggerHost}/rendezvous/${runMode.rendezvous}`); | ||
rendezvous.on('message', msg => bundleReceived(msg.bundle)); | ||
} | ||
} | ||
|
||
runModeChanged(store.getState().runMode); | ||
|
||
return next => action => { | ||
// only update if prevRunMode is different from newRunMode | ||
if (action.type !== UPDATE_LOCATION) { | ||
return next(action); | ||
} | ||
|
||
let prevRunMode = store.getState().runMode; | ||
let result = next(action); | ||
let newRunMode = store.getState().runMode; | ||
if (newRunMode.path !== prevRunMode.path | ||
|| newRunMode.rendezvous !== prevRunMode.rendezvous) { | ||
|
||
runModeChanged(newRunMode); | ||
} | ||
|
||
return result; | ||
} | ||
} |
Oops, something went wrong.