Skip to content

Commit

Permalink
Merge pull request #2709 from isenseDev/revert-2680-ds2670
Browse files Browse the repository at this point in the history
Revert "Detect when vis fails to render"
  • Loading branch information
doug-salvati authored Sep 22, 2017
2 parents c3245ee + 7b098a3 commit 501f9e0
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 156 deletions.
10 changes: 0 additions & 10 deletions app/assets/javascripts/visualizations/highvis/bar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ $ ->
super(@canvas)

start: ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break
@configs.analysisType ?= @ANALYSISTYPE_TOTAL
@configs.histogramDensity ?= false

Expand Down
46 changes: 0 additions & 46 deletions app/assets/javascripts/visualizations/highvis/baseVis.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,52 +68,6 @@ $ ->
analysisTypeNames: ['Total', 'Maximum', 'Mininum', 'Mean (Average)',
'Mean with Deviation', 'Median', 'Row Count']

###
Makes sure default fields are still in existence
Return values:
0 -> Everything checks out.
There is a field selected and it exists.
-1 -> There is no field selected.
This is not ALWAYS an error, think about table.
-2 -> There is a field selected which does not exist.
User needs to reset their defaults.
-3 -> Case -1 occurred but the problem could not be
auto-fixed.
-4 -> Case -2 occurred but the problem could not be
auto-fixed. This case could cause serious prolems
and should be handled.
###
validate_fields: (should_fix_problem) ->
fieldIds = for field in data.fields
field.fieldID
l = globals.configs.fieldSelection.length

for id in globals.configs.fieldSelectionIds
if not (id in fieldIds)
if should_fix_problem
# Choose the first normal field
idx = data.normalFields.slice(1)[0]
id = fieldIds[idx]
if not id?
return -4
else
globals.configs.fieldSelection = [idx]
globals.configs.fieldSelectionIds = [id]
return -2

if l is 0
if should_fix_problem
# Choose the first normal field
idx = data.normalFields.slice(1)[0]
id = fieldIds[idx]
if not id?
return -3
else
globals.configs.fieldSelection = [idx]
globals.configs.fieldSelectionIds = [id]
return -1
return 0

###
Start sequence used by runtime
###
Expand Down
13 changes: 0 additions & 13 deletions app/assets/javascripts/visualizations/highvis/box.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ $ ->
@configs.whiskerMode ?= 'iqr'

start: ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break
@configs.analysisType ?= @ANALYSISTYPE_TOTAL
@configs.histogramDensity ?= false

@configs.displayField = Math.min globals.configs.fieldSelection...
super()

Expand Down
15 changes: 0 additions & 15 deletions app/assets/javascripts/visualizations/highvis/histogram.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,6 @@ $ ->
updatedTooltips: false

start: ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break

@configs.analysisType ?= @ANALYSISTYPE_TOTAL
@configs.histogramDensity ?= false


@configs.displayField = Math.min globals.configs.fieldSelection...
@configs.binSize ?= @defaultBinSize()
super()
Expand Down
12 changes: 0 additions & 12 deletions app/assets/javascripts/visualizations/highvis/map.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ $ ->
delete @timeLines

start: ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break

# Draw the static compass
$('#compass').show()

# Map needs this canvas visible to draw correctly
Expand Down
13 changes: 0 additions & 13 deletions app/assets/javascripts/visualizations/highvis/photos.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ $ ->
constructor: (@canvas) ->

start: ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break
@configs.analysisType ?= @ANALYSISTYPE_TOTAL
@configs.histogramDensity ?= false

super()

# Photos doesn't have any fancy group by options, so set it to a default
Expand Down
13 changes: 0 additions & 13 deletions app/assets/javascripts/visualizations/highvis/pie.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ $ ->
else 'Percent'

start: () ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break
@configs.analysisType ?= @ANALYSISTYPE_TOTAL
@configs.histogramDensity ?= false

@configs.displayField = Math.min globals.configs.fieldSelection...
@configs.analysisType ?= @ANALYSISTYPE_TOTAL
super()
Expand Down
11 changes: 0 additions & 11 deletions app/assets/javascripts/visualizations/highvis/scatter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ $ ->
@configs.fullDetail ?= 0

start: (animate = true) ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break

@configs.xAxisId ?= data.fields[@configs.xAxis].fieldID
# Reset the xAxis in case a new field was added or fields were reordered
if not @isScatter? then @configs.xAxis = data.timeFields[0]
Expand Down
10 changes: 0 additions & 10 deletions app/assets/javascripts/visualizations/highvis/summary.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ $ ->
@isSummary = true

start: ->
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break

@configs.displayField = Math.min(globals.configs.fieldSelection...)
super()

Expand Down
13 changes: 0 additions & 13 deletions app/assets/javascripts/visualizations/highvis/table.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ $ ->
globals.dateFormatter cellvalue

start: ->
# Validate fields exist
switch @validate_fields(true)
when -2
alert "The default field that you chose has been removed from the project, so a different
one was selected. If you are the owner, consider clicking 'Make Default' in the Save menu to reset."
when -4
alert "A critical error has occured and the chart can't be drawn.\nIf you are the owner,
please login and reset your defaults.\nYou probably deleted a field."
window.location.href = window.location.href.replace(/\/[A-Za-z0-9_]*\/?$/, "/edit")
else break
@configs.analysisType ?= @ANALYSISTYPE_TOTAL
@configs.histogramDensity ?= false

# Make table visible? (or something)
$('#' + @canvas).show()

Expand Down

0 comments on commit 501f9e0

Please sign in to comment.