From e576b3c5001dcc6031983f119bb09f26a2c24d41 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Tue, 20 Sep 2011 08:59:25 -0700 Subject: [PATCH] Remove unused admin sidebar. Show everyone app id. --- r2/r2/lib/pages/pages.py | 6 - r2/r2/public/static/css/reddit.css | 67 ------ r2/r2/templates/admin_rightbox.html | 29 --- r2/r2/templates/appservicemonitor.html | 278 ------------------------- r2/r2/templates/redditfooter.html | 1 + 5 files changed, 1 insertion(+), 380 deletions(-) delete mode 100644 r2/r2/templates/admin_rightbox.html delete mode 100644 r2/r2/templates/appservicemonitor.html diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 90490e3a5..e1377fdb3 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -277,9 +277,6 @@ class Reddit(Templated): if c.user.pref_show_adbox or not c.user.gold: ps.append(Ads()) - if c.user_is_admin: - ps.append(Admin_Rightbox()) - if c.user.pref_clickgadget and c.recent_clicks: ps.append(SideContentBox(_("Recently viewed links"), [ClickGadget(c.recent_clicks)])) @@ -2228,9 +2225,6 @@ class AdminUsage(Templated): class Ads(Templated): pass -class Admin_Rightbox(Templated): - pass - class Embed(Templated): """wrapper for embedding /help into reddit as if it were not on a separate wiki.""" def __init__(self,content = ''): diff --git a/r2/r2/public/static/css/reddit.css b/r2/r2/public/static/css/reddit.css index d205b9398..34a59df97 100644 --- a/r2/r2/public/static/css/reddit.css +++ b/r2/r2/public/static/css/reddit.css @@ -1362,73 +1362,6 @@ textarea.gray { color: gray; } font-size: larger; } -.server-status { width: 300px; } -.server-status table { - font-size: xx-small; - margin-left: 5px; - border-top: #BCBCBC solid 1px; - border-left: #BCBCBC solid 1px; - border-bottom: #E0E0E0 solid 1px; - border-right: #E0E0E0 solid 1px; - margin-bottom: 5px; - width: 290px; -} -.server-status td { padding-right: 2px; padding-left: 2px; } -.server-status .bar { height: 5px; background-color: blue; } -.load0 { background-color: #FFFFFF; } /* white */ -.load1 { background-color: #f0f5FF; } /* pale blue */ -.load2 { background-color: #E2ECFF; } /* blue */ -.load3 { background-color: #d6f5cb; } /* pale green */ -.load4 { background-color: #CAFF98; } /* green */ -.load5 { background-color: #e4f484; } /* yellowgreen */ -.load6 { background-color: #FFEA71; } /* orange */ -.load7 { background-color: #ffdb81; } /* orangerose */ -.load8 { background-color: #FF9191; } /* pink */ -.load9 { background-color: #FF0000; color: #FFFFFF } /* red */ -.server-status tr.down > * { - background-color: #C0C0C0; - text-decoration: line-through; -} - -.server-status th { font-weight: bold; padding-right: 2px; } -.server-status tr.title-region { cursor: pointer; } -.server-status tr.title-region:hover > td, -.server-status tr.title-region:hover > th { text-decoration: underline; } - -.server-status tr.title-region.empty { cursor: default; opacity: 0.7; } -.server-status tr.title-region.empty:hover > td, -.server-status tr.title-region.empty:hover > th { text-decoration: none; } - - -.server-status .pegged { - background-color: red; - font-weight: bold; - color: #FFFFFF; -} - -.server-status .membar { - height:11px; - border:1px solid white; - background-color:#6699FF; - position: relative; -} -.server-status .membar span { - position: absolute; - font-size: smaller; -} -.server-status .cpu50 { - height: 5px; - background-color:green; - border:1px solid white; - border-bottom: none; -} -.server-status .cpu300 { - height: 5px; - background-color:red; - border:1px solid white; -} - - /* login form */ .orangered { color: orangered; } diff --git a/r2/r2/templates/admin_rightbox.html b/r2/r2/templates/admin_rightbox.html deleted file mode 100644 index 8e690c363..000000000 --- a/r2/r2/templates/admin_rightbox.html +++ /dev/null @@ -1,29 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be consistent -## with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is Reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is CondeNet, Inc. -## -## All portions of the code written by CondeNet are Copyright (c) 2006-2010 -## CondeNet, Inc. All Rights Reserved. -################################################################################ - -<% - from r2.lib.services import AppServiceMonitor -%> - -%if c.user_is_admin: - ${AppServiceMonitor()} -%endif diff --git a/r2/r2/templates/appservicemonitor.html b/r2/r2/templates/appservicemonitor.html deleted file mode 100644 index 53d9666f1..000000000 --- a/r2/r2/templates/appservicemonitor.html +++ /dev/null @@ -1,278 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be consistent -## with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is Reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is CondeNet, Inc. -## -## All portions of the code written by CondeNet are Copyright (c) 2006-2010 -## CondeNet, Inc. All Rights Reserved. -################################################################################ - -<% - import datetime - cpu_col = 75. - mem_col = 40. - hide_data = "style='display:none'" if len(thing.hostlogs) > 4 else '' - # default number of color coding levels (to match reddit.css) - def get_load_level(host, nlevels = 8): - # default number of cpus shall be 1 - ncpus = getattr(host, "ncpu", 1) - # color code in nlevel levels - return _load_int(host.load(), ncpus, nlevels = 8) - def _load_int(current, max_val, nlevels = 8): - return min(max(int(nlevels*current/max_val+0.4), 0),nlevels+1) - - %> - -
-

Rendered by PID ${g.reddit_pid} on ${g.reddit_host} running ${g.short_version}

- - %for cache in ("memcaches", "rendercaches"): - <% - cache_lifetime = thing.get_cache_lifetime(key = cache) - if cache_lifetime > 0: - cache_lifetime = '%s' % datetime.timedelta(0, max(cache_lifetime, 0)) - else: - cache_lifetime = "--:--.--" - %> - - - - - %endfor -
${cache} lifetime:${'%s' % cache_lifetime}
- %if any(getattr(h, "queue", None) for h in thing.hostlogs): - - - - - - %for host in thing.hostlogs: - %if host.queue: - - - - %for name, data in host.queue: - <% - length = data() - max_len = host.queue.max_length(name) - load_level = _load_int(length, max_len) - %> - - - - - %endfor - %endif - %endfor -
queuelength
${name}${length} / ${max_len}
- %endif - %if any(h.database for h in thing.hostlogs): - - - - - - - - %for host in thing.hostlogs: - %if host.database: - <% - host_id = host.host.replace('.', '-') - load = host.load() - load_level = get_load_level(host) - if hasattr(host.database, "disk_usage"): - du = host.database.disk_usage - else: - du = 0; - du_wid = int(cpu_col*min(1, du)) - - if host.database.max_connections > 0: - max_conn = host.database.max_connections - conn = float(host.database.connections()) / max_conn - else: - max_conn = conn = 0 - - %> - - - - - - <% - qcount = host.database.query_count \ - if hasattr(host.database, "query_count") else None - %> - %if qcount and qcount(): - - - - - - %endif - - - - - %for ip, nconn in host.database.ip_conn.iteritems(): - - - - - - %endfor - - - - - %for db, nconn in host.database.db_conn.iteritems(): - - - - - - %endfor - %endif - %endfor -
databasediskconn
- ${host.host} load: ${load} - - %if host.database.vacuuming: - VACUUMING! - %else: -
- - ${"%3.0f%%" % (100 * du) } - -
- %endif -
- ${int(conn * max_conn)} -  /  - ${max_conn} - %if hasattr(host.database, "last_update"): - <% update = host.database.last_update() %> - %if not update or update > datetime.timedelta(0, 60): - - (${str(update).split('.')[0]} old) - - %endif - %endif -
- - query count: - - ${qcount()} -  /  - ${qcount(300)} -
by ip:
- ${ip} - - ${nconn()} -
by database:
- ${db} - - %if db in host.database.vacuuming: - VACUUMING! - %endif - - ${nconn()} -
- %endif - - - - - - - - - - %for host in thing.hostlogs: - <% - host_id = host.host.replace('.', '-') - load = host.load() - load_level = get_load_level(host) - %> - %if len(host.services): - - - - - - - %for service in host: - <% - pegged = all([service.cpu(x) > 99 \ - for x in (0, 5, 60, 300)]) or \ - (service.mem() >= 20) - pegged = "pegged" if pegged else "" - - mem_wid = int(mem_col/25*min(25, int(service.mem()))) - cpu_60_wid = int(cpu_col/100*min(100,int(service.cpu(60)))) - cpu_300_wid = int(cpu_col/100*min(100,int(service.cpu(300)))) - is_down = 'down' if service.pid < 0 else '' - %> - - - - - - - - %endfor - %endif - %endfor -
processmemory - 1 min / - 5 min -
- ${host.host} load: ${load} -
- %if g.reddit_host == host.host and g.reddit_pid == service.pid: - » - %else: -   - %endif - ${service.name} - -
-
-
-
-
- <% - age = service.age - if isinstance(age, str): - age = 0 - if age > 60: - age = "%d hr" % int(age/60) - else: - age = "%d min" % age - %> - ${age if service.pid > 0 else 'down'} -
-
- - - diff --git a/r2/r2/templates/redditfooter.html b/r2/r2/templates/redditfooter.html index 18f0b35f7..230ec03ec 100644 --- a/r2/r2/templates/redditfooter.html +++ b/r2/r2/templates/redditfooter.html @@ -54,4 +54,5 @@ dict(year=datetime.datetime.now().timetuple()[0])}

REDDIT and the ALIEN Logo are registered trademarks of Advance Magazine Publishers Inc.

+

Rendered by PID ${g.reddit_pid} on ${g.reddit_host} running ${g.short_version}.