Skip to content
This repository was archived by the owner on May 24, 2018. It is now read-only.

Commit 163ea86

Browse files
Merge pull request #363 from Unity-Technologies/cdsk-935-environment-stylesheet
[CDSK-935] Create a mechanism to change stylesheet between staging and production
2 parents 876fc22 + 3ad19bb commit 163ea86

File tree

10 files changed

+49
-34
lines changed

10 files changed

+49
-34
lines changed

master/buildbot/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1525084848
1+
1525251296

master/buildbot/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def __init__(self):
134134
self.globalFactory = dict(initialSteps=[], lastSteps=[])
135135
self.regex_branches = REGEX_BRANCHES
136136
self.tag_as_branch_regex = TAG_AS_BRANCH_REGEX
137+
self.environment = 'staging'
137138

138139
_known_config_keys = set([
139140
"buildbotURL", "buildCacheSize", "builders", "buildHorizon", "caches",
@@ -147,6 +148,7 @@ def __init__(self):
147148
"analytics_code", "gzip", "autobahn_push", "lastBuildCacheDays",
148149
"requireLogin", "globalFactory", "slave_debug_url", "slaveManagerUrl",
149150
"cleanUpPeriod", "buildRequestsDays", "remoteCallTimeout", "myBuildDayCount",
151+
"environment",
150152
])
151153

152154
@classmethod
@@ -289,6 +291,7 @@ def copy_str_param(name, alt_key=None):
289291

290292
copy_str_param('realTimeServer')
291293
copy_str_param('analytics_code')
294+
copy_str_param('environment')
292295

293296
copy_int_param('cleanUpPeriod')
294297
copy_int_param('changeHorizon')

master/buildbot/status/web/base.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -508,20 +508,14 @@ def getAnalyticsCode(self, request):
508508

509509

510510
class ContextMixin(AccessorMixin):
511-
custom_css_file = None
512-
custom_css = None
513511

514512
def getContext(self, request):
515513
status = self.getStatus(request)
516514
rootpath = path_to_root(request)
517515
locale_enc = locale.getdefaultlocale()[1]
518516
authz = self.getAuthz(request)
519517
authenticated = authz.authenticated(request)
520-
521-
self.custom_css_file = os.path.join(request.site.buildbot_service.public_html, 'prod/css/custom.css')
522-
self.custom_css = os.path.isfile(self.custom_css_file) \
523-
if self.custom_css is None or request.site.buildbot_service.public_html not in self.custom_css_file \
524-
else self.custom_css
518+
master = request.site.buildbot_service.master
525519

526520
if locale_enc is not None:
527521
locale_tz = unicode(time.tzname[time.localtime()[-1]], locale_enc)
@@ -530,7 +524,6 @@ def getContext(self, request):
530524
return dict(title_url = status.getTitleURL(),
531525
title = status.getTitle(),
532526
stylesheet = rootpath + 'default.css',
533-
custom_styles = self.custom_css,
534527
path_to_root = rootpath,
535528
version = version,
536529
realTimeServer = self.getRealTimeServer(request),
@@ -544,7 +537,8 @@ def getContext(self, request):
544537
request = request,
545538
alert_msg = request.args.get("alert_msg", [""])[0],
546539
analytics_code = self.getAnalyticsCode(request),
547-
authenticated=authenticated
540+
authenticated=authenticated,
541+
environment=master.config.environment,
548542
)
549543

550544

