Skip to content

Commit

Permalink
1.40.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
baumandm committed Oct 17, 2016
1 parent 6aa99e4 commit df26fc4
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 75 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 1.40.0 (10/12/2016)

## Features

- Analytics: collect new analytics events for: Login, Logout, Create Dashboard, Modify Dashboard, Push Dashboard

- Dashboard Sidebar: Increased width of sidebar; expanded the first section in the sidebar initially.

- Dashboard Editor: Drag-and-drop to reorder Data Sources, Pages, Widgets, etc.

- Dashboard Editor: Added spinner when saving a Dashboard; prevent accidentally double-saving

# 1.39.0 (09/28/2016)

## Features
Expand Down
4 changes: 2 additions & 2 deletions cyclotron-site/app/partials/dashboardSidebar.jade
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

.sidebar-accordion

accordion-group(ng-repeat='content in dashboard.sidebar.sidebarContent track by $index', heading='{{ content.heading }}')
accordion-group(ng-repeat='content in sidebarContent track by $index', heading='{{ content.heading }}', is-open='content.isOpen')
div(ng-bind-html='trustHtml(content.html)')

accordion-group.show-hide-widgets(heading='Show/Hide Widgets', ng-if='dashboard.sidebar.showHideWidgets == true')
accordion-group.show-hide-widgets(heading='Show/Hide Widgets', ng-if='dashboard.sidebar.showHideWidgets == true', is-open='isShowHideWidgetsOpen')

ul.widget-list(dnd-list='calculatedWidgets')
li(ng-repeat='widget in calculatedWidgets',
Expand Down
4 changes: 3 additions & 1 deletion cyclotron-site/app/partials/editor/guiEditor.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
.dashboard-well
.button-bar(ng-if='editor.initialized')
button.btn(ng-class='{"btn-default": !canSave(), "btn-success": canSave()}', ng-click='save()')
i.fa.fa-check-square-o
i.fa.fa-check-square-o(ng-hide='isSaving')
span(ng-show='isSaving')
i.fa.fa-cog.fa-spin
| Save

.btn-group(uib-dropdown, ng-if='canPreview()')
Expand Down
15 changes: 8 additions & 7 deletions cyclotron-site/app/partials/editor/objectArray.jade
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
div
ul.list-group
li.list-group-item(ng-repeat='item in model')
ul.list-group(dnd-list='model')
li.list-group-item(ng-repeat='item in model',
dnd-draggable='item'
dnd-moved='model.splice($index, 1)'
dnd-effect-allowed='move')

.clearfix
span.icon
i.fa.fa-bars

span.object-array-name(ng-click='goToSubState(substate, item, $index)', title='Edit this {{ label }}')
| {{ headingfn({item: item, index: $index, label: label}) }}

span.button-group.pull-right
button#move-up.btn.btn-default(type='button', ng-click='moveUp($index)', title='Move {{ label }} Up')
i.fa.fa-angle-double-up

button#move-down.btn.btn-default(type='button', ng-click='moveDown($index)', title='Move {{ label }} Down')
i.fa.fa-angle-double-down

button#clone.btn.btn-default(type='button', ng-click='cloneItem($index)', title='Clone {{ label }}')
i.fa.fa-copy
Expand Down
8 changes: 7 additions & 1 deletion cyclotron-site/app/scripts/common/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ cyclotronApp.config ($stateProvider, $urlRouterProvider, $locationProvider, $con
}
$locationProvider.hashPrefix = '!'

cyclotronApp.run ($rootScope, $urlRouter, $location, $state, $stateParams, $uibModal, configService, userService) ->
cyclotronApp.run ($rootScope, $urlRouter, $location, $state, $stateParams, $uibModal, analyticsService, configService, userService) ->

#
# Authentication-related scope variables
Expand All @@ -338,6 +338,12 @@ cyclotronApp.run ($rootScope, $urlRouter, $location, $state, $stateParams, $uibM

$rootScope.logout = userService.logout

$rootScope.$on 'login', (event) ->
analyticsService.recordEvent 'login', { }

$rootScope.$on 'logout', (event) ->
analyticsService.recordEvent 'logout', { }

$rootScope.userTooltip = ->
return '' unless userService.authEnabled
'Logged In: ' + userService.currentUser().name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cyclotronServices.factory 'commonConfigService', ->

exports = {

version: '1.39.0'
version: '1.40.0'

logging:
enableDebug: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
p = dashboardResource.query({ q: query }).$promise

p.then (dashboards) ->
deferred.resolve(dashboards)
deferred.resolve dashboards

p.catch (error) ->
alertify.error(error?.data || 'Cannot connect to cyclotron-svc (getDashboards)', 2500)
deferred.reject(error)
deferred.reject error

return deferred.promise

Expand All @@ -160,10 +160,10 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
).$promise

p.then (dashboard) ->
deferred.resolve(dashboard)
deferred.resolve dashboard

p.catch (error) ->
deferred.reject(error)
deferred.reject error

return deferred.promise

Expand All @@ -174,6 +174,7 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
p = dashboardResource.save({ session: userService.currentSession()?.key }, dashboard).$promise

p.then ->
analyticsService.recordEvent 'createDashboard', { dashboardName: dashboard.name }
alertify.log('Created Dashboard', 2500)
deferred.resolve()

Expand All @@ -184,7 +185,7 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
userService.setLoggedOut()
else
alertify.error(error.data, 2500)
deferred.reject(error)
deferred.reject error

if userService.hasEditPermission(dashboard)
doSave()
Expand All @@ -208,7 +209,8 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
}, dashboard).$promise

