From fa05fd8ffeb055b05d0ea4b4942c73e59ce007e0 Mon Sep 17 00:00:00 2001 From: Christoph Wolfes Date: Mon, 12 Jun 2017 14:45:10 +0200 Subject: [PATCH] updated dist folder --- dist/adf-widget-sonar.js | 766 +++++++++++++++++++++++++++++++++++ dist/adf-widget-sonar.min.js | 1 + 2 files changed, 767 insertions(+) create mode 100644 dist/adf-widget-sonar.js create mode 100644 dist/adf-widget-sonar.min.js diff --git a/dist/adf-widget-sonar.js b/dist/adf-widget-sonar.js new file mode 100644 index 0000000..1f02ec4 --- /dev/null +++ b/dist/adf-widget-sonar.js @@ -0,0 +1,766 @@ +(function(window, undefined) {'use strict'; + +//app initialisation with dependencies +var sonarADFWidget = angular.module('adf.widget.sonar', ['adf.provider', 'chart.js', 'ui.bootstrap', 'ui.bootstrap.datepicker','angular-svg-round-progressbar']) +.constant("sonarEndpoint", { + "url": "https://ecosystem.cloudogu.com/sonar"//https://sonarqube.com" +}).constant("METRIC_NAMES", {"open_issues":"Open Issues","ncloc":"Lines of Code", +"public_documented_api_density": "Public documented API density","duplicated_lines_density": "Duplicated Lines (%)", +"sqale_index":"SQALE index", "coverage": "Coverage (%)", "tests": "Tests" }) + .config(['ChartJsProvider', function (ChartJsProvider) { + // Configure all charts + ChartJsProvider.setOptions({ + chartColors: ['#16688d', '#fdb45c'], + responsive: false, + maintainAspectRatio: true, + legend:{ + display:true + } + }); + // Configure all line charts + ChartJsProvider.setOptions('line', { + showLines: true + }); + }]) + .config(["dashboardProvider", function(dashboardProvider) { + dashboardProvider + .widget('sonar-all-projects-statistics', { + title: 'Sonar Statistics of all Projects ', + description: 'Displays all SonarQube statistics', + templateUrl: '{widgetsPath}/sonar/src/allProjects/view.html', + resolve: { + data: ["sonarApi", "config", "sonarEndpoint", function(sonarApi, config, sonarEndpoint) { + if (config.apiUrl) { + return sonarApi.getAllProjectsStatistics(config.apiUrl); + } + else if (sonarEndpoint.url){ + return sonarApi.getAllProjectsStatistics(sonarEndpoint.url); + } + return 'Please Setup the Widget'; + }] + }, + category: 'SonarQube', + controller: 'sonarStatsCtrl', + controllerAs: 'vm', + edit: { + templateUrl: '{widgetsPath}/sonar/src/allProjects/edit.html' + } + }) + .widget('sonar-linechart', { + title: 'Sonar Linechart of a Project', + description: 'Displays a linechart with different metrics', + templateUrl: '{widgetsPath}/sonar/src/chart/view.html', + resolve: { + data: ["sonarApi", "config", "sonarEndpoint", function(sonarApi, config, sonarEndpoint) { + var apiUrl; + if (config.apiUrl) { + apiUrl = config.apiUrl; + } else { + apiUrl = sonarEndpoint.url; + } + if (apiUrl && config.project && config.metrics){ + return sonarApi.getChartData(config.apiUrl, config.project, config.metrics, config.timespan); + } else{ + return 'Please Setup the Widget'; + } + }] + }, + category: 'SonarQube', + controller: 'sonarLineChart', + controllerAs: 'vm', + edit: { + templateUrl: '{widgetsPath}/sonar/src/chart/edit.html' + } + }) + .widget('sonar-compare', { + title: 'Sonar Project Compare', + description: 'Displays a table to compare two projects', + templateUrl: '{widgetsPath}/sonar/src/compare/view.html', + resolve: { + data: ["sonarApi", "config", "sonarEndpoint", function(sonarApi, config, sonarEndpoint) { + + if (config.apiUrl){ + return sonarApi.getMetrics(config.apiUrl, config.projectname1, config.projectname2); + } + else if (sonarEndpoint.url && config.projectname1 && config.projectname2){ + return sonarApi.getMetrics(sonarEndpoint.url, config.projectname1,config.projectname2); + } + return 'Please Setup the Widget'; + }] + }, + category: 'SonarQube', + controller: 'compare', + controllerAs: 'vm', + edit: { + templateUrl: '{widgetsPath}/sonar/src/compare/edit.html' + } + }) + .widget('project-progress', { + title: 'Project Progress', + description: 'Visualizes the progress of a project', + templateUrl: '{widgetsPath}/sonar/src/project-progress/view.html', + resolve: { + data: ["sonarApi", "config", function(sonarApi, config) { + if (config.projectBeginn){ + return sonarApi.getProjectTime(config.projectBeginn, config.projectEnd); + } + return 'Please Setup the Widget'; + }] + }, + controller: 'progress', + controllerAs: 'vm', + edit: { + templateUrl: '{widgetsPath}/sonar/src/project-progress/edit.html' + } + }) + .widget('sonar-my-issues', { + title: 'Sonar: My Issues', + description: 'Displays all issues of yourself', + templateUrl: '{widgetsPath}/sonar/src/issues/view.html', + resolve: { + data: ["sonarApi", "config", "sonarEndpoint", function(sonarApi, config, sonarEndpoint) { + if (config.apiUrl) { + return sonarApi.getAllMyIssues(config.apiUrl); + } + else if (sonarEndpoint.url){ + return sonarApi.getAllMyIssues(sonarEndpoint.url); + } + return 'Please Setup the Widget'; + }] + }, + category: 'SonarQube', + controller: 'sonarIssueCtrl', + controllerAs: 'vm', + edit: { + templateUrl: '{widgetsPath}/sonar/src/issues/edit.html' + } + }) + .widget('sonar-projectquality', { + title: 'Sonar: Projectquality of a Project', + description: 'Displays Status of the Quality Gate, Code Coverage and Blocker Issues', + templateUrl: '{widgetsPath}/sonar/src/projectquality/view.html', + resolve: { + data: ["sonarApi", "config", "sonarEndpoint", function(sonarApi, config, sonarEndpoint) { + if (config.apiUrl && config.project) { + return sonarApi.getProjectquality(config.apiUrl, config.project); + } + else if (sonarEndpoint.url && config.project){ + return sonarApi.getProjectquality(sonarEndpoint.url, config.project); + } + return 'Please Setup the Widget'; + }] + }, + category: 'SonarQube', + controller: 'qualityCtrl', + controllerAs: 'vm', + edit: { + templateUrl: '{widgetsPath}/sonar/src/projectquality/edit.html' + } + }); + + }]); + +angular.module("adf.widget.sonar").run(["$templateCache", function($templateCache) {$templateCache.put("{widgetsPath}/sonar/src/allProjects/edit.html","
"); +$templateCache.put("{widgetsPath}/sonar/src/allProjects/view.html","

{{(vm.data.linesOfCode | number)||0}}

Lines of code

{{(vm.data.coverage | number:2)||0}}%

Average test coverage

"); +$templateCache.put("{widgetsPath}/sonar/src/chart/edit.html","

(*Required)

"); +$templateCache.put("{widgetsPath}/sonar/src/chart/view.html",""); +$templateCache.put("{widgetsPath}/sonar/src/compare/edit.html","
"); +$templateCache.put("{widgetsPath}/sonar/src/compare/view.html","
Please configure the widget
Metric{{vm.projectLeft.data.component.name}}{{vm.projectRight.data.component.name}}
{{vm.METRIC_NAMES[metric.metric]}}{{vm.projectLeft.data.component.measures[$index].value}}{{vm.projectRight.data.component.measures[$index].value}}
"); +$templateCache.put("{widgetsPath}/sonar/src/issues/edit.html","
"); +$templateCache.put("{widgetsPath}/sonar/src/issues/view.html","
You don\'t have any issues.
{{project.project}} {{project.subProject}} {{project.component}}
{{issue.message}}L{{issue.line}}
{{issue.type | lowercase}} {{issue.severity | lowercase}}{{issue.status | lowercase}} {{issue.effort}} effort {{issue.tag}}
"); +$templateCache.put("{widgetsPath}/sonar/src/project-progress/edit.html","

"); +$templateCache.put("{widgetsPath}/sonar/src/project-progress/view.html","
Please configure the widget

{{config.projectname}}

{{vm.result.daysLeft}}/{{vm.result.maxDays}}

Projekttage

"); +$templateCache.put("{widgetsPath}/sonar/src/projectquality/edit.html","

(*Required)

"); +$templateCache.put("{widgetsPath}/sonar/src/projectquality/view.html","
Please configure the widget

Passed

Quality Gate

Error

Quality Gate

Warning

Quality Gate

unknown

Quality Gate

{{vm.coverage||\"unknown\"}}

Code Coverage

{{vm.blocker||\"unknown\"}}

Blocker Issues

");}]); + + +sonarADFWidget.controller('qualityCtrl', qualityCtrl); + +function qualityCtrl(data) { + var vm = this; + vm.name = data.name; + + angular.forEach(data.msr, function (metric) { + if (metric.key === "coverage") //going through all entries with if/elseif since there could miss some entries. So there is no special order + vm.coverage = metric.frmt_val; + else if (metric.key === "blocker_violations") + vm.blocker = metric.frmt_val; + else if (metric.key === "quality_gate_details") { + vm.qualityGateStatus = metric.data.split('"')[3]; //structure of quality_gate_details: "level":"OK",... + } + }); +} +qualityCtrl.$inject = ["data"]; + + + +sonarADFWidget. +controller('progress', progress); + +function progress(data, roundProgressConfig){ + var vm = this; + roundProgressConfig.max = data.maxDays; + roundProgressConfig.current = data.daysLeft; + vm.result = data; + vm.progressProperties=roundProgressConfig; +} +progress.$inject = ["data", "roundProgressConfig"]; + + + +sonarADFWidget. + controller('sonarIssueCtrl', sonarIssueCtrl); + +function sonarIssueCtrl(data, config) { + var vm = this; + + if (data.length != 0) { + + angular.forEach(data, function (issue) { + + // Preparing displaying of issue components + if (issue.subProject) + issue.subProject = issue.subProject.slice(issue.component.search(":") + 1).replace(":", " "); + if (issue.project) + issue.project = issue.project.slice(issue.component.search(":") + 1).replace(":", " "); //eig wird noch "parent" abgeschnitten, aber keine Ahnung warum! + if (issue.component) + issue.component = issue.component.slice(issue.component.lastIndexOf(":") + 1); + + if (issue.type) + issue.type = issue.type.replace("_", " "); + + for (var i = 0; i < issue.tags.length; i++) { + if (i == 0) + issue.tag = issue.tags[i]; + else + issue.tag = issue.tag + ", " + issue.tags[i]; + } + }); + + // sorting the elements by project, subProject and component + // has the structure: projects [project, subProject, component, projectIssues[]] + vm.projects = new Array(); + vm.projects[0] = new Object(); + + var counter = 0; //counting the projects + var counter2 = 1; //counting the projectIssues per project + for (var i = 0; i < data.length; i++) { + + if (data[i].status !== "CLOSED") { + + if (!vm.projects[counter].project) { //first initialisation of an object + vm.projects[counter] = new Object(); + vm.projects[counter].project = data[i].project; + vm.projects[counter].subProject = data[i].subProject; + vm.projects[counter].component = data[i].component; + vm.projects[counter].projectIssue = new Array(); + vm.projects[counter].projectIssue[0] = data[i]; + } else { //if there is already an object in vm.projects + if (data[i].project === vm.projects[counter].project + && data[i].subProject === vm.projects[counter].subProject + && data[i].component === vm.projects[counter].component) { + vm.projects[counter].projectIssue[counter2] = data[i]; + counter2 = counter2 + 1; + } else { + counter = counter + 1; + counter2 = 1; + vm.projects[counter] = new Object(); + vm.projects[counter].project = data[i].project; + vm.projects[counter].subProject = data[i].subProject; + vm.projects[counter].component = data[i].component; + vm.projects[counter].projectIssue = new Array; + vm.projects[counter].projectIssue[0] = data[i]; + } + } + } + } + } + + vm.sorting = function (issue) { + if (config.sorting == "sortBySeverity") + return vm.sortBySeverity(issue); + else + return vm.sortByEffort(issue); + }; + + + vm.sortBySeverity = function (issue) { + var severity = 0; //4=blocker, 3=critical, 2=major, 1=minor, 0=info + for (var i = 0; i < issue.projectIssue.length; i++) { + if (issue.projectIssue[i].severity === "BLOCKER") + severity = 4; + else if (issue.projectIssue[i].severity === "CRITICAL" && severity < 3) + severity = 3; + else if (issue.projectIssue[i].severity === "MAJOR" && severity < 2) + severity = 2; + else if (issue.projectIssue[i].severity === "MINOR" && severity < 1) + severity = 1; + } + return -severity; + }; + + vm.sortByEffort = function (issue) { + var effort = 0; + for (var i = 0; i < issue.projectIssue.length; i++) { + if (issue.projectIssue[i].effort && effort < parseInt(issue.projectIssue[i].effort.slice(0, issue.projectIssue[i].effort.search("m")))) + effort = parseInt(issue.projectIssue[i].effort.slice(0, issue.projectIssue[i].effort.search("m"))); + } + return -effort; + }; +} +sonarIssueCtrl.$inject = ["data", "config"]; + + + +sonarADFWidget.controller('compare', compare); + +function compare(data,METRIC_NAMES) { + var vm = this; + + vm.METRIC_NAMES = METRIC_NAMES; + vm.projectLeft = data.projectLeft; + vm.projectRight = data.projectRight; + +} +compare.$inject = ["data", "METRIC_NAMES"]; + +sonarADFWidget.controller('editController', editController); + +function editController($scope, $http, sonarApi, sonarEndpoint) { + var vm = this; + + $scope.updateProjects = function() { + var url; + if ($scope.config.apiUrl) { + url = $scope.config.apiUrl; + } else { + url = sonarEndpoint.url; + } + vm.projects = []; + sonarApi.getProjects(url).then(function(data) { + data.forEach(function(project) { + var proj = { + name: project.k + } + vm.projects.push(proj); + }); + }); + } + $scope.updateProjects(); + +} + + + +sonarADFWidget. +controller('sonarLineChart', sonarLineChart); +//setup controller +function sonarLineChart(data, METRIC_NAMES) { + //initialize controller variable + var vm = this; + var series = []; + var values = []; + for (var i = 0; i < data.length; i++) { + series.push(METRIC_NAMES[data[i].metric]); + values.push(data[i].values); + } + + //setup the chart legend and labels + vm.series = series; + vm.labels = data[0].dates; + vm.values = values; +} +sonarLineChart.$inject = ["data", "METRIC_NAMES"]; + +sonarADFWidget.controller('editController', editController); + +function editController($scope, sonarApi, sonarEndpoint) { + var vm = this; + if(!$scope.config.timespan) { + $scope.config.timespan= {}; + } + + // convert strings to date objects + if($scope.config.timespan.fromDateTime){ + $scope.config.timespan.fromDateTime = new Date($scope.config.timespan.fromDateTime); + $scope.config.timespan.toDateTime = new Date($scope.config.timespan.toDateTime); + } + $scope.updateProjects = function() { + var url; + if ($scope.config.apiUrl) { + url = $scope.config.apiUrl; + } else { + url = sonarEndpoint.url; + } + vm.projects = []; + sonarApi.getProjects(url).then(function(data) { + data.forEach(function(project) { + var proj = { + name: project.k + }; + vm.projects.push(proj); + }); + }); + }; + $scope.updateProjects(); + + $scope.inlineOptions = { + customClass: getDayClass, + minDate: new Date(), + showWeeks: true + }; + if(!$scope.dateOptions){ + $scope.dateOptions = { + formatYear: 'yy', + startingDay: 1 + }; + } + + $scope.toggleMin = function() { + $scope.inlineOptions.minDate = $scope.inlineOptions.minDate ? null : new Date(); + $scope.dateOptions.minDate = $scope.inlineOptions.minDate; + }; + + $scope.toggleMin(); + + $scope.open1 = function() { + $scope.popup1.opened = true; + }; + + $scope.open2 = function() { + $scope.popup2.opened = true; + }; + + $scope.formats = ['yyyy-MM-dd', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate']; + $scope.format = $scope.formats[0]; + $scope.altInputFormats = ['M!/d!/yyyy']; + + $scope.popup1 = { + opened: false + }; + + $scope.popup2 = { + opened: false + }; + + var tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); + var afterTomorrow = new Date(tomorrow); + afterTomorrow.setDate(tomorrow.getDate() + 1); + $scope.events = [{ + date: tomorrow, + status: 'full' + }, { + date: afterTomorrow, + status: 'partially' + }]; + + function getDayClass(data) { + var date = data.date, + mode = data.mode; + if (mode === 'day') { + var dayToCheck = new Date(date).setHours(0, 0, 0, 0); + + for (var i = 0; i < $scope.events.length; i++) { + var currentDay = new Date($scope.events[i].date).setHours(0, 0, 0, 0); + + if (dayToCheck === currentDay) { + return $scope.events[i].status; + } + } + } + return ''; + } +} +editController.$inject = ["$scope", "sonarApi", "sonarEndpoint"]; + + + +sonarADFWidget. +controller('sonarStatsCtrl', sonarStatsCtrl); + +function sonarStatsCtrl(data){ + var vm = this; + vm.data = data; +} +sonarStatsCtrl.$inject = ["data"]; + + + +sonarADFWidget. +factory('sonarApi', sonarApi); + +//function factory sonar +function sonarApi($http, $q) { + + function createApiUrlProjects(sonarUrl) { + return sonarUrl + '/api/projects/index?format=json'; + } + + function createApiUrlAllProjectsStatistics(sonarUrl) { + return sonarUrl + '/api/resources?metrics=ncloc,coverage'; + } + + function createApiUrlAllMyIssues(sonarUrl) { + return sonarUrl + '/api/issues/search?assignees=__me__';//--> nur zum Testen, eigentlich ist es __me__! + } + + function createApiUrlMetrics(sonarUrl, projectname) { + return sonarUrl + '/api/measures/component?componentKey=' + projectname + '&metricKeys=open_issues,ncloc,public_documented_api_density,duplicated_lines_density,sqale_index'; + } + + function createApiUrlQuality(sonarUrl, projectname) { + return sonarUrl + '/api/resources?resource=' + projectname + '&metrics=coverage,blocker_violations,quality_gate_details'; + } + + function getProjectTime(projectBeginn, projectEnd) { + var beginn = new Date(projectBeginn); + var end = new Date(projectEnd); + var today = new Date(); + + var maxDays = workingDaysBetweenDates(beginn, end); + var daysLeft = workingDaysBetweenDates(today, end); + + return { + 'maxDays': maxDays, + 'daysLeft': daysLeft + }; + + } + + function workingDaysBetweenDates(startDate, endDate) { + + // Validate input + if (endDate < startDate){ + return 0; + } + + // Calculate days between dates + var millisecondsPerDay = 86400 * 1000; // Day in milliseconds + startDate.setHours(0, 0, 0, 1); // Start just after midnight + endDate.setHours(23, 59, 59, 999); // End just before midnight + var diff = endDate - startDate; // Milliseconds between datetime objects + var days = Math.ceil(diff / millisecondsPerDay); + + // Subtract two weekend days for every week in between + var weeks = Math.floor(days / 7); + days = days - (weeks * 2); + + // Handle special cases + var startDay = startDate.getDay(); + var endDay = endDate.getDay(); + + // Remove weekend not previously removed. + if (startDay - endDay > 1) + { + days = days - 2; + } + + // Remove start day if span starts on Sunday but ends before Saturday + if (startDay === 0 && endDay != 6){ + days = days - 1; + } + + // Remove end day if span ends on Saturday but starts after Sunday + if (endDay === 6 && startDay != 0) + { + days = days - 1; + } + + return days; + } + + + function createMetricsString(metrics) { + var metricsString = ""; + if (metrics.linesOfCode) { + metricsString += "ncloc,"; + } + if (metrics.technicalDebt) { + metricsString += "sqale_index,"; + } + if (metrics.amountTest) { + metricsString += "tests,"; + } + if (metrics.testCoverage) { + metricsString += "coverage,"; + } + if (metrics.issues) { + metricsString += "open_issues,"; + } + if (metrics.rulesviolations) { + metricsString += "duplicated_lines_density,"; + } + return metricsString.slice(0, -1); + } + + function getMetrics(sonarUrl, projectname1, projectname2) { + var apiUrlProject1 = createApiUrlMetrics(sonarUrl, projectname1); + var apiUrlProject2 = createApiUrlMetrics(sonarUrl, projectname2); + var api1 = $http.get(apiUrlProject1); + var api2 = $http.get(apiUrlProject2); + var responsesArray = $q.all([api1, api2]) + .then(function(response) { + var projectLeft = response[0]; + var projectRight = response[1]; + var projectMetrics = { + 'projectLeft': projectLeft, + 'projectRight': projectRight + }; + return projectMetrics; + }); + + return responsesArray; + } + + + function getChartData(sonarUrl, projectname, metrics, timespan) { + + var apiUrl; + var fromDateTime; + var toDateTime; + var metricsString = createMetricsString(metrics); + if (timespan.type === 'dynamic') { + var today = new Date(); + switch(timespan.dynamic) { + case 'week': + fromDateTime = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000); + break; + case 'month': + fromDateTime = new Date(today.getFullYear(), today.getMonth() - 1, today.getDay()); + break; + case 'year': + fromDateTime = new Date(today.getFullYear() - 1, today.getMonth(), today.getDay()); + break; + } + toDateTime = today; + } else if (timespan.type === 'static') { + fromDateTime = timespan.fromDateTime; + toDateTime = timespan.toDateTime; + } + if ((fromDateTime && toDateTime)) { + apiUrl = sonarUrl + '/api/timemachine?resource=' + projectname + '&metrics=' + metricsString + '&fromDateTime=' + fromDateTime + '&toDateTime=' + toDateTime; + } else { + apiUrl = sonarUrl + '/api/timemachine?resource=' + projectname + '&metrics=' + metricsString; + } + return $http({ + method: 'GET', + url: apiUrl, + headers: { + 'Accept': 'application/json' + } + }).then(function(response) { + var metricsArray = []; + var responseData = response.data[0]; + var cols = responseData.cols; + var cells = responseData.cells; + for (var x = 0; x < cols.length; x++) { + var values = []; + var dates = []; + for (var y = 0; y < cells.length; y++) { + dates[y] = cells[y].d.split("T")[0]; + values[y] = cells[y].v[x]; + + } + var metricsObj = { + 'metric': cols[x].metric, + 'values': values, + 'dates': dates + }; + metricsArray.push(metricsObj); + } + return metricsArray; + }); + + } + + function generateArray(projects) { + var linesOfCodeSum = 0; + var avarageCoverage = 0; + for (var i = 0; i < projects.length; i++) { + if (projects[i].msr[0]) { + var linesOfCode = projects[i].msr[0].val; + linesOfCodeSum += linesOfCode; + } + if (projects[i].msr[1]) { + var coverage = projects[i].msr[1].val; + avarageCoverage += coverage; + } + } + avarageCoverage = avarageCoverage / projects.length; + return { + 'linesOfCode': linesOfCodeSum, + 'coverage': avarageCoverage + }; + } + + function getProjects(sonarUrl) { + var apiUrl = createApiUrlProjects(sonarUrl); + + return $http({ + method: 'GET', + url: apiUrl, + headers: { + 'Accept': 'application/json' + } + }).then(function(response) { + return response.data; + }); + } + + function getAllProjectsStatistics(sonarUrl){ + var apiUrl = createApiUrlAllProjectsStatistics(sonarUrl); + + return $http({ + method: 'GET', + url: apiUrl, + headers: { + 'Accept': 'application/json' + } + }).then(function(response) { + var projects = response.data; + return generateArray(projects); + }); + } + + function getAllMyIssues(sonarUrl){ + var apiUrl = createApiUrlAllMyIssues(sonarUrl); + + return $http({ + method: 'GET', + url: apiUrl, + headers: { + 'Accept': 'application/json' + } + }).then(function(response) { + return response.data.issues; + }); + } + + function getProjectquality(sonarUrl, project){ + var apiUrl = createApiUrlQuality(sonarUrl, project); + + return $http({ + method: 'GET', + url: apiUrl, + headers: { + 'Accept': 'application/json' + } + }).then(function(response) { + return response.data[0]; + }); + } + + return { + getProjects: getProjects, + getAllProjectsStatistics: getAllProjectsStatistics, + getChartData: getChartData, + getMetrics: getMetrics, + getProjectTime: getProjectTime, + getAllMyIssues: getAllMyIssues, + getProjectquality: getProjectquality + }; + +} +sonarApi.$inject = ["$http", "$q"]; +})(window); \ No newline at end of file diff --git a/dist/adf-widget-sonar.min.js b/dist/adf-widget-sonar.min.js new file mode 100644 index 0000000..ff9d3bd --- /dev/null +++ b/dist/adf-widget-sonar.min.js @@ -0,0 +1 @@ +!function(e,t){"use strict";function o(e){var t=this;t.name=e.name,angular.forEach(e.msr,function(e){"coverage"===e.key?t.coverage=e.frmt_val:"blocker_violations"===e.key?t.blocker=e.frmt_val:"quality_gate_details"===e.key&&(t.qualityGateStatus=e.data.split('"')[3])})}function n(e,t){var o=this;t.max=e.maxDays,t.current=e.daysLeft,o.result=e,o.progressProperties=t}function r(e,t){var o=this;if(0!=e.length){angular.forEach(e,function(e){e.subProject&&(e.subProject=e.subProject.slice(e.component.search(":")+1).replace(":"," ")),e.project&&(e.project=e.project.slice(e.component.search(":")+1).replace(":"," ")),e.component&&(e.component=e.component.slice(e.component.lastIndexOf(":")+1)),e.type&&(e.type=e.type.replace("_"," "));for(var t=0;t1&&(r-=2),0===s&&6!=i&&(r-=1),6===i&&0!=s&&(r-=1),r}function c(e){var t="";return e.linesOfCode&&(t+="ncloc,"),e.technicalDebt&&(t+="sqale_index,"),e.amountTest&&(t+="tests,"),e.testCoverage&&(t+="coverage,"),e.issues&&(t+="open_issues,"),e.rulesviolations&&(t+="duplicated_lines_density,"),t.slice(0,-1)}function p(o,n,r){var s=a(o,n),i=a(o,r),l=e.get(s),c=e.get(i),p=t.all([l,c]).then(function(e){var t=e[0],o=e[1],n={projectLeft:t,projectRight:o};return n});return p}function d(t,o,n,r){var a,s,i,l=c(n);if("dynamic"===r.type){var p=new Date;switch(r.dynamic){case"week":s=new Date(p.getTime()-6048e5);break;case"month":s=new Date(p.getFullYear(),p.getMonth()-1,p.getDay());break;case"year":s=new Date(p.getFullYear()-1,p.getMonth(),p.getDay())}i=p}else"static"===r.type&&(s=r.fromDateTime,i=r.toDateTime);return a=s&&i?t+"/api/timemachine?resource="+o+"&metrics="+l+"&fromDateTime="+s+"&toDateTime="+i:t+"/api/timemachine?resource="+o+"&metrics="+l,e({method:"GET",url:a,headers:{Accept:"application/json"}}).then(function(e){for(var t=[],o=e.data[0],n=o.cols,r=o.cells,a=0;a
"),e.put("{widgetsPath}/sonar/src/allProjects/view.html",'

{{(vm.data.linesOfCode | number)||0}}

Lines of code

{{(vm.data.coverage | number:2)||0}}%

Average test coverage

'),e.put("{widgetsPath}/sonar/src/chart/edit.html",'

(*Required)

'),e.put("{widgetsPath}/sonar/src/chart/view.html",''),e.put("{widgetsPath}/sonar/src/compare/edit.html",'
'),e.put("{widgetsPath}/sonar/src/compare/view.html",'
Please configure the widget
Metric{{vm.projectLeft.data.component.name}}{{vm.projectRight.data.component.name}}
{{vm.METRIC_NAMES[metric.metric]}}{{vm.projectLeft.data.component.measures[$index].value}}{{vm.projectRight.data.component.measures[$index].value}}
'),e.put("{widgetsPath}/sonar/src/issues/edit.html","
"),e.put("{widgetsPath}/sonar/src/issues/view.html",'
You don\'t have any issues.
{{project.project}} {{project.subProject}} {{project.component}}
{{issue.message}}L{{issue.line}}
{{issue.type | lowercase}} {{issue.severity | lowercase}}{{issue.status | lowercase}} {{issue.effort}} effort {{issue.tag}}
'),e.put("{widgetsPath}/sonar/src/project-progress/edit.html",'

'),e.put("{widgetsPath}/sonar/src/project-progress/view.html",'
Please configure the widget

{{config.projectname}}

{{vm.result.daysLeft}}/{{vm.result.maxDays}}

Projekttage

'),e.put("{widgetsPath}/sonar/src/projectquality/edit.html",'

(*Required)

'),e.put("{widgetsPath}/sonar/src/projectquality/view.html",'
Please configure the widget

Passed

Quality Gate

Error

Quality Gate

Warning

Quality Gate

unknown

Quality Gate

{{vm.coverage||"unknown"}}

Code Coverage

{{vm.blocker||"unknown"}}

Blocker Issues

')}]),p.controller("qualityCtrl",o),o.$inject=["data"],p.controller("progress",n),n.$inject=["data","roundProgressConfig"],p.controller("sonarIssueCtrl",r),r.$inject=["data","config"],p.controller("compare",a),a.$inject=["data","METRIC_NAMES"],p.controller("editController",s),p.controller("sonarLineChart",i),i.$inject=["data","METRIC_NAMES"],p.controller("editController",s),s.$inject=["$scope","sonarApi","sonarEndpoint"],p.controller("sonarStatsCtrl",l),l.$inject=["data"],p.factory("sonarApi",c),c.$inject=["$http","$q"]}(window); \ No newline at end of file