Skip to content

Commit

Permalink
Merge branch 'h2o-steam'
Browse files Browse the repository at this point in the history
Fixes PP-71, PP-80, PP-82
  • Loading branch information
lo5 committed May 15, 2014
2 parents a8759d9 + b2be635 commit 5a9906d
Show file tree
Hide file tree
Showing 95 changed files with 3,407 additions and 2,325 deletions.
263 changes: 145 additions & 118 deletions client/Makefile

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions client/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@
],
"dependencies": {
"jquery": "~2.1.0",
"jquery-timeago": "~1.4.0",
"d3": "~3.4.4",
"bootstrap": "~3.1.1",
"knockout": "komputing/knockout",
"lodash": "~2.4.1",
"chai": "~1.9.1",
"tv4": "~1.0.15",
"hasher": "~1.2.0",
"crossroads": "~0.12.0",
"fontawesome": "~4.0.3",
"stacktrace": "~0.6.0"
"stacktrace": "~0.6.0",
"momentjs": "~2.6.0"
}
}
10 changes: 6 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@
"homepage": "https://github.com/0xdata/h2o",
"dependencies": {
"coffee-script": "~1.7.1",
"mocha": "~1.18.2",
"istanbul": "~0.2.7",
"uglify-js": "~2.4.13",
"jade": "~1.3.1",
"stylus": "~0.43.0",
"coffeelint": "~1.1.0",
"nib": "~1.0.2",
"groc": "~0.6.3",
"chai": "~1.9.1",
"lodash": "~2.4.1",
"tv4": "~1.0.16",
"watchy": "~0.4.3"
"watchy": "~0.4.3",
"request": "~2.34.0",
"tape": "~2.12.3",
"browserify": "~3.44.2",
"faucet": "0.0.1",
"jshint": "~2.5.0"
}
}
Binary file added client/src/images/h2o-spin-16.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/images/h2o-spin-32.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/images/h2o-spin-48.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/images/h2o-spin-64.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions client/src/scripts/alert-dialog.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Steam.AlertDialog = (_, _title, _message, _go) ->

confirm = -> _go 'confirm'
cancel = -> _go 'cancel'

title: _title
message: _message
confirm: confirm
cancel: cancel
template: 'alert-dialog'

26 changes: 23 additions & 3 deletions client/src/scripts/application-context.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@ Steam.ApplicationContext = ->
fatal: do edge$
notify: do edge$

schedule: do edge$
unschedule: do edge$
timeout: do edge$

status: do edge$

route: do edge$
setRoute: do edge$
getRoute: do edge$
onRouteSucceeded: do edge$
onRouteFailed: do edge$

requestJSON: do edge$
loadDialog: do edge$
unloadDialog: do edge$
positionDialog: do edge$

alert: do edge$
confirm: do edge$
fail: do edge$

invokeH2O: do edge$

requestFrames: do edge$
requestFramesAndCompatibleModels: do edge$
Expand Down Expand Up @@ -46,25 +60,31 @@ Steam.ApplicationContext = ->
displayEmpty: do edge$

loadFrames: do edge$
framesLoaded: do edge$
displayFrame: do edge$
promptForFrame: do edge$

loadModels: do edge$
displayModel: do edge$
modelSelectionChanged: do edge$
modelSelectionCleared: do edge$
modelsSelected: do edge$
modelsDeselected: do edge$
deselectAllModels: do edge$
clearModelSelection: do edge$

loadNotifications: do edge$
displayNotification: do edge$

loadScorings: do edge$
scoringsLoaded: do edge$
displayScoring: do edge$
scoringSelectionChanged: do edge$
scoringSelectionCleared: do edge$
scoringsSelected: do edge$
scoringsDeselected: do edge$
deselectAllScorings: do edge$
clearScoringSelection: do edge$
deleteScorings: do edge$
deleteActiveScoring: do edge$



8 changes: 6 additions & 2 deletions client/src/scripts/application.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Steam.Application = (_) ->

Steam.ErrorMonitor _
if window
Steam.ErrorMonitor _
#Steam.MouseMonitor _

Steam.Timers _
Steam.EventLog _
Steam.Cache _
Steam.LocalStorage _
Expand All @@ -11,8 +15,8 @@ Steam.Application = (_) ->
#_.route 'home'

_view = Steam.MainView _

Steam.Router _, Steam.Routes _
Steam.DialogManager _

context: _
view: _view
Expand Down
52 changes: 52 additions & 0 deletions client/src/scripts/dialog-manager.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Steam.DialogManager = (_) ->

initialize = ->
linkDialog _.alert, Steam.AlertDialog
linkDialog _.fail, Steam.ErrorDialog
linkDialog _.promptForFrame, Steam.SelectFrameDialog

# --- Add additional dialogs here ---

linkDialog = (edge, createDialog) ->
link$ edge, (requestArgs..., go) ->
throw new Error 'No continuation provided.' unless isFunction go
requestArgs.unshift _
requestArgs.push (responseArgs...) ->
_.unloadDialog dialog
go.apply null, responseArgs
_.loadDialog dialog = createDialog.apply null, requestArgs

link$ _.positionDialog, (element) ->
return unless element.nodeType is 1
$dialogContainer = $ element
$dialog = $ $dialogContainer.children()[0]
[ $dialogHeader, $dialogBody ] = map $dialog.children(), (child) -> $ child
dialogWidth = parseInt $dialog.attr 'data-dialog-width'
dialogHeight = parseInt $dialog.attr 'data-dialog-height'

