summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/web
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/MyDashboard/web')
-rw-r--r--extensions/MyDashboard/web/js/prod_comp_search.js99
-rw-r--r--extensions/MyDashboard/web/js/query.js2
-rw-r--r--extensions/MyDashboard/web/styles/mydashboard.css12
3 files changed, 34 insertions, 79 deletions
diff --git a/extensions/MyDashboard/web/js/prod_comp_search.js b/extensions/MyDashboard/web/js/prod_comp_search.js
index db9d47c5c..d56baebec 100644
--- a/extensions/MyDashboard/web/js/prod_comp_search.js
+++ b/extensions/MyDashboard/web/js/prod_comp_search.js
@@ -19,7 +19,6 @@ YUI({
autoComplete = null;
var resultListFormat = function(query, results) {
- Y.log(results);
return Y.Array.map(results, function (result) {
var data = result.raw;
return Y.Escape.html(data.product) + " :: " +
@@ -27,6 +26,17 @@ YUI({
});
};
+ 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: {
@@ -37,7 +47,7 @@ YUI({
dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
schema: {
- resultsListLocator : "result.products",
+ resultListLocator : "result.products",
resultFields : [ "product", "component" ]
}
});
@@ -53,75 +63,26 @@ YUI({
maxResultsDisplayed: 25,
suppressInputUpdate: true,
maxResults: 25,
- 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);
+ 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;
+ }
},
-// resultListLocator: 'response.result.products',
-// resultListLocator: 'result.products'
-// resultListLocator: function (response) {
-// Y.log(response);
-// return (response && response.data && response.data.result.products) || [];
-// },
-// // Makes sure an array is returned even on an error.
-// if (response.error) {
-// return [];
-// }
-//
-// Y.log(response);
-//
-// return response.query.results;
-//
-// return [{
-// product: "Foo",
-// component: "Bar"
-// }];
-// var query = response.query.results.json,
-// addresses;
-//
-// if (query.status !== 'OK') {
-// return [];
-// }
-//
-// // Grab the actual addresses from the YQL query.
-// addresses = query.results;
-//
-// // Makes sure an array is always returned.
-// return addresses.length > 0 ? addresses : [addresses];
-// },
- });
-
- input.ac.on('query', function() {
- Y.one("#prod_comp_throbber").removeClass('bz_default_hidden');
});
- input.ac.after('results', function() {
- Y.one("#prod_comp_throbber").addClass('bz_default_hidden');
- });
-
- input.ac.on('select', function (itemNode, result) {
- var url = "enter_bug.cgi?product=" + encodeURIComponent(result.component) +
- "&component=" + encodeURIComponent(result.product);
- Y.log(url);
- //autoComplete.dataReturnEvent.subscribe(function(type, args) {
- // args[0].autoHighlight = args[2].length == 1;
- //});
-// doBeforeLoadData: function(sQuery, oResponse, oPayload) {
-// Y.one("#prod_comp_throbber").addClass('bz_default_hidden');
-// return true;
-// }
+ input.on('focus', function (e) {
+ if (e.target.value && e.target.value.length > 3) {
+ dataSource.load(e.target.value);
+ }
});
-
-// autoComplete.textboxFocusEvent.subscribe(function () {
-// var input = Y.one(field);
-// if (input.value && input.value.length > 3) {
-// sendQuery(input.value);
-// }
-// });
});
diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js
index e0ebc1f14..b9248bf6b 100644
--- a/extensions/MyDashboard/web/js/query.js
+++ b/extensions/MyDashboard/web/js/query.js
@@ -76,7 +76,7 @@ YUI({
},
paginator: new Y.PaginatorView({
model: new Y.PaginatorModel({ itemsPerPage: 25 }),
- container: '#query_pagination_top',
+ container: 'query_pagination_top',
})
});
diff --git a/extensions/MyDashboard/web/styles/mydashboard.css b/extensions/MyDashboard/web/styles/mydashboard.css
index eda65ecfa..fd441ec7a 100644
--- a/extensions/MyDashboard/web/styles/mydashboard.css
+++ b/extensions/MyDashboard/web/styles/mydashboard.css
@@ -51,22 +51,16 @@
text-align:center;
}
-#file_bug_container,
+#prod_comp_search_container,
#query_list_container {
margin-bottom: 10px;
border: 1px solid rgb(116,126,147);
padding: 10px;
+ height: 40px;
}
#prod_comp_search_main {
- width: 400px;
- margin-right: auto;
margin-left: auto;
+ margin-right: auto;
text-align: left;
}
-
-#prod_comp_search_main li.yui-ac-highlight a {
- text-decoration: none;
- color: #FFFFFF;
- display: block;
-}