p.then ->
alertify.log("Saved Dashboard", 2500)
analyticsService.recordEvent 'modifyDashboard', { dashboardName: dashboard.name, rev: dashboard.rev }
alertify.log 'Saved Dashboard', 2500
deferred.resolve()

p.catch (error) ->
Expand All @@ -218,10 +220,10 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
alertify.error('Dashboard not saved')
userService.setLoggedOut()
when 403
alertify.error("You don't have permission to edit this Dashboard")
alertify.error('You don\'t have permission to edit this Dashboard')
else
alertify.error(error.data, 2500)
deferred.reject(error)
deferred.reject error

if userService.hasEditPermission(dashboard)
doUpdate()
Expand All @@ -231,7 +233,7 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
if e
doUpdate()
else
deferred.reject('Cancelled')
deferred.reject 'Cancelled'

return deferred.promise

Expand All @@ -244,8 +246,9 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
}).$promise

p.then (dashboard) ->
analyticsService.recordEvent 'deleteDashboard', { dashboardName: dashboard.name }
alertify.log('Deleted Dashboard', 2500)
deferred.resolve(dashboard)
deferred.resolve dashboard

p.catch (error) ->
switch error.status
Expand All @@ -257,7 +260,7 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
alertify.error("You don't have permission to delete this Dashboard")
else
alertify.error(error.data, 2500)
deferred.reject(error)
deferred.reject error

return deferred.promise

Expand All @@ -267,11 +270,11 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
p = revisionsResource.query({name: dashboardName}).$promise

p.then (dashboards) ->
deferred.resolve(dashboards)
deferred.resolve dashboards

p.catch (error) ->
alertify.error(error?.data || 'Cannot connect to cyclotron-svc (getRevisions)', 2500)
deferred.reject(error)
deferred.reject error

return deferred.promise

Expand All @@ -281,10 +284,10 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe
url = configService.restServiceUrl + '/dashboards/' + dashboardName + '/revisions/' + rev1 + '/diff/' + rev2
$http.get(url).then (response) ->
# Returns formatted HTML diff
deferred.resolve(response.data)
deferred.resolve response.data
.catch (error) ->
alertify.error(error?.data || 'Cannot connect to cyclotron-svc (getRevisionDiff)', 2500)
deferred.reject(error)
deferred.reject error

return deferred.promise

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# language governing permissions and limitations under the License.
###

cyclotronServices.factory 'userService', ($http, $q, $localForage, configService, logService) ->
cyclotronServices.factory 'userService', ($http, $localForage, $q, $rootScope, configService, logService) ->

