Bug 1336556 - Apply strict DI in angular controllers & apps

This will prevent some minification errors after the migration from grunt
to webpack.
This commit is contained in:
Casey Williams 2017-02-28 18:25:57 -08:00 коммит произвёл Ed Morley
Родитель b2e9e75457
Коммит de1137aeb8
19 изменённых файлов: 529 добавлений и 523 удалений

Просмотреть файл

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html ng-controller="AdminCtrl" ng-app="admin" ng-init="init()">
<html ng-controller="AdminCtrl" ng-app="admin" ng-init="init()" ng-strict-di>
<head>
<meta charset="utf-8">
<title>Treeherder Admin</title>

Просмотреть файл

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html ng-controller="FailureViewerCtrl" ng-init="init()" ng-app="failureviewer">
<html ng-controller="FailureViewerCtrl" ng-init="init()" ng-app="failureviewer" ng-strict-di>
<head>
<meta charset="utf-8">
<title>Failure Viewer</title>

Просмотреть файл

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html ng-app="treeherder.app">
<html ng-app="treeherder.app" ng-strict-di>
<head>
<meta charset="utf-8">
<title ng-bind="getWindowTitle()">Treeherder</title>

Просмотреть файл

@ -5,35 +5,36 @@ var admin = angular.module('admin', [
'ui.router', 'ui.bootstrap', 'treeherder', 'react'
]);
admin.config(function($compileProvider, $httpProvider, $stateProvider, $urlRouterProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
admin.config(['$compileProvider', '$httpProvider', '$stateProvider', '$urlRouterProvider',
function($compileProvider, $httpProvider, $stateProvider, $urlRouterProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.useApplyAsync(true);
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.useApplyAsync(true);
$stateProvider
.state('profiles', {
templateUrl: 'partials/admin/profiles_list.html',
url: '/profiles',
controller: 'ProfilesListCtrl'
})
.state('profiles_detail', {
templateUrl: 'partials/admin/profiles_detail.html',
url: '/profiles/:id',
controller: 'ProfilesDetailCtrl'
})
.state('exclusions', {
templateUrl: 'partials/admin/exclusions_list.html',
url: '/exclusions',
controller: 'ExclusionsListCtrl'
})
.state('exclusions_detail', {
templateUrl: 'partials/admin/exclusions_detail.html',
url: '/exclusions/:id',
controller: 'ExclusionsDetailCtrl'
});
$stateProvider
.state('profiles', {
templateUrl: 'partials/admin/profiles_list.html',
url: '/profiles',
controller: 'ProfilesListCtrl'
})
.state('profiles_detail', {
templateUrl: 'partials/admin/profiles_detail.html',
url: '/profiles/:id',
controller: 'ProfilesDetailCtrl'
})
.state('exclusions', {
templateUrl: 'partials/admin/exclusions_list.html',
url: '/exclusions',
controller: 'ExclusionsListCtrl'
})
.state('exclusions_detail', {
templateUrl: 'partials/admin/exclusions_detail.html',
url: '/exclusions/:id',
controller: 'ExclusionsDetailCtrl'
});
$urlRouterProvider.otherwise('/profiles');
});
$urlRouterProvider.otherwise('/profiles');
}]);

Просмотреть файл

@ -2,32 +2,33 @@
treeherder.component('thLogViewer', {
templateUrl: 'partials/logviewer/logviewer.html',
controller: ($sce, $location, $element, $scope, $rootScope) => {
const unifiedLogviewerUrl = 'https://taskcluster.github.io/unified-logviewer/';
const logParams = () => {
const q = $location.search();
let params = { lineHeight: 13 };
controller: ['$sce', '$location', '$element', '$scope', '$rootScope',
($sce, $location, $element, $scope, $rootScope) => {
const unifiedLogviewerUrl = 'https://taskcluster.github.io/unified-logviewer/';
const logParams = () => {
const q = $location.search();
let params = { lineHeight: 13 };
if (q.lineNumber) {
const lines = q.lineNumber.toString().split('-');
if (q.lineNumber) {
const lines = q.lineNumber.toString().split('-');
params.lineNumber = lines[0] - $rootScope.logOffset;
params.highlightStart = lines[0];
params.highlightEnd = lines.length === 2 ? lines[1] : lines[0];
}
params.lineNumber = lines[0] - $rootScope.logOffset;
params.highlightStart = lines[0];
params.highlightEnd = lines.length === 2 ? lines[1] : lines[0];
}
return Object.keys(params)
.reduce((qs, key) => `${qs}&${key}=${params[key]}`, '');
};
return Object.keys(params)
.reduce((qs, key) => `${qs}&${key}=${params[key]}`, '');
};
$element.find('iframe').bind('load', () => $scope.$parent.logviewerInit());
$element.find('iframe').bind('load', () => $scope.$parent.logviewerInit());
$scope.$parent.$watch('rawLogURL', () => {
const parent = $scope.$parent;
$scope.$parent.$watch('rawLogURL', () => {
const parent = $scope.$parent;
if ($scope.$parent.rawLogURL) {
$element[0].childNodes[0].src = $sce.trustAsResourceUrl(`${unifiedLogviewerUrl}?url=${parent.rawLogURL}${logParams()}`);
}
});
}
if ($scope.$parent.rawLogURL) {
$element[0].childNodes[0].src = $sce.trustAsResourceUrl(`${unifiedLogviewerUrl}?url=${parent.rawLogURL}${logParams()}`);
}
});
}]
});

Просмотреть файл

