You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2018/11/08 13:43:00 UTC
[3/4] qpid-broker-j git commit: QPID-8191: [Broker-J] Delete old
unused log viewer widgets and UI components
QPID-8191: [Broker-J] Delete old unused log viewer widgets and UI components
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/f5718f9b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/f5718f9b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/f5718f9b
Branch: refs/heads/master
Commit: f5718f9b11779e1c53e7fe7fb5af46340f0f9608
Parents: dfaedda
Author: Alex Rudyy <or...@apache.org>
Authored: Thu Nov 8 10:57:01 2018 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Thu Nov 8 13:42:18 2018 +0000
----------------------------------------------------------------------
.../js/qpid/management/logger/LogViewer.js | 246 -------------
.../resources/logger/memory/showLogViewer.html | 26 --
.../resources/grid/showColumnDefDialog.html | 32 --
.../grid/showRowNumberLimitDialog.html | 33 --
.../js/qpid/common/grid/ColumnDefDialog.js | 155 --------
.../js/qpid/common/grid/EnhancedFilter.js | 265 --------------
.../js/qpid/common/grid/EnhancedFilterTools.js | 361 -------------------
.../js/qpid/common/grid/FilterSummary.js | 201 -----------
.../js/qpid/common/grid/GridUpdater.js | 321 -----------------
.../js/qpid/common/grid/RowNumberLimitDialog.js | 108 ------
.../js/qpid/common/grid/UpdatableGrid.js | 56 ---
.../js/qpid/management/logger/FileBrowser.js | 185 ----------
.../js/qpid/management/logger/LogViewer.js | 246 -------------
13 files changed, 2235 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/logging-logback/src/main/java/resources/js/qpid/management/logger/LogViewer.js
----------------------------------------------------------------------
diff --git a/broker-plugins/logging-logback/src/main/java/resources/js/qpid/management/logger/LogViewer.js b/broker-plugins/logging-logback/src/main/java/resources/js/qpid/management/logger/LogViewer.js
deleted file mode 100644
index 377f925..0000000
--- a/broker-plugins/logging-logback/src/main/java/resources/js/qpid/management/logger/LogViewer.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-define(["dojo/_base/xhr",
- "dojo/parser",
- "dojo/query",
- "dojo/date/locale",
- "dijit/registry",
- "qpid/common/grid/GridUpdater",
- "qpid/common/grid/UpdatableGrid",
- "dojo/text!logger/memory/showLogViewer.html",
- "dojo/domReady!"], function (xhr, parser, query, locale, registry, GridUpdater, UpdatableGrid, template)
-{
-
- var defaulGridRowLimit = 4096;
- var currentTimeZone;
-
- function dataTransformer(data, userPreferences)
- {
- for (var i = 0; i < data.length; i++)
- {
- data[i].time = userPreferences.addTimeZoneOffsetToUTC(data[i].timestamp);
- }
- return data;
- }
-
- function LogViewer(loggerModelObj, management, containerNode, contentPane)
- {
- var that = this;
- this.management = management;
- this.modelObj = {
- type: loggerModelObj.type,
- name: "getLogEntries",
- parent: loggerModelObj
- };
- this.lastLogId = 0;
- this.containerNode = containerNode;
- this.contentPane = contentPane;
- containerNode.innerHTML = template;
- parser.parse(containerNode)
- .then(function (instances)
- {
- that._buildGrid();
- });
- }
-
- LogViewer.prototype._buildGrid = function ()
- {
- var that = this;
- var userPreferences = this.management.userPreferences;
- currentTimeZone = userPreferences.getTimeZoneDescription();
- var gridStructure = [{
- hidden: false,
- name: "ID",
- field: "id",
- width: "50px",
- datatype: "number",
- filterable: true
- }, {
- name: "Date",
- field: "time",
- width: "100px",
- datatype: "date",
- formatter: function (val)
- {
- return userPreferences.formatDateTime(val, {selector: "date"});
- }
- }, {
- name: "Time ",
- field: "time",
- width: "100px",
- datatype: "time",
- formatter: function (val)
- {
- return userPreferences.formatDateTime(val, {selector: "time"});
- }
- }, {
- name: "Time zone",
- field: "time",
- width: "80px",
- datatype: "string",
- hidden: true,
- filterable: false,
- formatter: function (val)
- {
- return currentTimeZone;
- }
- }, {
- name: "Level",
- field: "level",
- width: "50px",
- datatype: "string",
- autoComplete: true,
- hidden: true
- }, {
- name: "Logger",
- field: "logger",
- width: "150px",
- datatype: "string",
- autoComplete: false,
- hidden: true
- }, {
- name: "Thread",
- field: "threadName",
- width: "100px",
- datatype: "string",
- hidden: true
- }, {
- name: "Log Message",
- field: "message",
- width: "auto",
- datatype: "string"
- }];
-
- var gridNode = query(".logEntries", this.containerNode)[0];
- try
- {
- var updater = new GridUpdater({
- userPreferences: userPreferences,
- updatable: false,
- checkVisibilityFunc: function() {return that.contentPane.selected;},
- serviceUrl: function ()
- {
- return that.management.buildObjectURL(that.modelObj, {lastLogId: that.lastLogId});
- },
- onUpdate: function (items)
- {
- if (items)
- {
- var maxId = -1;
- for (var i in items)
- {
- var item = items[i];
- if (item.id > maxId)
- {
- maxId = item.id
- }
- }
- if (maxId != -1)
- {
- that.lastLogId = maxId
- }
- }
- },
- append: true,
- appendLimit: defaulGridRowLimit,
- dataTransformer: function (data)
- {
- return dataTransformer(data, userPreferences);
- }
- });
- this.grid = new UpdatableGrid(updater.buildUpdatableGridArguments({
- structure: gridStructure,
- selectable: true,
- selectionMode: "none",
- sortInfo: -1,
- sortFields: [{
- attribute: 'id',
- descending: true
- }],
- plugins: {
- nestedSorting: true,
- enhancedFilter: {
- defaulGridRowLimit: defaulGridRowLimit,
- displayLastUpdateTime: true
- },
- indirectSelection: false,
- pagination: {defaultPageSize: 10}
- }
- }), gridNode);
- var onStyleRow = function (row)
- {
- var item = that.grid.getItem(row.index);
- if (item)
- {
- var level = that.grid.store.getValue(item, "level", null);
- var changed = false;
- if (level == "ERROR")
- {
- row.customClasses += " redBackground";
- changed = true;
- }
- else if (level == "WARN")
- {
- row.customClasses += " yellowBackground";
- changed = true;
- }
- else if (level == "DEBUG")
- {
- row.customClasses += " grayBackground";
- changed = true;
- }
- if (changed)
- {
- that.grid.focus.styleRow(row);
- }
- }
- };
- this.grid.on("styleRow", onStyleRow);
- this.grid.startup();
- userPreferences.addListener(this, userPreferences.timeZonePreferenceName);
- }
- catch (err)
- {
- if (console && console.error)
- {
- console.error(err);
- }
- }
- };
-
- LogViewer.prototype.onPreferenceChange = function (data)
- {
- var userPreferences = this.management.userPreferences;
- currentTimeZone = userPreferences.getTimeZoneDescription();
- if (this.grid.updater.memoryStore)
- {
- dataTransformer(this.grid.updater.memoryStore.data, userPreferences);
- this.grid._refresh();
- }
- };
-
- LogViewer.prototype.close = function (data)
- {
- this.management.userPreferences.removeListener(this);
- }
-
- return LogViewer;
-});
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/logging-logback/src/main/java/resources/logger/memory/showLogViewer.html
----------------------------------------------------------------------
diff --git a/broker-plugins/logging-logback/src/main/java/resources/logger/memory/showLogViewer.html b/broker-plugins/logging-logback/src/main/java/resources/logger/memory/showLogViewer.html
deleted file mode 100644
index 3cadb50..0000000
--- a/broker-plugins/logging-logback/src/main/java/resources/logger/memory/showLogViewer.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<div class="logViewer">
- <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Log Viewer'" class="clear">
- <div class="logEntries"></div>
- </div>
-</div>
-
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html b/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html
deleted file mode 100644
index 535b9a1..0000000
--- a/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<div>
- <div>
- <div>Select columns to display:</div>
- <div class="columnList"></div>
- </div>
- <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar">
- <button value="Display" data-dojo-type="dijit.form.Button"
- class="displayButton" data-dojo-props="label: 'Display' "></button>
- <button value="Cancel" data-dojo-type="dijit.form.Button" data-dojo-props="label: 'Cancel'"
- class="cancelButton"></button>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html b/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html
deleted file mode 100644
index cacdf49..0000000
--- a/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<div>
- <div>
- <div>Set the maximum number of rows to cache and display:</div>
- <input class="rowNumberLimit" data-dojo-type="dijit.form.NumberSpinner"
- data-dojo-props="invalidMessage: 'Invalid value', required: true, smallDelta: 1,mconstraints: {min:1,max:65535,places:0, pattern: '#####'}, label: 'Maximum number of rows:', name: 'rowNumberLimit'"></input>
- </div>
- <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar">
- <button value="Submit" data-dojo-type="dijit.form.Button"
- class="submitButton" data-dojo-props="label: 'Submit' "></button>
- <button value="Cancel" data-dojo-type="dijit.form.Button" data-dojo-props="label: 'Cancel'"
- class="cancelButton"></button>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js
deleted file mode 100644
index abc5bde..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/declare",
- "dojo/_base/event",
- "dojo/_base/array",
- "dojo/_base/lang",
- "dojo/parser",
- "dojo/dom-construct",
- "dojo/query",
- "dijit/registry",
- "dijit/form/Button",
- "dijit/form/CheckBox",
- "dojox/grid/enhanced/plugins/Dialog",
- "dojo/text!../../../grid/showColumnDefDialog.html",
- "dojo/domReady!"],
- function (declare, event, array, lang, parser, dom, query, registry, Button, CheckBox, Dialog, template)
- {
-
- return declare("qpid.common.grid.ColumnDefDialog", null, {
-
- grid: null,
- containerNode: null,
- _columns: [],
- _dialog: null,
-
- constructor: function (args)
- {
- var grid = this.grid = args.grid;
- var that = this;
- this.containerNode = dom.create("div", {innerHTML: template});
- parser.parse(this.containerNode)
- .then(function (instances)
- {
- that._postParse();
- });
- },
- _postParse: function ()
- {
- var submitButton = registry.byNode(query(".displayButton", this.containerNode)[0]);
- this.closeButton = registry.byNode(query(".cancelButton", this.containerNode)[0]);
- var columnsContainer = query(".columnList", this.containerNode)[0];
-
- this._buildColumnWidgets(columnsContainer);
-
- this._dialog = new Dialog({
- "refNode": this.grid.domNode,
- "title": "Grid Columns",
- "content": this.containerNode
- });
-
- var self = this;
- submitButton.on("click", function (e)
- {
- self._onColumnsSelect(e);
- });
- this.closeButton.on("click", function (e)
- {
- self._dialog.hide();
- });
-
- this._dialog.startup();
- },
-
- destroy: function ()
- {
- this._dialog.destroyRecursive();
- this._dialog = null;
- this.grid = null;
- this.containerNode = null;
- this._columns = null;
- },
-
- showDialog: function ()
- {
- this._initColumnWidgets();
- this._dialog.show();
- },
-
- _initColumnWidgets: function ()
- {
- var cells = this.grid.layout.cells;
- for (var i in cells)
- {
- var cell = cells[i];
- this._columns[cell.name].checked = !cell.hidden;
- }
- },
-
- _onColumnsSelect: function (evt)
- {
- event.stop(evt);
- var grid = this.grid;
- grid.beginUpdate();
- var cells = grid.layout.cells;
- try
- {
- for (var i in cells)
- {
- var cell = cells[i];
- var widget = this._columns[cell.name];
- grid.layout.setColumnVisibility(i, widget.checked);
- }
- }
- finally
- {
- grid.endUpdate();
- this._dialog.hide();
- }
- },
-
- _buildColumnWidgets: function (columnsContainer)
- {
- var cells = this.grid.layout.cells;
- for (var i in cells)
- {
- var cell = cells[i];
- var widget = new dijit.form.CheckBox({
- required: false,
- checked: !cell.hidden,
- label: cell.name,
- name: this.grid.id + "_cchb_ " + i
- });
-
- this._columns[cell.name] = widget;
-
- var div = dom.create("div");
- div.appendChild(widget.domNode);
- div.appendChild(dom.create("span", {innerHTML: cell.name}));
-
- columnsContainer.appendChild(div);
- }
- }
-
- });
-
- });
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js
deleted file mode 100644
index a8d2760..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/declare",
- "dojo/_base/lang",
- "dojo/_base/array",
- "dijit/Toolbar",
- "dojox/grid/enhanced/_Plugin",
- "dojox/grid/enhanced/plugins/Dialog",
- "dojox/grid/enhanced/plugins/filter/FilterLayer",
- "dojox/grid/enhanced/plugins/filter/FilterDefDialog",
- "dojox/grid/enhanced/plugins/filter/FilterStatusTip",
- "dojox/grid/enhanced/plugins/filter/ClearFilterConfirm",
- "dojox/grid/EnhancedGrid",
- "dojo/i18n!dojox/grid/enhanced/nls/Filter",
- "qpid/common/grid/EnhancedFilterTools"],
- function (declare,
- lang,
- array,
- Toolbar,
- _Plugin,
- Dialog,
- FilterLayer,
- FilterDefDialog,
- FilterStatusTip,
- ClearFilterConfirm,
- EnhancedGrid,
- nls,
- EnhancedFilterTools)
- {
-
- // override CriteriaBox#_getColumnOptions to show criteria for hidden columns with EnhancedFilter
- dojo.extend(dojox.grid.enhanced.plugins.filter.CriteriaBox, {
- _getColumnOptions: function ()
- {
- var colIdx = this.dlg.curColIdx >= 0 ? String(this.dlg.curColIdx) : "anycolumn";
- var filterHidden = this.plugin.filterHidden;
- return array.map(array.filter(this.plugin.grid.layout.cells, function (cell)
- {
- return !(cell.filterable === false || (!filterHidden && cell.hidden));
- }), function (cell)
- {
- return {
- label: cell.name || cell.field,
- value: String(cell.index),
- selected: colIdx == String(cell.index)
- };
- });
- }
- });
-
- // Enhanced filter has extra functionality for refreshing, limiting rows, displaying/hiding columns in the grid
- var EnhancedFilter = declare("qpid.common.grid.EnhancedFilter", _Plugin, {
- // summary:
- // Accept the same plugin parameters as dojox.grid.enhanced.plugins.Filter and the following:
- //
- // filterHidden: boolean:
- // Whether to display filtering criteria for hidden columns. Default to true.
- //
- // defaulGridRowLimit: int:
- // Default limit for numbers of items to cache in the gris dtore
- //
- // disableFiltering: boolean:
- // Whether to disable a filtering including filter button, clear filter button and filter summary.
- //
- // toolbar: dijit.Toolbar:
- // An instance of toolbar to add the enhanced filter widgets.
-
- // name: String
- // plugin name
- name: "enhancedFilter",
-
- // filterHidden: Boolean
- // whether to filter hidden columns
- filterHidden: true,
-
- constructor: function (grid, args)
- {
- // summary:
- // See constructor of dojox.grid.enhanced._Plugin.
- this.grid = grid;
- this.nls = nls;
- this.userPreferences = args.userPreferences;
- args = this.args = lang.isObject(args) ? args : {};
- if (typeof args.ruleCount != 'number' || args.ruleCount < 0)
- {
- args.ruleCount = 0;
- }
- this.ruleCountToConfirmClearFilter = args.ruleCountToConfirmClearFilter || 5;
-
- if (args.filterHidden)
- {
- this.filterHidden = args.filterHidden;
- }
- this.defaulGridRowLimit = args.defaulGridRowLimit;
- this.disableFiltering = args.disableFiltering;
- this.displayLastUpdateTime = args.displayLastUpdateTime;
-
- //Install UI components
- var obj = {"plugin": this};
-
- this.filterBar =
- ( args.toolbar && args.toolbar instanceof dijit.Toolbar) ? args.toolbar : new Toolbar();
-
- if (!this.disableFiltering)
- {
- //Install filter layer
- this._wrapStore();
-
- this.clearFilterDialog = new Dialog({
- refNode: this.grid.domNode,
- title: this.nls["clearFilterDialogTitle"],
- content: new ClearFilterConfirm(obj)
- });
-
- this.filterDefDialog = new FilterDefDialog(obj);
- this.filterDefDialog.filterDefPane._clearFilterBtn.set("label", "Clear Filter");
-
- nls["statusTipTitleNoFilter"] = "Filter is not set";
- nls["statusTipMsg"] = "Click on 'Set Filter' button to specify filtering conditions";
- this.filterStatusTip = new FilterStatusTip(obj);
-
- var self = this;
- var toggleClearFilterBtn = function (arg)
- {
- self.enhancedFilterTools.toggleClearFilterBtn(arg);
- };
-
- this.filterBar.toggleClearFilterBtn = toggleClearFilterBtn;
-
- this.grid.isFilterBarShown = function ()
- {
- return true
- };
-
- this.connect(this.grid.layer("filter"), "onFilterDefined", function (filter)
- {
- toggleClearFilterBtn(true);
- });
-
- //Expose the layer event to grid.
- grid.onFilterDefined = function ()
- {
- };
- this.connect(grid.layer("filter"), "onFilterDefined", function (filter)
- {
- grid.onFilterDefined(grid.getFilter(), grid.getFilterRelation());
- });
- }
-
- // add extra buttons into toolbar
- this.enhancedFilterTools = new EnhancedFilterTools({
- grid: grid,
- toolbar: this.filterBar,
- filterStatusTip: this.filterStatusTip,
- clearFilterDialog: this.clearFilterDialog,
- filterDefDialog: this.filterDefDialog,
- defaulGridRowLimit: this.defaulGridRowLimit,
- disableFiltering: this.disableFiltering,
- displayLastUpdateTime: this.displayLastUpdateTime,
- nls: nls,
- ruleCountToConfirmClearFilter: this.ruleCountToConfirmClearFilter,
- userPreferences: this.userPreferences
- });
-
- this.filterBar.placeAt(this.grid.viewsHeaderNode, "before");
- this.filterBar.startup();
-
- },
-
- destroy: function ()
- {
- this.inherited(arguments);
- try
- {
- if (this.filterDefDialog)
- {
- this.filterDefDialog.destroy();
- this.filterDefDialog = null;
- }
- if (this.grid)
- {
- this.grid.unwrap("filter");
- this.grid = null;
- }
- if (this.filterBar)
- {
- this.filterBar.destroyRecursive();
- this.filterBar = null;
- }
- if (this.enhancedFilterTools)
- {
- this.enhancedFilterTools.destroy();
- this.enhancedFilterTools = null;
- }
- if (this.clearFilterDialog)
- {
- this.clearFilterDialog.destroyRecursive();
- this.clearFilterDialog = null;
- }
- if (this.filterStatusTip)
- {
- this.filterStatusTip.destroy();
- this.filterStatusTip = null;
- }
- this.args = null;
-
- }
- catch (e)
- {
- console.warn("Filter.destroy() error:", e);
- }
- },
-
- _wrapStore: function ()
- {
- var g = this.grid;
- var args = this.args;
- var filterLayer = args.isServerSide
- ? new FilterLayer.ServerSideFilterLayer(args)
- : new FilterLayer.ClientSideFilterLayer({
- cacheSize: args.filterCacheSize,
- fetchAll: args.fetchAllOnFirstFilter,
- getter: this._clientFilterGetter
- });
- FilterLayer.wrap(g, "_storeLayerFetch", filterLayer);
-
- this.connect(g, "_onDelete", lang.hitch(filterLayer, "invalidate"));
- },
-
- onSetStore: function (store)
- {
- this.filterDefDialog.clearFilter(true);
- },
-
- _clientFilterGetter: function (/* data item */ datarow, /* cell */cell, /* int */rowIndex)
- {
- return cell.get(rowIndex, datarow);
- }
-
- });
-
- EnhancedGrid.registerPlugin(EnhancedFilter);
-
- return EnhancedFilter;
-
- });
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js
deleted file mode 100644
index 0f69548..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/declare",
- "dojo/_base/event",
- "dojo/dom-construct",
- "dojo/date/locale",
- "dijit/form/Button",
- "dijit/form/ToggleButton",
- "qpid/common/grid/RowNumberLimitDialog",
- "qpid/common/grid/ColumnDefDialog",
- "qpid/common/grid/FilterSummary"],
- function (declare,
- event,
- domConstruct,
- locale,
- Button,
- ToggleButton,
- RowNumberLimitDialog,
- ColumnDefDialog,
- FilterSummary)
- {
-
- var _stopEvent = function (evt)
- {
- try
- {
- if (evt && evt.preventDefault)
- {
- event.stop(evt);
- }
- }
- catch (e)
- {
- }
- };
-
- return declare("qpid.common.grid.EnhancedFilterTools", null, {
-
- grid: null,
- filterBar: null,
- filterStatusTip: null,
- clearFilterDialog: null,
- filterDefDialog: null,
-
- columnDefDialog: null,
- columnDefButton: null,
- filterDefButton: null,
- clearFilterButton: null,
- filterSummary: null,
- setRowNumberLimitButton: null,
- setRowNumberLimitDialog: null,
- refreshButton: null,
- autoRefreshButton: null,
-
- constructor: function (params)
- {
- this.inherited(arguments);
-
- this.userPreferences = params.userPreferences;
- this.filterBar = params.toolbar;
- this.grid = params.grid;
- this.filterStatusTip = params.filterStatusTip;
- this.clearFilterDialog = params.clearFilterDialog;
- this.filterDefDialog = params.filterDefDialog;
- this.ruleCountToConfirmClearFilter = params.ruleCountToConfirmClearFilter;
- this.displayLastUpdateTime =
- params.hasOwnProperty("displayLastUpdateTime") ? params.displayLastUpdateTime : true;
-
- this._addRefreshButtons();
- this._addRowLimitButton(params.defaulGridRowLimit);
- this._addColumnsButton();
-
- if (!params.disableFiltering)
- {
- this._addFilteringTools(params.nls);
- }
- },
-
- toggleClearFilterBtn: function (clearFlag)
- {
- var filterLayer = this.grid.layer("filter");
- var filterSet = filterLayer && filterLayer.filterDef && filterLayer.filterDef();
- this.clearFilterButton.set("disabled", !filterSet);
- },
-
- destroy: function ()
- {
- this.inherited(arguments);
-
- if (this.columnDefDialog)
- {
- this.columnDefDialog.destroy();
- this.columnDefDialog = null;
- }
- if (this.columnDefButton)
- {
- this.columnDefButton.destroy();
- this.columnDefButton = null;
- }
- if (this.filterDefButton)
- {
- this.filterDefButton.destroy();
- this.filterDefButton = null;
- }
- if (this.clearFilterButton)
- {
- this.clearFilterButton.destroy();
- this.clearFilterButton = null;
- }
- if (this.filterSummary)
- {
- this.filterSummary.destroy();
- this.filterSummary = null;
- }
- if (this.setRowNumberLimitButton)
- {
- this.setRowNumberLimitButton.destroy();
- this.setRowNumberLimitButton = null;
- }
- if (this.setRowNumberLimitDialog)
- {
- this.setRowNumberLimitDialog.destroy();
- this.setRowNumberLimitDialog = null;
- }
- if (this.refreshButton)
- {
- this.refreshButton.destroy();
- this.refreshButton = null;
- }
- if (this.autoRefreshButton)
- {
- this.autoRefreshButton.destroy();
- this.autoRefreshButton = null;
- }
-
- this.grid = null;
- this.filterBar = null;
- this.filterStatusTip = null;
- this.clearFilterDialog = null;
- this.filterDefDialog = null;
- },
-
- _addRefreshButtons: function ()
- {
- var self = this;
- this.refreshButton = new dijit.form.Button({
- label: "Refresh",
- type: "button",
- iconClass: "gridRefreshIcon",
- title: "Manual Refresh"
- });
-
- this.autoRefreshButton = new dijit.form.ToggleButton({
- label: "Auto Refresh",
- type: "button",
- iconClass: "gridAutoRefreshIcon",
- title: "Auto Refresh"
- });
-
- this.autoRefreshButton.on("change", function (value)
- {
- self.grid.updater.updatable = value;
- self.refreshButton.set("disabled", value);
- });
-
- this.refreshButton.on("click", function (value)
- {
- self.grid.updater.performUpdate();
- });
-
- this.filterBar.addChild(this.autoRefreshButton);
- this.filterBar.addChild(this.refreshButton);
-
- if (this.displayLastUpdateTime)
- {
- var updateStatusPanel = domConstruct.create("div");
- var updateTimeLabel = domConstruct.create("span", {
- innerHTML: "Update time: ",
- "class": "formLabel-labelCell",
- "style": "padding-right: 5px;padding-left: 5px"
- }, updateStatusPanel);
- var updateTimeLabelPreferredTZ = domConstruct.create("span", {
- innerHTML: "Preferred timezone:",
- "style": "padding-right: 5px"
- }, updateStatusPanel);
- var updateTimePreferredTZ = domConstruct.create("span",
- {"style": "padding-right: 5px"},
- updateStatusPanel);
- var updateTimeLabelBrowserTZ = domConstruct.create("span", {
- innerHTML: "Browser timezone:",
- "style": "padding-right: 5px"
- }, updateStatusPanel);
- var updateTimeBrowserTZ = domConstruct.create("span",
- {"style": "padding-right: 5px"},
- updateStatusPanel);
-
- var userPreferences = this.userPreferences;
- var lastUpdateTimeUpdater = function (data)
- {
- var userTimeZone = userPreferences.timeZone;
- var displayStyle = userTimeZone ? "inline" : "none";
- updateTimeLabelPreferredTZ.style.display = displayStyle;
- updateTimePreferredTZ.style.display = displayStyle;
- var formatOptions = {
- selector: "time",
- timePattern: "HH:mm:ss.SSS",
- appendTimeZone: true,
- addOffset: true
- };
- var updateTime = new Date();
- updateTimePreferredTZ.innerHTML =
- userPreferences.formatDateTime(updateTime.getTime(), formatOptions);
- updateTimeBrowserTZ.innerHTML = locale.format(updateTime, formatOptions);
- };
-
- if (self.grid.updater.store)
- {
- // data have been already provided/or fetched
- // set last update time to current time
- lastUpdateTimeUpdater();
- }
-
- self.grid.updater.addOnUpdate(lastUpdateTimeUpdater);
- domConstruct.place(updateStatusPanel, this.grid.viewsHeaderNode, "before");
- }
- },
-
- _addRowLimitButton: function (defaulGridRowLimit)
- {
- var self = this;
- this.setRowNumberLimitButton = new dijit.form.Button({
- label: "Set Row Limit",
- type: "button",
- iconClass: "rowNumberLimitIcon",
- title: "Set Row Number Limit"
- });
- this.setRowNumberLimitButton.set("title", "Set Row Number Limit (Current: " + defaulGridRowLimit + ")");
-
- this.setRowNumberLimitDialog = new RowNumberLimitDialog(this.grid.domNode, function (newLimit)
- {
- if (newLimit > 0 && self.grid.updater.appendLimit != newLimit)
- {
- self.grid.updater.appendLimit = newLimit;
- self.grid.updater.performRefresh([]);
- self.setRowNumberLimitButton.set("title", "Set Row Number Limit (Current: " + newLimit + ")");
- }
- });
-
- this.setRowNumberLimitButton.on("click", function (evt)
- {
- self.setRowNumberLimitDialog.showDialog(self.grid.updater.appendLimit);
- });
-
- this.filterBar.addChild(this.setRowNumberLimitButton);
- },
-
- _addColumnsButton: function ()
- {
- var self = this;
- this.columnDefDialog = new ColumnDefDialog({grid: this.grid});
-
- this.columnDefButton = new dijit.form.Button({
- label: "Display Columns",
- type: "button",
- iconClass: "columnDefDialogButtonIcon",
- title: "Show/Hide Columns"
- });
-
- this.columnDefButton.on("click", function (e)
- {
- _stopEvent(e);
- self.columnDefDialog.showDialog();
- });
-
- this.filterBar.addChild(this.columnDefButton);
- },
-
- _addFilteringTools: function (nls)
- {
- var self = this;
-
- this.filterDefButton = new dijit.form.Button({
- "class": "dojoxGridFBarBtn",
- label: "Set Filter",
- iconClass: "dojoxGridFBarDefFilterBtnIcon",
- showLabel: "true",
- title: "Define filter"
- });
-
- this.clearFilterButton = new dijit.form.Button({
- "class": "dojoxGridFBarBtn",
- label: "Clear filter",
- iconClass: "dojoxGridFBarClearFilterButtontnIcon",
- showLabel: "true",
- title: "Clear filter",
- disabled: true
- });
-
- this.filterDefButton.on("click", function (e)
- {
- _stopEvent(e);
-
- // a bit of a hack to force dialog to rebuild the criteria controls in order to get rid from empty rule controls
- self.filterDefDialog._criteriasChanged = true;
- self.filterDefDialog.showDialog();
- });
-
- this.clearFilterButton.on("click", function (e)
- {
- _stopEvent(e);
- if (self.ruleCountToConfirmClearFilter && self.filterDefDialog.getCriteria()
- >= self.ruleCountToConfirmClearFilter)
- {
- self.clearFilterDialog.show();
- }
- else
- {
- self.grid.layer("filter")
- .filterDef(null);
- self.toggleClearFilterBtn(true)
- }
- });
-
- this.filterSummary = new FilterSummary({
- grid: this.grid,
- filterStatusTip: this.filterStatusTip,
- nls: nls
- });
-
- this.filterBar.addChild(this.filterDefButton);
- this.filterBar.addChild(this.clearFilterButton);
-
- this.filterBar.addChild(new dijit.ToolbarSeparator());
- this.filterBar.addChild(this.filterSummary, "last");
- this.filterBar.getColumnIdx = function (coordX)
- {
- return self.filterSummary._getColumnIdx(coordX);
- };
-
- }
- });
- });
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js
deleted file mode 100644
index ade2077..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/declare",
- "dojo/_base/lang",
- "dojo/_base/html",
- "dojo/query",
- "dojo/dom-construct",
- "dojo/string",
- "dojo/on",
- "dijit/_WidgetBase"], function (declare, lang, html, query, domConstruct, string, on, _WidgetBase)
-{
-
- return declare("qpid.common.grid.FilterSummary", [_WidgetBase], {
-
- domNode: null,
- itemName: null,
- filterStatusTip: null,
- grid: null,
- _handle_statusTooltip: null,
- _timeout_statusTooltip: 300,
- _nls: null,
-
- constructor: function (params)
- {
- this.inherited(arguments);
- this.itemName = params.itemsName;
- this.initialize(params.filterStatusTip, params.grid);
- this._nls = params.nls;
- },
-
- buildRendering: function ()
- {
- this.inherited(arguments);
- var itemsName = this.itemName || this._nls["defaultItemsName"];
- var message = string.substitute(this._nls["filterBarMsgNoFilterTemplate"], [0, itemsName]);
- this.domNode = domConstruct.create("span", {
- innerHTML: message,
- "class": "dijit dijitReset dijitInline dijitButtonInline",
- role: "presentation"
- });
- },
-
- postCreate: function ()
- {
- this.inherited(arguments);
- on(this.domNode, "mouseenter", lang.hitch(this, this._onMouseEnter));
- on(this.domNode, "mouseleave", lang.hitch(this, this._onMouseLeave));
- on(this.domNode, "mousemove", lang.hitch(this, this._onMouseMove));
- },
-
- destroy: function ()
- {
- this.inherited(arguments);
- this.itemName = null;
- this.filterStatusTip = null;
- this.grid = null;
- this._handle_statusTooltip = null;
- this._filteredClass = null;
- this._nls = null;
- },
-
- initialize: function (filterStatusTip, grid)
- {
- this.filterStatusTip = filterStatusTip;
- this.grid = grid;
- if (this.grid)
- {
- var filterLayer = grid.layer("filter");
- this.connect(filterLayer, "onFiltered", this.onFiltered);
- }
- },
-
- onFiltered: function (filteredSize, originSize)
- {
- try
- {
- var itemsName = this.itemName
- || this._nls["defaultItemsName"], msg = "", g = this.grid, filterLayer = g.layer(
- "filter");
- if (filterLayer.filterDef())
- {
- msg = string.substitute(this._nls["filterBarMsgHasFilterTemplate"],
- [filteredSize, originSize, itemsName]);
- }
- else
- {
- msg = string.substitute(this._nls["filterBarMsgNoFilterTemplate"], [originSize, itemsName]);
- }
- this.domNode.innerHTML = msg;
- }
- catch (e)
- {
- // swallow and log exception
- // otherwise grid rendering is screwed
- console.error(e);
- }
- },
-
- _getColumnIdx: function (coordX)
- {
- var headers = query("[role='columnheader']", this.grid.viewsHeaderNode);
- var idx = -1;
- for (var i = headers.length - 1; i >= 0; --i)
- {
- var coord = html.position(headers[i]);
- if (coordX >= coord.x && coordX < coord.x + coord.w)
- {
- idx = i;
- break;
- }
- }
- if (idx >= 0 && this.grid.layout.cells[idx].filterable !== false)
- {
- return idx;
- }
- else
- {
- return -1;
- }
- },
-
- _setStatusTipTimeout: function ()
- {
- this._clearStatusTipTimeout();
- this._handle_statusTooltip =
- setTimeout(lang.hitch(this, this._showStatusTooltip), this._timeout_statusTooltip);
- },
-
- _clearStatusTipTimeout: function ()
- {
- if (this._handle_statusTooltip)
- {
- clearTimeout(this._handle_statusTooltip);
- }
- this._handle_statusTooltip = null;
- },
-
- _showStatusTooltip: function ()
- {
- this._handle_statusTooltip = null;
- if (this.filterStatusTip)
- {
- this.filterStatusTip.showDialog(this._tippos.x, this._tippos.y, this._getColumnIdx(this._tippos.x));
- }
- },
-
- _updateTipPosition: function (evt)
- {
- this._tippos = {
- x: evt.pageX,
- y: evt.pageY
- };
- },
-
- _onMouseEnter: function (e)
- {
- this._updateTipPosition(e);
- if (this.filterStatusTip)
- {
- this._setStatusTipTimeout();
- }
- },
-
- _onMouseMove: function (e)
- {
- if (this.filterStatusTip)
- {
- this._setStatusTipTimeout();
- if (this._handle_statusTooltip)
- {
- this._updateTipPosition(e);
- }
- }
- },
-
- _onMouseLeave: function (e)
- {
- this._clearStatusTipTimeout();
- }
- });
-
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js
deleted file mode 100644
index b291543..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/xhr",
- "dojo/parser",
- "dojo/_base/array",
- "dojo/_base/lang",
- "qpid/common/properties",
- "qpid/common/updater",
- "qpid/common/UpdatableStore",
- "qpid/common/util",
- "dojo/store/Memory",
- "dojo/data/ObjectStore",
- "qpid/common/grid/EnhancedFilter",
- "dojox/grid/enhanced/plugins/NestedSorting",
- "dojo/domReady!"],
- function (xhr, parser, array, lang, properties, updater, UpdatableStore, util, Memory, ObjectStore)
- {
-
- function GridUpdater(args, store)
- {
- this.checkVisibilityFunc = args.hasOwnProperty("checkVisibilityFunc") ? args.checkVisibilityFunc : false;
- this.updatable = args.hasOwnProperty("updatable") ? args.updatable : true;
- this.serviceUrl = args.serviceUrl;
- this.userPreferences = args.userPreferences;
- this.onUpdate = [];
- if (args.onUpdate)
- {
- this.onUpdate.push(args.onUpdate);
- }
- this.dataTransformer = args.dataTransformer;
-
- this.appendData = args.append;
- this.appendLimit = args.appendLimit;
- this.initialData = args.data;
- this.initializeStore(store);
- };
-
- GridUpdater.prototype.buildUpdatableGridArguments = function (args)
- {
- var filterPluginFound = args && args.hasOwnProperty("plugins") && args.plugins.filter ? true : false;
-
- var gridProperties = {
- autoHeight: true,
- plugins: {
- pagination: {
- defaultPageSize: 25,
- pageSizes: [10, 25, 50, 100],
- description: true,
- sizeSwitch: true,
- pageStepper: true,
- gotoButton: true,
- maxPageStep: 4,
- position: "bottom"
- },
- enhancedFilter: {
- disableFiltering: filterPluginFound,
- userPreferences: this.userPreferences
- }
- }
- };
-
- if (args)
- {
- for (var argProperty in args)
- {
- if (args.hasOwnProperty(argProperty))
- {
- if (argProperty == "plugins")
- {
- var argPlugins = args[argProperty];
- for (var argPlugin in argPlugins)
- {
- if (argPlugins.hasOwnProperty(argPlugin))
- {
- var argPluginProperties = argPlugins[argPlugin];
- if (argPluginProperties && gridProperties.plugins.hasOwnProperty(argPlugin))
- {
- var gridPlugin = gridProperties.plugins[argPlugin];
- for (var pluginProperty in argPluginProperties)
- {
- if (argPluginProperties.hasOwnProperty(pluginProperty))
- {
- gridPlugin[pluginProperty] = argPluginProperties[pluginProperty];
- }
- }
- }
- else
- {
- gridProperties.plugins[argPlugin] = argPlugins[argPlugin];
- }
- }
- }
- }
- else
- {
- gridProperties[argProperty] = args[argProperty];
- }
- }
- }
- }
-
- gridProperties.updater = this;
- gridProperties.store = this.dataStore;
-
- return gridProperties;
- };
-
- GridUpdater.prototype.initializeStore = function (store)
- {
- var self = this;
-
- function processData(data)
- {
- if (self.dataTransformer)
- {
- data = self.dataTransformer(data);
- }
- var dataSet = false;
- if (!store)
- {
- store = new ObjectStore({
- objectStore: new Memory({
- data: data,
- idProperty: "id"
- })
- });
- dataSet = true;
- }
- self.dataStore = store
- self.store = store;
- if (store instanceof ObjectStore)
- {
- if (store.objectStore instanceof Memory)
- {
- self.memoryStore = store.objectStore;
- }
- self.store = store.objectStore
- }
-
- if (data)
- {
- if ((dataSet || self.updateOrAppend(data)) && self.onUpdate.length > 0)
- {
- self.fireUpdate(data);
- }
- }
- };
-
- if (this.serviceUrl)
- {
- var requestUrl = lang.isFunction(this.serviceUrl) ? this.serviceUrl() : this.serviceUrl;
- xhr.get({
- url: requestUrl,
- handleAs: "json"
- })
- .then(processData, util.xhrErrorHandler);
- }
- else
- {
- processData(this.initialData);
- }
- };
-
- GridUpdater.prototype.start = function (grid)
- {
- this.grid = grid;
- if (this.serviceUrl)
- {
- updater.add(this);
- }
- };
-
- GridUpdater.prototype.destroy = function ()
- {
- updater.remove(this);
- if (this.dataStore)
- {
- this.dataStore.close();
- this.dataStore = null;
- }
- this.store = null;
- this.memoryStore = null;
- this.grid = null;
- this.onUpdate = null;
- };
-
- GridUpdater.prototype.updateOrAppend = function (data)
- {
- return this.appendData
- ? UpdatableStore.prototype.append.call(this, data, this.appendLimit)
- : UpdatableStore.prototype.update.call(this, data);
- };
-
- GridUpdater.prototype.refresh = function (data)
- {
- if (this.dataTransformer && data)
- {
- data = this.dataTransformer(data);
- }
- this.updating = true;
- try
- {
- if (this.updateOrAppend(data))
- {
- // EnhancedGrid with Filter plugin has "filter" layer.
- // The filter expression needs to be re-applied after the data update
- var filterLayer = this.grid.layer("filter");
- if (filterLayer && filterLayer.filterDef)
- {
- var currentFilter = filterLayer.filterDef();
-
- if (currentFilter)
- {
- // re-apply filter in the filter layer
- filterLayer.filterDef(currentFilter);
- }
- }
-
- // refresh grid to render updates
- this.grid._refresh();
- }
- }
- finally
- {
- this.updating = false;
- this.fireUpdate(data);
- }
- }
-
- GridUpdater.prototype.update = function ()
- {
- if (this.updatable && (!this.checkVisibilityFunc || this.checkVisibilityFunc()))
- {
- this.performUpdate();
- }
- };
-
- GridUpdater.prototype.performUpdate = function ()
- {
- var self = this;
- var requestUrl = lang.isFunction(this.serviceUrl) ? this.serviceUrl() : this.serviceUrl;
- var requestArguments = {
- url: requestUrl,
- sync: properties.useSyncGet,
- handleAs: "json"
- };
- xhr.get(requestArguments)
- .then(function (data)
- {
- self.refresh(data);
- });
- };
-
- GridUpdater.prototype.performRefresh = function (data)
- {
- if (!this.updating)
- {
- this.refresh(data);
- }
- };
-
- GridUpdater.prototype.fireUpdate = function (data)
- {
- if (this.onUpdate.length > 0)
- {
- for (var i = 0; i < this.onUpdate.length; i++)
- {
- var onUpdate = this.onUpdate[i];
- try
- {
- onUpdate(data);
- }
- catch (e)
- {
- if (console && console.error)
- {
- console.error(e);
- }
- }
- }
- }
- };
-
- GridUpdater.prototype.addOnUpdate = function (obj)
- {
- this.onUpdate.push(obj);
- };
-
- GridUpdater.prototype.removeOnUpdate = function (obj)
- {
- for (var i = 0; i < this.onUpdate.length; i++)
- {
- if (this.onUpdate[i] === obj)
- {
- this.onUpdate.splice(i, 1);
- return;
- }
- }
- };
-
- return GridUpdater;
- });
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js
deleted file mode 100644
index 2222b42..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/declare",
- "dojo/_base/event",
- "dojo/_base/array",
- "dojo/_base/lang",
- "dojo/parser",
- "dojo/dom-construct",
- "dojo/query",
- "dijit/registry",
- "dijit/form/Button",
- "dijit/form/CheckBox",
- "dojox/grid/enhanced/plugins/Dialog",
- "dojo/text!../../../grid/showRowNumberLimitDialog.html",
- "dojo/domReady!"],
- function (declare, event, array, lang, parser, dom, query, registry, Button, CheckBox, Dialog, template)
- {
-
- return declare("qpid.management.logs.RowNumberLimitDialog", null, {
-
- grid: null,
- dialog: null,
-
- constructor: function (domNode, limitChangedCallback)
- {
- var that = this;
- this.containerNode = dom.create("div", {innerHTML: template});
- parser.parse(this.containerNode)
- .then(function (instances)
- {
- that._postParse(domNode, limitChangedCallback);
- });
- },
- _postParse: function (domNode, limitChangedCallback)
- {
- this.rowNumberLimit = registry.byNode(query(".rowNumberLimit", this.containerNode)[0])
- this.submitButton = registry.byNode(query(".submitButton", this.containerNode)[0]);
- this.closeButton = registry.byNode(query(".cancelButton", this.containerNode)[0]);
-
- this.dialog = new Dialog({
- "refNode": domNode,
- "title": "Grid Rows Number",
- "content": this.containerNode
- });
-
- var self = this;
- this.submitButton.on("click", function (e)
- {
- if (self.rowNumberLimit.value > 0)
- {
- try
- {
- limitChangedCallback(self.rowNumberLimit.value);
- }
- catch (e)
- {
- console.error(e);
- }
- finally
- {
- self.dialog.hide();
- }
- }
- });
-
- this.closeButton.on("click", function (e)
- {
- self.dialog.hide();
- });
- this.dialog.startup();
- },
-
- destroy: function ()
- {
- this.submitButton.destroy();
- this.closeButton.destroy();
- this.dialog.destroy();
- this.dialog = null;
- },
-
- showDialog: function (currentLimit)
- {
- this.rowNumberLimit.set("value", currentLimit);
- this.dialog.show();
- }
-
- });
-
- });
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js
deleted file mode 100644
index 3ee20e2..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-define(["dojo/_base/declare", "dojox/grid/EnhancedGrid", "dojo/domReady!"], function (declare, EnhancedGrid)
-{
-
- return declare("qpid.common.grid.UpdatableGrid", [EnhancedGrid], {
-
- updater: null,
-
- postCreate: function ()
- {
- this.inherited(arguments);
- if (this.updater)
- {
- this.updater.start(this);
- }
- },
-
- destroy: function ()
- {
- if (this.updater)
- {
- try
- {
- this.updater.destroy();
- }
- catch (e)
- {
- console.error(e)
- }
- this.updater = null;
- }
- this.inherited(arguments);
- }
- });
-
-});
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f5718f9b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/FileBrowser.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/FileBrowser.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/FileBrowser.js
deleted file mode 100644
index fc7a4b0..0000000
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/FileBrowser.js
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-define(["qpid/common/util",
- "dojo/query",
- "dojo/number",
- "dojo/_base/lang",
- "dojo/_base/connect",
- "dojox/html/entities",
- "dojo/text!logger/file/fileBrowser.html",
- "dojox/grid/EnhancedGrid",
- "qpid/common/UpdatableStore",
- "dijit/registry",
- "dojo/domReady!"],
- function (util, query, number, lang, connect, entities, template, EnhancedGrid, UpdatableStore, registry)
- {
- function FileBrowser(params)
- {
- var that = this;
- this.management = params.management;
- this.modelObj = params.modelObj;
- util.parse(params.containerNode, template, function ()
- {
- that.postParse(params);
- });
- }
-
- FileBrowser.prototype.postParse = function (params)
- {
- var that = this;
- var gridProperties = {
- height: 400,
- selectionMode: "extended",
- plugins: {
- indirectSelection: true,
- pagination: {
- pageSizes: [10, 25, 50, 100],
- description: true,
- sizeSwitch: true,
- pageStepper: true,
- gotoButton: true,
- maxPageStep: 4,
- position: "bottom"
- }
- }
- };
-
- this.downloadButton = registry.byNode(query(".downloadButton", params.containerNode)[0]);
- this.downloadButton.on("click", function (e)
- {
- that.downloadSelectedFiles()
- });
-
- this.downloadAllButton = registry.byNode(query(".downloadAllButton", params.containerNode)[0]);
- this.downloadAllButton.on("click", function (e)
- {
- that.downloadAllFiles()
- });
-
- this.logFiles = this.addIdToFileObjects(params.data);
- this.logFileGrid = new UpdatableStore(this.logFiles, query(".logFilesGrid", params.containerNode)[0], [{
- name: "Name",
- field: "name",
- width: "40%"
- }, {
- name: "Size",
- field: "size",
- width: "20%",
- formatter: function (val)
- {
- return val > 1024 ? (val > 1048576 ? number.round(val / 1048576) + " MB" : number.round(val / 1024)
- + " KB") : val + " B";
- }
- }, {
- name: "Last Modified",
- field: "lastModified",
- width: "40%",
- formatter: function (val)
- {
- return that.management.userPreferences.formatDateTime(val, {
- addOffset: true,
- appendTimeZone: true
- });
- }
- }], function (obj)
- {
- obj.grid.on("rowDblClick", function (evt)
- {
- var idx = evt.rowIndex;
- var theItem = this.getItem(idx);
- that.download(theItem);
- });
- }, gridProperties, EnhancedGrid);
- }
-
- FileBrowser.prototype.download = function (item)
- {
- var parentModelObj = this.modelObj;
- var modelObj = {
- type: parentModelObj.type,
- name: "getFile",
- parent: parentModelObj
- }
- this.management.download(modelObj, {fileName: item.name});
- }
-
- FileBrowser.prototype.addIdToFileObjects = function (data)
- {
- var fileItems = [];
- var logFiles = data.logFiles;
- for (var idx in logFiles)
- {
- var item = lang.mixin(logFiles[idx], {id: logFiles[idx].name});
- fileItems.push(item);
- }
- return fileItems;
- }
-
- FileBrowser.prototype.downloadSelectedFiles = function ()
- {
- var data = this.logFileGrid.grid.selection.getSelected();
- this.downloadFiles(data);
- }
-
- FileBrowser.prototype.downloadAllFiles = function ()
- {
- var parentModelObj = this.modelObj;
- var modelObj = {
- type: parentModelObj.type,
- name: "getAllFiles",
- parent: parentModelObj
- }
- this.management.download(modelObj, {});
- }
-
- FileBrowser.prototype.downloadFiles = function (fileItems)
- {
- if (fileItems.length)
- {
- var parentModelObj = this.modelObj;
- var modelObj = {
- type: parentModelObj.type,
- name: "getFiles",
- parent: parentModelObj
- }
- var items = [];
- for (var i = 0; i < fileItems.length; i++)
- {
- items.push(fileItems[i].id);
- }
- this.management.download(modelObj, {fileName: items});
- }
- }
-
- FileBrowser.prototype.update = function (restData)
- {
- if (this.logFileGrid)
- {
- this.logFiles = this.addIdToFileObjects(restData);
- if (this.logFileGrid.update(this.logFiles))
- {
- //this.logFileGrid.grid._refresh();
- }
- }
- }
-
- return FileBrowser;
- });
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org