Merge pull request #633 from meejah/ticket3228-remote-old-js

delete ancient jquery, d3 and the thing that depends on them
This commit is contained in:
meejah 2019-07-24 17:11:41 +00:00 committed by GitHub
commit 3f9f4537b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1 additions and 15754 deletions

View File

@ -0,0 +1 @@
remove ancient bundled jquery and d3, and the "dowload timeline" feature they support

View File

@ -1,37 +0,0 @@
<html xmlns:n="http://nevow.com/ns/nevow/0.1">
<head>
<title>AllMyData - Tahoe - File Download Status Timeline</title>
<link href="/tahoe.css" rel="stylesheet" type="text/css"/>
<link href="/icon.png" rel="shortcut icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/jquery-1.11.0.js"></script>
<script type="text/javascript" src="/d3-2.4.6.js"></script>
<script type="text/javascript" src="/d3-2.4.6.time.js"></script>
<script type="text/javascript" src="/download_status_timeline.js"></script>
</head>
<body>
<h1>File Download Status</h1>
<ul>
<li>Started: <span n:render="started"/></li>
<li>Storage Index: <span n:render="si"/>,
Total Size: <span n:render="total_size"/></li>
<li>Progress: <span n:render="progress"/>,
Status: <span n:render="status"/></li>
</ul>
<div style="">
<button id="toggle_misc_button">toggle misc events</button>
<button id="zoom_in_button">zoom in</button>
<button id="zoom_out_button">zoom out</button>
<button id="reset_button">reset zoom</button>
<!-- <div id="overview" style="float:right;width:166px;height:100px; border: 1px solid #ddd">overview</div> -->
<div id="timeline" style="border: 1px solid #aaa"></div>
</div>
<div>Return to the <a href="/">Welcome Page</a></div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,692 +0,0 @@
(function(){d3.time = {};
var d3_time = Date;
d3.time.format = function(template) {
var n = template.length;
function format(date) {
var string = [],
i = -1,
j = 0,
c,
f;
while (++i < n) {
if (template.charCodeAt(i) == 37) {
string.push(
template.substring(j, i),
(f = d3_time_formats[c = template.charAt(++i)])
? f(date) : c);
j = i + 1;
}
}
string.push(template.substring(j, i));
return string.join("");
}
format.parse = function(string) {
var date = new d3_time(1900, 0, 1),
i = d3_time_parse(date, template, string, 0);
if (i != string.length) return null;
if (date.hour12) {
var hours = date.getHours() % 12;
date.setHours(date.hour12pm ? hours + 12 : hours);
}
delete date.hour12;
delete date.hour12pm;
return date;
};
format.toString = function() {
return template;
};
return format;
};
function d3_time_parse(date, template, string, j) {
var c,
p,
i = 0,
n = template.length,
m = string.length;
while (i < n) {
if (j >= m) return -1;
c = template.charCodeAt(i++);
if (c == 37) {
p = d3_time_parsers[template.charAt(i++)];
if (!p || ((j = p(date, string, j)) < 0)) return -1;
} else if (c != string.charCodeAt(j++)) {
return -1;
}
}
return j;
}
var d3_time_zfill2 = d3.format("02d"),
d3_time_zfill3 = d3.format("03d"),
d3_time_zfill4 = d3.format("04d"),
d3_time_sfill2 = d3.format("2d");
var d3_time_formats = {
a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); },
A: function(d) { return d3_time_weekdays[d.getDay()]; },
b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); },
B: function(d) { return d3_time_months[d.getMonth()]; },
c: d3.time.format("%a %b %e %H:%M:%S %Y"),
d: function(d) { return d3_time_zfill2(d.getDate()); },
e: function(d) { return d3_time_sfill2(d.getDate()); },
H: function(d) { return d3_time_zfill2(d.getHours()); },
I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); },
j: d3_time_dayOfYear,
L: function(d) { return d3_time_zfill3(d.getMilliseconds()); },
m: function(d) { return d3_time_zfill2(d.getMonth() + 1); },
M: function(d) { return d3_time_zfill2(d.getMinutes()); },
p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; },
S: function(d) { return d3_time_zfill2(d.getSeconds()); },
U: d3_time_weekNumberSunday,
w: function(d) { return d.getDay(); },
W: d3_time_weekNumberMonday,
x: d3.time.format("%m/%d/%y"),
X: d3.time.format("%H:%M:%S"),
y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); },
Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); },
Z: d3_time_zone,
"%": function(d) { return "%"; }
};
var d3_time_parsers = {
a: d3_time_parseWeekdayAbbrev,
A: d3_time_parseWeekday,
b: d3_time_parseMonthAbbrev,
B: d3_time_parseMonth,
c: d3_time_parseLocaleFull,
d: d3_time_parseDay,
e: d3_time_parseDay,
H: d3_time_parseHour24,
I: d3_time_parseHour12,
// j: function(d, s, i) { /*TODO day of year [001,366] */ return i; },
L: d3_time_parseMilliseconds,
m: d3_time_parseMonthNumber,
M: d3_time_parseMinutes,
p: d3_time_parseAmPm,
S: d3_time_parseSeconds,
// U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; },
// w: function(d, s, i) { /*TODO weekday [0,6] */ return i; },
// W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; },
x: d3_time_parseLocaleDate,
X: d3_time_parseLocaleTime,
y: d3_time_parseYear,
Y: d3_time_parseFullYear
// ,
// Z: function(d, s, i) { /*TODO time zone */ return i; },
// "%": function(d, s, i) { /*TODO literal % */ return i; }
};
// Note: weekday is validated, but does not set the date.
function d3_time_parseWeekdayAbbrev(date, string, i) {
return string.substring(i, i += 3).toLowerCase() in d3_time_weekdayAbbrevLookup ? i : -1;
}
var d3_time_weekdayAbbrevLookup = {
sun: 3,
mon: 3,
tue: 3,
wed: 3,
thu: 3,
fri: 3,
sat: 3
};
// Note: weekday is validated, but does not set the date.
function d3_time_parseWeekday(date, string, i) {
d3_time_weekdayRe.lastIndex = 0;
var n = d3_time_weekdayRe.exec(string.substring(i, i + 10));
return n ? i += n[0].length : -1;
}
var d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig;
var d3_time_weekdays = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
];
function d3_time_parseMonthAbbrev(date, string, i) {
var n = d3_time_monthAbbrevLookup[string.substring(i, i += 3).toLowerCase()];
return n == null ? -1 : (date.setMonth(n), i);
}
var d3_time_monthAbbrevLookup = {
jan: 0,
feb: 1,
mar: 2,
apr: 3,
may: 4,
jun: 5,
jul: 6,
aug: 7,
sep: 8,
oct: 9,
nov: 10,
dec: 11
};
function d3_time_parseMonth(date, string, i) {
d3_time_monthRe.lastIndex = 0;
var n = d3_time_monthRe.exec(string.substring(i, i + 12));
return n ? (date.setMonth(d3_time_monthLookup[n[0].toLowerCase()]), i += n[0].length) : -1;
}
var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;
var d3_time_monthLookup = {
january: 0,
february: 1,
march: 2,
april: 3,
may: 4,
june: 5,
july: 6,
august: 7,
september: 8,
october: 9,
november: 10,
december: 11
};
var d3_time_months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
function d3_time_parseLocaleFull(date, string, i) {
return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
}
function d3_time_parseLocaleDate(date, string, i) {
return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
}
function d3_time_parseLocaleTime(date, string, i) {
return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
}
function d3_time_parseFullYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 4));
return n ? (date.setFullYear(n[0]), i += n[0].length) : -1;
}
function d3_time_parseYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.setFullYear(d3_time_century() + +n[0]), i += n[0].length) : -1;
}
function d3_time_century() {
return ~~(new Date().getFullYear() / 1000) * 1000;
}
function d3_time_parseMonthNumber(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.setMonth(n[0] - 1), i += n[0].length) : -1;
}
function d3_time_parseDay(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.setDate(+n[0]), i += n[0].length) : -1;
}
// Note: we don't validate that the hour is in the range [0,23].
function d3_time_parseHour24(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.setHours(+n[0]), i += n[0].length) : -1;
}
// Note: we don't validate that the hour is in the range [1,12].
function d3_time_parseHour12(date, string, i) {
date.hour12 = true;
return d3_time_parseHour24(date, string, i);
}
function d3_time_parseMinutes(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.setMinutes(+n[0]), i += n[0].length) : -1;
}
function d3_time_parseSeconds(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.setSeconds(+n[0]), i += n[0].length) : -1;
}
function d3_time_parseMilliseconds(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 3));
return n ? (date.setMilliseconds(+n[0]), i += n[0].length) : -1;
}
// Note: we don't look at the next directive.
var d3_time_numberRe = /\s*\d+/;
function d3_time_parseAmPm(date, string, i) {
var n = d3_time_amPmLookup[string.substring(i, i += 2).toLowerCase()];
return n == null ? -1 : (date.hour12pm = n, i);
}
var d3_time_amPmLookup = {
am: 0,
pm: 1
};
function d3_time_year(d) {
return new d3_time(d.getFullYear(), 0, 1);
}
function d3_time_daysElapsed(d0, d1) {
return ~~((d1 - d0) / 864e5 - (d1.getTimezoneOffset() - d0.getTimezoneOffset()) / 1440);
}
function d3_time_dayOfYear(d) {
return d3_time_zfill3(1 + d3_time_daysElapsed(d3_time_year(d), d));
}
function d3_time_weekNumberSunday(d) {
var d0 = d3_time_year(d);
return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + d0.getDay()) / 7));
}
function d3_time_weekNumberMonday(d) {
var d0 = d3_time_year(d);
return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + (d0.getDay() + 6) % 7) / 7));
}
// TODO table of time zone offset names?
function d3_time_zone(d) {
var z = d.getTimezoneOffset(),
zs = z > 0 ? "-" : "+",
zh = ~~(Math.abs(z) / 60),
zm = Math.abs(z) % 60;
return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
}
d3.time.format.utc = function(template) {
var local = d3.time.format(template);
function format(date) {
try {
d3_time = d3_time_format_utc;
var utc = new d3_time();
utc._ = date;
return local(utc);
} finally {
d3_time = Date;
}
}
format.parse = function(string) {
try {
d3_time = d3_time_format_utc;
var date = local.parse(string);
return date && date._;
} finally {
d3_time = Date;
}
};
format.toString = local.toString;
return format;
};
function d3_time_format_utc() {
this._ = new Date(Date.UTC.apply(this, arguments));
}
d3_time_format_utc.prototype = {
getDate: function() { return this._.getUTCDate(); },
getDay: function() { return this._.getUTCDay(); },
getFullYear: function() { return this._.getUTCFullYear(); },
getHours: function() { return this._.getUTCHours(); },
getMilliseconds: function() { return this._.getUTCMilliseconds(); },
getMinutes: function() { return this._.getUTCMinutes(); },
getMonth: function() { return this._.getUTCMonth(); },
getSeconds: function() { return this._.getUTCSeconds(); },
getTimezoneOffset: function() { return 0; },
valueOf: function() { return this._.getTime(); },
setDate: function(x) { this._.setUTCDate(x); },
setDay: function(x) { this._.setUTCDay(x); },
setFullYear: function(x) { this._.setUTCFullYear(x); },
setHours: function(x) { this._.setUTCHours(x); },
setMilliseconds: function(x) { this._.setUTCMilliseconds(x); },
setMinutes: function(x) { this._.setUTCMinutes(x); },
setMonth: function(x) { this._.setUTCMonth(x); },
setSeconds: function(x) { this._.setUTCSeconds(x); }
};
var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
function d3_time_formatIsoNative(date) {
return date.toISOString();
}
d3_time_formatIsoNative.parse = function(string) {
return new Date(string);
};
d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
function d3_time_range(floor, step, number) {
return function(t0, t1, dt) {
var time = floor(t0), times = [];
if (time < t0) step(time);
if (dt > 1) {
while (time < t1) {
var date = new Date(+time);
if (!(number(date) % dt)) times.push(date);
step(time);
}
} else {
while (time < t1) times.push(new Date(+time)), step(time);
}
return times;
};
}
d3.time.second = function(date) {
return new Date(~~(date / 1e3) * 1e3);
};
d3.time.second.utc = d3.time.second;
d3.time.seconds = d3_time_range(d3.time.second, function(date) {
date.setTime(date.getTime() + 1e3);
}, function(date) {
return date.getSeconds();
});
d3.time.seconds.utc = d3.time.seconds;
d3.time.minute = function(date) {
return new Date(~~(date / 6e4) * 6e4);
};
d3.time.minute.utc = d3.time.minute;d3.time.minutes = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) {
return date.getMinutes();
});
d3.time.minutes.utc = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) {
return date.getUTCMinutes();
});
function d3_time_minutesStep(date) {
date.setTime(date.getTime() + 6e4); // assumes no leap seconds
}
d3.time.hour = function(date) {
var offset = date.getTimezoneOffset() / 60;
return new Date((~~(date / 36e5 - offset) + offset) * 36e5);
};
d3.time.hour.utc = function(date) {
return new Date(~~(date / 36e5) * 36e5);
};
d3.time.hours = d3_time_range(d3.time.hour, d3_time_hoursStep, function(date) {
return date.getHours();
});
d3.time.hours.utc = d3_time_range(d3.time.hour.utc, d3_time_hoursStep, function(date) {
return date.getUTCHours();
});
function d3_time_hoursStep(date) {
date.setTime(date.getTime() + 36e5);
}
d3.time.day = function(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
};
d3.time.day.utc = function(date) {
return new Date(~~(date / 864e5) * 864e5);
};
d3.time.days = d3_time_range(d3.time.day, function(date) {
date.setDate(date.getDate() + 1);
}, function(date) {
return date.getDate() - 1;
});
d3.time.days.utc = d3_time_range(d3.time.day.utc, function(date) {
date.setUTCDate(date.getUTCDate() + 1);
}, function(date) {
return date.getUTCDate() - 1;
});
d3.time.week = function(date) {
(date = d3.time.day(date)).setDate(date.getDate() - date.getDay());
return date;
};
d3.time.week.utc = function(date) {
(date = d3.time.day.utc(date)).setUTCDate(date.getUTCDate() - date.getUTCDay());
return date;
};
d3.time.weeks = d3_time_range(d3.time.week, function(date) {
date.setDate(date.getDate() + 7);
}, function(date) {
return ~~((date - new Date(date.getFullYear(), 0, 1)) / 6048e5);
});
d3.time.weeks.utc = d3_time_range(d3.time.week.utc, function(date) {
date.setUTCDate(date.getUTCDate() + 7);
}, function(date) {
return ~~((date - Date.UTC(date.getUTCFullYear(), 0, 1)) / 6048e5);
});
d3.time.month = function(date) {
return new Date(date.getFullYear(), date.getMonth(), 1);
};
d3.time.month.utc = function(date) {
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
};
d3.time.months = d3_time_range(d3.time.month, function(date) {
date.setMonth(date.getMonth() + 1);
}, function(date) {
return date.getMonth();
});
d3.time.months.utc = d3_time_range(d3.time.month.utc, function(date) {
date.setUTCMonth(date.getUTCMonth() + 1);
}, function(date) {
return date.getUTCMonth();
});
d3.time.year = function(date) {
return new Date(date.getFullYear(), 0, 1);
};
d3.time.year.utc = function(date) {
return new Date(Date.UTC(date.getUTCFullYear(), 0, 1));
};
d3.time.years = d3_time_range(d3.time.year, function(date) {
date.setFullYear(date.getFullYear() + 1);
}, function(date) {
return date.getFullYear();
});
d3.time.years.utc = d3_time_range(d3.time.year.utc, function(date) {
date.setUTCFullYear(date.getUTCFullYear() + 1);
}, function(date) {
return date.getUTCFullYear();
});
// TODO nice
function d3_time_scale(linear, methods, format) {
function scale(x) {
return linear(x);
}
scale.invert = function(x) {
return d3_time_scaleDate(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
linear.domain(x);
return scale;
};
scale.ticks = function(m, k) {
var extent = d3_time_scaleExtent(scale.domain());
if (typeof m !== "function") {
var span = extent[1] - extent[0],
target = span / m,
i = d3.bisect(d3_time_scaleSteps, target, 1, d3_time_scaleSteps.length - 1);
if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
m = methods[i];
k = m[1];
m = m[0];
}
return m(extent[0], extent[1], k);
};
scale.tickFormat = function() {
return format;
};
scale.copy = function() {
return d3_time_scale(linear.copy(), methods, format);
};
// TOOD expose d3_scale_linear_rebind?
scale.range = d3.rebind(scale, linear.range);
scale.rangeRound = d3.rebind(scale, linear.rangeRound);
scale.interpolate = d3.rebind(scale, linear.interpolate);
scale.clamp = d3.rebind(scale, linear.clamp);
return scale;
}
// TODO expose d3_scaleExtent?
function d3_time_scaleExtent(domain) {
var start = domain[0], stop = domain[domain.length - 1];
return start < stop ? [start, stop] : [stop, start];
}
function d3_time_scaleDate(t) {
return new Date(t);
}
function d3_time_scaleFormat(formats) {
return function(date) {
var i = formats.length - 1, f = formats[i];
while (!f[1](date)) f = formats[--i];
return f[0](date);
};
}
var d3_time_scaleSteps = [
1e3, // 1-second
5e3, // 5-second
15e3, // 15-second
3e4, // 30-second
6e4, // 1-minute
3e5, // 5-minute
9e5, // 15-minute
18e5, // 30-minute
36e5, // 1-hour
108e5, // 3-hour
216e5, // 6-hour
432e5, // 12-hour
864e5, // 1-day
1728e5, // 2-day
6048e5, // 1-week
1728e6, // 1-month
7776e6, // 3-month
31536e6 // 1-year
];
var d3_time_scaleLocalMethods = [
[d3.time.seconds, 1],
[d3.time.seconds, 5],
[d3.time.seconds, 15],
[d3.time.seconds, 30],
[d3.time.minutes, 1],
[d3.time.minutes, 5],
[d3.time.minutes, 15],
[d3.time.minutes, 30],
[d3.time.hours, 1],
[d3.time.hours, 3],
[d3.time.hours, 6],
[d3.time.hours, 12],
[d3.time.days, 1],
[d3.time.days, 2],
[d3.time.weeks, 1],
[d3.time.months, 1],
[d3.time.months, 3],
[d3.time.years, 1]
];
var d3_time_scaleLocalFormats = [
[d3.time.format("%Y"), function(d) { return true; }],
[d3.time.format("%B"), function(d) { return d.getMonth(); }],
[d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }],
[d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }],
[d3.time.format("%I %p"), function(d) { return d.getHours(); }],
[d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }],
[d3.time.format(":%S"), function(d) { return d.getSeconds() || d.getMilliseconds(); }]
];
var d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
d3.time.scale = function() {
return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
};
var d3_time_scaleUTCMethods = [
[d3.time.seconds.utc, 1],
[d3.time.seconds.utc, 5],
[d3.time.seconds.utc, 15],
[d3.time.seconds.utc, 30],
[d3.time.minutes.utc, 1],
[d3.time.minutes.utc, 5],
[d3.time.minutes.utc, 15],
[d3.time.minutes.utc, 30],
[d3.time.hours.utc, 1],
[d3.time.hours.utc, 3],
[d3.time.hours.utc, 6],
[d3.time.hours.utc, 12],
[d3.time.days.utc, 1],
[d3.time.days.utc, 2],
[d3.time.weeks.utc, 1],
[d3.time.months.utc, 1],
[d3.time.months.utc, 3],
[d3.time.years.utc, 1]
];
var d3_time_scaleUTCFormats = [
[d3.time.format.utc("%Y"), function(d) { return true; }],
[d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }],
[d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }],
[d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }],
[d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }],
[d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }],
[d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds() || d.getUTCMilliseconds(); }]
];
var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
d3.time.scale.utc = function() {
return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
};
})();

