summaryrefslogtreecommitdiffstats
path: root/extensions/ProductDashboard/web
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-01-03 23:24:56 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-01-03 23:24:56 +0100
commite3b051b686c16ead5f8b63206940b885532e1c95 (patch)
tree1bb8f6bb49c872528f1d5dc53334a66c426db088 /extensions/ProductDashboard/web
parenta29bc8846fac5d7bcbe37ed306eb612bfc74acee (diff)
downloadbugzilla-e3b051b686c16ead5f8b63206940b885532e1c95.tar.gz
bugzilla-e3b051b686c16ead5f8b63206940b885532e1c95.tar.xz
More ProductDashboard work
Diffstat (limited to 'extensions/ProductDashboard/web')
-rw-r--r--extensions/ProductDashboard/web/js/components.js75
-rw-r--r--extensions/ProductDashboard/web/js/duplicates.js28
-rw-r--r--extensions/ProductDashboard/web/js/popularity.js28
-rw-r--r--extensions/ProductDashboard/web/js/productdashboard.js98
-rw-r--r--extensions/ProductDashboard/web/js/recents.js32
-rw-r--r--extensions/ProductDashboard/web/js/roadmap.js24
-rw-r--r--extensions/ProductDashboard/web/js/summary.js45
-rw-r--r--extensions/ProductDashboard/web/styles/productdashboard.css20
8 files changed, 252 insertions, 98 deletions
diff --git a/extensions/ProductDashboard/web/js/components.js b/extensions/ProductDashboard/web/js/components.js
new file mode 100644
index 000000000..538b15457
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/components.js
@@ -0,0 +1,75 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0.
+ */
+
+YUI({
+ base: 'js/yui3/',
+ combine: false
+}).use("datatable", "datatable-sort", function(Y) {
+ if (typeof PD.updated_recently != 'undefined') {
+ var columns = [
+ { key:"id", label:"ID", sortable:true, allowHTML: true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>' },
+ { key:"bug_status", label:"Status", sortable:true },
+ { key:"version", label:"Version", sortable:true },
+ { key:"component", label:"Component", sortable:true },
+ { key:"severity", label:"Severity", sortable:true },
+ { key:"summary", label:"Summary", sortable:false },
+ ];
+
+ var updatedRecentlyDataTable = new Y.DataTable({
+ columns: columns,
+ data: PD.updated_recently
+ });
+ updatedRecentlyDataTable.render("#updated_recently");
+
+ if (typeof PD.past_due != 'undefined') {
+ var pastDueDataTable = new Y.DataTable({
+ columns: columns,
+ data: PD.past_due
+ });
+ pastDueDataTable.render('#past_due');
+ }
+ }
+
+ if (typeof PD.component_counts != 'undefined') {
+ var summary_url = '<a href="page.cgi?id=productdashboard.html&amp;product=' +
+ encodeURIComponent(PD.product_name) + '&bug_status=' +
+ encodeURIComponent(PD.bug_status) + '&tab=components';
+
+ var columns = [
+ { key:"name", label:"Name", sortable:true, allowHTML: true,
+ formatter: summary_url + '&component={value}">{value}</a>' },
+ { key:"count", label:"Count", sortable:true },
+ { key:"percentage", label:"Percentage", sortable:false, allowHTML: true,
+ formatter: '<div class="percentage"><div class="bar" style="width:{value}%"></div><div class="percent">{value}%</div></div>' },
+ { key:"link", label:"Link", sortable:false, allowHTML: true }
+ ];
+
+ var componentsDataTable = new Y.DataTable({
+ columns: columns,
+ data: PD.component_counts
+ });
+ componentsDataTable.render("#component_counts");
+
+ columns[0].formatter = summary_url + '&version={value}">{value}</a>';
+ var versionsDataTable = new Y.DataTable({
+ columns: columns,
+ data: PD.version_counts
+ });
+ versionsDataTable.render('#version_counts');
+
+ if (typeof PD.milestone_counts != 'undefined') {
+ columns[0].formatter = summary_url + '&target_milestone={value}">{value}</a>';
+ var milestonesDataTable = new Y.DataTable({
+ columns: columns,
+ data: PD.milestone_counts
+ });
+ milestonesDataTable.render('#milestone_counts');
+ }
+ }
+});
diff --git a/extensions/ProductDashboard/web/js/duplicates.js b/extensions/ProductDashboard/web/js/duplicates.js
new file mode 100644
index 000000000..5e3193a65
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/duplicates.js
@@ -0,0 +1,28 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0.
+ */
+
+YUI({
+ base: 'js/yui3/',
+ combine: false
+}).use("datatable", "datatable-sort", function (Y) {
+ var column_defs = [
+ { key:"id", label:"ID", sortable:true, allowHTML: true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>' },
+ { key:"count", label:"Count", sortable:true },
+ { key:"status", label:"Status", sortable:true },
+ { key:"version", label:"Version", sortable:true },
+ { key:"component", label:"Component", sortable:true },
+ { key:"severity", label:"Severity", sortable:true },
+ { key:"summary", label:"Summary", sortable:false },
+ ];
+
+ var duplicatesDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.duplicates
+ }).render('#duplicates');
+});
diff --git a/extensions/ProductDashboard/web/js/popularity.js b/extensions/ProductDashboard/web/js/popularity.js
new file mode 100644
index 000000000..b78b67867
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/popularity.js
@@ -0,0 +1,28 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0.
+ */
+
+YUI({
+ base: 'js/yui3/',
+ combine: false
+}).use("datatable", "datatable-sort", function (Y) {
+ var column_defs = [
+ { key:"id", label:"ID", sortable:true, allowHTML: true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>' },
+ { key:"count", label:"Count", sortable:true },
+ { key:"status", label:"Status", sortable:true },
+ { key:"version", label:"Version", sortable:true },
+ { key:"component", label:"Component", sortable:true },
+ { key:"severity", label:"Severity", sortable:true },
+ { key:"summary", label:"Summary", sortable:false },
+ ];
+
+ var popularityDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.popularity
+ }).render('#popularity');
+});
diff --git a/extensions/ProductDashboard/web/js/productdashboard.js b/extensions/ProductDashboard/web/js/productdashboard.js
deleted file mode 100644
index 56bc451ff..000000000
--- a/extensions/ProductDashboard/web/js/productdashboard.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This Source Code Form is "Incompatible With Secondary Licenses", as
- * defined by the Mozilla Public License, v. 2.0.
- */
-
-YAHOO.namespace('ProductDashboard');
-
-var PD = YAHOO.ProductDashboard;
-
-PD.addStatListener = function (div_name, table_name, column_defs, fields, options) {
- YAHOO.util.Event.addListener(window, "load", function() {
- YAHOO.example.StatsFromMarkup = new function() {
- this.myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get(table_name));
- this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
- this.myDataSource.responseSchema = { fields:fields };
- this.myDataTable = new YAHOO.widget.DataTable(div_name, column_defs, this.myDataSource, options);
- this.myDataTable.subscribe("rowMouseoverEvent", this.myDataTable.onEventHighlightRow);
- this.myDataTable.subscribe("rowMouseoutEvent", this.myDataTable.onEventUnhighlightRow);
- };
- });
-}
-
-// Custom sort handler to sort by bug id inside an anchor tag
-PD.sortBugIdLinks = function (a, b, desc) {
- // Deal with empty values
- if (!YAHOO.lang.isValue(a)) {
- return (!YAHOO.lang.isValue(b)) ? 0 : 1;
- }
- else if(!YAHOO.lang.isValue(b)) {
- return -1;
- }
- // Now we need to pull out the ID text and convert to Numbers
- // First we do 'a'
- var container = document.createElement("bug_id_link");
- container.innerHTML = a.getData("id");
- var anchors = container.getElementsByTagName("a");
- var text = anchors[0].textContent;
- if (text === undefined) text = anchors[0].innerText;
- var new_a = new Number(text);
- // Then we do 'b'
- container.innerHTML = b.getData("id");
- anchors = container.getElementsByTagName("a");
- text = anchors[0].textContent;
- if (text == undefined) text = anchors[0].innerText;
- var new_b = new Number(text);
-
- if (!desc) {
- return YAHOO.util.Sort.compare(new_a, new_b);
- }
- else {
- return YAHOO.util.Sort.compare(new_b, new_a);
- }
-}
-
-// Custom sort handler for bug severities
-PD.sortBugSeverity = function (a, b, desc) {
- // Deal with empty values
- if (!YAHOO.lang.isValue(a)) {
- return (!YAHOO.lang.isValue(b)) ? 0 : 1;
- }
- else if(!YAHOO.lang.isValue(b)) {
- return -1;
- }
-
- var new_a = new Number(severities[YAHOO.lang.trim(a.getData('bug_severity'))]);
- var new_b = new Number(severities[YAHOO.lang.trim(b.getData('bug_severity'))]);
-
- if (!desc) {
- return YAHOO.util.Sort.compare(new_a, new_b);
- }
- else {
- return YAHOO.util.Sort.compare(new_b, new_a);
- }
-}
-
-// Custom sort handler for bug priorities
-PD.sortBugPriority = function (a, b, desc) {
- // Deal with empty values
- if (!YAHOO.lang.isValue(a)) {
- return (!YAHOO.lang.isValue(b)) ? 0 : 1;
- }
- else if(!YAHOO.lang.isValue(b)) {
- return -1;
- }
-
- var new_a = new Number(priorities[YAHOO.lang.trim(a.getData('priority'))]);
- var new_b = new Number(priorities[YAHOO.lang.trim(b.getData('priority'))]);
-
- if (!desc) {
- return YAHOO.util.Sort.compare(new_a, new_b);
- }
- else {
- return YAHOO.util.Sort.compare(new_b, new_a);
- }
-}
diff --git a/extensions/ProductDashboard/web/js/recents.js b/extensions/ProductDashboard/web/js/recents.js
new file mode 100644
index 000000000..84e1758b6
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/recents.js
@@ -0,0 +1,32 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0.
+ */
+
+YUI({
+ base: 'js/yui3/',
+ combine: false
+}).use("datatable", "datatable-sort", function (Y) {
+ var column_defs = [
+ { key:"id", label:"ID", sortable:true, allowHTML: true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>' },
+ { key:"status", label:"Status", sortable:true },
+ { key:"version", label:"Version", sortable:true },
+ { key:"component", label:"Component", sortable:true },
+ { key:"severity", label:"Severity", sortable:true },
+ { key:"summary", label:"Summary", sortable:false },
+ ];
+
+ var recentlyOpenedDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.recents.opened
+ }).render('#recently_opened');
+
+ var recentlyClosedDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.recents.closed
+ }).render('#recently_closed');
+});
diff --git a/extensions/ProductDashboard/web/js/roadmap.js b/extensions/ProductDashboard/web/js/roadmap.js
new file mode 100644
index 000000000..1bef5b091
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/roadmap.js
@@ -0,0 +1,24 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0.
+ */
+
+YUI({
+ base: 'js/yui3/',
+ combine: false
+}).use("datatable", "datatable-sort", function (Y) {
+ var column_defs = [
+ { key: 'name', label: 'Name', sortable: true },
+ { key: 'percentage', label: 'Percentage', sortable: false, allowHTML: true,
+ formatter: '<div class="percentage"><div class="bar" style="width:{value}%"></div><div class="percent">{value}%</div></div>' },
+ { key: 'link', label: 'Links', allowHTML: true, sortable: false }
+ ];
+
+ var roadmapDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.roadmap,
+ }).render('#bug_milestones');
+});
diff --git a/extensions/ProductDashboard/web/js/summary.js b/extensions/ProductDashboard/web/js/summary.js
new file mode 100644
index 000000000..59d000d7b
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/summary.js
@@ -0,0 +1,45 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0.
+ */
+
+YUI({
+ base: 'js/yui3/',
+ combine: false
+}).use("datatable", "datatable-sort", function (Y) {
+ var column_defs = [
+ { key: 'name', label: 'Name', sortable: true },
+ { key: 'count', label: 'Count', sortable: true },
+ { key: 'percentage', label: 'Percentage', sortable: true, allowHTML: true,
+ formatter: '<div class="percentage"><div class="bar" style="width:{value}%"></div><div class="percent">{value}%</div></div>' },
+ { key: 'link', label: 'Link', allowHTML: true }
+ ];
+
+ var bugsCountDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.summary.bug_counts
+ }).render('#bug_counts');
+
+ var statusCountsDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.summary.status_counts
+ }).render('#status_counts');
+
+ var priorityCountsDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.summary.priority_counts
+ }).render('#priority_counts');
+
+ var severityCountsDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.summary.severity_counts
+ }).render('#severity_counts');
+
+ var assigneeCountsDataTable = new Y.DataTable({
+ columns: column_defs,
+ data: PD.summary.assignee_counts
+ }).render('#assignee_counts');
+});
diff --git a/extensions/ProductDashboard/web/styles/productdashboard.css b/extensions/ProductDashboard/web/styles/productdashboard.css
index 1e821fa11..c0c45cf38 100644
--- a/extensions/ProductDashboard/web/styles/productdashboard.css
+++ b/extensions/ProductDashboard/web/styles/productdashboard.css
@@ -23,3 +23,23 @@
padding-bottom: 5px;
margin-bottom: 10px;
}
+
+.percentage {
+ position:relative;
+ width: 200px;
+ border: 1px solid rgb(203, 203, 203);
+ position: relative;
+ padding: 3px;
+}
+
+.bar{
+ background-color: #00ff00;
+ height: 20px;
+}
+
+.percent{
+ position: absolute;
+ display: inline-block;
+ top: 3px;
+ left: 48%;
+}