summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/web
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/MyDashboard/web')
-rw-r--r--extensions/MyDashboard/web/js/flags.js6
-rw-r--r--extensions/MyDashboard/web/js/prod_comp_search.js88
-rw-r--r--extensions/MyDashboard/web/js/query.js65
-rw-r--r--extensions/MyDashboard/web/styles/mydashboard.css21
4 files changed, 45 insertions, 135 deletions
diff --git a/extensions/MyDashboard/web/js/flags.js b/extensions/MyDashboard/web/js/flags.js
index b1605e04e..925cb8b6a 100644
--- a/extensions/MyDashboard/web/js/flags.js
+++ b/extensions/MyDashboard/web/js/flags.js
@@ -33,9 +33,7 @@ YUI({
if (e.response) {
Y.one("#" + type + "_flags_found").setHTML(
e.response.results.length + ' flags found');
- Y.one("#" + type + "_container .status").addClass('bz_default_hidden');
dataTable[type].set('data', e.response.results);
- dataTable[type].render("#" + type + "_table");
}
},
failure: function(o) {
@@ -53,7 +51,9 @@ YUI({
var stringified = Y.JSON.stringify(json_object);
- Y.one("#" + type + "_container .status").removeClass('bz_default_hidden');
+ dataTable[type].set('data', []);
+ dataTable[type].render("#" + type + "_table");
+ dataTable[type].showMessage('loadingMessage');
dataSource[type].sendRequest({
request: stringified,
diff --git a/extensions/MyDashboard/web/js/prod_comp_search.js b/extensions/MyDashboard/web/js/prod_comp_search.js
deleted file mode 100644
index d56baebec..000000000
--- a/extensions/MyDashboard/web/js/prod_comp_search.js
+++ /dev/null
@@ -1,88 +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.
- */
-
-// Product and component search to file a new bug
-YUI({
- base: 'js/yui3/',
- combine: false
-}).use("node", "json-stringify", "autocomplete", "escape",
- "datasource-io", "datasource-jsonschema", "array-extras", function (Y) {
- var counter = 0,
- format = '',
- cloned_bug_id = '',
- dataSource = null,
- autoComplete = null;
-
- var resultListFormat = function(query, results) {
- return Y.Array.map(results, function (result) {
- var data = result.raw;
- return Y.Escape.html(data.product) + " :: " +
- Y.Escape.html(data.component);
- });
- };
-
- var requestTemplate = function(query) {
- counter = counter + 1;
- var json_object = {
- version: "1.1",
- method : "MyDashboard.prod_comp_search",
- id : counter,
- params : { search: query }
- };
- return Y.JSON.stringify(json_object);
- };
-
- var dataSource = new Y.DataSource.IO({
- source: 'jsonrpc.cgi',
- ioConfig: {
- method: "POST",
- headers: { 'Content-Type': 'application/json' }
- }
- });
-
- dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
- schema: {
- resultListLocator : "result.products",
- resultFields : [ "product", "component" ]
- }
- });
-
- var input = Y.one('#prod_comp_search');
-
- input.plug(Y.Plugin.AutoComplete, {
- enableCache: true,
- source: dataSource,
- minQueryLength: 3,
- queryDelay: 0.05,
- resultFormatter: resultListFormat,
- maxResultsDisplayed: 25,
- suppressInputUpdate: true,
- maxResults: 25,
- requestTemplate: requestTemplate,
- on: {
- query: function() {
- Y.one("#prod_comp_throbber").removeClass('bz_default_hidden');
- },
- results: function() {
- Y.one("#prod_comp_throbber").addClass('bz_default_hidden');
- },
- select: function(e) {
- var data = e.result.raw;
- var url = "enter_bug.cgi?product=" + encodeURIComponent(data.product) +
- "&component=" + encodeURIComponent(data.component);
- window.location.href = url;
- }
- },
- });
-
- input.on('focus', function (e) {
- if (e.target.value && e.target.value.length > 3) {
- dataSource.load(e.target.value);
- }
- });
-});
diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js
index b9248bf6b..746717e75 100644
--- a/extensions/MyDashboard/web/js/query.js
+++ b/extensions/MyDashboard/web/js/query.js
@@ -10,12 +10,28 @@
YUI({
base: 'js/yui3/',
combine: false
-}).use("node", "datatable", "datatable-sort", "json-stringify",
- "datatable-datasource", "datasource-io", "datasource-jsonschema",
- "gallery-paginator-view", "gallery-datatable-paginator", function (Y) {
+}).use("node", "datatable", "datatable-sort", "datatable-message", "json-stringify",
+ "datatable-datasource", "datasource-io", "datasource-jsonschema", "cookie", function (Y) {
var counter = 0,
dataSource = null,
- dataTable = null;
+ dataTable = null,
+ default_query = "assignedbugs";
+
+ // Grab last used query name from cookie or use default
+ var query_cookie = Y.Cookie.get("my_dashboard_query");
+ if (query_cookie) {
+ var cookie_value_found = 0;
+ Y.one("#query").get("options").each( function() {
+ if (this.get("value") == query_cookie) {
+ this.set('selected', true);
+ default_query = query_cookie;
+ cookie_value_found = 1;
+ }
+ });
+ if (!cookie_value_found) {
+ Y.Cookie.set("my_dashboard_query", "");
+ }
+ }
var updateQueryTable = function(query_name) {
if (!query_name) return;
@@ -30,9 +46,7 @@ YUI({
Y.one("#query_bugs_found").setHTML(
'<a href="buglist.cgi?' + e.response.meta.buffer +
'">' + e.response.results.length + ' bugs found</a>');
- Y.one("#query_container .status").addClass('bz_default_hidden');
dataTable.set('data', e.response.results);
- dataTable.render("#query_table");
}
},
failure: function(o) {
@@ -50,7 +64,9 @@ YUI({
var stringified = Y.JSON.stringify(json_object);
- Y.one("#query_container .status").removeClass('bz_default_hidden');
+ dataTable.set('data', []);
+ dataTable.render("#query_table");
+ dataTable.showMessage('loadingMessage');
dataSource.sendRequest({
request: stringified,
@@ -63,6 +79,19 @@ YUI({
};
dataSource = new Y.DataSource.IO({ source: 'jsonrpc.cgi' });
+
+ dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
+ schema: {
+ resultListLocator: "result.result.bugs",
+ resultFields: ["bug_id", "changeddate", "bug_status", "short_desc"],
+ metaFields: {
+ description: "result.result.description",
+ heading: "result.result.heading",
+ buffer: "result.result.buffer"
+ }
+ }
+ });
+
dataTable = new Y.DataTable({
columns: [
{ key:"bug_id", label:"Bug", sortable:true,
@@ -71,38 +100,20 @@ YUI({
{ key:"bug_status", label:"Status", sortable:true },
{ key:"short_desc", label:"Summary", sortable:true },
],
- strings: {
- emptyMessage: 'No query data found.',
- },
- paginator: new Y.PaginatorView({
- model: new Y.PaginatorModel({ itemsPerPage: 25 }),
- container: 'query_pagination_top',
- })
});
dataTable.plug(Y.Plugin.DataTableSort);
dataTable.plug(Y.Plugin.DataTableDataSource, {
datasource: dataSource,
- initialRequest: updateQueryTable("assignedbugs"),
- });
-
- dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
- schema: {
- resultListLocator: "result.result.bugs",
- resultFields: ["bug_id", "changeddate", "bug_status", "short_desc"],
- metaFields: {
- description: "result.result.description",
- heading: "result.result.heading",
- buffer: "result.result.buffer"
- }
- }
+ initialRequest: updateQueryTable(default_query),
});
Y.one('#query').on('change', function(e) {
var index = e.target.get('selectedIndex');
var selected_value = e.target.get("options").item(index).getAttribute('value');
updateQueryTable(selected_value);
+ Y.Cookie.set("my_dashboard_query", selected_value, { expires: new Date("January 12, 2025") });
});
Y.one('#query_refresh').on('click', function(e) {
diff --git a/extensions/MyDashboard/web/styles/mydashboard.css b/extensions/MyDashboard/web/styles/mydashboard.css
index fd441ec7a..dc253c0d1 100644
--- a/extensions/MyDashboard/web/styles/mydashboard.css
+++ b/extensions/MyDashboard/web/styles/mydashboard.css
@@ -38,29 +38,16 @@
width: 40%;
}
-.items_found, .refresh, .status {
+.items_found, .refresh {
font-size: 80%;
}
-.status {
- color: red;
- float: right;
-}
-
#query_list_container {
text-align:center;
}
-#prod_comp_search_container,
-#query_list_container {
- margin-bottom: 10px;
- border: 1px solid rgb(116,126,147);
- padding: 10px;
- height: 40px;
-}
-
+#query_list_container,
#prod_comp_search_main {
- margin-left: auto;
- margin-right: auto;
- text-align: left;
+ padding: 20px !important;
+ height: 40px;
}