Merge branch 'master' into pagesnew

This commit is contained in:
Joseph Schorr 2015-03-05 14:22:10 -05:00
commit 86447c0a99
52 changed files with 553 additions and 211 deletions

View file

@ -0,0 +1,11 @@
/**
* Adds an ng-name attribute which sets the name of a form field. Using the normal name field
* in Angular 1.3 works, but we're still on 1.2.
*/
angular.module('quay').directive('ngName', function () {
return function (scope, element, attr) {
scope.$watch(attr.ngName, function (name) {
element.attr('name', name);
});
};
});

View file

@ -38,6 +38,23 @@ angular.module('quay').directive('createExternalNotificationDialog', function ()
$scope.unauthorizedEmail = false;
};
$scope.hasRegexMismatch = function(err, fieldName) {
if (!err.pattern) {
return;
}
for (var i = 0; i < err.pattern.length; ++i) {
var current = err.pattern[i];
var value = current.$viewValue;
var elem = $element.find('#' + fieldName);
if (value == elem[0].value) {
return true;
}
}
return false;
};
$scope.createNotification = function() {
if (!$scope.currentConfig.email) {
$scope.performCreateNotification();

View file

@ -0,0 +1,22 @@
/**
* An element which displays the current status of the service as an announcement bar.
*/
angular.module('quay').directive('quayServiceStatusBar', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/quay-service-status-bar.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {},
controller: function($scope, $element, StatusService) {
$scope.indicator = 'loading';
StatusService.getStatus(function(data) {
$scope.indicator = data['status']['indicator'];
$scope.incidents = data['incidents'];
});
}
};
return directiveDefinitionObject;
});

View file

@ -0,0 +1,24 @@
/**
* An element which displays the current status of the service.
*/
angular.module('quay').directive('quayServiceStatus', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/quay-service-status.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {},
controller: function($scope, $element, StatusService) {
$scope.indicator = 'loading';
$scope.description = '';
StatusService.getStatus(function(data) {
$scope.indicator = data['status']['indicator'];
$scope.incidents = data['incidents'];
$scope.description = data['status']['description'];
});
}
};
return directiveDefinitionObject;
});

View file

@ -523,7 +523,7 @@ ImageHistoryTree.prototype.pruneUnreferenced_ = function(node) {
}
if (!node.tags) {
return true;
return node.children.length == 0;
}
return (node.children.length == 0 && node.tags.length == 0);

View file

@ -101,8 +101,11 @@ function(Config, Features) {
'fields': [
{
'name': 'room_id',
'type': 'string',
'title': 'Room ID #'
'type': 'regex',
'title': 'Room ID #',
'regex': '^[0-9]+$',
'help_url': 'https://hipchat.com/admin/rooms',
'regex_fail_message': 'We require the HipChat room <b>number</b>, not name.'
},
{
'name': 'notification_token',

View file

@ -120,7 +120,7 @@ function(KeyService, UserService, CookieService, ApiService, Features, Config) {
};
planService.getPlans = function(callback, opt_includePersonal) {
planService.verifyLoaded(function() {
planService.verifyLoaded(function(plans) {
var filtered = [];
for (var i = 0; i < plans.length; ++i) {
var plan = plans[i];

View file

@ -0,0 +1,40 @@
/**
* Helper service for retrieving the statuspage status of the quay service.
*/
angular.module('quay').factory('StatusService', ['Features', function(Features) {
if (!Features.BILLING) {
return;
}
var STATUSPAGE_PAGE_ID = '8szqd6w4s277';
var STATUSPAGE_SRC = 'https://statuspage-production.s3.amazonaws.com/se-v2.js';
var statusPageHandler = null;
var statusPageData = null;
var callbacks = [];
var handleGotData = function(data) {
if (!data) { return; }
statusPageData = data;
for (var i = 0; i < callbacks.length; ++i) {
callbacks[i](data);
}
callbacks = [];
};
$.getScript(STATUSPAGE_SRC, function(){
statusPageHandler = new StatusPage.page({ page: STATUSPAGE_PAGE_ID });
statusPageHandler.summary({
success : handleGotData
});
});
var statusService = {};
statusService.getStatus = function(callback) {
callbacks.push(callback);
handleGotData(statusPageData);
};
return statusService;
}]);