From ce8c2eb8a59922ed83e08296b25591c43dac03e6 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Thu, 18 Apr 2013 14:52:45 -0400 Subject: [PATCH 1/3] Removing 'incubator' from the default source dir Signed-off-by: Chip Childers --- tools/build/build_asf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build/build_asf.sh b/tools/build/build_asf.sh index c692febb143..f58f5e0011d 100755 --- a/tools/build/build_asf.sh +++ b/tools/build/build_asf.sh @@ -17,7 +17,7 @@ # under the License. version='TESTBUILD' -sourcedir=~/incubator-cloudstack/ +sourcedir=~/cloudstack/ outputdir=~/cs-asf-build/ branch='master' tag='no' From 9573f51d3b5c79209262c398c4f13897ceaa19a8 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Thu, 18 Apr 2013 21:32:08 +0200 Subject: [PATCH 2/3] CLOUDSTACK-1977: Add management setup directory to classpath This way the DB upgrade process can locate the SQL files --- packaging/debian/init/cloud-management | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/init/cloud-management b/packaging/debian/init/cloud-management index 1e008312e09..8431eec8811 100755 --- a/packaging/debian/init/cloud-management +++ b/packaging/debian/init/cloud-management @@ -125,7 +125,7 @@ fi # Define other required variables CATALINA_PID="/var/run/$NAME.pid" BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap -JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:/etc/cloudstack/management" +JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:/etc/cloudstack/management:/usr/share/cloudstack-management/setup" # Look for Java Secure Sockets Extension (JSSE) JARs if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then From 6babaf96163f18453eeb7de69857ec62f01d88b3 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 12:34:59 -0700 Subject: [PATCH 3/3] Add UI 'module' API Add a variant to a plugin, called a 'module.' It is designed for features that are build-in to the standard UI (i.e., not installed dynamically), but can still utilize the modular nature of UI plugins. It works exactly the same way as a plugin, except: -Modules are added to modules/ folder -Modules are registered in modules/modules.js -No config.js (no need for metadata, since they are built-in features) - /ui/modules/ folder will not be touched by the build system, so any modules are committed directly to the ui/ folder. In other words, modules are not installed automatically. --- ui/index.jsp | 3 +- ui/modules/modules.js | 20 +++++++++++ ui/scripts/plugins.js | 78 ++++++++++++++++++++++++++++++------------- 3 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 ui/modules/modules.js diff --git a/ui/index.jsp b/ui/index.jsp index 550661e546a..5e5a7f2becf 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1680,9 +1680,10 @@ under the License. - + + diff --git a/ui/modules/modules.js b/ui/modules/modules.js new file mode 100644 index 00000000000..490749ff085 --- /dev/null +++ b/ui/modules/modules.js @@ -0,0 +1,20 @@ +// 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. +(function($, cloudStack) { + cloudStack.modules = [ + ]; +}(jQuery, cloudStack)); diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index d3e07055299..9d1991cc759 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. (function($, cloudStack, require) { + if (!cloudStack.pluginAPI) cloudStack.pluginAPI = {}; + var loadCSS = function(path) { var $link = $(''); @@ -27,27 +29,29 @@ $('head').append($link); }; - var pluginAPI = { - pollAsyncJob: pollAsyncJobResult, - apiCall: function(command, args) { - $.ajax({ - url: createURL(command), - data: args.data, - success: args.success, - error: function(json) { - args.error(parseXMLHttpResponse(json)); - } - }) - }, - addSection: function(section) { - cloudStack.sections[section.id] = $.extend(section, { - customIcon: 'plugins/' + section.id + '/icon.png' - }); - }, - extend: function(obj) { - $.extend(true, cloudStack, obj); + $.extend(cloudStack.pluginAPI, { + ui: { + pollAsyncJob: pollAsyncJobResult, + apiCall: function(command, args) { + $.ajax({ + url: createURL(command), + data: args.data, + success: args.success, + error: function(json) { + args.error(parseXMLHttpResponse(json)); + } + }) + }, + addSection: function(section) { + cloudStack.sections[section.id] = $.extend(section, { + customIcon: 'plugins/' + section.id + '/icon.png' + }); + }, + extend: function(obj) { + $.extend(true, cloudStack, obj); + } } - }; + }); cloudStack.sections.plugins = { title: 'label.plugins', @@ -66,9 +70,37 @@ loadCSS(pluginCSS); // Execute plugin - cloudStack.plugins[pluginID]({ - ui: pluginAPI - }); + cloudStack.plugins[pluginID]( + $.extend(true, {}, cloudStack.pluginAPI, { + pluginAPI: { + extend: function(api) { + cloudStack.pluginAPI[pluginID] = api; + } + } + }) + ); + }); + }); + + // Load modules + $(cloudStack.modules).map(function(index, moduleID) { + var basePath = 'modules/' + moduleID + '/'; + var moduleJS = basePath + moduleID + '.js'; + var moduleCSS = basePath + moduleID + '.css'; + + require([moduleJS], function() { + loadCSS(moduleCSS); + + // Execute module + cloudStack.modules[moduleID]( + $.extend(true, {}, cloudStack.pluginAPI, { + pluginAPI: { + extend: function(api) { + cloudStack.pluginAPI[moduleID] = api; + } + } + }) + ); }); }); }(jQuery, cloudStack, require));