@ -1,11 +1,11 @@
'use strict';
treeherder.component('phCompareTable', {
templateUrl: function($element, $attrs) {
templateUrl: ['$element', '$attrs', function($element, $attrs) {
if ($attrs.type === 'trend')
return 'partials/perf/trendtable.html';
return 'partials/perf/comparetable.html';
},
}],
bindings: {
baseTitle: '@',
newTitle: '@',
@ -17,7 +17,7 @@ treeherder.component('phCompareTable', {
filterByFramework: '@',
releaseBlockerCriteria: '@'
},
controller: function($element, $attrs) {
controller: ['$element', '$attrs', function($element, $attrs) {
var ctrl = this;
if (!ctrl.baseTitle) {
@ -72,7 +72,7 @@ treeherder.component('phCompareTable', {
};
ctrl.updateFilteredTestList();
}
}]
});
treeherder.component('phAverage', {

Просмотреть файл

@ -36,48 +36,89 @@ perf.factory('PhBugs', [
}]);
perf.controller(
'ModifyAlertSummaryCtrl',
function($scope, $uibModalInstance, alertSummary) {
$scope.title = "Link to bug";
$scope.placeholder = "Bug #";
'ModifyAlertSummaryCtrl', ['$scope', '$uibModalInstance', 'alertSummary',
function($scope, $uibModalInstance, alertSummary) {
$scope.title = "Link to bug";
$scope.placeholder = "Bug #";
$scope.update = function() {
var newId = parseInt(
$scope.modifyAlert.newId.$modelValue);
$scope.update = function() {
var newId = parseInt(
$scope.modifyAlert.newId.$modelValue);
$scope.modifying = true;
alertSummary.assignBug(newId).then(function() {
$scope.modifying = false;
$uibModalInstance.close('assigned');
$scope.modifying = true;
alertSummary.assignBug(newId).then(function() {
$scope.modifying = false;
$uibModalInstance.close('assigned');
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.$on('modal.closing', function(event) {
if ($scope.modifying) {
event.preventDefault();
}
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.$on('modal.closing', function(event) {
if ($scope.modifying) {
event.preventDefault();
}
});
});
}]);
perf.controller(
'MarkDownstreamAlertsCtrl',
function($scope, $uibModalInstance, $http, $q, alertSummary, allAlertSummaries,
PhAlerts, phAlertStatusMap) {
$scope.title = "Mark alerts downstream";
$scope.placeholder = "Alert #";
'MarkDownstreamAlertsCtrl', ['$scope', '$uibModalInstance', '$http', '$q', 'alertSummary',
'allAlertSummaries', 'PhAlerts', 'phAlertStatusMap',
function($scope, $uibModalInstance, $http, $q, alertSummary, allAlertSummaries,
PhAlerts, phAlertStatusMap) {
$scope.title = "Mark alerts downstream";
$scope.placeholder = "Alert #";
$scope.update = function() {
var newId = parseInt(
$scope.modifyAlert.newId.$modelValue);
$scope.update = function() {
var newId = parseInt(
$scope.modifyAlert.newId.$modelValue);
alertSummary.modifySelectedAlerts({
status: phAlertStatusMap.DOWNSTREAM.id,
related_summary_id: newId
}).then(
function() {
alertSummary.modifySelectedAlerts({
status: phAlertStatusMap.DOWNSTREAM.id,
related_summary_id: newId
}).then(
function() {
var summariesToUpdate = [alertSummary].concat(
_.find(allAlertSummaries, function(alertSummary) {
return alertSummary.id === newId;
}) || []);
$q.all(_.map(summariesToUpdate, function(alertSummary) {
return alertSummary.update();
})).then(function() {
$uibModalInstance.close('downstreamed');
});
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.$on('modal.closing', function(event) {
if ($scope.modifying) {
event.preventDefault();
}
});
}]);
perf.controller(
'ReassignAlertsCtrl', ['$scope', '$uibModalInstance', '$http', '$q', 'alertSummary',
'allAlertSummaries','PhAlerts', 'phAlertStatusMap',
function($scope, $uibModalInstance,$http, $q, alertSummary, allAlertSummaries, PhAlerts, phAlertStatusMap) {
$scope.title = "Reassign alerts";
$scope.placeholder = "Alert #";
$scope.update = function() {
var newId = parseInt(
$scope.modifyAlert.newId.$modelValue);
// FIXME: validate that new summary id is on same repository?
alertSummary.modifySelectedAlerts({
status: phAlertStatusMap.REASSIGNED.id,
related_summary_id: newId
}).then(function() {
// FIXME: duplication with downstream alerts controller
var summariesToUpdate = [alertSummary].concat(
_.find(allAlertSummaries, function(alertSummary) {
return alertSummary.id === newId;
@ -88,56 +129,16 @@ perf.controller(
$uibModalInstance.close('downstreamed');
});
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.$on('modal.closing', function(event) {
if ($scope.modifying) {
event.preventDefault();
}
});
});
perf.controller(
'ReassignAlertsCtrl',
function($scope, $uibModalInstance, $http, $q, alertSummary,
allAlertSummaries, PhAlerts, phAlertStatusMap) {
$scope.title = "Reassign alerts";
$scope.placeholder = "Alert #";
$scope.update = function() {
var newId = parseInt(
$scope.modifyAlert.newId.$modelValue);
// FIXME: validate that new summary id is on same repository?
alertSummary.modifySelectedAlerts({
status: phAlertStatusMap.REASSIGNED.id,
related_summary_id: newId
}).then(function() {
// FIXME: duplication with downstream alerts controller
var summariesToUpdate = [alertSummary].concat(
_.find(allAlertSummaries, function(alertSummary) {
return alertSummary.id === newId;
}) || []);
$q.all(_.map(summariesToUpdate, function(alertSummary) {
return alertSummary.update();
})).then(function() {
$uibModalInstance.close('downstreamed');
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.$on('modal.closing', function(event) {
if ($scope.modifying) {
event.preventDefault();
}
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.$on('modal.closing', function(event) {
if ($scope.modifying) {
event.preventDefault();
}
});
});
}]);
perf.controller('AlertsCtrl', [
'$state', '$stateParams', '$scope', '$rootScope', '$http', '$q', '$uibModal',

Просмотреть файл

@ -5,9 +5,9 @@ perf.controller('GraphsCtrl', [
'thServiceDomain', '$http', '$q', '$timeout', 'PhSeries', 'PhAlerts',
'ThRepositoryModel', 'ThResultSetModel', 'phTimeRanges', 'phDefaultTimeRangeValue',
function GraphsCtrl($state, $stateParams, $scope, $rootScope, $location,
$uibModal, thServiceDomain, $http, $q, $timeout, PhSeries,
PhAlerts, ThRepositoryModel, ThResultSetModel,
phTimeRanges, phDefaultTimeRangeValue) {
$uibModal, thServiceDomain, $http, $q, $timeout, PhSeries,
PhAlerts, ThRepositoryModel, ThResultSetModel,
phTimeRanges, phDefaultTimeRangeValue) {
var availableColors = [ 'red', 'green', 'blue', 'orange', 'purple' ];
$scope.highlightedRevisions = [ undefined, undefined ];
@ -32,7 +32,7 @@ perf.controller('GraphsCtrl', [
$scope.creatingAlert = false;
var alertSummary = _.find(alertSummaryData.results,
{ id: alertSummaryId });
{ id: alertSummaryId });
$scope.tooltipContent.alertSummary = alertSummary;
dataPoint.series.relatedAlertSummaries = alertSummaryData.results;
@ -56,7 +56,7 @@ perf.controller('GraphsCtrl', [
frameworkId: flotItem.series.thSeries.frameworkId,
resultSetId: resultSetId,
flotDataOffset: (flotItem.dataIndex -
flotItem.series.resultSetData.indexOf(resultSetId)),
flotItem.series.resultSetData.indexOf(resultSetId)),
jobId: flotItem.series.jobIdData[flotItem.dataIndex]
};
}
@ -107,16 +107,16 @@ perf.controller('GraphsCtrl', [
phSeries.flotSeries.resultSetData[firstResultSetIndex- 1] : null;
var retriggerNum = _.countBy(phSeries.flotSeries.resultSetData,
function(resultSetId) {
return resultSetId === dataPoint.resultSetId ? 'retrigger':'original';
});
function(resultSetId) {
return resultSetId === dataPoint.resultSetId ? 'retrigger':'original';
});
var prevFlotDataPointIndex = (flotData.pointIndex - 1);
var flotSeriesData = flotData.series.data;
var t = flotSeriesData[flotData.pointIndex][0],
v = flotSeriesData[flotData.pointIndex][1],
v0 = ((prevFlotDataPointIndex >= 0) ?
flotSeriesData[prevFlotDataPointIndex][1] : v),
flotSeriesData[prevFlotDataPointIndex][1] : v),
dv = v - v0,
dvp = v / v0 - 1;
var alertSummary = _.find(phSeries.relatedAlertSummaries, function(alertSummary) {
@ -125,13 +125,13 @@ perf.controller('GraphsCtrl', [
var alert;
if (alertSummary) {
alert = _.find(alertSummary.alerts,
function(alert) {
return alert.series_signature.signature_hash === phSeries.signature;
});
function(alert) {
return alert.series_signature.signature_hash === phSeries.signature;
});
}
$scope.tooltipContent = {
project: _.findWhere($rootScope.repos,
{ name: phSeries.projectName }),
{ name: phSeries.projectName }),
revisionUrl: thServiceDomain + '#/jobs?repo=' + phSeries.projectName,
prevResultSetId: prevResultSetId,
resultSetId: dataPoint.resultSetId,
@ -150,32 +150,32 @@ perf.controller('GraphsCtrl', [
// Get revision information for both this datapoint and the previous
// one
_.each([{ resultSetId: dataPoint.resultSetId,
scopeKey: 'revision' },
{ resultSetId: prevResultSetId,
scopeKey: 'prevRevision' }],
function(resultRevision) {
ThResultSetModel.getRevisions(
phSeries.projectName, resultRevision.resultSetId).then(
function(revisions) {
$scope.tooltipContent[resultRevision.scopeKey] =
revisions[0];
if ($scope.tooltipContent.prevRevision && $scope.tooltipContent.revision) {
$scope.tooltipContent.pushlogURL = $scope.tooltipContent.project.getPushLogHref({
from: $scope.tooltipContent.prevRevision,
to: $scope.tooltipContent.revision
});
}
}, function() {
$scope.tooltipContent.revisionInfoAvailable = false;
});
});
scopeKey: 'revision' },
{ resultSetId: prevResultSetId,
scopeKey: 'prevRevision' }],
function(resultRevision) {
ThResultSetModel.getRevisions(
phSeries.projectName, resultRevision.resultSetId).then(
function(revisions) {
$scope.tooltipContent[resultRevision.scopeKey] =
revisions[0];
if ($scope.tooltipContent.prevRevision && $scope.tooltipContent.revision) {
$scope.tooltipContent.pushlogURL = $scope.tooltipContent.project.getPushLogHref({
from: $scope.tooltipContent.prevRevision,
to: $scope.tooltipContent.revision
});
}
}, function() {
$scope.tooltipContent.revisionInfoAvailable = false;
});
});
// now position it
$timeout(function() {
var x = parseInt(flotData.series.xaxis.p2c(t) +
$scope.plot.offset().left);
$scope.plot.offset().left);
var y = parseInt(flotData.series.yaxis.p2c(v) +
$scope.plot.offset().top);
$scope.plot.offset().top);
var tip = $('#graph-tooltip');
function getTipPosition(tip, x, y, yoffset) {
@ -196,9 +196,9 @@ perf.controller('GraphsCtrl', [
tipPosition = getTipPosition(tip, x, y, 10);
if (tip.css('visibility') === 'hidden') {
tip.css({ opacity: 0, visibility: 'visible', left: tipPosition.left,
top: tipPosition.top + 10 });
top: tipPosition.top + 10 });
tip.animate({ opacity: 1, left: tipPosition.left,
top: tipPosition.top }, 250);
top: tipPosition.top }, 250);
} else {
tip.css({ opacity: 1, left: tipPosition.left, top: tipPosition.top });
}
@ -216,9 +216,9 @@ perf.controller('GraphsCtrl', [
$scope.ttHideTimer = setTimeout(function() {
$scope.ttHideTimer = null;
tip.animate({ opacity: 0, top: '+=10' },
250, 'linear', function() {
$(this).css({ visibility: 'hidden' });
});
250, 'linear', function() {
$(this).css({ visibility: 'hidden' });
});
}, now ? 0 : 250);
}
}
@ -415,12 +415,12 @@ perf.controller('GraphsCtrl', [
if (series.visible) {
return ThResultSetModel.getResultSetsFromRevision(
series.projectName, rev).then(
function(resultSets) {
addHighlightedDatapoint(series, resultSets[0].id);
}, function() {
function(resultSets) {
addHighlightedDatapoint(series, resultSets[0].id);
}, function() {
/* ignore cases where no result set exists
for revision */
});
for revision */
});
}
return null;
}));
@ -527,9 +527,9 @@ perf.controller('GraphsCtrl', [
function updateDocumentTitle() {
if ($scope.seriesList.length) {
window.document.title = ($scope.seriesList[0].name + " " +
$scope.seriesList[0].platform +
" (" + $scope.seriesList[0].projectName +
")");
$scope.seriesList[0].platform +
" (" + $scope.seriesList[0].projectName +
")");
if ($scope.seriesList.length > 1)
window.document.title += " and others";
} else {
@ -541,24 +541,24 @@ perf.controller('GraphsCtrl', [
$state.transitionTo('graphs', {
series: $scope.seriesList.map(function(series) {
return "[" + [series.projectName,
series.signature,
(series.visible ? 1 : 0),
series.frameworkId] + "]";
series.signature,
(series.visible ? 1 : 0),
series.frameworkId] + "]";
}),
timerange: ($scope.myTimerange.value !== phDefaultTimeRangeValue) ?
$scope.myTimerange.value : undefined,
highlightedRevisions: _.filter($scope.highlightedRevisions,
function(highlight) {
return (highlight &&
highlight.length >= 12);
}),
function(highlight) {
return (highlight &&
highlight.length >= 12);
}),
highlightAlerts: !$scope.highlightAlerts ? 0 : undefined,
zoom: (function() {
if ((typeof $scope.zoom.x !== "undefined")
&& (typeof $scope.zoom.y !== "undefined")
&& ($scope.zoom.x !== 0 && $scope.zoom.y !== 0)) {
var modifiedZoom = ("[" + ($scope.zoom['x'].toString()
+ ',' + $scope.zoom['y'].toString()) + "]").replace(/[\[\{\}\]"]+/g, '');
+ ',' + $scope.zoom['y'].toString()) + "]").replace(/[\[\{\}\]"]+/g, '');
return modifiedZoom;
}
$scope.zoom = [];
@ -566,10 +566,10 @@ perf.controller('GraphsCtrl', [
})(),
selected: (function() {
return ($scope.selectedDataPoint) ? "[" + [$scope.selectedDataPoint.projectName,
$scope.selectedDataPoint.signature,
$scope.selectedDataPoint.resultSetId,
$scope.selectedDataPoint.jobId,
$scope.selectedDataPoint.frameworkId]
$scope.selectedDataPoint.signature,
$scope.selectedDataPoint.resultSetId,
$scope.selectedDataPoint.jobId,
$scope.selectedDataPoint.frameworkId]
+ "]" : undefined;
})()
}, {
@ -584,9 +584,9 @@ perf.controller('GraphsCtrl', [
function getSeriesData(series) {
return PhSeries.getSeriesData(series.projectName, { interval: $scope.myTimerange.value,
signatures: series.signature,
framework: series.frameworkId
}).then(
signatures: series.signature,
framework: series.frameworkId
}).then(
function(seriesData) {
series.flotSeries = {
lines: { show: false },
@ -606,7 +606,7 @@ perf.controller('GraphsCtrl', [
'push_id'),
thSeries: jQuery.extend({}, series),
jobIdData: _.pluck(seriesData[series.signature],
'job_id')
'job_id')
};
}).then(function() {
series.relatedAlertSummaries = [];
@ -629,7 +629,7 @@ perf.controller('GraphsCtrl', [
}).then(function(seriesList) {
if (!seriesList.length) {
return $q.reject("Signature `" + partialSeries.signature +
"` not found for " + partialSeries.project);
"` not found for " + partialSeries.project);
}
var seriesSummary = seriesList[0];
seriesSummary.projectName = partialSeries.project;
@ -670,7 +670,7 @@ perf.controller('GraphsCtrl', [
// add the color back to the list of available colors
availableColors.push(series.color);
// deselect datapoint if no longer valid
// deselect datapoint if no longer valid
if ($scope.selectedDataPoint &&
$scope.selectedDataPoint.signature === signature &&
$scope.selectedDataPoint.projectName === projectName) {
@ -718,11 +718,11 @@ perf.controller('GraphsCtrl', [
ThRepositoryModel.load().then(function() {
if ($stateParams.timerange) {
var timeRange = _.find(phTimeRanges,
{'value': parseInt($stateParams.timerange)});
{'value': parseInt($stateParams.timerange)});
$scope.myTimerange = timeRange;
} else {
$scope.myTimerange = _.find(phTimeRanges,
{'value': phDefaultTimeRangeValue});
{'value': phDefaultTimeRangeValue});
}
$scope.timeRangeChanged = function() {
$scope.loadingGraphs = true;
@ -877,229 +877,230 @@ perf.filter('testNameContainsWords', function() {
};
});
perf.controller('TestChooserCtrl', function($scope, $uibModalInstance, $http,
projects, timeRange, thServiceDomain,
thDefaultRepo, PhSeries, PhFramework,
defaultFrameworkId, defaultProjectName,
defaultPlatform, $q, testsDisplayed,
options, thPerformanceBranches,
phDefaultFramework) {
$scope.timeRange = timeRange;
$scope.projects = projects;
$scope.selectedProject = _.findWhere(projects, {
name: defaultProjectName ? defaultProjectName : thDefaultRepo
});
$scope.includeSubtests = false;
$scope.loadingTestData = false;
$scope.loadingRelatedSignatures = true;
var series = [];
$scope.addTestData = function () {
if (($scope.testsToAdd.length + testsDisplayed.length) > 6) {
var a = window.confirm('WARNING: Displaying more than 6 graphs at the same time is not supported in the UI. Do it anyway?');
if (a === true) {
perf.controller('TestChooserCtrl', ['$scope', '$uibModalInstance', '$http',
'projects', 'timeRange', 'thServiceDomain', 'thDefaultRepo', 'PhSeries',
'PhFramework', 'defaultFrameworkId', 'defaultProjectName', 'defaultPlatform',
'$q', 'testsDisplayed', 'options', 'thPerformanceBranches', 'phDefaultFramework',
function($scope, $uibModalInstance, $http, projects, timeRange, thServiceDomain,
thDefaultRepo, PhSeries, PhFramework, defaultFrameworkId, defaultProjectName,
defaultPlatform, $q, testsDisplayed, options, thPerformanceBranches,
phDefaultFramework) {
$scope.timeRange = timeRange;
$scope.projects = projects;
$scope.selectedProject = _.findWhere(projects, {
name: defaultProjectName ? defaultProjectName : thDefaultRepo
});
$scope.includeSubtests = false;
$scope.loadingTestData = false;
$scope.loadingRelatedSignatures = true;
var series = [];
$scope.addTestData = function () {
if (($scope.testsToAdd.length + testsDisplayed.length) > 6) {
var a = window.confirm('WARNING: Displaying more than 6 graphs at the same time is not supported in the UI. Do it anyway?');
if (a === true) {
addTestToGraph();
}
} else {
addTestToGraph();
}
} else {
addTestToGraph();
}
};
};
var addTestToGraph = function () {
$scope.selectedSeriesList = $scope.testsToAdd;
$scope.selectedSeriesList.forEach(function(selectedSeries, i) {
series[i] = _.clone(selectedSeries);
series[i].projectName = selectedSeries.projectName;
});
$uibModalInstance.close(series);
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.unselectedTestList = []; // tests in the "tests" list
$scope.selectedTestSignatures = []; // tests in the "tests" list that have been selected by the user
$scope.testsToAdd = []; // tests in the "tests to add" list
$scope.selectedTestsToAdd = []; // tests in the "to add" test list that have been selected by the user
$scope.unselectTest = function () {
$scope.selectedTestsToAdd.forEach(function(testValue) {
// selectedTestsToAdd is stored in JSON format, need to convert
// it back to an object and get the actual value
var test = _.findWhere($scope.testsToAdd, JSON.parse(testValue));
// add test back to unselected test list if we're browsing for
// the current project/platform, otherwise just discard it
if (test.projectName === $scope.selectedProject.name &&
test.platform === $scope.selectedPlatform) {
$scope.unselectedTestList.push(test);
}
// unconditionally remove it from the current list
_.remove($scope.testsToAdd, test);
});
// resort unselected test list
$scope.unselectedTestList = _.sortBy($scope.unselectedTestList,
'name');
};
$scope.selectTest = function () {
$scope.selectedTestSignatures.forEach(function(signature) {
// Add the selected tests to the selected test list
$scope.testsToAdd.push(_.clone(
_.findWhere($scope.unselectedTestList, { signature: signature })));
// Remove the added tests from the unselected test list
_.remove($scope.unselectedTestList, { signature: signature });
});
};
var loadingExtraDataPromise = $q.defer();
var addRelatedPlatforms = function(originalSeries) {
PhSeries.getSeriesList(
originalSeries.projectName, {
interval: $scope.timeRange,
framework: originalSeries.frameworkId
}).then(function(seriesList) {
$scope.testsToAdd = _.clone(_.filter(seriesList, function(series) {
return series.platform !== originalSeries.platform &&
series.name === originalSeries.name &&
!_.any(testsDisplayed, {
projectName: series.projectName,
signature: series.signature
});
}));
}).then(function() {
// resolve the testsToAdd's length after every thing was done
// so we don't need timeout here
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
var addTestToGraph = function () {
$scope.selectedSeriesList = $scope.testsToAdd;
$scope.selectedSeriesList.forEach(function(selectedSeries, i) {
series[i] = _.clone(selectedSeries);
series[i].projectName = selectedSeries.projectName;
});
};
$uibModalInstance.close(series);
};
var addRelatedBranches = function(originalSeries) {
var branchList = [];
thPerformanceBranches.forEach(function (branch) {
if (branch !== originalSeries.projectName) {
branchList.push(_.findWhere($scope.projects, {name: branch}));
}
});
// get each project's series data from remote and use promise to
// ensure each step will be executed after last on has finished
$q.all(branchList.map(function(project) {
return PhSeries.getSeriesList(project.name, {
interval: $scope.timeRange,
signature: originalSeries.signature,
framework: originalSeries.frameworkId
});
})).then(function(seriesList) {
// we get a list of lists because we are getting the results
// of multiple promises, filter that down to one flat list
seriesList = _.flatten(seriesList);
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
// filter out tests which are already displayed
$scope.testsToAdd = _.filter(seriesList, function(series) {
return !_.any(testsDisplayed, {
projectName: series.projectName,
signature: series.signature
});
});
}).then(function () {
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
});
};
$scope.unselectedTestList = []; // tests in the "tests" list
$scope.selectedTestSignatures = []; // tests in the "tests" list that have been selected by the user
$scope.testsToAdd = []; // tests in the "tests to add" list
$scope.selectedTestsToAdd = []; // tests in the "to add" test list that have been selected by the user
var addRelatedConfigs = function(originalSeries) {
PhSeries.getSeriesList(
originalSeries.projectName, {
interval: $scope.timeRange,
framework: originalSeries.frameworkId
}).then(function(seriesList) {
$scope.testsToAdd = _.clone(_.filter(seriesList, function(series) {
return series.platform === originalSeries.platform &&
series.testName === originalSeries.testName &&
series.name !== originalSeries.name;
}));
}).then(function() {
// resolve the testsToAdd's length after every thing was done
// so we don't need timeout here
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
});
};
if (options.option !== undefined) {
$scope.loadingRelatedSignatures = false;
if (options.option === "addRelatedPlatform") {
addRelatedPlatforms(options.relatedSeries);
} else if (options.option === "addRelatedBranches") {
addRelatedBranches(options.relatedSeries);
} else if (options.option === "addRelatedConfigs") {
addRelatedConfigs(options.relatedSeries);
}
loadingExtraDataPromise.promise.then(function(length){
if (length > 0) {
$scope.loadingRelatedSignatures = true;
} else {
window.alert("Oops, no related platforms or branches have been found.");
}
});
}
$scope.unselectTest = function () {
$scope.selectedTestsToAdd.forEach(function(testValue) {
// selectedTestsToAdd is stored in JSON format, need to convert
// it back to an object and get the actual value
var test = _.findWhere($scope.testsToAdd, JSON.parse(testValue));
PhFramework.getFrameworkList().then(function(frameworkList) {
$scope.frameworkList = frameworkList;
if (defaultFrameworkId) {
$scope.selectedFramework = _.findWhere($scope.frameworkList, {
id: defaultFrameworkId
});
} else {
$scope.selectedFramework = _.findWhere($scope.frameworkList, {
name: phDefaultFramework
});
}
$scope.updateTestInput = function() {
$scope.addTestDataDisabled = true;
$scope.loadingTestData = true;
$scope.loadingPlatformList = true;
$scope.platformList = [];
PhSeries.getPlatformList($scope.selectedProject.name, {
interval: $scope.timeRange,
framework: $scope.selectedFramework.id }).then(function(platformList) {
$scope.platformList = platformList;
$scope.platformList.sort();
if (_.contains($scope.platformList, defaultPlatform)) {
$scope.selectedPlatform = defaultPlatform;
} else {
$scope.selectedPlatform = $scope.platformList[0];
}
$scope.loadingPlatformList = false;
$scope.updateTestSelector();
});
$scope.updateTestSelector = function() {
$scope.loadingTestData = true;
if ($scope.selectedPlatform) {
defaultPlatform = $scope.selectedPlatform;
// add test back to unselected test list if we're browsing for
// the current project/platform, otherwise just discard it
if (test.projectName === $scope.selectedProject.name &&
test.platform === $scope.selectedPlatform) {
$scope.unselectedTestList.push(test);
}
PhSeries.getSeriesList(
$scope.selectedProject.name,
{ interval: $scope.timeRange, platform: $scope.selectedPlatform,
framework: $scope.selectedFramework.id,
subtests: $scope.includeSubtests ? 1 : 0 }).then(function(seriesList) {
$scope.unselectedTestList = _.sortBy(
_.filter(seriesList,
{ platform: $scope.selectedPlatform }), 'name');
// filter out tests which are already displayed or are
// already selected
_.forEach(_.union(testsDisplayed, $scope.testsToAdd),
// unconditionally remove it from the current list
_.remove($scope.testsToAdd, test);
});
// resort unselected test list
$scope.unselectedTestList = _.sortBy($scope.unselectedTestList,
'name');
};
$scope.selectTest = function () {
$scope.selectedTestSignatures.forEach(function(signature) {
// Add the selected tests to the selected test list
$scope.testsToAdd.push(_.clone(
_.findWhere($scope.unselectedTestList, { signature: signature })));
// Remove the added tests from the unselected test list
_.remove($scope.unselectedTestList, { signature: signature });
});
};
var loadingExtraDataPromise = $q.defer();
var addRelatedPlatforms = function(originalSeries) {
PhSeries.getSeriesList(
originalSeries.projectName, {
interval: $scope.timeRange,
framework: originalSeries.frameworkId
}).then(function(seriesList) {
$scope.testsToAdd = _.clone(_.filter(seriesList, function(series) {
return series.platform !== originalSeries.platform &&
series.name === originalSeries.name &&
!_.any(testsDisplayed, {
projectName: series.projectName,
signature: series.signature
});
}));
}).then(function() {
// resolve the testsToAdd's length after every thing was done
// so we don't need timeout here
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
});
};
var addRelatedBranches = function(originalSeries) {
var branchList = [];
thPerformanceBranches.forEach(function (branch) {
if (branch !== originalSeries.projectName) {
branchList.push(_.findWhere($scope.projects, {name: branch}));
}
});
// get each project's series data from remote and use promise to
// ensure each step will be executed after last on has finished
$q.all(branchList.map(function(project) {
return PhSeries.getSeriesList(project.name, {
interval: $scope.timeRange,
signature: originalSeries.signature,
framework: originalSeries.frameworkId
});
})).then(function(seriesList) {
// we get a list of lists because we are getting the results
// of multiple promises, filter that down to one flat list
seriesList = _.flatten(seriesList);
// filter out tests which are already displayed
$scope.testsToAdd = _.filter(seriesList, function(series) {
return !_.any(testsDisplayed, {
projectName: series.projectName,
signature: series.signature
});
});
}).then(function () {
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
});
};
var addRelatedConfigs = function(originalSeries) {
PhSeries.getSeriesList(
originalSeries.projectName, {
interval: $scope.timeRange,
framework: originalSeries.frameworkId
}).then(function(seriesList) {
$scope.testsToAdd = _.clone(_.filter(seriesList, function(series) {
return series.platform === originalSeries.platform &&
series.testName === originalSeries.testName &&
series.name !== originalSeries.name;
}));
}).then(function() {
// resolve the testsToAdd's length after every thing was done
// so we don't need timeout here
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
});
};
if (options.option !== undefined) {
$scope.loadingRelatedSignatures = false;
if (options.option === "addRelatedPlatform") {
addRelatedPlatforms(options.relatedSeries);
} else if (options.option === "addRelatedBranches") {
addRelatedBranches(options.relatedSeries);
} else if (options.option === "addRelatedConfigs") {
addRelatedConfigs(options.relatedSeries);
}
loadingExtraDataPromise.promise.then(function(length){
if (length > 0) {
$scope.loadingRelatedSignatures = true;
} else {
window.alert("Oops, no related platforms or branches have been found.");
}
});
}
PhFramework.getFrameworkList().then(function(frameworkList) {
$scope.frameworkList = frameworkList;
if (defaultFrameworkId) {
$scope.selectedFramework = _.findWhere($scope.frameworkList, {
id: defaultFrameworkId
});
} else {
$scope.selectedFramework = _.findWhere($scope.frameworkList, {
name: phDefaultFramework
});
}
$scope.updateTestInput = function() {
$scope.addTestDataDisabled = true;
$scope.loadingTestData = true;
$scope.loadingPlatformList = true;
$scope.platformList = [];
PhSeries.getPlatformList($scope.selectedProject.name, {
interval: $scope.timeRange,
framework: $scope.selectedFramework.id }).then(function(platformList) {
$scope.platformList = platformList;
$scope.platformList.sort();
if (_.contains($scope.platformList, defaultPlatform)) {
$scope.selectedPlatform = defaultPlatform;
} else {
$scope.selectedPlatform = $scope.platformList[0];
}
$scope.loadingPlatformList = false;
$scope.updateTestSelector();
});
$scope.updateTestSelector = function() {
$scope.loadingTestData = true;
if ($scope.selectedPlatform) {
defaultPlatform = $scope.selectedPlatform;
}
PhSeries.getSeriesList(
$scope.selectedProject.name,
{ interval: $scope.timeRange, platform: $scope.selectedPlatform,
framework: $scope.selectedFramework.id,
subtests: $scope.includeSubtests ? 1 : 0 }).then(function(seriesList) {
$scope.unselectedTestList = _.sortBy(
_.filter(seriesList,
{ platform: $scope.selectedPlatform }), 'name');
// filter out tests which are already displayed or are
// already selected
_.forEach(_.union(testsDisplayed, $scope.testsToAdd),
function(test) {
_.remove($scope.unselectedTestList, {
projectName: test.projectName,
signature: test.signature });
});
$scope.loadingTestData = false;
});
};
$scope.loadingTestData = false;
});
};
};
$uibModalInstance.updateTestInput = $scope.updateTestInput;
$scope.updateTestInput();
});
});
};
$uibModalInstance.updateTestInput = $scope.updateTestInput;
$scope.updateTestInput();
});
}]);

Просмотреть файл

@ -2,7 +2,7 @@
var failureViewerApp = angular.module('failureviewer', ['treeherder']);
failureViewerApp.config(function($compileProvider) {
failureViewerApp.config(['$compileProvider', function($compileProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
});
}]);

Просмотреть файл

@ -2,13 +2,14 @@
var logViewerApp = angular.module('logviewer', ['treeherder']);
logViewerApp.config(function($compileProvider, $resourceProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
logViewerApp.config(['$compileProvider', '$resourceProvider',
function($compileProvider, $resourceProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
// All queries should be cancellable by default (why is this configurable??)
$resourceProvider.defaults.cancellable = true;
});
// All queries should be cancellable by default (why is this configurable??)
$resourceProvider.defaults.cancellable = true;
}]);

Просмотреть файл

@ -1,66 +1,66 @@
"use strict";
// configure the router here, after we have defined all the controllers etc
perf.config(function($compileProvider, $httpProvider, $stateProvider, $urlRouterProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
perf.config(['$compileProvider', '$httpProvider', '$stateProvider', '$urlRouterProvider',
function($compileProvider, $httpProvider, $stateProvider, $urlRouterProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.useApplyAsync(true);
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.useApplyAsync(true);
$stateProvider.state('alerts', {
title: 'Alerts',
templateUrl: 'partials/perf/alertsctrl.html',
url: '/alerts?id&status&framework&filter&hideImprovements&hideTo&page',
controller: 'AlertsCtrl'
}).state('graphs', {
title: 'Graphs',
templateUrl: 'partials/perf/graphsctrl.html',
url: '/graphs?timerange&series&highlightedRevisions&highlightAlerts&zoom&selected',
controller: 'GraphsCtrl'
}).state('compare', {
templateUrl: 'partials/perf/comparectrl.html',
url: '/compare?originalProject&originalRevision&newProject&newRevision&hideMinorChanges&framework&filter&showOnlyImportant&showOnlyConfident',
controller: 'CompareResultsCtrl'
}).state('comparesubtest', {
templateUrl: 'partials/perf/comparesubtestctrl.html',
url: '/comparesubtest?originalProject&originalRevision&newProject&newRevision&originalSignature&newSignature&filter&showOnlyImportant&showOnlyConfident&framework',
controller: 'CompareSubtestResultsCtrl'
}).state('comparechooser', {
title: 'Compare',
templateUrl: 'partials/perf/comparechooserctrl.html',
url: '/comparechooser?originalProject&originalRevision&newProject&newRevision',
controller: 'CompareChooserCtrl'
}).state('e10s_trend', {
title: 'e10s trend dashboard',
templateUrl: 'partials/perf/e10s-trend.html',
url: '/e10s-trend?filter&showOnlyImportant&showOnlyConfident&showOnlyBlockers&repo&basedate&newdate&timerange&revision',
controller: 'e10sTrendCtrl'
}).state('e10s_trendsubtest', {
templateUrl: 'partials/perf/e10s-trend-subtest.html',
url: '/e10s_trendsubtest?filter&showOnlyImportant&showOnlyConfident&showOnlyBlockers&repo&basedate&newdate&timerange&revision&baseSignature&e10sSignature',
controller: 'e10sTrendSubtestCtrl'
}).state('dashboard', {
title: 'Perfherder Dashboard',
templateUrl: 'partials/perf/dashboard.html',
url: '/dashboard?topic&filter&showOnlyImportant&showOnlyConfident&showOnlyBlockers&repo&timerange&revision',
controller: 'dashCtrl'
}).state('dashboardsubtest', {
templateUrl: 'partials/perf/dashboardsubtest.html',
url: '/dashboardsubtest?topic&filter&showOnlyImportant&showOnlyConfident&baseSignature&variantSignature&repo&timerange&revision',
controller: 'dashSubtestCtrl'
});
$stateProvider.state('alerts', {
title: 'Alerts',
templateUrl: 'partials/perf/alertsctrl.html',
url: '/alerts?id&status&framework&filter&hideImprovements&hideTo&page',
controller: 'AlertsCtrl'
}).state('graphs', {
title: 'Graphs',
templateUrl: 'partials/perf/graphsctrl.html',
url: '/graphs?timerange&series&highlightedRevisions&highlightAlerts&zoom&selected',
controller: 'GraphsCtrl'
}).state('compare', {
templateUrl: 'partials/perf/comparectrl.html',
url: '/compare?originalProject&originalRevision&newProject&newRevision&hideMinorChanges&framework&filter&showOnlyImportant&showOnlyConfident',
controller: 'CompareResultsCtrl'
}).state('comparesubtest', {
templateUrl: 'partials/perf/comparesubtestctrl.html',
url: '/comparesubtest?originalProject&originalRevision&newProject&newRevision&originalSignature&newSignature&filter&showOnlyImportant&showOnlyConfident&framework',
controller: 'CompareSubtestResultsCtrl'
}).state('comparechooser', {
title: 'Compare',
templateUrl: 'partials/perf/comparechooserctrl.html',
url: '/comparechooser?originalProject&originalRevision&newProject&newRevision',
controller: 'CompareChooserCtrl'
}).state('e10s_trend', {
title: 'e10s trend dashboard',
templateUrl: 'partials/perf/e10s-trend.html',
url: '/e10s-trend?filter&showOnlyImportant&showOnlyConfident&showOnlyBlockers&repo&basedate&newdate&timerange&revision',
controller: 'e10sTrendCtrl'
}).state('e10s_trendsubtest', {
templateUrl: 'partials/perf/e10s-trend-subtest.html',
url: '/e10s_trendsubtest?filter&showOnlyImportant&showOnlyConfident&showOnlyBlockers&repo&basedate&newdate&timerange&revision&baseSignature&e10sSignature',
controller: 'e10sTrendSubtestCtrl'
}).state('dashboard', {
title: 'Perfherder Dashboard',
templateUrl: 'partials/perf/dashboard.html',
url: '/dashboard?topic&filter&showOnlyImportant&showOnlyConfident&showOnlyBlockers&repo&timerange&revision',
controller: 'dashCtrl'
}).state('dashboardsubtest', {
templateUrl: 'partials/perf/dashboardsubtest.html',
url: '/dashboardsubtest?topic&filter&showOnlyImportant&showOnlyConfident&baseSignature&variantSignature&repo&timerange&revision',
controller: 'dashSubtestCtrl'
});
$urlRouterProvider.otherwise('/graphs');
}).run(['$rootScope', '$state', '$stateParams',
function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
$urlRouterProvider.otherwise('/graphs');
}]).run(['$rootScope', '$state', '$stateParams', function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
$rootScope.$on('$stateChangeSuccess', function() {
if ($state.current.title) {
window.document.title = $state.current.title;
}
});
}]);
$rootScope.$on('$stateChangeSuccess', function() {
if ($state.current.title) {
window.document.title = $state.current.title;
}
});
}]);

Просмотреть файл

@ -117,6 +117,6 @@ var revisionListComponent = React.createClass({
}
});
treeherder.directive('revisions', function (reactDirective, $injector) {
treeherder.directive('revisions', ['reactDirective', '$injector', function (reactDirective, $injector) {
return reactDirective(revisionListComponent, undefined, {}, {$injector});
});
}]);

Просмотреть файл

@ -45,6 +45,6 @@ var ReactSelectComponent = React.createClass({
}
});
treeherder.directive('reactselect', function (reactDirective) {
treeherder.directive('reactselect', ['reactDirective', function (reactDirective) {
return reactDirective(ReactSelectComponent);
});
}]);

Просмотреть файл

@ -1,36 +1,37 @@
'use strict';
var treeherderApp = angular.module('treeherder.app',
['treeherder', 'ui.bootstrap', 'ngRoute',
'mc.resizer', 'angular-toArrayFilter', 'react']);
['treeherder', 'ui.bootstrap', 'ngRoute',
'mc.resizer', 'angular-toArrayFilter', 'react']);
treeherderApp.config(function($compileProvider, $routeProvider,
$httpProvider, $logProvider, $resourceProvider,
localStorageServiceProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
treeherderApp.config(['$compileProvider', '$routeProvider', '$httpProvider',
'$logProvider', '$resourceProvider', 'localStorageServiceProvider',
function($compileProvider, $routeProvider, $httpProvider, $logProvider,
$resourceProvider, localStorageServiceProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
// All queries should be cancellable by default (why is this configurable??)
$resourceProvider.defaults.cancellable = true;
// All queries should be cancellable by default (why is this configurable??)
$resourceProvider.defaults.cancellable = true;
// enable or disable debug messages using $log.
// comment out the next line to enable them
$logProvider.debugEnabled(false);
// enable or disable debug messages using $log.
// comment out the next line to enable them
$logProvider.debugEnabled(false);
localStorageServiceProvider.setPrefix("treeherder");
localStorageServiceProvider.setPrefix("treeherder");
// avoid CORS issue when getting the logs from the ftp site
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
// avoid CORS issue when getting the logs from the ftp site
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.useApplyAsync(true);
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.useApplyAsync(true);
$routeProvider.
$routeProvider.
when('/jobs', {
controller: 'JobsCtrl',
templateUrl: 'partials/main/jobs.html',
@ -47,4 +48,4 @@ treeherderApp.config(function($compileProvider, $routeProvider,
template: '<login-callback/>'
}).
otherwise({redirectTo: '/jobs'});
});
}]);

Просмотреть файл

@ -2,7 +2,7 @@
var userguideApp = angular.module('userguide', []);
userguideApp.config(function ($compileProvider) {
userguideApp.config(['$compileProvider', function ($compileProvider) {
// Disable debug data, as recommended by https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled(false);
});
}]);

Просмотреть файл

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html ng-controller="LogviewerCtrl" ng-init="init()" ng-app="logviewer">
<html ng-controller="LogviewerCtrl" ng-init="init()" ng-app="logviewer" ng-strict-di>
<head>
<meta charset="utf-8">
<title ng-bind="::logViewerTitle">Log viewer</title>

Просмотреть файл

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html ng-app="perf">
<html ng-app="perf" ng-strict-di>
<head>
<meta charset="utf-8">
<title>Perfherder</title>

Просмотреть файл

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html ng-app="userguide">
<html ng-app="userguide" ng-strict-di>
<head>
<meta charset="utf-8">
<title>Treeherder User Guide</title>

4
ui/vendor/resizer.js поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
/* From: http://stackoverflow.com/a/22253161/295132 (author: Mario Campa) */
angular.module('mc.resizer', []).directive('resizer', function($document) {
angular.module('mc.resizer', []).directive('resizer', ['$document', function($document) {
return function($scope, $element, $attrs) {
$element.on('mousedown', function(event) {
event.preventDefault();
@ -41,4 +41,4 @@ angular.module('mc.resizer', []).directive('resizer', function($document) {
$document.unbind('mouseup', mouseup);
}
};
});
}]);