parentWidth = $dialog.parent().parent().width()

unless dialogWidth > 0
dialogWidth = parentWidth * 0.75

# Set the dialog width so that the .height() measurement returns an accurate height.
$dialog.width dialogWidth

unless dialogHeight > 0
dialogHeight = $dialog.height()

dialogLeft = -dialogWidth / 2
dialogTop = -dialogHeight / 2
dialogHeaderHeight = $dialogHeader.height()
dialogBodyHeight = dialogHeight - dialogHeaderHeight

$dialog.attr 'style', "position:absolute;width:#{dialogWidth}px;height:#{dialogHeight}px;left:#{dialogLeft}px;top:#{dialogTop}px"
$dialogHeader.attr 'style', 'position:absolute;top:0;left:0;right:0'
$dialogBody.attr 'style', "position:absolute;left:0;right:0;bottom:0;top:#{dialogHeaderHeight}px"

initialize()

return



3 changes: 0 additions & 3 deletions client/src/scripts/dom.coffee

This file was deleted.

22 changes: 0 additions & 22 deletions client/src/scripts/dom.global.coffee

This file was deleted.

13 changes: 13 additions & 0 deletions client/src/scripts/error-dialog.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Steam.ErrorDialog = (_, _title, _message, error, _go) ->

confirm = -> _go 'confirm'
cancel = -> _go 'cancel'

title: _title
message: _message
confirm: confirm
cancel: cancel
error: error
template: 'error-dialog'


12 changes: 7 additions & 5 deletions client/src/scripts/error-monitor.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Steam.ErrorMonitor = (_) ->
window.onerror = (message, url, lineNumber) ->
_.fatal message,
url: url
lineNumber: lineNumber




if window
window.onerror = (message, url, lineNumber) ->
_.fatal message,
url: url
lineNumber: lineNumber


13 changes: 8 additions & 5 deletions client/src/scripts/frame-list-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Steam.FrameListView = (_) ->
when 'compatibleWithModel'
"Showing datasets compatible with\n#{predicate.modelKey}"
else
''
throw new Error 'Invalid predicate type'

displayItem = (item) ->
if item
Expand Down Expand Up @@ -45,12 +45,13 @@ Steam.FrameListView = (_) ->
displayFrames = (frames) ->
_items items = map frames, createItem
activateAndDisplayItem head items
_.framesLoaded()

apply$ _predicate, (predicate) ->
loadFrames = (predicate) ->
console.assert isDefined predicate
switch predicate.type
when 'all'
_.requestFrames (error, data) ->
_.requestFramesAndCompatibleModels (error, data) ->
if error
#TODO handle errors
else
Expand All @@ -62,13 +63,15 @@ Steam.FrameListView = (_) ->
#TODO handle errors
else
displayFrames (head data.models).compatible_frames

_predicate predicate
return

clearPredicate = -> _predicate type: 'all'
clearPredicate = -> loadFrames type: 'all'

link$ _.loadFrames, (predicate) ->
if predicate
_predicate predicate
loadFrames predicate
else
displayActiveItem()

Expand Down
25 changes: 11 additions & 14 deletions client/src/scripts/frame-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,39 @@ Steam.FrameView = (_, _frame) ->
_compatibleModelsCount = node$ ''

initialize = (frame) ->
_.requestFrameAndCompatibleModels frame.key, (error, data) ->
if error
#TODO handle errors
else
#TODO typecheck
unless isEmpty data.frames
aFrame = head data.frames
_compatibleModels createCompatibleModelsSection aFrame
_compatibleModelsCount "(#{aFrame.compatible_models.length})"
return
_compatibleModels createCompatibleModelsSection frame
_compatibleModelsCount "(#{frame.compatible_models.length})"

# Columns section
createColumnsSection = (columnNames) ->
rows = map columnNames, (columnName) -> [ columnName ]
[ table, tbody, tr, td ] = geyser.generate words 'table.table.table-condensed.table-hover tbody tr td'
[ table, tbody, tr, td ] = geyser.generate words 'table.table.table-condensed tbody tr td'
table [
tbody map rows, (row) ->
tr map row, td
]

createCompatibleModelsSection = (frame) ->
headers = [
'Key'
'Method'
'Category'
'Response Column'
'State'
#TODO uncomment when this is functional
# 'State'
]

rows = map frame.compatible_models, (model) ->
[
model.key
model.model_algorithm
model.model_category
model.response_column_name
model.state
#TODO uncomment when this is functional
# model.state
]

[ table, thead, tbody, tr, th, td ] = geyser.generate words 'table.table.table-condensed.table-hover thead tbody tr th td'
[ table, thead, tbody, tr, th, td ] = geyser.generate words 'table.table.table-condensed thead tbody tr th td'

table [
thead [
Expand All @@ -57,6 +53,7 @@ Steam.FrameView = (_, _frame) ->

data: _frame
key: _frame.key
timestamp: _frame.creation_epoch_time_millis
title: _frame.key
columns: createColumnsSection _frame.column_names
columnCount: "(#{_frame.column_names.length})"
Expand Down
Loading

0 comments on commit 5a9906d

Please sign in to comment.