From 6ad5594540e5356094dfa07d024e2fbfe96dd075 Mon Sep 17 00:00:00 2001 From: illa1 Date: Mon, 5 Sep 2016 20:55:02 +0200 Subject: [PATCH 01/30] Detailed versions of dependencies. --- requirements.txt | 2 +- setup.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 17379d7a..83089ff8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ django-custom-field==2.5 psycopg2 -django-extensions +django-extensions==1.6.7 Werkzeug ipdb celery[redis] diff --git a/setup.py b/setup.py index a9a8b5aa..0bdcfb0d 100644 --- a/setup.py +++ b/setup.py @@ -24,9 +24,9 @@ ], install_requires=[ 'openpyxl==2.2.1', - 'python-dateutil', - 'django-report-utils>=0.3.15', - 'djangorestframework>=3.0.4', + 'python-dateutil==2.5.3', + 'django-report-utils==0.3.15', + 'djangorestframework==3.1', "six" ] ) From ede231688cba8c8ca5238e905ccfa59545394972 Mon Sep 17 00:00:00 2001 From: illa1 Date: Mon, 5 Sep 2016 20:57:37 +0200 Subject: [PATCH 02/30] Changed postgres to sqlite3. --- report_builder_demo/settings.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/report_builder_demo/settings.py b/report_builder_demo/settings.py index 889939e5..5dd7f41a 100644 --- a/report_builder_demo/settings.py +++ b/report_builder_demo/settings.py @@ -62,11 +62,8 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'postgres', - 'USER': 'postgres', - 'HOST': 'db', - 'PORT': 5432, + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } @@ -114,7 +111,7 @@ BROKER_URL = 'redis://{}:{}/0'.format(REDIS_ADDR, REDIS_PORT) CELERY_RESULT_BACKEND = BROKER_URL -REPORT_BUILDER_ASYNC_REPORT = True +REPORT_BUILDER_ASYNC_REPORT = False REPORT_BUILDER_GLOBAL_EXPORT = True REPORT_BUILDER_EMAIL_NOTIFICATION = False From 3e29491709d84998974133b7257d65fff1b35260 Mon Sep 17 00:00:00 2001 From: illa1 Date: Mon, 5 Sep 2016 21:02:26 +0200 Subject: [PATCH 03/30] Added simple chart for report (type: column, x-axis: first column, y-axis: last column). --- .../static/report_builder/controllers.js | 32 +++++++++++++++++++ .../report_builder/partials/show_report.html | 6 +++- .../templates/report_builder/spa.html | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/report_builder/static/report_builder/controllers.js b/report_builder/static/report_builder/controllers.js index aeb0a310..29e57853 100644 --- a/report_builder/static/report_builder/controllers.js +++ b/report_builder/static/report_builder/controllers.js @@ -257,6 +257,7 @@ reportBuilderApp.controller('ReportFilterCtrl', function($scope) { reportBuilderApp.controller('ReportShowCtrl', function($scope, $window, $http, $timeout, $mdToast, reportService) { $scope.getPreview = function() { + $scope.reportData.chart = false; $scope.reportData.statusMessage = null; $scope.reportData.refresh = true; reportService.getPreview($scope.report.id).then(function(data) { @@ -275,6 +276,37 @@ reportBuilderApp.controller('ReportShowCtrl', function($scope, $window, $http, $ }); }; + $scope.createChart = function() { + $scope.reportData.chart = true; + $scope.reportData.statusMessage = null; + $scope.reportData.refresh = true; + reportService.getPreview($scope.report.id).then(function(data) { + var chart_data = data.map(function(row) { + return [ row[0], row[row.length-1]]; + }); + var categories = chart_data.map(function(row) { + return row[0]; + }); + Highcharts.chart('highchart_container', { + chart: { + type: 'column' + }, + xAxis: { + categories: categories, + }, + title: { + text: $scope.report.name, + }, + series: [{ + data: chart_data, + }] + }); + $scope.reportData.refresh = false; + }, function(response) { + $scope.reportData.refresh = false; + $scope.reportData.statusMessage = "Error with status code " + response.status; + }); + }; $scope.save = function() { angular.forEach($scope.report.displayfield_set, function(value, index) { value.position = index; diff --git a/report_builder/static/report_builder/partials/show_report.html b/report_builder/static/report_builder/partials/show_report.html index 30f58823..7bc5b249 100644 --- a/report_builder/static/report_builder/partials/show_report.html +++ b/report_builder/static/report_builder/partials/show_report.html @@ -4,6 +4,7 @@ Preview xlsx csv + chart Changes have not been saved @@ -54,7 +55,10 @@

Filter Field Errors

-
+
+
+
+
+ + +