How to use buildTrend method in Best

Best JavaScript code snippet using best

BuildTrendReport.js

Source:BuildTrendReport.js Github

copy

Full Screen

1function BuildTrendReport(rallydatasource, detail_div) {2 var that = this;3 var rallyDataSource;4 var buildDef;5 //UI elements6 var buildTrendTable;7 var buildTrendGraph;8 var buildTrendLegend;9 var buildTrendWait;10 var buildTrendRadio;11 var buildTrendReleaseDD;12 //UI divs13 var buildTrendLabeldiv;14 var buildTrendDescriptiondiv;15 var buildTrendStatusRatiodiv;16 var buildTrendLegenddiv;17 var buildTrendGraphdiv;18 var buildTrendTablediv;19 var buildTrendRadiodiv;20 var buildTrendReleaseDDdiv;21 var spinnerdiv;22 function display() {23 buildTrendLabeldiv.innerHTML = buildDef.Name;24 buildTrendDescriptiondiv.innerHTML = buildDef.Description || "";25 if (buildTrendRadio !== undefined) {26 buildTrendRadio.destroy();27 buildTrendReleaseDD.destroy();28 }29 showRadioGroup();30 buildTrendRadio.setValue("30");31 buildTrendTBchange({}, {value:"30"});32 }33 function showRadioGroup(){34 dojo.style(buildTrendReleaseDDdiv, { "display" : "none"} );35 var config = {36 radios: [{label:"Last 30 days", value:"30"}, {label:"Last 90 days", value:"90"}, {label:"By Release", value:"Release"}],37 groupName : "TrendTimebox",38 showLabel : true,39 labelPosition : "after",40 defaultValue : "30"41 };42 buildTrendRadio = new rally.sdk.ui.basic.RadioButtonGroup(config);43 buildTrendRadio.display(buildTrendRadiodiv, buildTrendTBchange);44 var configDD = {45 showLabel:false46 };47 buildTrendReleaseDD = new rally.sdk.ui.ReleaseDropdown(configDD, rallyDataSource);48 buildTrendReleaseDD.display(buildTrendReleaseDDdiv, buildTrendReleaseDDChange);49 }50 function buildTrendTBchange(sender, args) {51 var optionpicked = args.value;52 if (optionpicked === "Release") {53 dojo.style(buildTrendReleaseDDdiv, { "display" : "inline"} );54 buildTrendReleaseDDChange();55 }56 else {57 dojo.style(buildTrendReleaseDDdiv, { "display" : "none"} );58 var today = new Date();59 var gmtHours = today.getTimezoneOffset()/60;60 today = rally.sdk.util.DateTime.add(today, "hour", gmtHours);61 var delta = (parseInt(optionpicked, 10) === 90) ? -90 : -30;62 var subtr = rally.sdk.util.DateTime.add(today, "day", delta);63 var startdate = rally.sdk.util.DateTime.toIsoString(subtr);64 var enddate = rally.sdk.util.DateTime.toIsoString(today);65 queryBuildDefDetail(startdate, enddate);66 }67 }68 function buildTrendReleaseDDChange(sender, args) {69 if (dojo.style(buildTrendReleaseDDdiv,"display") !== "none") {70 var startdate = buildTrendReleaseDD.getSelectedStart();71 var enddate = buildTrendReleaseDD.getSelectedEnd();72 queryBuildDefDetail(startdate,enddate);73 }74 }75 function queryBuildDefDetail(start_date,end_date) {76 var builddefref = buildDef._ref;77 buildTrendWait = new rally.sdk.ui.basic.Wait({hideTarget: false});78 buildTrendWait.display(spinnerdiv);79 var query_string = '((BuildDefinition = "' + builddefref + '") AND ((CreationDate > "';80 query_string = query_string + start_date + '" ) AND (CreationDate < "' + end_date + '")))';81 var queryConfig = {82 type : 'build',83 key : 'buildtrend',84 fetch : 'Status,CreationDate,Number,URI,Duration',85 query : query_string,86 order : 'CreationDate Desc'87 };88 rallyDataSource.findAll(queryConfig, showBuildTrendInfo);89 }90 function showBuildTrendInfo(results) {91 if (buildTrendTable !== undefined) {92 buildTrendTable.destroy();93 }94 var tableConfig = {95 sortingEnabled : false,96 columnKeys : [ 'Number', 'Date', 'Duration', 'Status' ],97 columnHeaders : [ 'Build #', 'Date', 'Duration', 'Status' ],98 columnWidths : [ '15%', '30%', '25%', '30%' ],99 noDataMessage : "No Builds available"100 };101 buildTrendTable = new rally.sdk.ui.Table(tableConfig);102 var successes = 0;103 for ( var i = 0; i < results.buildtrend.length; i++) {104 var numberlink = "<a href='"+ results.buildtrend[i].Uri + "' target='_blank'>" + results.buildtrend[i].Number + "</a>";105 var rowinfo = {106 'Number' : numberlink,107 'Date' : results.buildtrend[i].CreationDate,108 'Duration' : results.buildtrend[i].Duration || '',109 'Status' : results.buildtrend[i].Status110 };111 buildTrendTable.addRow(rowinfo);112 if (results.buildtrend[i].Status === "SUCCESS") { successes++; }113 }114 buildTrendStatusRatiodiv.innerHTML = "<span class='highsuccess'>" + successes + "</span> / " + results.buildtrend.length;115 buildTrendWait.hide();116 buildTrendTable.display(buildTrendTablediv);117 showBuildTrendGraph(results);118 }119 function showBuildTrendGraph(results){120 var dates = [];121 var buildSuccesses = [];122 var buildOther = [];123 if (buildTrendGraph) {124 buildTrendGraph.destroy();125 }126 if (buildTrendLegend) {127 buildTrendLegend.destroy();128 buildTrendLegend = null;129 }130 if (results.buildtrend.length > 0) {131 buildTrendGraph = new dojox.charting.Chart2D(buildTrendGraphdiv);132 var chartconfig = {133 type : "StackedColumns",134 gap : 3135 };136 buildTrendGraph.addPlot("default", chartconfig);137 //Fill the data series138 for (var i=(results.buildtrend.length - 1); i >= 0; i--) {139 var buildDate = rally.sdk.util.DateTime.fromIsoString(results.buildtrend[i].CreationDate);140 buildDate = rally.sdk.util.DateTime.format(buildDate, "yyyy-MM-dd");141 var buildDateIndex = dojo.indexOf(dates, buildDate);142 if ( buildDateIndex === -1 ) {143 dates.push(buildDate);144 buildSuccesses.push(0);145 buildOther.push(0);146 buildDateIndex = dates.length - 1;147 }148 if (results.buildtrend[i].Status === "SUCCESS") {149 buildSuccesses[buildDateIndex] = buildSuccesses[buildDateIndex] + 1;150 }151 else {152 buildOther[buildDateIndex] = buildOther[buildDateIndex] + 1;153 }154 }155 var datelabels = [];156 datelabels.push({value: 0, text: ""});157 for (var j = 0; j < dates.length; j++) {158 datelabels.push( { value: j+1, text: dates[j].substring(5, dates[j].length) } );159 }160 //Horizontal Axis Config161 var dateaxis = {162 fixLower:"minor",163 majorTickStep: 4,164 minorTickStep: 1,165 labels : datelabels166 };167 buildTrendGraph.addAxis("x", dateaxis);168 //Vertical Axis Config169 var buildaxis = {170 vertical : true,171 min: 0,172 minorTicks: false173 };174 buildTrendGraph.addAxis("y", buildaxis);175 buildTrendGraph.addSeries("Success", buildSuccesses);176 buildTrendGraph.addSeries("Failure", buildOther);177 setChartTheme();178 buildTrendGraph.setTheme(buildDashboard.themes.rallybuilds);179 var atooltip = new dojox.charting.action2d.Tooltip(buildTrendGraph, "default", {duration: 200, text: showTT});180 buildTrendGraph.render();181 buildTrendLegend = new dojox.charting.widget.Legend( {chart: buildTrendGraph},182 dojo.create("div", {}, buildTrendLegenddiv));183 }184 else { buildTrendGraph = undefined; }185 }186 function showTT(event) {187 var datev = event.chart.axes.x.labels[event.index].text;188 var h1 = event.chart.series[0].data[event.index];189 var h2 = event.chart.series[1].data[event.index];190 var height = event.y;191 if (((h1+ h2) === height) && (h2 !== 0)) {height = h2;}192 return "(" + datev + ") - " + height;193 }194 function setChartTheme(){195 dojo.provide("buildDashboard.themes.rallybuilds");196 buildDashboard.themes.rallybuilds = new dojox.charting.Theme({197 colors: [198 "#f47168",199 "#6ab17d"200 ]201 });202 }203 function init(rallydatasource, detail_div) {204 rallyDataSource = rallydatasource;205 var detaildiv = dojo.byId(detail_div);206 var labeldivs = dojo.create("div", { style : { "display" : "block" }}, detaildiv);207 buildTrendStatusRatiodiv = dojo.create("div", {id: "buildTrendStatusRatio"}, labeldivs);208 buildTrendLabeldiv = dojo.create("div", {id: "buildTrendLabel"}, labeldivs);209 buildTrendDescriptiondiv = dojo.create("div", {id: "buildTrendDescription"}, labeldivs);210 var radiodivs = dojo.create("div", {id: "buildTrendControlDiv"}, detaildiv);211 buildTrendRadiodiv = dojo.create("div", {id: "buildTrendRadio"}, radiodivs);212 buildTrendReleaseDDdiv = dojo.create("div", {id: "buildTrendReleaseDD"}, radiodivs);213 spinnerdiv = dojo.create("div", {id: "buildTrendspinner"}, detaildiv);214 buildTrendLegenddiv = dojo.create("div", {id: "buildTrendLegend"}, detaildiv);215 buildTrendGraphdiv = dojo.create("div", {id: "buildTrendGraph"}, detaildiv);216 buildTrendTablediv = dojo.create("div", {id: "buildTrendTable"}, detaildiv);217 dojo.style(buildTrendRadiodiv, {"display" : "inline"});218 dojo.style(buildTrendReleaseDDdiv, {"display" : "none"});219 var tablestyle = {220 "display" : "block",221 "marginLeft" : "auto",222 "marginRight" : "auto"223 };224 dojo.style(buildTrendTablediv, tablestyle);225 return that;226 }227 this.showBuildTrend = function(builddef) {228 buildDef = builddef;229 display();230 };231 this.destroy = function() {232 buildTrendRadio.destroy();233 buildTrendReleaseDD.destroy();234 buildTrendLegend.destroy();235 buildTrendGraph.destroy();236 buildTrendTable.destroy();237 };238 init(rallydatasource, detail_div);...

Full Screen

Full Screen

buildgraphsController.js

Source:buildgraphsController.js Github

copy

Full Screen

1/*******************************************************************************2*Copyright 2018 Cognizant Technology Solutions3* 4* Licensed under the Apache License, Version 2.0 (the "License"); you may not5* use this file except in compliance with the License. You may obtain a copy6* of the License at7* 8* http://www.apache.org/licenses/LICENSE-2.09* 10* Unless required by applicable law or agreed to in writing, software11* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13* License for the specific language governing permissions and limitations under14* the License.15 ******************************************************************************/16'use strict';17angular.module('Build')18.controller('buildgraphsController',19 ['$scope','$location', '$mdDialog', 'dataToPass','BuildService','$rootScope' ,'graphval',20 function ($scope,$location, $mdDialog, dataToPass,BuildService,$rootScope,graphval) {21 $scope.dataToPass = dataToPass;22 $rootScope.graphs = graphval;23 24 var daysArray = [];25 var successValArray = [];26 var failureValArray = [];27 var abortedValArray = [];28 var buildArray = [];29 var ValArray = [];30 var projectsArray = [];31 var user_successValArray = [];32 var user_successValArray = [];33 var user_failureValArray = [];34 var user_abortedValArray = []; 35 var others_successValArray = [];36 var others_failureValArray = [];37 var others_abortedValArray = [];38 if($scope.dataToPass == "buildTrends") //BUILD TRENDS 39 {40 $scope.graph_title = "Weekly BuildTrend";41 42 $scope.buildtrendJson=$rootScope.graphs.trendsarray;43 $scope.$evalAsync(function () {44 45 var bctx = document.getElementById("chartdiv").getContext("2d"); 46 47 $scope.buildtrendJson.forEach(function(data)48 { 49 daysArray.push(data.Days);50 successValArray.push(data.Success);51 failureValArray.push(data.Failure);52 abortedValArray.push(data.Aborted);53 });54 55 var barChartData = {56 labels: daysArray,57 datasets: [{58 label: 'Success',59 backgroundColor: '#84b761',60 data: successValArray61 }, {62 label: 'Failure',63 backgroundColor: '#f73333',64 data: failureValArray65 }, {66 label: 'Aborted',67 backgroundColor: '#fdd400',68 data: abortedValArray69 }]70 };71 72 window.myBar = new Chart(bctx, {73 type: 'bar',74 data: barChartData,75 options: {76 maintainAspectRatio: false,77 title:{78 display:true,79 text:"Weekly BuildTrend"80 },81 tooltips: {82 mode: 'index',83 intersect: false84 },85 responsive: true,86 scales: {87 xAxes: [{88 stacked: true,89 }],90 yAxes: [{91 stacked: true92 }]93 }94 }95 }); 96 });97 }98 else if($scope.dataToPass == "lastBuild"){ //LAST BUILD99 $scope.graph_title = "Today's BuildTrend"; 100 $scope.lastbuildJson = $rootScope.graphs.latestbuildarray;101 $scope.$evalAsync(function () {102 103 var lbtctx = document.getElementById("chartdiv").getContext("2d");104 105 $scope.lastbuildJson.forEach(function(data)106 { 107 buildArray.push(data.build_status);108 ValArray.push(data.value); 109 });110 111 var config = {112 type: 'pie',113 data: {114 datasets: [{115 data: ValArray,116 backgroundColor: [117 '#f73333', 118 '#84b761', 119 '#fdd400'120 ],121 label: 'Todays BuildTrend'122 }],123 labels: buildArray124 },125 options: {126 maintainAspectRatio: false,127 title:{128 display:true,129 text:"Today's BuildTrend"130 },131 tooltips: {132 mode: 'index',133 intersect: false134 },135 responsive: true136 }137 };138 window.myPie = new Chart(lbtctx, config); 139 140 });141 }142 else if($scope.dataToPass == "projectBuilds") //PROJECT BUILD 143 { 144 $scope.graph_title = "Project wise BuildTrend";145 146 $scope.projectbuildJson = $rootScope.graphs.projwisearray;147 $scope.$evalAsync(function () {148 var pbctx = document.getElementById("chartdiv").getContext("2d");149 $scope.projectbuildJson.forEach(function(data)150 { 151 projectsArray.push(data.Projects);152 successValArray.push(data.Success);153 failureValArray.push(data.Failure);154 abortedValArray.push(data.Aborted);155 }); 156 157 var barChartData = {158 labels: projectsArray,159 datasets: [{160 label: 'Success',161 backgroundColor: '#84b761',162 data: successValArray163 }, {164 label: 'Failure',165 backgroundColor: '#f73333',166 data: failureValArray167 }, {168 label: 'Aborted',169 backgroundColor: '#fdd400',170 data: abortedValArray171 }]172 };173 174 window.myBar = new Chart(pbctx, {175 type: 'bar',176 data: barChartData,177 options: {178 maintainAspectRatio: false,179 title:{180 display:true,181 text:"Project wise BuildTrend"182 },183 tooltips: {184 mode: 'index',185 intersect: false186 },187 responsive: true,188 scales: {189 xAxes: [{190 stacked: true,191 }],192 yAxes: [{193 stacked: true194 }]195 }196 }197 });198 });199 }200 else if($scope.dataToPass == "comparisonBuilds") //COMPARE BUILDS201 { 202 $scope.graph_title = "You vs Others";203 204 $scope.comparisonbuildJson = $rootScope.graphs.comparebuildarray;205 $scope.$evalAsync(function () {206 207 var cmpctx = document.getElementById("chartdiv").getContext("2d");208 209 $scope.comparisonbuildJson.forEach(function(data)210 { 211 projectsArray.push(data.projects);212 user_successValArray.push(data.you_success);213 user_failureValArray.push(data.you_failure);214 user_abortedValArray.push(data.you_aborted); 215 others_successValArray.push(data.others_success);216 others_failureValArray.push(data.others_failure);217 others_abortedValArray.push(data.others_aborted);218 219 });220 221 var barChartData = {222 labels: projectsArray,223 datasets: [{224 label: 'Success',225 backgroundColor: '#84b761',226 stack: 'Stack 0',227 data: user_successValArray228 }, {229 label: 'Failure',230 backgroundColor: '#f73333',231 stack: 'Stack 0',232 data: user_failureValArray233 }, {234 label: 'Aborted',235 backgroundColor: '#fdd400',236 stack: 'Stack 0',237 data: user_abortedValArray238 },{239 label: 'Others Success',240 backgroundColor: '#cc4748',241 stack: 'Stack 1',242 data: others_successValArray243 }, {244 label: 'Others Failure',245 backgroundColor: '#cd82ad',246 stack: 'Stack 1',247 data: others_failureValArray248 }, {249 label: 'Others Aborted',250 backgroundColor: '#2f4074',251 stack: 'Stack 1',252 data: others_abortedValArray253 }]254 };255 256 window.myBar = new Chart(cmpctx, {257 type: 'bar',258 data: barChartData,259 options: {260 maintainAspectRatio: false,261 title:{262 display:true,263 text:"You vs Others"264 },265 tooltips: {266 mode: 'index',267 intersect: false268 },269 responsive: true,270 scales: {271 xAxes: [{272 stacked: true,273 }],274 yAxes: [{275 stacked: true276 }]277 }278 }279 });280 281 });282 }283 284 function addLegendLabel(e) {285 var title = document.createElement("div");286 /*title.innerHTML = "Build Status";*/287 title.className = "legend-title";288 e.chart.legendDiv.appendChild(title)289 }290 $scope.cancel = function() {291 $mdDialog.cancel();292 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const BestBuy = require('./BestBuy');2const bb = new BestBuy();3const BestBuy = require('./BestBuy');4const bb = new BestBuy();5const BestBuy = require('./BestBuy');6const bb = new BestBuy();7const BestBuy = require('./BestBuy');8const bb = new BestBuy();9const BestBuy = require('./BestBuy');10const bb = new BestBuy();

Full Screen

Using AI Code Generation

copy

Full Screen

1const BestBuy = require('./bestBuy');2let bestBuy = new BestBuy();3let products = [];4let trends = [];5let trendData = [];6let trendData2 = [];7let trendData3 = [];8let trendData4 = [];9let trendData5 = [];10let trendData6 = [];11let trendData7 = [];12let trendData8 = [];13let trendData9 = [];14let trendData10 = [];15let trendData11 = [];16let trendData12 = [];17let trendData13 = [];18let trendData14 = [];19let trendData15 = [];20let trendData16 = [];21let trendData17 = [];22let trendData18 = [];23let trendData19 = [];24let trendData20 = [];25let trendData21 = [];26let trendData22 = [];27let trendData23 = [];28let trendData24 = [];29let trendData25 = [];30let trendData26 = [];31let trendData27 = [];32let trendData28 = [];33let trendData29 = [];34let trendData30 = [];35let trendData31 = [];

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestTrend = require('./index.js');2var trend = new BestTrend();3var data = [1,2,3,4,5,6,7,8,9,10];4var trendString = trend.buildTrend(data);5console.log(trendString);6var data = [1,2,3,4,5,6,7,8,9,10,11,12,13];7var trendString = trend.buildTrend(data);8console.log(trendString);9var data = [10,9,8,7,6,5,4,3,2,1];10var trendString = trend.buildTrend(data);11console.log(trendString);12var data = [10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4];13var trendString = trend.buildTrend(data);14console.log(trendString);15var data = [1,1,1,1,1,1,1,1,1,1];16var trendString = trend.buildTrend(data);17console.log(trendString);18var data = [1,1,1,1,1,1,1,1,1,1,1,1,1];19var trendString = trend.buildTrend(data);20console.log(trendString);21var data = [1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2];22var trendString = trend.buildTrend(data);23console.log(trendString);24var data = [1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1];25var trendString = trend.buildTrend(data);26console.log(trendString);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Best automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful