Skip to content

Commit

Permalink
1.31.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
baumandm committed May 31, 2016
1 parent a04a685 commit d607432
Show file tree
Hide file tree
Showing 16 changed files with 324 additions and 69 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# 1.31.0 (05/26/2016)

## Features

- Table Widget: Added optional pagination--can automatically or manually specify the number of rows displayed per page. Improves performance when displaying large Data Sources.

- Number Widget: Added Click event handler: can provide a JavaScript function that gets executed when the Number is clicked.

- Dashboard Controls: Added an option to disable the UI controls completely

## Bug Fixes

- Elasticsearch: Fixed error handling for HTTP status code 400

- _.flattenObject: Fixed premature return when handling false values

## Breaking Changes

- Removed overrides to the Highcharts' dateFormats property

# 1.30.0 (05/12/2016)

## Features
Expand Down
2 changes: 1 addition & 1 deletion cyclotron-site/app/partials/dashboard.jade
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//- Dashboards
div.dashboard

.dashboard-controls
.dashboard-controls(ng-hide='dashboard.showDashboardControls == false')
i.fa.fa-chevron-left(ng-click='moveBack()', ng-class='{ disabled: !canMoveBack() }', title='Go to the previous page')
i.fa.fa-pause(ng-click='pause()', ng-show='!paused', title='Pause Dashboard page rotation')
i.fa.fa-play(ng-click='play()', ng-show='paused', ng-class='{ disabled: !canMoveForward() }', title='Start Dashboard page rotation')
Expand Down
1 change: 1 addition & 0 deletions cyclotron-site/app/scripts/common/mixins.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,6 @@ _.mixin({
_.assign newObj, _.flattenObject value
else
newObj[key] = value
return
newObj
})
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cyclotronServices.factory 'commonConfigService', ->