loggedIn = false
currentSession = null
Expand Down Expand Up @@ -93,6 +93,8 @@ cyclotronServices.factory 'userService', ($http, $q, $localForage, configService
exports.cachedUserId = session.user._id

loggedIn = true

$rootScope.$broadcast 'login', { }
alertify.success('Logged in as <strong>' + session.user.name + '</strong>', 2500)

deferred.resolve(session)
Expand Down Expand Up @@ -145,6 +147,7 @@ cyclotronServices.factory 'userService', ($http, $q, $localForage, configService
exports.setLoggedOut()
$localForage.removeItem('session')

$rootScope.$broadcast('logout')
alertify.log('Logged Out', 2500)
deferred.resolve()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ cyclotronDirectives.directive 'dashboardSidebar', ($timeout, layoutService) ->
link: (scope, element, attrs) ->
# Initial position
isSidebarExpanded = false

scope.sidebarContent = _.cloneDeep scope.dashboard.sidebar.sidebarContent
if scope.sidebarContent?.length > 0
scope.sidebarContent[0].isOpen = true
else
scope.isShowHideWidgetsOpen = true

$element = $(element)
$parent = $element.parent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# Analytics controller
#
cyclotronApp.controller 'AnalyticsController', ($scope, analyticsService) ->
cyclotronApp.controller 'AnalyticsController', ($scope, $uibModal, analyticsService) ->

$scope.smallLimit = 10
$scope.largeLimit = 20
Expand Down
30 changes: 19 additions & 11 deletions cyclotron-site/app/scripts/mgmt/controller.guiEditor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cyclotronApp.controller 'GuiEditorController', ($scope, $state, $stateParams, $l
$scope.editor.initialized and
$scope.editor.hasEditPermission and
$scope.isDirty() and
!$scope.isSaving and
!$scope.hasDuplicateDataSourceName()

$scope.canExport = ->
Expand Down Expand Up @@ -323,18 +324,17 @@ cyclotronApp.controller 'GuiEditorController', ($scope, $state, $stateParams, $l
$scope.editor.latestRevisionDeleted = true
$scope.editor.isDirty = true



$scope.save = ->
if not $scope.isDirty()
# Dashboard not modified; don't save
return
# Ensure Dashboard has been modified
return unless $scope.isDirty()

if not $scope.isLoggedIn()
# Login then attempt to save again
$scope.login(true).then ->
$scope.editor.hasEditPermission = userService.hasEditPermission $scope.editor.dashboardWrapper
$scope.save()
else if $scope.canSave()
$scope.isSaving = true
try
# Create or Update the Dashboard, then reload
if ($scope.editor.isNew)
Expand All @@ -354,22 +354,30 @@ cyclotronApp.controller 'GuiEditorController', ($scope, $state, $stateParams, $l
$scope.editor.hasEditPermission = userService.hasEditPermission $scope.editor.dashboardWrapper

else
dashboardService.update($scope.editor.dashboardWrapper).then ->
$scope.editor.dashboardWrapper.rev = ++$scope.editor.latestRevision
dashboardToSave = _.cloneDeep $scope.editor.dashboardWrapper
dashboardService.update(dashboardToSave).then ->
$scope.editor.latestRevision = $scope.editor.revision = ++dashboardToSave.rev
$scope.editor.latestRevisionDeleted = false

$scope.editor.dashboardWrapper.rev = $scope.editor.latestRevision
$scope.editor.dashboardWrapper.deleted = false
$scope.editor.dashboardWrapper.lastUpdatedBy = userService.currentUser()
$scope.editor.latestRevision = $scope.editor.revision = $scope.editor.dashboardWrapper.rev
$scope.editor.latestRevisionDeleted = false
$scope.editor.cleanDashboardWrapper = _.cloneDeep $scope.editor.dashboardWrapper
$scope.editor.cleanDashboardWrapper = dashboardToSave
$scope.editor.cleanDashboardWrapper.rev = $scope.editor.latestRevision
$scope.editor.cleanDashboardWrapper.deleted = false
$scope.editor.cleanDashboardWrapper.lastUpdatedBy = userService.currentUser()

$scope.editor.hasEditPermission = userService.hasEditPermission $scope.editor.dashboardWrapper
$scope.editor.isDirty = false
$scope.isSaving = false
$location.search('rev', null)

catch e
$scope.isSaving = false

# Possibly a javascript parsing error on the eval
alertify.error(e.toString(), 10000)


$scope.newPage = ->
dashboardService.addPage $scope.editor.dashboard

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# PushDashboard controller -- for modal dialog
#
cyclotronApp.controller 'PushDashboardController', ($scope, $uibModalInstance, $q, $http, $timeout, configService, dashboardService, focusService, userService) ->
cyclotronApp.controller 'PushDashboardController', ($scope, $uibModalInstance, $q, $http, $timeout, analyticsService, configService, dashboardService, focusService, userService) ->

$scope.environmentsForPush = _.reject configService.cyclotronEnvironments, { canPush: false }

Expand Down Expand Up @@ -72,6 +72,7 @@ cyclotronApp.controller 'PushDashboardController', ($scope, $uibModalInstance, $
p.then (sessionKey) ->
q = dashboardService.pushToService($scope.editor.dashboardWrapper, $scope.fields.pushLocation.serviceUrl, sessionKey)
q.then ->
analyticsService.recordEvent 'pushDashboard', { dashboardName: $scope.editor.dashboardWrapper.name, destination: $scope.fields.pushLocation.serviceUrl }
alertify.log("Pushed Dashboard to " + $scope.fields.pushLocation.name, 2500)

$uibModalInstance.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ cyclotronDirectives.directive 'editorViewInlineArray', ->
$scope.removeItem = (index) ->
$scope.model.splice(index, 1)

# Moves an item to a new location
$scope.moveItem = (oldIndex, newIndex) ->
return unless $scope.model?
return if newIndex < 0 || newIndex >= $scope.model.length

item = $scope.model.splice(oldIndex, 1)[0]
$scope.model.splice(newIndex, 0, item)

$scope.moveUp = (index) ->
$scope.moveItem(index, index - 1)

$scope.moveDown = (index) ->
$scope.moveItem(index, index + 1)

$scope.addNewObject = ->
$scope.model = [] unless $scope.model?
if $scope.definition.sample?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ cyclotronDirectives.directive 'editorViewObjectArray', ->
cloned.name = clonedName + cloneIndex
$scope.model.splice(spliceIndex+1, 0, cloned)

# Moves an item to a new location
$scope.moveItem = (oldIndex, newIndex) ->
return unless $scope.model?
return if newIndex < 0 || newIndex >= $scope.model.length

item = $scope.model.splice(oldIndex, 1)[0]
$scope.model.splice(newIndex, 0, item)

$scope.moveUp = (index) ->
$scope.moveItem(index, index - 1)

$scope.moveDown = (index) ->
$scope.moveItem(index, index + 1)

$scope.goToSubState = (state, item, index) ->
$scope.$parent.goToSubState(state, item, index)

Expand Down
Loading

0 comments on commit df26fc4

Please sign in to comment.