www/prod/css/default.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,8 @@ span.log-warning{color:#AD823A}
899899
.yellow{background-color:#7A760D;border:1px solid #9F9B41;-webkit-box-shadow:0 0 4px #9F9B41 inset;box-shadow:0 0 4px #9F9B41 inset}
900900
.top-menu-container{background-image:-moz-linear-gradient(top,#386b6d 0,#3B7d78 100%);background-image:-webkit-linear-gradient(top,#386b6d 0,#3B7d78 100%);background-image:-o-linear-gradient(top,#386b6d 0,#3B7d78 100%);background-image:-ms-linear-gradient(top,#386b6d 0,#3B7d78 100%);background-image:linear-gradient(top,#386b6d 0,#3B7d78 100%)}
901901
.top-menu-container:after{content:"";display:table;clear:both}
902+
.staging .top-menu-container{background-image:-moz-linear-gradient(top,#143c07 0,#143c07 100%);background-image:-webkit-linear-gradient(top,#143c07 0,#143c07 100%);background-image:-o-linear-gradient(top,#143c07 0,#143c07 100%);background-image:-ms-linear-gradient(top,#143c07 0,#143c07 100%);background-image:linear-gradient(top,#143c07 0,#143c07 100%)}
903+
.production .top-menu-container{background-image:-moz-linear-gradient(top,#6a5b70 0,#6a5b70 100%);background-image:-webkit-linear-gradient(top,#6a5b70 0,#6a5b70 100%);background-image:-o-linear-gradient(top,#6a5b70 0,#6a5b70 100%);background-image:-ms-linear-gradient(top,#6a5b70 0,#6a5b70 100%);background-image:linear-gradient(top,#6a5b70 0,#6a5b70 100%)}
902904
.outer-bar{float:right;height:17px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px;border:1px solid #a2cdcf;display:none;margin:-2px 0 -2px 5px;position:relative;width:12px}
903905
.smartphone-nav{display:block;float:right;margin:10px 0;cursor:pointer}
904906
.smartphone-nav li{background-color:#a2cdcf;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px;margin-top:3px;width:20px;height:3px}
@@ -919,6 +921,7 @@ ul.top-menu>li>a{display:block;padding:10px 0;text-transform:none;font-size:11px
919921
.submenu li:last-child{margin-bottom:10px}
920922
.submenu li a{font-size:11px}
921923
.sub-menu-container{background-image:-moz-linear-gradient(top,#869e9c 0,#b9c9ca 100%);background-image:-webkit-linear-gradient(top,#869e9c 0,#b9c9ca 100%);background-image:-o-linear-gradient(top,#869e9c 0,#b9c9ca 100%);background-image:-ms-linear-gradient(top,#869e9c 0,#b9c9ca 100%);background-image:linear-gradient(top,#869e9c 0,#b9c9ca 100%);border-bottom:1px solid #b6c7c8;border-top:1px #89a09e;margin-bottom:22px}
924+
.production .sub-menu-container,.staging .sub-menu-container{background-image:-moz-linear-gradient(top,#a9a7aa 0,#cdcdcd 100%);background-image:-webkit-linear-gradient(top,#a9a7aa 0,#cdcdcd 100%);background-image:-o-linear-gradient(top,#a9a7aa 0,#cdcdcd 100%);background-image:-ms-linear-gradient(top,#a9a7aa 0,#cdcdcd 100%);background-image:linear-gradient(top,#a9a7aa 0,#cdcdcd 100%)}
922925
.header+.container{margin-top:30px}
923926
.breadcrumbs-nav{display:inline-block;padding:11px 0 10px;margin:0}
924927
.breadcrumbs-nav>li{color:rgba(255,255,255,.52);font-size:11px;float:left;list-style:none;margin:0 12px 0 0;padding:0;font-weight:700;letter-spacing:1.1px;line-height:12px}

www/sass/bootstrap/_variables.scss

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ $bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")
1111
//
1212
//## Gray and brand colors for use across Bootstrap.
1313

14-
$gray-darker: lighten(#000, 13.5%) !default; // #222
15-
$gray-dark: #444 !default; //
16-
$gray: lighten(#000, 33.5%) !default; // #555
17-
$gray-light: lighten(#000, 60%) !default; // #999
18-
$gray-lighter: lighten(#000, 93.5%) !default; // #eee
19-
$grey1: #ccc;
20-
$brand-primary: #3B7d78 !default;
21-
$brand-success: #5cb85c !default;
22-
$brand-info: #5bc0de !default;
23-
$brand-warning: #f0ad4e !default;
24-
$brand-danger: #d9534f !default;
25-
$brand-katana: #386b6d !default;
14+
$gray-darker: lighten(#000, 13.5%) !default; // #222
15+
$gray-dark: #444 !default; //
16+
$gray: lighten(#000, 33.5%) !default; // #555
17+
$gray-light: lighten(#000, 60%) !default; // #999
18+
$gray-lighter: lighten(#000, 93.5%) !default; // #eee
19+
$grey1: #ccc;
20+
$brand-primary: #3B7d78 !default;
21+
$brand-success: #5cb85c !default;
22+
$brand-info: #5bc0de !default;
23+
$brand-warning: #f0ad4e !default;
24+
$brand-danger: #d9534f !default;
25+
$brand-katana: #386b6d !default;
26+
$brand-staging-katana: #143c07 !default;
27+
$brand-production-katana: #6a5b70 !default;
2628

2729
//== Scaffolding
2830
//
@@ -772,6 +774,12 @@ $breadcrumb-separator: "/" !default;
772774
$breadcrumb-background-top: #869e9c !default;
773775
$breadcrumb-background-bottom: #b9c9ca !default;
774776

777+
$breadcrumb-staging-background-top: #a9a7aa !default;
778+
$breadcrumb-staging-background-bottom: #cdcdcd !default;
779+
780+
$breadcrumb-production-background-top: #a9a7aa !default;
781+
$breadcrumb-production-background-bottom: #cdcdcd !default;
782+
775783
//== Carousel
776784
//
777785
//##

www/sass/modules/page-elements/_navigation.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ border: 1px solid #9F9B41;
5656
@include pie-clearfix;
5757
}
5858

59+
.staging .top-menu-container {
60+
@include bgimage (linear-gradient(top, $brand-staging-katana 0%, $brand-staging-katana 100%));
61+
}
62+
63+
.production .top-menu-container {
64+
@include bgimage (linear-gradient(top, $brand-production-katana 0%, $brand-production-katana 100%));
65+
}
66+
5967
.outer-bar {
6068
float:right;
6169
height:17px;
@@ -196,6 +204,14 @@ ul.top-menu > .project-dropdown {
196204
margin-bottom: 22px;
197205
}
198206

207+
.staging .sub-menu-container {
208+
@include bgimage (linear-gradient(top , $breadcrumb-staging-background-top 0%, $breadcrumb-staging-background-bottom 100%));
209+
}
210+
211+
.production .sub-menu-container {
212+
@include bgimage (linear-gradient(top , $breadcrumb-production-background-top 0%, $breadcrumb-production-background-bottom 100%));
213+
}
214+
199215
.header + .container {
200216
margin-top: 30px;
201217
}

www/templates/buildstatus.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
f{% extends "layout.html" %}
1+
{% extends "layout.html" %}
22
{% from "box_macros.html" import box %}
33

44
{% block header %}

www/templates/layout.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
<link rel="shortcut icon" href="{{ path_to_root }}favicon.ico">
5959
{% block extra_header %}{% endblock %}
6060
<link rel="stylesheet" href="/prod/css/default.css?cachebust={{version}}" type="text/css" />
61-
{% if custom_styles %}
62-
<link rel="stylesheet" href="/prod/css/custom.css?cachebust={{version}}" type="text/css" />
63-
{% endif %}
6461
{% endblock %}
6562

6663
</head>
@@ -78,11 +75,11 @@
7875
{% set colorBlindInputVal = 'off' %}
7976
{% endif %}
8077

81-
<body {{ bodyId }} class="interface katana-main {{colorBlindClass}}" data-realTimeServer="{{ realTimeServer }}">
78+
<body {{ bodyId }} class="interface katana-main {{ colorBlindClass }} {{ environment }}" data-realTimeServer="{{ realTimeServer }}">
8279

8380
{% block header -%}
8481

85-
<header class="header">
82+
<header class="header">
8683
<nav class="top-menu-container">
8784
<div class="container">
8885

www/templates/log_chunk.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
<html>
33
<head>
44
<link rel="stylesheet" href="/prod/css/default.css" type="text/css" />
5-
{% if custom_styles %}
6-
<link rel="stylesheet" href="/prod/css/custom.css?cachebust={{version}}" type="text/css" />
7-
{% endif %}
85

96
<script type="text/javascript">
107
var require = {

www/templates/login.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88

99
<link rel="stylesheet" href="/prod/css/default.css" type="text/css"/>
10-
{% if custom_styles %}
11-
<link rel="stylesheet" href="/prod/css/custom.css?cachebust={{version}}" type="text/css" />
12-
{% endif %}
1310
<link rel="shortcut icon" href="{{ path_to_root }}favicon.ico">
1411
<script type="text/javascript">
1512
var require = {

0 commit comments

Comments
 (0)