From 80004ba202887a69d362df614d371eeba3cab4d6 Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Sat, 14 Sep 2013 11:30:18 +0000 Subject: QPID-5138: Add preferences UI into web management console git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1523222 13f79535-47bb-0310-9956-ffa450edef68 --- .../server/management/plugin/HttpManagement.java | 7 + .../plugin/servlet/rest/HelperServlet.java | 3 + .../java/resources/common/TimeZoneSelector.html | 35 ++++ .../src/main/java/resources/css/common.css | 16 +- .../src/main/java/resources/images/gear.png | Bin 0 -> 3512 bytes .../src/main/java/resources/images/help.png | Bin 0 -> 932 bytes .../src/main/java/resources/index.html | 47 +++++- .../resources/js/qpid/authorization/checkUser.js | 2 +- .../resources/js/qpid/common/TimeZoneSelector.js | 176 +++++++++++++++++++++ .../resources/js/qpid/management/Preferences.js | 149 +++++++++++++++++ .../src/main/java/resources/showPreferences.html | 51 ++++++ 11 files changed, 479 insertions(+), 7 deletions(-) create mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html create mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png create mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png create mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js create mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js create mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferences.html (limited to 'qpid/java/broker-plugins/management-http/src') diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 4aebf90a75..d2e0c0dc6e 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -330,6 +330,13 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem root.addServlet(new ServletHolder(new LogFileListingServlet()), "/rest/logfiles"); root.addServlet(new ServletHolder(new LogFileServlet()), "/rest/logfile"); + String[] timeZoneFiles = {"africa", "antarctica", "asia", "australasia", "backward", + "etcetera", "europe", "northamerica", "pacificnew", "southamerica"}; + for (String timeZoneFile : timeZoneFiles) + { + root.addServlet(new ServletHolder(FileServlet.INSTANCE), "/dojo/dojox/date/zoneinfo/" + timeZoneFile); + } + final SessionManager sessionManager = root.getSessionHandler().getSessionManager(); sessionManager.setSessionCookie(JSESSIONID_COOKIE_PREFIX + lastPort); sessionManager.setMaxInactiveInterval((Integer)getAttribute(TIME_OUT)); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java index 5314cbaece..9ba36bb5c2 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java @@ -41,6 +41,8 @@ import org.codehaus.jackson.map.SerializationConfig; public class HelperServlet extends AbstractServlet { + private static final long serialVersionUID = 1L; + private static final String PARAM_ACTION = "action"; private Map _actions; @@ -56,6 +58,7 @@ public class HelperServlet extends AbstractServlet new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOST_STORE_TYPES, "ListMessageStoreTypes"), new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOST_TYPES, "ListVirtualHostTypes"), new ListBrokerAttribute(Broker.SUPPORTED_PREFERENCES_PROVIDERS_TYPES, "ListPreferencesProvidersTypes"), + new ListBrokerAttribute(Broker.PRODUCT_VERSION, "version"), new ListGroupProviderAttributes(), new ListAccessControlProviderAttributes(), new PluginClassProviderAction() diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html new file mode 100644 index 0000000000..0c60970f11 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html @@ -0,0 +1,35 @@ + + + + + + + +
Region + + City + +
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css index e45c9cb463..d9064f40c9 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css @@ -148,4 +148,18 @@ div .messages { .grayBackground tr{background-color:#eeeeee !important; background-image: none !important;} .dojoxGridRowOdd.grayBackground tr{ background-color:#e9e9e9 !important; background-image: none !important;} .dojoxGridRowOdd.yellowBackground tr{background-color:#fafdd5 !important; background-image: none !important;} -.dojoxGridRowOdd.redBackground tr{background-color:#f4c1c1 !important; background-image: none !important;} \ No newline at end of file +.dojoxGridRowOdd.redBackground tr{background-color:#f4c1c1 !important; background-image: none !important;} + +.preferencesIcon +{ + background: url("../images/gear.png") no-repeat; + width: 16px; + height: 16px; +} + +.helpIcon +{ + background: url("../images/help.png") no-repeat; + width: 16px; + height: 16px; +} \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png new file mode 100644 index 0000000000..0bb4394b46 Binary files /dev/null and b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png new file mode 100644 index 0000000000..f7d3698d25 Binary files /dev/null and b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html index 4b97c464ec..4fc961ec12 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html @@ -42,7 +42,6 @@ var dojoConfig = { tlmSiblingOfDojo:false, - parseOnLoad:true, async:true, baseUrl: getContextPath(), packages:[ @@ -58,7 +57,14 @@ @@ -75,7 +92,27 @@
- +
+ +
+
+
+ Preferences +
+ +
+ Help +
+
+
+
@@ -104,4 +141,4 @@
- \ No newline at end of file + diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js index 159c7458ed..d65e6c6e07 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js @@ -29,7 +29,7 @@ var updateUI = function updateUI(data) if(data.user) { dom.byId("authenticatedUser").innerHTML = entities.encode(String(data.user)); - dom.byId("login").style.display = "block"; + dom.byId("login").style.display = "inline"; } }; diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js new file mode 100644 index 0000000000..287fbc9619 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js @@ -0,0 +1,176 @@ +/* + * + * 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/array", + "dojo/dom-construct", + "dojo/parser", + "dojo/query", + "dojo/store/Memory", + "dijit/_WidgetBase", + "dijit/registry", + "dojo/text!common/TimeZoneSelector.html", + "dijit/form/ComboBox", + "dijit/form/FilteringSelect", + "dojox/date/timezone", + "dojox/validate/us", + "dojox/validate/web", + "dojo/domReady!"], +function (declare, array, domConstruct, parser, query, Memory, _WidgetBase, registry, template) { + + var preferencesRegions = ["Africa","America","Antarctica","Arctic","Asia","Atlantic","Australia","Europe","Indian","Pacific"]; + + function initSupportedTimeZones() + { + var supportedTimeZones = []; + var allTimeZones = dojox.date.timezone.getAllZones(); + for(var i = 0; i < allTimeZones.length; i++) + { + var timeZone = allTimeZones[i]; + var elements = timeZone.split("/"); + if (elements.length > 1) + { + for(var j = 0; j 1) + { + this._regionSelector.timeZone = value; + this._regionSelector.set("value", elements[0]); + this._citySelector.set("value", value); + } + else + { + this._regionSelector.set("value", "undefined"); + } + } + else + { + this._regionSelector.set("value", "undefined"); + } + this.value = value; + }, + + destroy: function() + { + if (this.domNode) + { + this.domNode.destroy(); + this.domNode = null; + } + _regionSelector: null; + _citySelector: null; + } + + }); +}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js new file mode 100644 index 0000000000..6d587b37d1 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js @@ -0,0 +1,149 @@ +/* + * + * 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/xhr", + "dojo/_base/event", + "dojo/dom", + "dojo/dom-construct", + "dojo/parser", + "dojo/query", + "dojo/json", + "dojox/html/entities", + "dijit/registry", + "qpid/common/TimeZoneSelector", + "dojo/text!../../showPreferences.html", + "dijit/Dialog", + "dijit/form/NumberSpinner", + "dijit/form/CheckBox", + "dijit/form/Textarea", + "dijit/form/FilteringSelect", + "dijit/form/TextBox", + "dijit/form/DropDownButton", + "dijit/form/Button", + "dijit/form/Form", + "dojox/validate/us", + "dojox/validate/web", + "dojo/domReady!"], +function (declare, xhr, event, dom, domConstruct, parser, query, json, entities, registry, TimeZoneSelector, markup) { + + var preferenceNames = ["timeZone", "updatePeriod", "saveTabs"]; + + return declare("qpid.management.Preferences", null, { + + preferencesDialog: null, + saveButton: null, + cancelButton: null, + + constructor: function() + { + var that = this; + + this.domNode = domConstruct.create("div", {innerHTML: markup}); + parser.parse(this.domNode); + + for(var i=0; i +
+
+ + + + + + + + + + + + + +
Time zone: + +
Update period: +
Save tabs:
+
+ + +
+
+
-- cgit v1.2.1