From 6cc73f21bed8092b3c29d359b22c6dca8fe66bb5 Mon Sep 17 00:00:00 2001 From: Dave Bauman Date: Wed, 1 Feb 2017 17:14:02 -0500 Subject: [PATCH] 1.46.0 release --- CHANGELOG.md | 12 +++ cyclotron-site/app/scripts/common/app.coffee | 3 - .../services.commonConfigService.coffee | 2 +- .../services/services.dashboardService.coffee | 19 +++-- .../mgmt/controller.dashboardAnalytics.coffee | 77 +++++++++++++++---- .../scripts/mgmt/controller.guiEditor.coffee | 3 +- cyclotron-site/package.json | 2 +- cyclotron-svc/package.json | 6 +- 8 files changed, 94 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1052b50..dfb5262 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# 1.46.0 + +## Features + +## Bug Fixes + +- Dashboard Analytics: Fixed inability to view analytics for dashboards requiring authentication, even when logged in + +- Example example-datasource-json: Fixed broken weather API + +- Upgraded two library versions to fix builds in Node v6+ + # 1.45.0 (12/21/2016) ## Features diff --git a/cyclotron-site/app/scripts/common/app.coffee b/cyclotron-site/app/scripts/common/app.coffee index 400636a..e5537f3 100644 --- a/cyclotron-site/app/scripts/common/app.coffee +++ b/cyclotron-site/app/scripts/common/app.coffee @@ -179,9 +179,6 @@ cyclotronApp.config ($stateProvider, $urlRouterProvider, $locationProvider, $con resolve: session: loadExistingSession deps: lazyLoad ['/js/app.mgmt.js'], ['/css/app.mgmt.css'] - dashboard: ['$q', '$stateParams', 'dashboardService', ($q, $stateParams, dashboardService) -> - dashboardService.getDashboard $stateParams.dashboardName - ] }) .state('export', { url: '/export/{dashboardName:.*}' diff --git a/cyclotron-site/app/scripts/common/services/services.commonConfigService.coffee b/cyclotron-site/app/scripts/common/services/services.commonConfigService.coffee index f5c9a0d..578b346 100644 --- a/cyclotron-site/app/scripts/common/services/services.commonConfigService.coffee +++ b/cyclotron-site/app/scripts/common/services/services.commonConfigService.coffee @@ -39,7 +39,7 @@ cyclotronServices.factory 'commonConfigService', -> exports = { - version: '1.45.0' + version: '1.46.0' logging: enableDebug: false diff --git a/cyclotron-site/app/scripts/common/services/services.dashboardService.coffee b/cyclotron-site/app/scripts/common/services/services.dashboardService.coffee index dc246e9..83449f1 100644 --- a/cyclotron-site/app/scripts/common/services/services.dashboardService.coffee +++ b/cyclotron-site/app/scripts/common/services/services.dashboardService.coffee @@ -291,14 +291,23 @@ cyclotronServices.factory 'dashboardService', ($http, $resource, $q, analyticsSe return deferred.promise - service.getRevision = (dashboardName, rev, callback) -> - revisionResource.get { + service.getRevision = (dashboardName, rev) -> + deferred = $q.defer() + + p = revisionResource.get({ name: dashboardName rev: rev session: userService.currentSession()?.key - }, (revision) -> - if _.isFunction callback - callback(revision) + }).$promise + + p.then (revision) -> + deferred.resolve revision + + p.catch (error) -> + alertify.error(error?.data || 'Cannot connect to cyclotron-svc (getRevision)', 2500) + deferred.reject error + + return deferred.promise service.like = (dashboard) -> p = likesResource.save2({ diff --git a/cyclotron-site/app/scripts/mgmt/controller.dashboardAnalytics.coffee b/cyclotron-site/app/scripts/mgmt/controller.dashboardAnalytics.coffee index efffd39..dd29fc6 100644 --- a/cyclotron-site/app/scripts/mgmt/controller.dashboardAnalytics.coffee +++ b/cyclotron-site/app/scripts/mgmt/controller.dashboardAnalytics.coffee @@ -17,15 +17,9 @@ # # Analytics controller -- for Dashboard analytics # -cyclotronApp.controller 'DashboardAnalyticsController', ($scope, dashboard, analyticsService, dashboardService) -> - - $scope.dashboard = dashboard - $scope.dashboardId = dashboard._id - - $scope.createdDate = '?' - $scope.lastModifiedDate = moment(dashboard.date).format('MM/DD HH:mm:ss') - $scope.longModifiedDate = moment(dashboard.date).format('MM/DD/YYYY HH:mm:ss') +cyclotronApp.controller 'DashboardAnalyticsController', ($scope, $stateParams, $uibModal, analyticsService, dashboardService) -> + $scope.dashboardName = $stateParams.dashboardName $scope.pageViewsOptions = x_accessor: 'date' @@ -66,7 +60,7 @@ cyclotronApp.controller 'DashboardAnalyticsController', ($scope, dashboard, anal # Analytics relative to a startDate $scope.loadTimeseriesData = -> - return unless dashboard.visits > 0 + return unless $scope.dashboard.visits > 0 timeSpan = $scope.selectedTimespan.split('_') if timeSpan.length == 1 then timeSpan.unshift 1 @@ -112,11 +106,62 @@ cyclotronApp.controller 'DashboardAnalyticsController', ($scope, dashboard, anal $scope.visits = visits # Initialize - dashboardService.getRevision dashboard.name, 1, (rev) -> - $scope.rev1 = rev - $scope.createdDate = moment(rev.date).format('MM/DD HH:mm:ss') - $scope.longCreatedDate = moment(rev.date).format('MM/DD/YYYY HH:mm:ss') - - $scope.$watch 'selectedTimespan', (timespan) -> - $scope.loadTimeseriesData() + $scope.initialize = -> + q = dashboardService.getDashboard $scope.dashboardName + q.then (dashboard) -> + + $scope.dashboard = dashboard + $scope.dashboardId = dashboard._id + + $scope.createdDate = '?' + $scope.lastModifiedDate = moment(dashboard.date).format('MM/DD HH:mm:ss') + $scope.longModifiedDate = moment(dashboard.date).format('MM/DD/YYYY HH:mm:ss') + + q2 = dashboardService.getRevision dashboard.name, 1 + + q2.then (rev) -> + $scope.rev1 = rev + $scope.createdDate = moment(rev.date).format('MM/DD HH:mm:ss') + $scope.longCreatedDate = moment(rev.date).format('MM/DD/YYYY HH:mm:ss') + + # Add watcher on the timespan control + $scope.$watch 'selectedTimespan', (timespan) -> + $scope.loadTimeseriesData() + + q.catch (error) -> + switch error.status + when 401 + $scope.login(true).then -> + $scope.initialize() + return + when 403 + $scope.dashboardEditors = error.data.data.editors + $scope.dashboardName = $scope.dashboardName + + $uibModal.open { + templateUrl: '/partials/viewPermissionDenied.html' + scope: $scope + controller: 'GenericErrorModalController' + backdrop: 'static' + keyboard: false + } + when 404 + $uibModal.open { + templateUrl: '/partials/404.html' + scope: $scope + controller: 'GenericErrorModalController' + backdrop: 'static' + keyboard: false + } + else + + $uibModal.open { + templateUrl: '/partials/500.html' + scope: $scope + controller: 'GenericErrorModalController' + backdrop: 'static' + keyboard: false + } + + $scope.initialize() diff --git a/cyclotron-site/app/scripts/mgmt/controller.guiEditor.coffee b/cyclotron-site/app/scripts/mgmt/controller.guiEditor.coffee index 2df93be..a0f59f1 100644 --- a/cyclotron-site/app/scripts/mgmt/controller.guiEditor.coffee +++ b/cyclotron-site/app/scripts/mgmt/controller.guiEditor.coffee @@ -157,7 +157,8 @@ cyclotronApp.controller 'GuiEditorController', ($scope, $state, $stateParams, $l $scope.loadDashboard $scope.editor.cleanDashboardWrapper $location.search('rev', null) else - dashboardService.getRevision $stateParams.dashboardName, $scope.editor.revision, (dashboardWrapper) -> + q = dashboardService.getRevision $stateParams.dashboardName, $scope.editor.revision + q.then (dashboardWrapper) -> $scope.loadDashboard dashboardWrapper $location.search('rev', $scope.editor.revision) diff --git a/cyclotron-site/package.json b/cyclotron-site/package.json index e8440a1..fe29852 100644 --- a/cyclotron-site/package.json +++ b/cyclotron-site/package.json @@ -1,7 +1,7 @@ { "name": "cyclotron-site", "description": "Cyclotron: website", - "version": "1.45.0", + "version": "1.46.0", "author": "Dave Bauman ", "license": "MIT", "private": true, diff --git a/cyclotron-svc/package.json b/cyclotron-svc/package.json index b69f067..983514c 100644 --- a/cyclotron-svc/package.json +++ b/cyclotron-svc/package.json @@ -1,7 +1,7 @@ { "name": "cyclotron-svc", "description": "Cyclotron: REST API", - "version": "1.45.0", + "version": "1.46.0", "author": "Dave Bauman ", "license": "MIT", "private": true, @@ -28,14 +28,14 @@ "json2csv": "^3.6.3", "json2xls": "^0.1.2", "jsondiffpatch": "0.1.41", - "ldapjs": "0.7.1", + "ldapjs": "1.0.1", "lodash": "~4.14.1", "moment": "~2.8.3", "mongoose": "~4.5.1", "morgan": "~1.5.3", "node-uuid": "~1.4.3", "passport": "~0.2.2", - "passport-ldapauth": "~0.3.0", + "passport-ldapauth": "1.0.0", "request": "~2.39", "serve-static": "~1.9.3", "shortid": "2.0.0",