exports = {

version: '1.30.0'
version: '1.31.0'

logging:
enableDebug: false
Expand Down Expand Up @@ -153,6 +153,14 @@ cyclotronServices.factory 'commonConfigService', ->
default: true
defaultHidden: true

showDashboardControls:
label: 'Show Dashboard Controls'
description: 'If false, hides the default Dashboard controls (rotation, export, etc)'
type: 'boolean'
required: false
default: true
defaultHidden: true

pages:
label: 'Pages'
description: 'The list of Page definitions which compose the Dashboard.'
Expand Down Expand Up @@ -2365,6 +2373,7 @@ cyclotronServices.factory 'commonConfigService', ->
inlineJs: true
required: false
defaultHidden: true
order: 4
tooltip:
label: 'Tooltip'
description: 'Sets the tooltip of the number.'
Expand All @@ -2373,19 +2382,22 @@ cyclotronServices.factory 'commonConfigService', ->
inlineJs: true
required: false
defaultHidden: true
order: 5
icon:
label: 'Icon'
description: 'Optional Font Awesome icon class to be displayed with the number.'
placeholder: 'Icon Class'
inlineJs: true
type: 'string'
defaultHidden: true
order: 6
iconColor:
label: 'Icon Color'
description: 'Optionally specifies a color for the icon if the icon property is also set. The value can be a named color (e.g. "red"), a hex color (e.g. "#AA0088") or a data source column/inline javascript (e.g. "#{statusColor}").'
type: 'string'
inlineJs: true
defaultHidden: true
order: 7
iconTooltip:
label: 'IconTooltip'
description: 'Sets the tooltip of the icon.'
Expand All @@ -2394,6 +2406,15 @@ cyclotronServices.factory 'commonConfigService', ->
inlineJs: true
required: false
defaultHidden: true
order: 8
onClick:
label: 'Click Event'
description: 'This event occurs when the user clicks on the number. If this property is set with a JavaScript function, the function will be called as an event handler.'
type: 'editor'
editorMode: 'javascript'
required: false
defaultHidden: true
order: 9
orientation:
label: 'Orientation'
description: 'Controls the direction in which the numbers are arranged.'
Expand Down Expand Up @@ -2759,22 +2780,56 @@ cyclotronServices.factory 'commonConfigService', ->
default: true
required: false
order: 14
rowHeight:
label: 'Minimum Row Height'
description: 'Specifies the (minimum) height in pixels of all rows (including the header row). The actual height of a row may be greater than this value, depending on the contents. If this is not set, each row will automatically size to its contents.'
type: 'integer'
required: false
order: 15
pagination:
label: 'Pagination'
description: 'Controls pagination of the Table.'
type: 'propertyset'
required: false
defaultHidden: true
order: 16
properties:
enabled:
label: 'Enable Pagination'
description: 'Enables or disables pagination for this Table Widget.'
type: 'boolean'
default: false
required: false
order: 1
autoItemsPerPage:
label: 'Auto Items Per Page'
description: 'Enables automatic detection of the number of rows to display in order to fit in the widget dimensions. Requires rowHeight property to be configured to work accurately. To manually size, set false and configure itemsPerPage instead.'
type: 'boolean'
default: true
required: false
order: 2
itemsPerPage:
label: 'Items Per Page'
description: 'Controls how many row are displayed on each page. If autoItemsPerPage is true, this is ignored.'
type: 'integer'
required: false
order: 3
filters:
label: 'Filters'
description: 'Optional, but if provided, specifies name-value pairs used to filter the data source\'s result set. Each key specifies a column in the data source, and the value specifies either a single value (string) or a set of values (array of strings). Only rows which have the specifies value(s) will be permitted.'
type: 'hash'
inlineJsKey: true
inlineJsValue: true
required: false
order: 15
order: 17
sortBy:
label: 'Sort By'
description: 'Optional, specifies the field(s) to sort the data by. If the value is a string, it will sort by that single field. If it is an array of strings, multiple fields will be used to sort, with left-to-right priority. The column name can be prefixed with a + or a - sign to indicate the direction or sort. + is ascending, while - is descending. The default sort direction is ascending, so the + sign does not need to be used. If this property is omitted, the original sort order of the data will be used.'
type: 'string[]'
inlineJs: true
required: false
placeholder: 'Column name'
order: 16
order: 18
sortFunction:
label: 'Sort Function'
description: 'Optional, specifies an alternative function to the default sort implementation.'
Expand All @@ -2783,7 +2838,7 @@ cyclotronServices.factory 'commonConfigService', ->
editorMode: 'javascript'
required: false
defaultHidden: true
order: 17
order: 19

tableau:
name: 'tableau'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,32 @@ cyclotronDataSources.factory 'elasticsearchDataSource', ($q, $http, configServic

# Successful Result
successCallback = (result) ->
responseAdapter = _.jsExec options.responseAdapter

if result.body.responses?
# E.g. _msearch responses
data = _.map result.body.responses, (response) ->
processResponse response, responseAdapter, reject
data = _.flatten data
else
data = processResponse result.body, responseAdapter, reject

if _.isNull data
logService.debug 'Elasticsearch result is null.'
data = []

resolve {
'0':
data: data
columns: null
}
if result.statusCode == 200
responseAdapter = _.jsExec options.responseAdapter

if result.body.responses?
# E.g. _msearch responses
data = _.map result.body.responses, (response) ->
processResponse response, responseAdapter, reject
data = _.flatten data
else
data = processResponse result.body, responseAdapter, reject

if _.isNull data
logService.debug 'Elasticsearch result is null.'
data = []

resolve {
'0':
data: data
columns: null
}
else
error = result.body?.error
if !error? then error = 'Status code: ' + result.statusCode
logService.error error
reject error


# Do the request, wiring up success/failure handlers
proxyUrl = (_.jsExec(options.proxy) || configService.restServiceUrl) + '/proxy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ cyclotronDirectives.directive 'dashboardPage', ($compile, $window, $timeout, con
if (newValue.enableMasonry != false)
masonry(element, scope.layout)

scope.layout = layoutService.getLayout(newValue, $($window).width(), $($window).height())
newLayout = layoutService.getLayout(newValue, $($window).width(), $($window).height())

# Optional persistent widget area of layout
newLayout.widget = scope.layout?.widget || {}
scope.layout = newLayout

# Set page margin if defined
if !_.isNullOrUndefined(scope.layout.margin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ cyclotronDirectives.directive 'widgetBody', ($timeout) ->
$widget = $widgetBody.parent()

sizer = ->
$title = $widget.find('.title')
$footer = $widget.find('.widget-footer')
$title = $widget.find '.title'
$footer = $widget.find '.widget-footer'
widgetBodyHeight = $widget.outerHeight() - $title.outerHeight() - $footer.outerHeight()
$widgetBody.height(Math.floor(widgetBodyHeight))
$widgetBody.height Math.floor(widgetBodyHeight)

if scope.layout?
scope.layout.widget.widgetBodyHeight = widgetBodyHeight

# Update on window resizing
$widget.add('.title, .widget-footer').on 'resize', _.throttle(->
Expand All @@ -36,11 +39,11 @@ cyclotronDirectives.directive 'widgetBody', ($timeout) ->

# Run now & again in 100ms
sizer()
timer = $timeout(sizer, 100)
timer = $timeout sizer, 100

scope.$on '$destroy', ->
$timeout.cancel timer
$widget.off('resize')
$widget.off 'resize'

return
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ cyclotronServices.factory 'layoutService', ->
# Enable/disable vertical scrolling
scrolling: dashboardPage.layout.scrolling

# Optional Widget-specific properties
widget: {}

if (dashboardPage.style == 'fullscreen')
# No margin on the fullscreen dashboards
layout.margin = 0
Expand Down
4 changes: 0 additions & 4 deletions cyclotron-site/app/widgets/chart/directives.highchart.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ Highcharts.setOptions {
shared: true
}

Highcharts.dateFormats =
W: (timestamp) -> moment(timestamp).isoWeek()
L: (timestamp) -> moment(timestamp).format('[Week] w (M/D - ') + moment(timestamp).add(6, 'days').format('M/D)')

# Inspired by: https://github.com/rootux/angular-highcharts-directive
cyclotronDirectives.directive 'highchart', (configService) ->
{
Expand Down
3 changes: 2 additions & 1 deletion cyclotron-site/app/widgets/number/number.jade
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
.the-number(ng-if='!nodata && !dataSourceError', ng-repeat='number in numbers',
single-number='singleNumber',
orientation='orientation',
class='{{ getClass() }}')
class='{{ getClass(number) }}',
ng-click='onClickEvent(number)')
span(ng-if='number.prefix') {{ number.prefix }}
h1.big(title='{{ number.tooltip }}',ng-style='{color: number.color || "inherit"}')
| {{ number.number }}
Expand Down
19 changes: 16 additions & 3 deletions cyclotron-site/app/widgets/number/numberWidget.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ cyclotronApp.controller 'NumberWidget', ($scope, dashboardService, dataService)
$scope.linkTarget = ->
if $scope.dashboard.openLinksInNewWindow == false then '_self' else '_blank'

$scope.getClass = ->
$scope.getClass = (number) ->
c = ''
if $scope.numbers.length == 1
return 'orientation-vertical'
c = 'orientation-vertical'
else
return 'orientation-' + $scope.orientation
c = 'orientation-' + $scope.orientation

if _.isFunction(number.onClick)
c += ' actionable'

return c

$scope.getUrl = ->
return '' if _.isEmpty($scope.widget.link)
Expand All @@ -65,11 +71,18 @@ cyclotronApp.controller 'NumberWidget', ($scope, dashboardService, dataService)
icon: _.compile(item.icon, row)
iconColor: _.compile(item.iconColor, row)
iconTooltip: _.compile(item.iconTooltip, row)
onClick: _.jsEval _.compile(item.onClick, row)
}

# Set flag for single number or not
$scope.singleNumber = ($scope.numbers.length == 1)

$scope.onClickEvent = (number) ->
console.log number
if _.isFunction(number.onClick)
# Invoke event handler; pass the number object as an argument
number.onClick({ number })

$scope.reload = ->
$scope.dataSource.execute(true)

Expand Down
18 changes: 18 additions & 0 deletions cyclotron-site/app/widgets/table/_table.less
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@
}

}

.paging {
text-align: center;
.box-sizing(border-box);
* {
.box-sizing(border-box);
}
*:before,
*:after {
.box-sizing(border-box);
}

.pagination a {
background-color: @headerColor;
color: contrast(@headerColor, @color, white);
border-bottom: 1px solid;
}
}
}

.widget-noscroll .table-widget {
Expand Down
26 changes: 26 additions & 0 deletions cyclotron-site/app/widgets/table/directives.tableRow.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'tableRow', ->
{
restrict: 'CA'
link: (scope, element, attrs) ->
$element = $(element)
$widgetBody = $element.parents '.widget-body'

if scope.widget.rowHeight?
$element.height scope.widget.rowHeight + 'px'
}
Loading

0 comments on commit d607432

Please sign in to comment.