- Move all quay.io domain references to config and add new methods for easy construction of URLs

- Make the Olark chat live behind a feature flag
This commit is contained in:
Joseph Schorr 2014-04-08 20:33:20 -04:00
parent da859203f7
commit 3a3758654c
8 changed files with 41 additions and 27 deletions

View file

@ -123,6 +123,7 @@ def render_page_template(name, **kwargs):
config_set=json.dumps(getFrontendVisibleConfig(app.config)), config_set=json.dumps(getFrontendVisibleConfig(app.config)),
mixpanel_key=app.config.get('MIXPANEL_KEY', ''), mixpanel_key=app.config.get('MIXPANEL_KEY', ''),
is_debug=str(app.config.get('DEBUGGING', False)).lower(), is_debug=str(app.config.get('DEBUGGING', False)).lower(),
show_chat=features.OLARK_CHAT,
cache_buster=random_string(), cache_buster=random_string(),
**kwargs)) **kwargs))

View file

@ -471,6 +471,15 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'angu
} }
var config = window.__config; var config = window.__config;
config.getDomain = function() {
return config['SERVER_NAME'];
};
config.getUrl = function(opt_path) {
var path = opt_path || '';
return config['PREFERRED_URL_SCHEME'] + '://' + config['SERVER_NAME'] + path;
};
config.getValue = function(name, opt_defaultValue) { config.getValue = function(name, opt_defaultValue) {
var value = config[name]; var value = config[name];
if (value == null) { if (value == null) {
@ -879,7 +888,7 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'angu
keyService['stripePublishableKey'] = Config['STRIPE_PUBLISHABLE_KEY']; keyService['stripePublishableKey'] = Config['STRIPE_PUBLISHABLE_KEY'];
keyService['githubClientId'] = Config['GITHUB_CLIENT_ID']; keyService['githubClientId'] = Config['GITHUB_CLIENT_ID'];
keyService['githubLoginClientId'] = Config['GITHUB_LOGIN_CLIENT_ID']; keyService['githubLoginClientId'] = Config['GITHUB_LOGIN_CLIENT_ID'];
keyService['githubRedirectUri'] = Config['PREFERRED_URL_SCHEME'] + '://' + Config['SERVER_NAME'] + '/oauth2/github/callback'; keyService['githubRedirectUri'] = Config.getUrl('/oauth2/github/callback');
return keyService; return keyService;
}]); }]);
@ -1195,7 +1204,7 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'angu
email: email, email: email,
amount: planDetails.price, amount: planDetails.price,
currency: 'usd', currency: 'usd',
name: 'Quay ' + planDetails.title + ' Subscription', name: 'Quay.io ' + planDetails.title + ' Subscription',
description: 'Up to ' + planDetails.privateRepos + ' private repositories', description: 'Up to ' + planDetails.privateRepos + ' private repositories',
panelLabel: 'Subscribe', panelLabel: 'Subscribe',
token: submitToken, token: submitToken,
@ -1861,7 +1870,7 @@ quayApp.directive('plansTable', function () {
}); });
quayApp.directive('dockerAuthDialog', function () { quayApp.directive('dockerAuthDialog', function (Config) {
var directiveDefinitionObject = { var directiveDefinitionObject = {
priority: 0, priority: 0,
templateUrl: '/static/directives/docker-auth-dialog.html', templateUrl: '/static/directives/docker-auth-dialog.html',
@ -1882,11 +1891,10 @@ quayApp.directive('dockerAuthDialog', function () {
$scope.downloadCfg = function() { $scope.downloadCfg = function() {
var auth = $.base64.encode($scope.username + ":" + $scope.token); var auth = $.base64.encode($scope.username + ":" + $scope.token);
config = { config = {}
"https://quay.io/v1/": { config[Config.getUrl('/v1/')] = {
"auth": auth, "auth": auth,
"email": "" "email": ""
}
}; };
var file = JSON.stringify(config, null, ' '); var file = JSON.stringify(config, null, ' ');
@ -3803,7 +3811,7 @@ quayApp.directive('dockerfileCommand', function () {
scope: { scope: {
'command': '=command' 'command': '=command'
}, },
controller: function($scope, $element, $sanitize) { controller: function($scope, $element, $sanitize, Config) {
var registryHandlers = { var registryHandlers = {
'quay.io': function(pieces) { 'quay.io': function(pieces) {
var rnamespace = pieces[pieces.length - 2]; var rnamespace = pieces[pieces.length - 2];
@ -3818,6 +3826,8 @@ quayApp.directive('dockerfileCommand', function () {
} }
}; };
registryHandlers[Config.getDomain()] = registryHandlers['quay.io'];
var kindHandlers = { var kindHandlers = {
'FROM': function(title) { 'FROM': function(title) {
var pieces = title.split('/'); var pieces = title.split('/');

View file

@ -48,14 +48,15 @@ function PlansCtrl($scope, $location, UserService, PlanService) {
}; };
} }
function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) { function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService, Config) {
// Default to showing sudo on all commands if on linux. // Default to showing sudo on all commands if on linux.
var showSudo = navigator.appVersion.indexOf("Linux") != -1; var showSudo = navigator.appVersion.indexOf("Linux") != -1;
$scope.tour = { $scope.tour = {
'title': 'Quay.io Tutorial', 'title': 'Quay.io Tutorial',
'initialScope': { 'initialScope': {
'showSudo': showSudo 'showSudo': showSudo,
'domainName': Config.getDomain()
}, },
'steps': [ 'steps': [
{ {
@ -316,7 +317,9 @@ function LandingCtrl($scope, UserService, ApiService, Features, Config) {
}; };
} }
function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiService, $routeParams, $rootScope, $location, $timeout) { function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiService, $routeParams, $rootScope, $location, $timeout, Config) {
$scope.Config = Config;
var namespace = $routeParams.namespace; var namespace = $routeParams.namespace;
var name = $routeParams.name; var name = $routeParams.name;
@ -1162,7 +1165,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
fetchRepository(); fetchRepository();
} }
function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams, $rootScope, $location, UserService) { function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams, $rootScope, $location, UserService, Config) {
var namespace = $routeParams.namespace; var namespace = $routeParams.namespace;
var name = $routeParams.name; var name = $routeParams.name;
@ -1178,12 +1181,12 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams
$scope.getBadgeFormat = function(format, repo) { $scope.getBadgeFormat = function(format, repo) {
if (!repo) { return; } if (!repo) { return; }
var imageUrl = 'https://quay.io/repository/' + namespace + '/' + name + '/status'; var imageUrl = Config.getUrl('/' + namespace + '/' + name + '/status');
if (!$scope.repo.is_public) { if (!$scope.repo.is_public) {
imageUrl += '?token=' + $scope.repo.status_token; imageUrl += '?token=' + $scope.repo.status_token;
} }
var linkUrl = 'https://quay.io/repository/' + namespace + '/' + name; var linkUrl = Config.getUrl('/' + namespace + '/' + name);
switch (format) { switch (format) {
case 'svg': case 'svg':

View file

@ -58,7 +58,7 @@
<span class="pull-command visible-md-inline"> <span class="pull-command visible-md-inline">
<div class="pull-container" title="Pull repository" bs-tooltip="tooltip.title"> <div class="pull-container" title="Pull repository" bs-tooltip="tooltip.title">
<div class="input-group"> <div class="input-group">
<input id="pull-text" type="text" class="form-control" value="{{ 'docker pull quay.io/' + repo.namespace + '/' + repo.name }}" readonly> <input id="pull-text" type="text" class="form-control" value="{{ 'docker pull ' + Config.getDomain() + '/' + repo.namespace + '/' + repo.name }}" readonly>
<span id="copyClipboard" class="input-group-addon" title="Copy to Clipboard" data-clipboard-target="pull-text"> <span id="copyClipboard" class="input-group-addon" title="Copy to Clipboard" data-clipboard-target="pull-text">
<i class="fa fa-copy"></i> <i class="fa fa-copy"></i>
</span> </span>
@ -87,13 +87,13 @@
<div class="panel-heading">How to push a new image to this repository:</div> <div class="panel-heading">How to push a new image to this repository:</div>
<div class="panel-body"> <div class="panel-body">
First login to Quay.io (if you have not done so already): First login to Quay.io (if you have not done so already):
<pre class="command">sudo docker login quay.io</pre> <pre class="command">sudo docker login {{ Config.getDomain() }}</pre>
Tag an image to this repository: Tag an image to this repository:
<pre class="command">sudo docker tag <i>0u123imageidgoeshere</i> quay.io/{{repo.namespace}}/{{repo.name}}</pre> <pre class="command">sudo docker tag <i>0u123imageidgoeshere</i> {{ Config.getDomain() }}/{{repo.namespace}}/{{repo.name}}</pre>
Push the image to this repository: Push the image to this repository:
<pre class="command">sudo docker push quay.io/{{repo.namespace}}/{{repo.name}}</pre> <pre class="command">sudo docker push {{ Config.getDomain() }}/{{repo.namespace}}/{{repo.name}}</pre>
</div> </div>
</div> </div>
</div> </div>

View file

@ -15,8 +15,8 @@
<p>Once a container has terminated in Docker, the next step is to <i>commit</i> the container to an image, and then <i>tag</i> that image with a relevant name so it can be saved to a repository.</p> <p>Once a container has terminated in Docker, the next step is to <i>commit</i> the container to an image, and then <i>tag</i> that image with a relevant name so it can be saved to a repository.</p>
<p>Docker lets us do this in one step with the <i>commit</i> command. To do so, we run the <code>docker commit</code> with the container ID from the previous step and tag it to be a repository under <code>quay.io</code>. <p>Docker lets us do this in one step with the <i>commit</i> command. To do so, we run the <code>docker commit</code> with the container ID from the previous step and tag it to be a repository under <code>{{ tour.tourScope.domainName }}</code>.
<pre class="command"> <pre class="command">
<code ng-show="tour.tourScope.showSudo">sudo </code>docker commit <var class="var1">{{ tour.tourScope.containerId || 'containerId' }}</var> quay.io/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var> <code ng-show="tour.tourScope.showSudo">sudo </code>docker commit <var class="var1">{{ tour.tourScope.containerId || 'containerId' }}</var> {{ tour.tourScope.domainName }}/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var>
</pre> </pre>

View file

@ -10,7 +10,7 @@
<p>The first step when using Quay.io is to login via the <code>docker login</code> command.</p> <p>The first step when using Quay.io is to login via the <code>docker login</code> command.</p>
<p>Enter your Quay.io username and your password when prompted.</p> <p>Enter your Quay.io username and your password when prompted.</p>
<pre class="command"><code ng-show="tour.tourScope.showSudo">sudo </code>docker login quay.io <pre class="command"><code ng-show="tour.tourScope.showSudo">sudo </code>docker login {{ tour.tourScope.domainName }}
Username: {{ tour.tourScope.username }} Username: {{ tour.tourScope.username }}
Password: (password here) Password: (password here)
Email: {{ tour.tourScope.email }}</pre> Email: {{ tour.tourScope.email }}</pre>

View file

@ -1,8 +1,8 @@
<p>Now that we've tagged our image with a repository name, we can <code>push</code> the repository to Quay.io:</p> <p>Now that we've tagged our image with a repository name, we can <code>push</code> the repository to Quay.io:</p>
<pre class="command"> <pre class="command">
<code ng-show="tour.tourScope.showSudo">sudo </code>docker push quay.io/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var> <code ng-show="tour.tourScope.showSudo">sudo </code>docker push {{ tour.tourScope.domainName }}/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var>
The push refers to a repository [quay.io/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var>] (len: 1) The push refers to a repository [{{ tour.tourScope.domainName }}/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var>] (len: 1)
Sending image list Sending image list
Pushing repository quay.io/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var> (1 tags) Pushing repository {{ tour.tourScope.domainName }}/{{ tour.tourScope.username }}/<var class="var2">{{ tour.tourScope.repoName || 'myfirstrepo' }}</var> (1 tags)
</pre> </pre>

View file

@ -140,8 +140,8 @@ mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
{% if show_chat %}
<!-- begin olark code --> <!-- begin olark code -->
{% if request.host == 'quay.io' %}
<script data-cfasync="false" type='text/javascript'>/*<![CDATA[*/window.olark||(function(c){var f=window,d=document,l=f.location.protocol=="https:"?"https:":"http:",z=c.name,r="load";var nt=function(){ <script data-cfasync="false" type='text/javascript'>/*<![CDATA[*/window.olark||(function(c){var f=window,d=document,l=f.location.protocol=="https:"?"https:":"http:",z=c.name,r="load";var nt=function(){
f[z]=function(){ f[z]=function(){
(a.s=a.s||[]).push(arguments)};var a=f[z]._={ (a.s=a.s||[]).push(arguments)};var a=f[z]._={
@ -160,8 +160,8 @@ mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug
loader: "static.olark.com/jsclient/loader0.js",name:"olark",methods:["configure","extend","declare","identify"]}); loader: "static.olark.com/jsclient/loader0.js",name:"olark",methods:["configure","extend","declare","identify"]});
/* custom configuration goes here (www.olark.com/documentation) */ /* custom configuration goes here (www.olark.com/documentation) */
olark.identify('1189-336-10-9918');/*]]>*/</script><noscript><a href="https://www.olark.com/site/1189-336-10-9918/contact" title="Contact us" target="_blank">Questions? Feedback?</a> powered by <a href="http://www.olark.com?welcome" title="Olark live chat software">Olark live chat software</a></noscript> olark.identify('1189-336-10-9918');/*]]>*/</script><noscript><a href="https://www.olark.com/site/1189-336-10-9918/contact" title="Contact us" target="_blank">Questions? Feedback?</a> powered by <a href="http://www.olark.com?welcome" title="Olark live chat software">Olark live chat software</a></noscript>
{% endif %}
<!-- end olark code --> <!-- end olark code -->
{% endif %}
<div class="angular-tour-ui" inline="false" tour="angular_tour_current"></div> <div class="angular-tour-ui" inline="false" tour="angular_tour_current"></div>
</body> </body>