From 9c1cde002ccae4a6b5c18add9394c1961df13496 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Mon, 29 Jan 2018 16:44:39 +0100 Subject: [PATCH] F #1692: Enable the option to add addons dynamically to Sunstone (#1693) --- src/sunstone/public/Gruntfile.js | 1 + src/sunstone/public/addons/README | 3 +++ src/sunstone/public/addons/opennebula/README | 3 +++ src/sunstone/public/addons/tabs/README | 3 +++ src/sunstone/public/app/addons.js | 13 +++++++++++++ src/sunstone/public/app/main.js | 7 ++++++- src/sunstone/views/index.erb | 5 ++++- 7 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/sunstone/public/addons/README create mode 100644 src/sunstone/public/addons/opennebula/README create mode 100644 src/sunstone/public/addons/tabs/README create mode 100644 src/sunstone/public/app/addons.js diff --git a/src/sunstone/public/Gruntfile.js b/src/sunstone/public/Gruntfile.js index a80b4db7be..8f201d5d91 100644 --- a/src/sunstone/public/Gruntfile.js +++ b/src/sunstone/public/Gruntfile.js @@ -72,6 +72,7 @@ module.exports = function(grunt) { modules: [ { name: 'main', + excludeShallow: ['addons'], include: ['almond'] }, { diff --git a/src/sunstone/public/addons/README b/src/sunstone/public/addons/README new file mode 100644 index 0000000000..50a77182e6 --- /dev/null +++ b/src/sunstone/public/addons/README @@ -0,0 +1,3 @@ +This directory emulates "app" to maintain consistency with Sunstone. + +In the process of minimizing, this directory is not compiled to add addons dynamically to production environments. diff --git a/src/sunstone/public/addons/opennebula/README b/src/sunstone/public/addons/opennebula/README new file mode 100644 index 0000000000..1d025ad371 --- /dev/null +++ b/src/sunstone/public/addons/opennebula/README @@ -0,0 +1,3 @@ +This dir emulates 'app/opennebula'. + +From here the ajax requests will be made to the OpenNebula driver. \ No newline at end of file diff --git a/src/sunstone/public/addons/tabs/README b/src/sunstone/public/addons/tabs/README new file mode 100644 index 0000000000..444abebc4b --- /dev/null +++ b/src/sunstone/public/addons/tabs/README @@ -0,0 +1,3 @@ +This dir emulates 'app/tabs'. + +The whole hierarchy is the same as in the Sunstone tabs. \ No newline at end of file diff --git a/src/sunstone/public/app/addons.js b/src/sunstone/public/app/addons.js new file mode 100644 index 0000000000..e1ee9243ca --- /dev/null +++ b/src/sunstone/public/app/addons.js @@ -0,0 +1,13 @@ +siteMap = { + addons: [ + + ] +}; + +var path = "../addons/tabs/"; +var deps = []; +siteMap.addons.forEach(function (addon) { + deps.push(path + addon); +}); + +require(deps, function (e){}); diff --git a/src/sunstone/public/app/main.js b/src/sunstone/public/app/main.js index 8cda989856..23e97821e3 100644 --- a/src/sunstone/public/app/main.js +++ b/src/sunstone/public/app/main.js @@ -19,6 +19,9 @@ require.config({ /* Almond */ 'almond': '../bower_components/almond/almond', + /* Addons */ + 'addons': './addons', + /* jQuery */ 'jquery': '../bower_components/jquery/dist/jquery', 'jquery-ui': '../bower_components/jquery-ui/jquery-ui', @@ -357,7 +360,9 @@ require.config({ deps: [ 'spice-spiceconn' ] - } + }, + + 'addons': {} } }); diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index 5e4fdba53f..ec606857d2 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -106,7 +106,10 @@ <% if $conf[:env] == 'dev' %> <% else %> - + + <% end %>