From 1dda1265970d9caeaed7f2c13dea8c2046029759 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 14:31:29 +0200 Subject: [PATCH 01/18] added dependency for parsing markdown files --- bower.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 0f571c7..dc2e263 100644 --- a/bower.json +++ b/bower.json @@ -25,7 +25,8 @@ "dependencies": { "angular": ">=1.4 <=1.6", "angular-dashboard-framework": "~0.12.0", - "angular-chart.js": "^0.10.2" + "angular-chart.js": "^0.10.2", + "angular-markdown-directive": "^0.3.1" }, "devDependencies": { "angular-local-storage": ">=0.2" From c53bc908e95cdcf467df67a0e63ad76578f48aff Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 14:32:34 +0200 Subject: [PATCH 02/18] created view for markdown content widget --- src/markdownPreview/view.html | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/markdownPreview/view.html diff --git a/src/markdownPreview/view.html b/src/markdownPreview/view.html new file mode 100644 index 0000000..c4b80ae --- /dev/null +++ b/src/markdownPreview/view.html @@ -0,0 +1,11 @@ + +
+ Please configure a specific file +
+
+
From 524bf06791dc097734b3e17194396150b53eba9c Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 14:32:57 +0200 Subject: [PATCH 03/18] created controller for markdown content widget --- src/markdownPreview/markdownPreview.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/markdownPreview/markdownPreview.js diff --git a/src/markdownPreview/markdownPreview.js b/src/markdownPreview/markdownPreview.js new file mode 100644 index 0000000..ab8e636 --- /dev/null +++ b/src/markdownPreview/markdownPreview.js @@ -0,0 +1,10 @@ + + +'use strict'; + +angular.module('adf.widget.scm') + .controller('MarkdownPreviewController', function(repository,fileContent){ + var vm = this; + vm.repository = repository; + vm.fileContent = fileContent; + }); From 7eb87ba125caf447d128bafe12cd3d54fa6e98a1 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 14:34:16 +0200 Subject: [PATCH 04/18] created custom widget config dialog --- src/markdownPreview/edit.html | 14 ++++++++++++++ src/markdownPreview/markdownPreviewEdit.js | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/markdownPreview/edit.html create mode 100644 src/markdownPreview/markdownPreviewEdit.js diff --git a/src/markdownPreview/edit.html b/src/markdownPreview/edit.html new file mode 100644 index 0000000..9eaf9f6 --- /dev/null +++ b/src/markdownPreview/edit.html @@ -0,0 +1,14 @@ +
+
+

+ +

+ + +
+
+ diff --git a/src/markdownPreview/markdownPreviewEdit.js b/src/markdownPreview/markdownPreviewEdit.js new file mode 100644 index 0000000..c71f6f2 --- /dev/null +++ b/src/markdownPreview/markdownPreviewEdit.js @@ -0,0 +1,10 @@ + + +'use strict'; + +angular.module('adf.widget.scm') + .controller('MarkdownPreviewEditController', function(repositories){ + var vm = this; + vm.repositories = repositories; + vm.selected = repositories[1]; + }); From 8dae9c4386e2e36db2dede33f6c21693c3d70b26 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 14:37:29 +0200 Subject: [PATCH 05/18] implemented file content access over scmm api --- src/service.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/service.js b/src/service.js index 24f66d8..aed79ff 100644 --- a/src/service.js +++ b/src/service.js @@ -26,7 +26,7 @@ angular.module('adf.widget.scm') .factory('SCM', function(scmEndpoint, $http){ - + function data(response){ return response.data; } @@ -51,6 +51,15 @@ angular.module('adf.widget.scm') return request('plugins/statistic/' + id + '/commits-per-month.json'); } + function getTeamMember(id){ + return request('repositories/'+id); + } + + function getFileContent(id, filePath){ + return request('repositories/'+id+'/content?path='+filePath); + } + + function getCommits(id, limit){ return request('repositories/' + id + '/changesets.json?limit=' + limit).then(function(data){ return data.changesets; @@ -62,6 +71,8 @@ angular.module('adf.widget.scm') getRepository: getRepository, getCommitsByAuthor: getCommitsByAuthor, getCommitsByMonth: getCommitsByMonth, - getCommits: getCommits + getCommits: getCommits, + getTeamMember: getTeamMember, + getFileContent: getFileContent }; }); From a7c1fe6c1344ec3779a78b6cfb7731d1c55dc445 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 14:38:19 +0200 Subject: [PATCH 06/18] updated widget list and dependencies --- src/scm.js | 58 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/src/scm.js b/src/scm.js index 1e10232..f9775f5 100644 --- a/src/scm.js +++ b/src/scm.js @@ -24,8 +24,8 @@ 'use strict'; -angular.module('adf.widget.scm', ['adf.provider', 'chart.js']) - .config(function(dashboardProvider){ +angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'btford.markdown']) + .config(function (dashboardProvider) { // category for widget add dialog var category = 'SCM-Manager'; @@ -36,15 +36,15 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js']) controllerAs: 'vm', resolve: { /** @ngInject **/ - repositories: function(SCM){ + repositories: function (SCM) { return SCM.getRepositories(); } } }; - var resolveRepository = function(SCM, config){ + var resolveRepository = function (SCM, config) { var result = null; - if (config.repository){ + if (config.repository) { result = SCM.getRepository(config.repository); } return result; @@ -61,9 +61,9 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js']) reload: true, resolve: { repository: resolveRepository, - commitsByAuthor: function(SCM, config){ + commitsByAuthor: function (SCM, config) { var result = null; - if (config.repository){ + if (config.repository) { result = SCM.getCommitsByAuthor(config.repository); } return result; @@ -81,9 +81,9 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js']) reload: true, resolve: { repository: resolveRepository, - commitsByMonth: function(SCM, config){ + commitsByMonth: function (SCM, config) { var result = null; - if (config.repository){ + if (config.repository) { result = SCM.getCommitsByMonth(config.repository); } return result; @@ -101,9 +101,9 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js']) reload: true, resolve: { repository: resolveRepository, - commits: function(SCM, config){ + commits: function (SCM, config) { var result = null; - if (config.repository){ + if (config.repository) { result = SCM.getCommits(config.repository, 50); } return result; @@ -121,14 +121,46 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js']) reload: true, resolve: { repository: resolveRepository, - commits: function(SCM, config){ + commits: function (SCM, config) { var result = null; - if (config.repository){ + if (config.repository) { result = SCM.getCommits(config.repository, 10); } return result; } }, edit: edit + }) + .widget('scm-markdown-content', { + title: 'SCM Markdown Content', + description: 'SCM Markdown Content Preview', + category: category, + templateUrl: '{widgetsPath}/scm/src/markdownPreview/view.html', + controller: 'MarkdownPreviewController', + controllerAs: 'vm', + reload: true, + resolve: { + repository: resolveRepository, + fileContent: function(SCM, config){ + var result = null; + if (config.repository && config.path){ + result = SCM.getFileContent(config.repository,config.path); + } + return result; + } + + + }, + edit: { + templateUrl: '{widgetsPath}/scm/src/markdownPreview/edit.html', + controller: 'MarkdownPreviewEditController', + controllerAs: 'vm', + resolve: { + /** @ngInject **/ + repositories: function (SCM) { + return SCM.getRepositories(); + } + } + } }); }); From ba0405497ff0e978e8f2efa2152b8e4844a071b5 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Thu, 11 May 2017 15:57:14 +0200 Subject: [PATCH 07/18] removed unused function --- src/service.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/service.js b/src/service.js index aed79ff..279a8e0 100644 --- a/src/service.js +++ b/src/service.js @@ -26,7 +26,6 @@ angular.module('adf.widget.scm') .factory('SCM', function(scmEndpoint, $http){ - function data(response){ return response.data; } @@ -51,15 +50,10 @@ angular.module('adf.widget.scm') return request('plugins/statistic/' + id + '/commits-per-month.json'); } - function getTeamMember(id){ - return request('repositories/'+id); - } - function getFileContent(id, filePath){ return request('repositories/'+id+'/content?path='+filePath); } - function getCommits(id, limit){ return request('repositories/' + id + '/changesets.json?limit=' + limit).then(function(data){ return data.changesets; @@ -72,7 +66,6 @@ angular.module('adf.widget.scm') getCommitsByAuthor: getCommitsByAuthor, getCommitsByMonth: getCommitsByMonth, getCommits: getCommits, - getTeamMember: getTeamMember, getFileContent: getFileContent }; }); From 067fcc8607ca2d5ba918684dcc9235b8278ffa48 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:19:20 +0200 Subject: [PATCH 08/18] updated angular-chart.js dependency --- bower.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index dc2e263..153da4a 100644 --- a/bower.json +++ b/bower.json @@ -24,8 +24,8 @@ "description": "SCM-Manager related widgets", "dependencies": { "angular": ">=1.4 <=1.6", - "angular-dashboard-framework": "~0.12.0", - "angular-chart.js": "^0.10.2", + "angular-dashboard-framework": "v0.12.x", + "angular-chart.js": "^1.1.0", "angular-markdown-directive": "^0.3.1" }, "devDependencies": { From 68186589448d4df833dc50059c7dd9f7d622eabb Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:33:07 +0200 Subject: [PATCH 09/18] updated widget descriptions --- src/scm.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/scm.js b/src/scm.js index f9775f5..f8e02a8 100644 --- a/src/scm.js +++ b/src/scm.js @@ -53,7 +53,7 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'bt dashboardProvider .widget('scm-commits-by-author', { title: 'SCM Commits By Author', - description: 'SCM-Manager pie chart for commit count by author', + description: 'Displays pie chart for commit count by author', category: category, templateUrl: '{widgetsPath}/scm/src/charts/pie-chart.html', controller: 'CommitsByAuthorController', @@ -73,7 +73,7 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'bt }) .widget('scm-commits-by-month', { title: 'SCM Commits By Month', - description: 'SCM-Manager line chart for commit count by month', + description: 'Displays line chart for commit count by month', category: category, templateUrl: '{widgetsPath}/scm/src/charts/line-chart.html', controller: 'CommitsByMonthController', @@ -93,7 +93,7 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'bt }) .widget('scm-commits-last-commits', { title: 'SCM Commits line chart', - description: 'SCM-Manager line char for the last 50 commits', + description: 'Displays line chart for the last 50 commits', category: category, templateUrl: '{widgetsPath}/scm/src/charts/line-chart.html', controller: 'LastCommitsController', @@ -113,7 +113,7 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'bt }) .widget('scm-commits', { title: 'SCM Commits', - description: 'SCM-Manager commits', + description: 'Displays last commits', category: category, templateUrl: '{widgetsPath}/scm/src/commits/view.html', controller: 'CommitsController', @@ -133,7 +133,7 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'bt }) .widget('scm-markdown-content', { title: 'SCM Markdown Content', - description: 'SCM Markdown Content Preview', + description: 'Displays a Markdown Content Preview', category: category, templateUrl: '{widgetsPath}/scm/src/markdownPreview/view.html', controller: 'MarkdownPreviewController', From f669b10fc704998a1f6e6ababe9ba3b504904260 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:35:17 +0200 Subject: [PATCH 10/18] fixed y-axis scale --- src/charts/commitsByMonth.js | 28 ++++++++++++++++++++-------- src/charts/commitsLastCommits.js | 20 ++++++++++++++++++-- src/charts/line-chart.html | 2 +- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/charts/commitsByMonth.js b/src/charts/commitsByMonth.js index fa3052b..b93c7a7 100644 --- a/src/charts/commitsByMonth.js +++ b/src/charts/commitsByMonth.js @@ -25,27 +25,39 @@ 'use strict'; angular.module('adf.widget.scm') - .controller('CommitsByMonthController', function(config, repository, commitsByMonth) { + .controller('CommitsByMonthController', function (config, repository, commitsByMonth) { var vm = this; if (commitsByMonth) { vm.chart = createChart(); } - function parseDate(input) { - var parts = input.split('-'); - return Date.UTC(parseInt(parts[0]), parseInt(parts[1]) - 1, 1); - } - function createChart() { var chartData = []; + var options = { + scales: { + yAxes: [ + { + id: 'y-axis-1', + display: true, + position: 'left', + ticks: { fixedStepSize: 1 }, + scaleLabel: { + display: true, + labelString: 'Commits' + } + } + ] + } + }; var chart = { labels: [], data: [chartData], series: ["Commits"], - class: "chart-line" + class: "chart-line", + options: options }; - angular.forEach(commitsByMonth.month, function(month) { + angular.forEach(commitsByMonth.month, function (month) { chart.labels.push(month.value); chartData.push(month.count); }); diff --git a/src/charts/commitsLastCommits.js b/src/charts/commitsLastCommits.js index fa95e15..f514ec4 100644 --- a/src/charts/commitsLastCommits.js +++ b/src/charts/commitsLastCommits.js @@ -33,12 +33,29 @@ angular.module('adf.widget.scm') } function createChart() { + var options = { + scales: { + yAxes: [ + { + id: 'y-axis-1', + display: true, + position: 'left', + ticks: { fixedStepSize: 1 }, + scaleLabel: { + display: true, + labelString: 'Commits' + } + } + ] + } + }; var chartData = []; var chart = { labels: [], data: [chartData], series: ["Commits"], - class: "chart-line" + class: "chart-line", + options: options }; var data = {}; @@ -57,7 +74,6 @@ angular.module('adf.widget.scm') }); angular.forEach(data, function(entry) { - console.log(entry); chart.labels.push(entry.date); chartData.push(entry.count); }); diff --git a/src/charts/line-chart.html b/src/charts/line-chart.html index 1b9a62a..6c22bd9 100644 --- a/src/charts/line-chart.html +++ b/src/charts/line-chart.html @@ -5,7 +5,7 @@
+ chart-series="vm.chart.series" chart-options="vm.chart.options">
From c8c5dc3eaa57d09c0ddcf79c8012dab2bae32406 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:36:18 +0200 Subject: [PATCH 11/18] added legend options to pie chart --- src/charts/commitsByAuthor.js | 10 +++++++++- src/charts/pie-chart.html | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/charts/commitsByAuthor.js b/src/charts/commitsByAuthor.js index 846c776..6f3d68e 100644 --- a/src/charts/commitsByAuthor.js +++ b/src/charts/commitsByAuthor.js @@ -40,11 +40,19 @@ angular.module('adf.widget.scm') data[author]= entry.count; }); + var options = { + legend: { + display: true, + position: "bottom" + } + }; + var chart = { labels: [], data: [], series: ["Commits"], - class: "chart-pie" + class: "chart-pie", + options: options }; angular.forEach(data, function (count, author) { diff --git a/src/charts/pie-chart.html b/src/charts/pie-chart.html index f97e9b1..b9ab188 100644 --- a/src/charts/pie-chart.html +++ b/src/charts/pie-chart.html @@ -5,7 +5,7 @@
+ chart-labels="vm.chart.labels" chart-options="vm.chart.options">
From 75eb03ff9db9cab29c2f63c1594d4bd20218c663 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:37:06 +0200 Subject: [PATCH 12/18] added markdown preview widget --- src/markdownPreview/edit.html | 9 ++++++++- src/markdownPreview/markdownPreviewEdit.js | 15 +++++++++++++-- src/service.js | 15 ++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/markdownPreview/edit.html b/src/markdownPreview/edit.html index 9eaf9f6..0efda14 100644 --- a/src/markdownPreview/edit.html +++ b/src/markdownPreview/edit.html @@ -1,12 +1,19 @@

-

+

+ +

diff --git a/src/markdownPreview/markdownPreviewEdit.js b/src/markdownPreview/markdownPreviewEdit.js index c71f6f2..1f10533 100644 --- a/src/markdownPreview/markdownPreviewEdit.js +++ b/src/markdownPreview/markdownPreviewEdit.js @@ -3,8 +3,19 @@ 'use strict'; angular.module('adf.widget.scm') - .controller('MarkdownPreviewEditController', function(repositories){ + .controller('MarkdownPreviewEditController', function(repositories, SCM){ var vm = this; vm.repositories = repositories; - vm.selected = repositories[1]; + + vm.getBranchesByRepositoryId = function(repositoryId){ + if (repositoryId){ + vm.selected = true; + SCM.getBranchesByRepositoryId(repositoryId).then(function(result){ + if (result.branch){ + vm.branches = result.branch; + } + }); + } + }; + }); diff --git a/src/service.js b/src/service.js index 279a8e0..a12a107 100644 --- a/src/service.js +++ b/src/service.js @@ -50,22 +50,27 @@ angular.module('adf.widget.scm') return request('plugins/statistic/' + id + '/commits-per-month.json'); } - function getFileContent(id, filePath){ - return request('repositories/'+id+'/content?path='+filePath); - } - function getCommits(id, limit){ return request('repositories/' + id + '/changesets.json?limit=' + limit).then(function(data){ return data.changesets; }); } + function getFileContent(id, filePath){ + return request('repositories/'+id+'/content?path='+filePath); + } + + function getBranchesByRepositoryId(id){ + return request('repositories/' + id + '/branches'); + } + return { getRepositories: getRepositories, getRepository: getRepository, getCommitsByAuthor: getCommitsByAuthor, getCommitsByMonth: getCommitsByMonth, getCommits: getCommits, - getFileContent: getFileContent + getFileContent: getFileContent, + getBranchesByRepositoryId: getBranchesByRepositoryId }; }); From 22d6dcc82f6cca3dea3a42e66f3d94b09492f715 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:53:45 +0200 Subject: [PATCH 13/18] updated angular and gulp-if dependency --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 153da4a..2e38a9d 100644 --- a/bower.json +++ b/bower.json @@ -23,7 +23,7 @@ ], "description": "SCM-Manager related widgets", "dependencies": { - "angular": ">=1.4 <=1.6", + "angular": ">=1.4 <=1.6.4", "angular-dashboard-framework": "v0.12.x", "angular-chart.js": "^1.1.0", "angular-markdown-directive": "^0.3.1" diff --git a/package.json b/package.json index 2a6dda5..dc88d58 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "gulp-connect": "~2.2.0", "gulp-csslint": "^0.1.5", "gulp-headerfooter": "^1.0.3", - "gulp-if": "^1.2.5", + "gulp-if": "2.x", "gulp-inject": "^1.2.0", "gulp-jshint": "^1.9.4", "gulp-less": "^3.0.2", From 617e7bfa59f445bb4e4272b3dac6ada43faa3bb9 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 13:59:14 +0200 Subject: [PATCH 14/18] refactored code --- src/charts/commitsByAuthor.js | 4 ++-- src/charts/commitsByMonth.js | 2 +- src/charts/commitsLastCommits.js | 10 ++++----- src/commits/commits.js | 12 +++++------ src/markdownPreview/edit.html | 4 +++- src/markdownPreview/markdownPreview.js | 4 +--- src/markdownPreview/markdownPreviewEdit.js | 13 +++++------- src/scm.js | 10 ++++----- src/service.js | 24 +++++++++++----------- 9 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/charts/commitsByAuthor.js b/src/charts/commitsByAuthor.js index 6f3d68e..fece35d 100644 --- a/src/charts/commitsByAuthor.js +++ b/src/charts/commitsByAuthor.js @@ -25,7 +25,7 @@ 'use strict'; angular.module('adf.widget.scm') - .controller('CommitsByAuthorController', function(config, repository, commitsByAuthor){ + .controller('CommitsByAuthorController', function (config, repository, commitsByAuthor) { var vm = this; if (repository && commitsByAuthor) { @@ -37,7 +37,7 @@ angular.module('adf.widget.scm') angular.forEach(commitsByAuthor.author, function (entry) { var author = entry.value; - data[author]= entry.count; + data[author] = entry.count; }); var options = { diff --git a/src/charts/commitsByMonth.js b/src/charts/commitsByMonth.js index b93c7a7..0dd7eab 100644 --- a/src/charts/commitsByMonth.js +++ b/src/charts/commitsByMonth.js @@ -40,7 +40,7 @@ angular.module('adf.widget.scm') id: 'y-axis-1', display: true, position: 'left', - ticks: { fixedStepSize: 1 }, + ticks: {fixedStepSize: 1}, scaleLabel: { display: true, labelString: 'Commits' diff --git a/src/charts/commitsLastCommits.js b/src/charts/commitsLastCommits.js index f514ec4..df98508 100644 --- a/src/charts/commitsLastCommits.js +++ b/src/charts/commitsLastCommits.js @@ -25,7 +25,7 @@ 'use strict'; angular.module('adf.widget.scm') - .controller('LastCommitsController', function($filter, config, repository, commits){ + .controller('LastCommitsController', function ($filter, config, repository, commits) { var vm = this; if (repository && commits) { @@ -40,7 +40,7 @@ angular.module('adf.widget.scm') id: 'y-axis-1', display: true, position: 'left', - ticks: { fixedStepSize: 1 }, + ticks: {fixedStepSize: 1}, scaleLabel: { display: true, labelString: 'Commits' @@ -59,11 +59,11 @@ angular.module('adf.widget.scm') }; var data = {}; - angular.forEach(commits, function(commit){ + angular.forEach(commits, function (commit) { var date = new Date(commit.date); var key = date.getUTCFullYear() + '-' + (date.getUTCMonth() + 1) + '-' + date.getUTCDate(); var entry = data[key]; - if (entry){ + if (entry) { entry.count += 1; } else { data[key] = { @@ -73,7 +73,7 @@ angular.module('adf.widget.scm') } }); - angular.forEach(data, function(entry) { + angular.forEach(data, function (entry) { chart.labels.push(entry.date); chartData.push(entry.count); }); diff --git a/src/commits/commits.js b/src/commits/commits.js index 04a81f6..76a7848 100644 --- a/src/commits/commits.js +++ b/src/commits/commits.js @@ -25,22 +25,22 @@ 'use strict'; angular.module('adf.widget.scm') - .controller('CommitsController', function($sce, config, repository, commits){ + .controller('CommitsController', function ($sce, config, repository, commits) { var vm = this; vm.repository = repository; // allow html descriptions - angular.forEach(commits, function(commit){ + angular.forEach(commits, function (commit) { commit.description = $sce.trustAsHtml(commit.description); }); vm.commits = commits; - vm.gravatarHash = function(commit){ + vm.gravatarHash = function (commit) { var hash; - if (commit.properties){ - for (var i=0; i

- diff --git a/src/markdownPreview/markdownPreview.js b/src/markdownPreview/markdownPreview.js index ab8e636..4b897ff 100644 --- a/src/markdownPreview/markdownPreview.js +++ b/src/markdownPreview/markdownPreview.js @@ -1,9 +1,7 @@ - - 'use strict'; angular.module('adf.widget.scm') - .controller('MarkdownPreviewController', function(repository,fileContent){ + .controller('MarkdownPreviewController', function (repository, fileContent) { var vm = this; vm.repository = repository; vm.fileContent = fileContent; diff --git a/src/markdownPreview/markdownPreviewEdit.js b/src/markdownPreview/markdownPreviewEdit.js index 1f10533..d96c545 100644 --- a/src/markdownPreview/markdownPreviewEdit.js +++ b/src/markdownPreview/markdownPreviewEdit.js @@ -1,17 +1,14 @@ - - 'use strict'; angular.module('adf.widget.scm') - .controller('MarkdownPreviewEditController', function(repositories, SCM){ + .controller('MarkdownPreviewEditController', function (repositories, SCM) { var vm = this; vm.repositories = repositories; - vm.getBranchesByRepositoryId = function(repositoryId){ - if (repositoryId){ - vm.selected = true; - SCM.getBranchesByRepositoryId(repositoryId).then(function(result){ - if (result.branch){ + vm.getBranchesByRepositoryId = function (repositoryId) { + if (repositoryId) { + SCM.getBranchesByRepositoryId(repositoryId).then(function (result) { + if (result.branch) { vm.branches = result.branch; } }); diff --git a/src/scm.js b/src/scm.js index f8e02a8..9dd3b64 100644 --- a/src/scm.js +++ b/src/scm.js @@ -24,7 +24,7 @@ 'use strict'; -angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'btford.markdown']) +angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'btford.markdown']) .config(function (dashboardProvider) { // category for widget add dialog @@ -141,15 +141,13 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'bt reload: true, resolve: { repository: resolveRepository, - fileContent: function(SCM, config){ + fileContent: function (SCM, config) { var result = null; - if (config.repository && config.path){ - result = SCM.getFileContent(config.repository,config.path); + if (config.repository && config.path) { + result = SCM.getFileContent(config.repository, config.path); } return result; } - - }, edit: { templateUrl: '{widgetsPath}/scm/src/markdownPreview/edit.html', diff --git a/src/service.js b/src/service.js index a12a107..998b7bb 100644 --- a/src/service.js +++ b/src/service.js @@ -25,42 +25,42 @@ 'use strict'; angular.module('adf.widget.scm') - .factory('SCM', function(scmEndpoint, $http){ - function data(response){ + .factory('SCM', function (scmEndpoint, $http) { + function data(response) { return response.data; } - function request(url){ + function request(url) { return $http.get(scmEndpoint + url).then(data); } - function getRepositories(){ + function getRepositories() { return request('repositories.json'); } - function getRepository(id){ + function getRepository(id) { return request('repositories/' + id + '.json'); } - function getCommitsByAuthor(id){ + function getCommitsByAuthor(id) { return request('plugins/statistic/' + id + '/commits-per-author.json'); } - function getCommitsByMonth(id){ + function getCommitsByMonth(id) { return request('plugins/statistic/' + id + '/commits-per-month.json'); } - function getCommits(id, limit){ - return request('repositories/' + id + '/changesets.json?limit=' + limit).then(function(data){ + function getCommits(id, limit) { + return request('repositories/' + id + '/changesets.json?limit=' + limit).then(function (data) { return data.changesets; }); } - function getFileContent(id, filePath){ - return request('repositories/'+id+'/content?path='+filePath); + function getFileContent(id, filePath) { + return request('repositories/' + id + '/content?path=' + filePath); } - function getBranchesByRepositoryId(id){ + function getBranchesByRepositoryId(id) { return request('repositories/' + id + '/branches'); } From 7bc50f830bc22e1543d78f40fa81993dcdf9ba50 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 15 May 2017 14:19:18 +0200 Subject: [PATCH 15/18] updated last commit chart naming --- src/scm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scm.js b/src/scm.js index 9dd3b64..5a4c9d0 100644 --- a/src/scm.js +++ b/src/scm.js @@ -92,7 +92,7 @@ angular.module('adf.widget.scm', ['adf.provider', 'chart.js', 'ngSanitize', 'btf edit: edit }) .widget('scm-commits-last-commits', { - title: 'SCM Commits line chart', + title: 'SCM Last Commit Chart', description: 'Displays line chart for the last 50 commits', category: category, templateUrl: '{widgetsPath}/scm/src/charts/line-chart.html', From e443151262226bf13017d7d90869c6212f7dcd50 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Wed, 17 May 2017 13:31:20 +0200 Subject: [PATCH 16/18] updated markdown widget to handle repositories without branch support --- src/markdownPreview/edit.html | 3 ++- src/markdownPreview/markdownPreviewEdit.js | 5 ++++- src/service.js | 11 +++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/markdownPreview/edit.html b/src/markdownPreview/edit.html index 1a112ee..d77266b 100644 --- a/src/markdownPreview/edit.html +++ b/src/markdownPreview/edit.html @@ -9,7 +9,8 @@

-

+ +