View File

@ -1,26 +0,0 @@
Copyright (c) 2010, Michael Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name Michael Bostock may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,478 +0,0 @@
var globals = {};
function onDataReceived(data) {
//console.log("got data, now rendering");
var show_misc = false;
//delete data.misc;
var timeline = d3.select("#timeline");
var w = Number(timeline.style("width").slice(0,-2));
// the SVG fills the width of the whole div, but it will extend
// as far vertically as necessary (depends upon the data)
var chart = timeline.append("svg:svg")
.attr("id", "outer_chart")
.attr("width", w)
.attr("pointer-events", "all")
.append("svg:g")
.call(d3.behavior.zoom().on("zoom", pan_and_zoom))
;
// this "backboard" rect lets us catch mouse events anywhere in the
// chart, even between the bars. Without it, we only see events on solid
// objects like bars and text, but not in the gaps between.
chart.append("svg:rect")
.attr("id", "outer_rect")
.attr("width", w).attr("height", 200).attr("fill", "none");
// but the stuff we put inside it should have some room
w = w-50;
// at this point we assume the data is fixed, but the zoom/pan is not
// create the static things (those which don't exist or not exist based
// upon the timeline data). Their locations will be adjusted later,
// during redraw, when we know the x+y coordinates
chart.append("svg:text")
.attr("class", "dyhb-label")
//.attr("x", "20px").attr("y", y)
.attr("text-anchor", "start") // anchor at top-left
.attr("dy", ".71em")
.attr("fill", "black")
.text("DYHB requests");
chart.append("svg:text")
.attr("class", "read-label")
//.attr("x", "20px").attr("y", y)
.attr("text-anchor", "start") // anchor at top-left
.attr("dy", ".71em")
.attr("fill", "black")
.text("read() requests");
chart.append("svg:text")
.attr("class", "segment-label")
//.attr("x", "20px").attr("y", y)
.attr("text-anchor", "start") // anchor at top-left
.attr("dy", ".71em")
.attr("fill", "black")
.text("segment() requests");
chart.append("svg:text")
.attr("class", "block-label")
//.attr("x", "20px").attr("y", y)
.attr("text-anchor", "start") // anchor at top-left
.attr("dy", ".71em")
.attr("fill", "black")
.text("block() requests");
chart.append("svg:text")
.attr("class", "seconds-label")
//.attr("x", w/2).attr("y", y + 35)
.attr("text-anchor", "middle")
.attr("fill", "black")
.text("seconds");
function reltime(t) {return t-data.bounds.min;}
var last = data.bounds.max - data.bounds.min;
//last = reltime(d3.max(data.dyhb, function(d){return d.finish_time;}));
last = last * 1.05;
// long downloads are likely to have too much info, start small
if (last > 10.0)
last = 10.0;
// d3.time.scale() has no support for ms or us.
var xOFF = d3.time.scale().domain([data.bounds.min, data.bounds.max])
.range([0,w]);
var x = d3.scale.linear().domain([-last*0.05, last])
.range([0,w]);
function tx(d) { return "translate(" +x(d) + ",0)"; }
function left(d) { return x(reltime(d.start_time)); }
function right(d) {
return d.finish_time ? x(reltime(d.finish_time)) : "1px";
}
function width(d) {
return d.finish_time ? x(reltime(d.finish_time))-x(reltime(d.start_time)) : "1px";
}
function halfwidth(d) {
if (d.finish_time)
return (x(reltime(d.finish_time))-x(reltime(d.start_time)))/2;
return "1px";
}
function middle(d) {
if (d.finish_time)
return (x(reltime(d.start_time))+x(reltime(d.finish_time)))/2;
else
return x(reltime(d.start_time)) + 1;
}
function color(d) { return data.server_info[d.serverid].color; }
function servername(d) { return data.server_info[d.serverid].short; }
function timeformat(duration) {
// TODO: trim to microseconds, maybe humanize
return duration;
}
function zoomin() {
//console.log("zoom in!");
//console.log(x.domain());
var old = x.domain();
var quarterwidth = (old[1] - old[0])/4;
x.domain([old[0]+quarterwidth, old[1]-quarterwidth]);
//console.log(x.domain());
redraw();
//d3.event.preventDefault();
}
function zoomout() {
//console.log("zoom out!");
var old = x.domain();
var halfwidth = (old[1] - old[0])/2;
x.domain([old[0]-halfwidth, old[1]+halfwidth]);
redraw();
}
function pan_and_zoom() {
//console.log("P", x.domain());
if (d3.event) d3.event.transform(x);
//console.log("p", x.domain());
redraw();
}
function clip() {
var clipped = {};
var min = data.bounds.min + x.domain()[0];
var max = data.bounds.min + x.domain()[1];
function inside(d) {
var finish_time = d.finish_time || d.start_time;
if (Math.max(d.start_time, min) < Math.min(finish_time, max))
return true;
return false;
}
clipped.dyhb = data.dyhb.filter(inside);
clipped.read = data.read.filter(inside);
clipped.segment = data.segment.filter(inside);
clipped.block = data.block.filter(inside);
if (show_misc && data.misc)
clipped.misc = data.misc.filter(inside);
return clipped;
}
function redraw() {
// at this point zoom/pan must be fixed
var clipped = clip(data);
var y = 0;
//chart.select(".dyhb-label")
// .attr("x", x(0))//"20px")
// .attr("y", y);
y += 20;
// DYHB section
var dyhb_y = d3.scale.ordinal()
.domain(d3.range(data.dyhb.length))
.rangeBands([y, y+data.dyhb.length*20], .2);
y += data.dyhb.length*20;
var dyhb = chart.selectAll("g.dyhb") // one per row
.data(clipped.dyhb, function(d) { return d.start_time; })
.attr("transform", function(d,i) {
return "translate("+x(reltime(d.start_time))+","
+dyhb_y(i)+")";
});
var new_dyhb = dyhb.enter().append("svg:g")
.attr("class", "dyhb")
.attr("transform", function(d,i) {
return "translate("+x(reltime(d.start_time))+","
+dyhb_y(i)+")";
})
;
dyhb.exit().remove();
dyhb.select("rect")
.attr("width", width)
;
new_dyhb.append("svg:rect")
.attr("width", width)
.attr("height", dyhb_y.rangeBand())
.attr("stroke", "black")
.attr("fill", color)
.attr("title", function(d){return "shnums: "+d.response_shnums;})
;
new_dyhb.append("svg:text")
.attr("text-anchor", "end")
.attr("fill", "#444")
.attr("x", "-0.3em") // for some reason dx doesn't work
.attr("dy", "1.0em")
.attr("font-size", "12px")
.text(servername)
;
dyhb.select(".rightbox")
.attr("transform", function(d) {return "translate("+width(d)
+",0)";});
var dyhb_rightboxes = new_dyhb.append("svg:g")
.attr("class", "rightbox")
.attr("transform", function(d) {return "translate("+width(d)
+",0)";})
;
dyhb_rightboxes.append("svg:text")
.attr("text-anchor", "start")
.attr("y", dyhb_y.rangeBand())
.attr("dx", "0.5em")
.attr("dy", "-0.4em")
.attr("fill", "#444")
.attr("font-size", "14px")
.text(function (d) {return "shnums: "+d.response_shnums;})
;
// read() requests
chart.select(".read-label")
.attr("x", "20px")
.attr("y", y);
y += 20;
var read = chart.selectAll("g.read")
.data(clipped.read, function(d) { return d.start_time; })
.attr("transform", function(d) {
return "translate("+left(d)+","+(y+30*d.row)+")"; });
read.select("rect")
.attr("width", width);
read.select("text")
.attr("x", halfwidth);
var new_read = read.enter().append("svg:g")
.attr("class", "read")
.attr("transform", function(d) {
return "translate("+left(d)+","+(y+30*d.row)+")"; })
;
read.exit().remove();
y += 30*(1+d3.max(data.read, function(d){return d.row;}));
new_read.append("svg:rect")
.attr("width", width)
.attr("height", 20)
.attr("fill", "red")
.attr("stroke", "black")
.attr("title", function(d)
{return "read(start="+d.start+", len="+d.length+") -> "
+d.bytes_returned+" bytes";})
;
new_read.append("svg:text")
.attr("x", halfwidth)
.attr("dy", "0.9em")
.attr("fill", "black")
.text(function(d) {return "["+d.start+":+"+d.length+"]";})
;
// segment requests
chart.select(".segment-label")
.attr("x", "20px")
.attr("y", y);
y += 20;
var segment = chart.selectAll("g.segment")
.data(clipped.segment, function(d) { return d.start_time; })
.attr("transform", function(d) {
return "translate("+left(d)+","+(y+30*d.row)+")"; });
segment.select("rect")
.attr("width", width);
segment.select("text")
.attr("x", halfwidth);
var new_segment = segment.enter().append("svg:g")
.attr("class", "segment")
.attr("transform", function(d) {
return "translate("+left(d)+","+(y+30*d.row)+")"; })
;
segment.exit().remove();
y += 30*(1+d3.max(data.segment, function(d){return d.row;}));
new_segment.append("svg:rect")
.attr("width", width)
.attr("height", 20)
.attr("fill", function(d){return d.success ? "#cfc" : "#fcc";})
.attr("stroke", "black")
.attr("stroke-width", 1)
.attr("title", function(d) {
return "seg"+d.segment_number+" ["+d.segment_start
+":+"+d.segment_length+"] (took "
+timeformat(d.finish_time-d.start_time)+")";})
;
new_segment.append("svg:text")
.attr("x", halfwidth)
.attr("text-anchor", "middle")
.attr("dy", "0.9em")
.attr("fill", "black")
.text(function(d) {return d.segment_number;})
;
var shnum_colors = d3.scale.category10();
if (show_misc && "misc" in clipped) {
// misc requests
var misc_label = chart.select("text.misc-label");
if (!misc_label.node()) {
chart.append("svg:text")
.attr("class", "misc-label");
misc_label = chart.select("text.misc-label");
}
misc_label
.attr("text-anchor", "start") // anchor at top-left
.attr("dy", ".71em")
.attr("fill", "black")
.text("misc requests")
.attr("x", "20px")
.attr("y", y)
;
y += 20;
var misc = chart.selectAll("g.misc")
.data(clipped.misc, function(d) { return d.start_time; })
.attr("transform", function(d) {
return "translate("+left(d)+","+(y+30*d.row)+")"; });
misc.select("rect")
.attr("width", width);
misc.select("text")
.attr("x", halfwidth);
var new_misc = misc.enter().append("svg:g")
.attr("class", "misc")
.attr("transform", function(d) {
return "translate("+left(d)+","+(y+30*d.row)+")"; })
;
misc.exit().remove();
y += 30*(1+d3.max(data.misc, function(d){return d.row;}));
new_misc.append("svg:rect")
.attr("width", width)
.attr("height", 20)
.attr("fill", "white")
.attr("stroke", "black")
.attr("stroke-width", 1)
.attr("title", function(d) {
return d.what+" (took "
+timeformat(d.finish_time-d.start_time)+")";})
;
new_misc.append("svg:text")
.attr("x", halfwidth)
.attr("text-anchor", "middle")
.attr("dy", "0.9em")
.attr("fill", "black")
.text(function(d) {return d.what;})
;
} else {
chart.select("text.misc-label").remove();
chart.selectAll("g.misc").remove();
}
// block requests
chart.select(".block-label")
.attr("x", "20px")
.attr("y", y);
y += 20;
var block_row_to_y = {};
var dummy = function() {
var row_y=y;
for (var group=0; group < data.block_rownums.length; group++) {
for (var row=0; row < data.block_rownums[group]; row++) {
block_row_to_y[group+"-"+row] = row_y;
row_y += 12; y += 12;
}
row_y += 5; y += 5;
}
}();
var blocks = chart.selectAll("g.block")
.data(clipped.block, function(d) { return d.start_time; })
.attr("transform", function(d) {
var ry = block_row_to_y[d.row[0]+"-"+d.row[1]];
return "translate("+left(d)+"," +ry+")"; });
blocks.select("rect")
.attr("width", width);
blocks.select("text")
.attr("x", halfwidth);
var new_blocks = blocks.enter().append("svg:g")
.attr("class", "block")
.attr("transform", function(d) {
var ry = block_row_to_y[d.row[0]+"-"+d.row[1]];
return "translate("+left(d)+"," +ry+")"; })
;
blocks.exit().remove();
// everything appended to blocks starts at the top-left of the
// correct per-rect location
new_blocks.append("svg:rect")
.attr("width", width)
.attr("y", function(d) {return (d.response_length > 100) ? 0:3;})
.attr("height",
function(d) {return (d.response_length > 100) ? 10:4;})
.attr("fill", color)
.attr("stroke", function(d){return shnum_colors(d.shnum);})
.attr("stroke-width", 1)
.attr("title", function(d){
return "sh"+d.shnum+"-on-"+servername(d)
+" ["+d.start+":+"+d.length+"] -> "
+d.response_length;})
;
new_blocks.append("svg:text")
.attr("x", halfwidth)
.attr("dy", "0.9em")
.attr("fill", "black")
.attr("font-size", "8px")
.attr("text-anchor", "middle")
.text(function(d) {return "sh"+d.shnum;})
;
var num = d3.format(".4g");
// horizontal scale markers: vertical lines at rational timestamps
var rules = chart.selectAll("g.rule")
.data(x.ticks(10))
.attr("transform", tx);
rules.select("text").text(x.tickFormat(10));
var newrules = rules.enter().insert("svg:g")
.attr("class", "rule")
.attr("transform", tx)
;
newrules.append("svg:line")
.attr("class", "rule-tick")
.attr("stroke", "black");
chart.selectAll("line.rule-tick")
.attr("y1", y)
.attr("y2", y + 6);
newrules.append("svg:line")
.attr("class", "rule-red")
.attr("stroke", "red")
.attr("stroke-opacity", .3);
chart.selectAll("line.rule-red")
.attr("y1", 0)
.attr("y2", y);
newrules.append("svg:text")
.attr("class", "rule-text")
.attr("dy", ".71em")
.attr("text-anchor", "middle")
.attr("fill", "black")
.text(x.tickFormat(10));
chart.selectAll("text.rule-text")
.attr("y", y + 9);
rules.exit().remove();
chart.select(".seconds-label")
.attr("x", w/2)
.attr("y", y + 35);
y += 45;
d3.select("#outer_chart").attr("height", y);
d3.select("#outer_rect").attr("height", y);
d3.select("#zoom").attr("transform", "translate("+(w-10)+","+10+")");
}
globals.x = x;
globals.redraw = redraw;
d3.select("#zoom_in_button").on("click", zoomin);
d3.select("#zoom_out_button").on("click", zoomout);
d3.select("#toggle_misc_button").on("click",
function() {
show_misc = !show_misc;
redraw();
});
d3.select("#reset_button").on("click",
function() {
x.domain([-last*0.05, last]).range([0,w]);
redraw();
});
redraw();
}
$(function() {
var datafile = "event_json";
if (location.hash)
datafile = location.hash.slice(1);
//console.log("fetching data from "+datafile);
$.ajax({url: datafile,
method: 'GET',
dataType: 'json',
success: onDataReceived });
});

