1 (function( $, app, i18n ){
4 var data = app.ns("data");
6 ui.Browser = ui.Page.extend({
8 cluster: null // (required) instanceof app.services.Cluster
12 this.cluster = this.config.cluster;
13 this.query = new app.data.Query( { cluster: this.cluster } );
14 this._refreshButton = new ui.Button({
15 label: i18n.text("General.RefreshResults"),
16 onclick: function( btn ) {
20 this.el = $(this._main_template());
21 new data.MetaDataFactory({
22 cluster: this.cluster,
23 onReady: function(metadata) {
24 this.metadata = metadata;
25 this.store = new data.QueryDataSourceInterface( { metadata: metadata, query: this.query } );
26 this.queryFilter = new ui.QueryFilter({ metadata: metadata, query: this.query });
27 this.queryFilter.attach(this.el.find("> .uiBrowser-filter") );
28 this.resultTable = new ui.ResultTable( {
29 onHeaderClick: this._changeSort_handler,
32 this.resultTable.attach( this.el.find("> .uiBrowser-table") );
37 updateResults: function() {
40 _changeSort_handler: function(table, wEv) {
41 this.query.setSort(wEv.column, wEv.dir === "desc");
42 this.query.setPage(1);
45 _main_template: function() {
46 return { tag: "DIV", cls: "uiBrowser", children: [
48 label: i18n.text("Browser.Title"),
50 right: [ this._refreshButton ]
52 { tag: "DIV", cls: "uiBrowser-filter" },
53 { tag: "DIV", cls: "uiBrowser-table" }
58 })( this.jQuery, this.app, this.i18n );