You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/01/13 19:11:29 UTC
incubator-trafficcontrol git commit: removes percentagebar from to
graph page due to incompatible license
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/1.8.x 7e5db8d0d -> 597e7795c
removes percentagebar from to graph page due to incompatible license
(cherry picked from commit 2ba6ebd0519977dac648a1e6750834f6c408c527)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/597e7795
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/597e7795
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/597e7795
Branch: refs/heads/1.8.x
Commit: 597e7795c48ab65fe57175642973481b9dc020e6
Parents: 7e5db8d
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Jan 12 15:41:11 2017 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Fri Jan 13 12:10:32 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/public/js/percentagebar.js | 100 -------------------
.../app/templates/visual_status/graphs.html.ep | 27 +----
2 files changed, 2 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/597e7795/traffic_ops/app/public/js/percentagebar.js
----------------------------------------------------------------------
diff --git a/traffic_ops/app/public/js/percentagebar.js b/traffic_ops/app/public/js/percentagebar.js
deleted file mode 100644
index 88a667e..0000000
--- a/traffic_ops/app/public/js/percentagebar.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// From http://www.webappers.com/progressBar/lib/progress.js
-// use:
-// <script>display('<%= $short %>_percent_indicator',0,1);</script><
-// update:
-// setProgress(cdn + "_percent_indicator", Math.round(lastVal/maxGbps[cdn] * 100));
-
-/* WebAppers Progress Bar, version 0.2
-* (c) 2007 Ray Cheung
-*
-* WebAppers Progress Bar is freely distributable under the terms of an Creative Commons license.
-* For details, see the WebAppers web site: http://wwww.Webappers.com/
-*
-/*--------------------------------------------------------------------------*/
-var initial = -120;
-var imageWidth=240;
-var eachPercent = (imageWidth/2)/100;
-
-function percentLabel( id, percentage )
-{
- document.write('<div id="'+id+'Text" class="percent_label">'+percentage+'%</div>');
-}
-
-function progressBar( id, percentage )
-{
- document.write('<div id="'+id+'" class="progress_bar"></div>');
-}
-
-
-function setText (id, percent)
-{
- $('#' + id +'Text')[0].innerHTML = percent+"%";
-}
-
-function setProgress(id, percentage)
-{
- if (isNaN(percentage) || !isFinite(percentage)){
- percentage = 0;
- }
- var percentageWidth = eachPercent * percentage;
- var pb = $('#' + id);
- /* Sample Colors
- var green = '#A4E142';
- var yellow = '#D5E043';
- var red = '#E05043';
- */
-
- /* Mark T's colors*/
- var green = '#76AA5E';
- var yellow = '#C07818';
- var red = '#6D1E05';
- var color = green;
- var backgroundColor = '#ccc';
- if (percentage = 0) {
- color = backgroundColor;
- } else if ((percentage > 50) && (percentage < 75)) {
- color = yellow;
- } else if ((percentage > 75) && (percentage <=100)) {
- color = red;
- } else {
- color = green;
- }
-
- pb.progressbar({
- value: percentageWidth,
- });
- pb.css({
- "background": backgroundColor
- });
- var pbValue = pb.find( ".ui-progressbar-value" );
- pbValue.css({
- "background": color
- });
- //#A4E142 - Green
- //#D5E043 - Yellow
- //#E05043 - Red
- var newProgress = eval(initial)+eval(percentageWidth)+'px';
- $('#' + id)[0].style.backgroundPosition=newProgress+' 0';
- setText(id,percentage);
-}
-
-/*--------------------------------------------------------------------------*/
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/597e7795/traffic_ops/app/templates/visual_status/graphs.html.ep
----------------------------------------------------------------------
diff --git a/traffic_ops/app/templates/visual_status/graphs.html.ep b/traffic_ops/app/templates/visual_status/graphs.html.ep
index 551a8c1..30bdbb8 100644
--- a/traffic_ops/app/templates/visual_status/graphs.html.ep
+++ b/traffic_ops/app/templates/visual_status/graphs.html.ep
@@ -41,8 +41,7 @@ function getCurrentStats() {
$('#' + cdn_name + '_conn_val').text(connections.replace(/\B(?=(\d{3})+(?!\d))/g, ",")); //toLocaleString doesnt work across browsers, this regex does.
var capacity = Math.round(item.capacity);
var percentage = Math.round(bandwidth/capacity * 100);
- setProgress(cdn_name + "_percent_indicator", percentage);
- setText(cdn_name + "_percent_indicator", "avail: " + capacity + ", used: " + percentage);
+ $('#' + cdn_name + '_percent_indicator').text("avail: " + capacity + ", used: " + percentage + "%");
}
if (item.cdn == "total") {
var bandwidth = item.bandwidth.toFixed(2);
@@ -59,30 +58,9 @@ function getCurrentStats() {
setInterval(getCurrentStats, 30000);
</script>
-<script type="text/javascript" src="/js/percentagebar.js"></script>
<style>
.statistics_section { float:left; width:35%; color:white; font-size:150%; height:400px; width:305px; background-color:#1f1f1f; margin-right:5px; border:solid 1px grey; }
-.ui-progressbar {
- position: relative;
-}
-.progress-label {
- /*position: absolute;*/
- left: 50%;
- top: 4px;
- text-shadow: 1px 1px 0 #fff;
-}
-.percent_label {
- clear:both;
- float:left;
- margin-left:10px;
-}
-.progress_bar {
- float:right;
- height: 10px;
- width: 100px;
- float:right;
-}
#graph_panel {width: 65%; float: left; border:solid 1px grey;}
#stat_value, #total_gbps_val, #total_conn_val { font-size: 225%; text-align: right; padding-right: 10px;}
#stat_label{padding-top: 30px;};
@@ -99,8 +77,7 @@ setInterval(getCurrentStats, 30000);
<div id="total_gbps_val"></div>
% foreach my $cdn ( @{ $cdn_names }) {
<div id ="stat_label"><%= $cdn %> Gbps: </div>
- <div><script>percentLabel('<%= $cdn %>_percent_indicator',0);</script></div>
- <div><script>progressBar('<%= $cdn %>_percent_indicator',0);</script></div>
+ <div id="<%= $cdn %>_percent_indicator"></div>
<div id="stat_value">
<div id="<%= $cdn %>_gbps_val"></div>
</div>