File diff suppressed because it is too large Load Diff

View File

@ -338,9 +338,6 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
rend.Page.__init__(self, data)
self.download_status = data
def child_timeline(self, ctx):
return DownloadStatusTimelinePage(self.download_status)
def download_results(self):
return defer.maybeDeferred(self.download_status.get_results)
@ -647,37 +644,6 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
def render_status(self, ctx, data):
return data.get_status()
class DownloadStatusTimelinePage(rend.Page):
docFactory = getxmlfile("download-status-timeline.xhtml")
def render_started(self, ctx, data):
started_s = render_time(data.get_started())
return started_s + " (%s)" % data.get_started()
def render_si(self, ctx, data):
si_s = base32.b2a_or_none(data.get_storage_index())
if si_s is None:
si_s = "(None)"
return si_s
def render_helper(self, ctx, data):
return {True: "Yes",
False: "No"}[data.using_helper()]
def render_total_size(self, ctx, data):
size = data.get_size()
if size is None:
return "(unknown)"
return size
def render_progress(self, ctx, data):
progress = data.get_progress()
# TODO: make an ascii-art bar
return "%.1f%%" % (100.0 * progress)
def render_status(self, ctx, data):
return data.get_status()
class RetrieveStatusPage(rend.Page, RateAndTimeMixin):
docFactory = getxmlfile("retrieve-status.xhtml")