diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-12-08 00:02:03 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-12-08 00:02:03 +0100 |
commit | 102c9694ef56fd673fe31729e67b650befb9df44 (patch) | |
tree | da54e655fa5a0e57b13b0c9ddad3ebafe471dc57 | |
parent | 6827b1d3d99e4e05fc2012896c9e2d941297b7ed (diff) | |
download | bugzilla-102c9694ef56fd673fe31729e67b650befb9df44.tar.gz bugzilla-102c9694ef56fd673fe31729e67b650befb9df44.tar.xz |
Current dashboard work
-rw-r--r-- | extensions/MyDashboard/lib/Queries.pm | 9 | ||||
-rw-r--r-- | extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl | 14 | ||||
-rw-r--r-- | extensions/MyDashboard/web/js/prod_comp_search.js | 99 | ||||
-rw-r--r-- | extensions/MyDashboard/web/js/query.js | 2 | ||||
-rw-r--r-- | extensions/MyDashboard/web/styles/mydashboard.css | 12 |
5 files changed, 47 insertions, 89 deletions
diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm index cbba3b468..628e26a73 100644 --- a/extensions/MyDashboard/lib/Queries.pm +++ b/extensions/MyDashboard/lib/Queries.pm @@ -12,6 +12,7 @@ use strict; use Bugzilla; use Bugzilla::CGI; use Bugzilla::Search; +use Bugzilla::Util qw(format_time); use Bugzilla::Extension::MyDashboard::Util qw(open_states quoted_open_states); use Bugzilla::Extension::MyDashboard::TimeAgo qw(time_ago); @@ -136,7 +137,6 @@ sub query_bugs { my $search = new Bugzilla::Search( fields => [ SELECT_COLUMNS ], params => scalar $params->Vars, - order => [ QUERY_ORDER ]); my $query = $search->sql(); @@ -149,10 +149,11 @@ sub query_bugs { my $bug = {}; foreach my $column (SELECT_COLUMNS) { $bug->{$column} = shift @$row; - #if ($column eq 'changeddate') { + if ($column eq 'changeddate') { + $bug->{$column} = format_time($bug->{$column}, '%Y-%m-%d %H:%M'); # my $date_then = datetime_from($bug->{$column}); # $bug->{'updated'} = time_ago($date_then, $date_now); - #} + } } push(@bugs, $bug); } @@ -185,7 +186,7 @@ sub query_flags { attachments.description AS attach_summary, requesters.realname AS requester, requestees.realname AS requestee, - " . $dbh->sql_date_format('flags.creation_date', '%Y:-%m-%d %H:%i') . " AS created + " . $dbh->sql_date_format('flags.creation_date', '%Y-%m-%d %H:%i') . " AS created FROM flags LEFT JOIN attachments ON ($attach_join_clause) diff --git a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl index d7cdb0d28..a386b6716 100644 --- a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl +++ b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl @@ -58,13 +58,15 @@ </div> <div id="right"> - <div id="prod_comp_search_main"> - <div id="prod_comp_search_label"> - File [% terms.Bug %]: - <img id="prod_comp_throbber" src="extensions/BMO/web/images/throbber.gif" - class="bz_default_hidden" width="16" height="11"> + <div id="prod_comp_search_container"> + <div id="prod_comp_search_main"> + <div id="prod_comp_search_label"> + File [% terms.Bug %]: + <img id="prod_comp_throbber" src="extensions/BMO/web/images/throbber.gif" + class="bz_default_hidden" width="16" height="11"> + </div> + <input id="prod_comp_search" type="text" size="60"> </div> - <input id="prod_comp_search" type="text" size="60"> </div> <div id="requestee_container"> 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; -} |