From 075f672c7d2bae60cf743fbca7de1366a28e868d Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 12:22:02 +0200 Subject: [PATCH 01/10] appflow: Add sunstone-appflow.conf --- flow/install.sh | 1 + flow/sunstone/etc/sunstone-appflow.conf | 7 +++++++ flow/sunstone/routes/appflow.rb | 13 ++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 flow/sunstone/etc/sunstone-appflow.conf diff --git a/flow/install.sh b/flow/install.sh index 3d1aa2de19..3cef318c58 100755 --- a/flow/install.sh +++ b/flow/install.sh @@ -98,6 +98,7 @@ copy_files "sunstone/routes/*" "$SUNSTONE_LOCATION/routes" # Do not link the ETC files LINK="no" +copy_files "sunstone/etc/sunstone-appflow.conf" "$ETC_LOCATION" copy_files "config/appflow-server.conf" "$ETC_LOCATION" diff --git a/flow/sunstone/etc/sunstone-appflow.conf b/flow/sunstone/etc/sunstone-appflow.conf new file mode 100644 index 0000000000..188a091b56 --- /dev/null +++ b/flow/sunstone/etc/sunstone-appflow.conf @@ -0,0 +1,7 @@ +################################################################################ +# Appflow +################################################################################ + +# Appflow endpoint +# +:appflow_server: http://localhost:2474/ \ No newline at end of file diff --git a/flow/sunstone/routes/appflow.rb b/flow/sunstone/routes/appflow.rb index 87b5730278..f47ff4e725 100644 --- a/flow/sunstone/routes/appflow.rb +++ b/flow/sunstone/routes/appflow.rb @@ -1,14 +1,25 @@ +APPFLOW_CONF_FILE = ETC_LOCATION + "/sunstone-appflow.conf" + $: << RUBY_LIB_LOCATION+"/apptools/flow" require 'appflow_client' +begin + appflow_conf = YAML.load_file(APPFLOW_CONF_FILE) +rescue Exception => e + STDERR.puts "Error parsing config file #{APPFLOW_CONF_FILE}: #{e.message}" + exit 1 +end + +set :appflow_config, appflow_conf + helpers do def build_client flow_client = settings.cloud_auth.client(session[:user]) split_array = flow_client.one_auth.split(':') Service::Client.new( - :url => settings.config[:appflow_server], + :url => settings.appflow_config[:appflow_server], :user_agent => "Sunstone", :username => split_array.shift, :password => split_array.join(':')) From d1240ec44e1aef896249d8f9597178f25622e885 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 12:22:23 +0200 Subject: [PATCH 02/10] appmarket: Add apptools.appmarket.appliances.js --- .../apptools.appmarket.appliances.js | 312 ++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js diff --git a/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js b/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js new file mode 100644 index 0000000000..c37a65d9af --- /dev/null +++ b/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js @@ -0,0 +1,312 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2010-2012, C12G Labs S.L */ +/* */ +/* Licensed 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. */ +/* -------------------------------------------------------------------------- */ + +/* Marketpplace tab plugin */ +var dataTable_appmarket; + +var AppMarket = { + "resource" : "MARKETPLACE", + + "show" : function(params){ + OpenNebula.Action.show(params,AppMarket.resource); + }, + "list" : function(params){ + //Custom list request function, since the contents do not come + //in the same format as the rest of opennebula resources. + var callback = params.success; + var callback_error = params.error; + var timeout = params.timeout || false; + var request = OpenNebula.Helper.request('MARKETPLACE','list'); + + $.ajax({ + url: 'marketplace', + type: 'GET', + data: {timeout: timeout}, + dataType: "json", + success: function(response){ + return callback ? + callback(request, response) : null; + }, + error: function(res){ + return callback_error ? callback_error(request, OpenNebula.Error(res)) : null; + } + }); + } +} +var appmarket_actions = { + "AppMarket.list" : { + type: "list", + call: AppMarket.list, + callback: function(req,res){ + //data can be added to the table directly, without further + //processing + updateView(res.appliances,dataTable_appmarket); + }, + error: onError + }, + "AppMarket.refresh" : { + type: "custom", + call: function () { + waitingNodes(dataTable_appmarket); + Sunstone.runAction('AppMarket.list'); + } + }, + "AppMarket.import" : { + //fetches images information and fills in the image creation + //dialog with it. + type: "multiple", + elements: appmarketplaceElements, + call: AppMarket.show, + callback: function(request,response){ + $('#img_name', $create_image_dialog).val(response['name']); + $('#img_path', $create_image_dialog).val(response['links']['download']['href']); + + //remove any options from the custom vars dialog box + $("#custom_var_image_box",$create_image_dialog).empty(); + + var md5 = response['files'][0]['md5'] + if ( md5 ) { + option = ''; + $("#custom_var_image_box",$create_image_dialog).append(option); + } + + var sha1 = response['files'][0]['sha1'] + if ( sha1 ) { + option = ''; + $("#custom_var_image_box",$create_image_dialog).append(option); + } + + popUpCreateImageDialog(); + }, + error: onError + }, + "AppMarket.showinfo" : { + type: "single", + call: AppMarket.show, + callback: updateMarketInfo, + error: onError + } +} + +var appmarket_buttons = { + "AppMarket.refresh" : { + type: "action", + text: '', + alwaysActive: true + }, + "AppMarket.import" : { + type: "action", + text: tr('Import to local infrastructure') + } +}; + +var appmarketplace_tab_content = '\ +

'+tr("OpenNebula AppMarket")+'

\ +
\ +
\ +
\ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("ID")+''+tr("Name")+''+tr("Publisher")+''+tr("Hypervisor")+''+tr("Arch")+''+tr("Format")+''+tr("Tags")+'
\ +'; + + +var appmarketplace_tab = { + title: "Appliances", + content: appmarketplace_tab_content, + buttons: appmarket_buttons, + tabClass: 'subTab', + parentTab: 'appmarket_dashboard_tab' +} + +Sunstone.addMainTab('appmarketplace_tab', appmarketplace_tab); +Sunstone.addActions(appmarket_actions); + + +/* + * INFO PANEL + */ + +var appmarketplace_info_panel = { + "appmarketplace_info_tab" : { + title: tr("Appliance information"), + content:"" + } +}; + +Sunstone.addInfoPanel("appmarketplace_info_panel", appmarketplace_info_panel); + +function appmarketplaceElements(){ + return getSelectedNodes(dataTable_appmarket); +} + +function updateMarketInfo(request,app){ + var info_tab = { + title : tr("Appliance information"), + content : + '\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("Appliance information")+'
' + tr("ID") + ''+app['_id']["$oid"]+'
' + tr("URL") + ''+config_response.system_config.appmarketplace_url+'/'+app['_id']["$oid"]+'
' + tr("Publisher") + ''+app['publisher']+'
' + tr("Downloads") + ''+app['downloads']+'
' + tr("OS") + ''+app['files'][0]['os-id']+' '+app['files'][0]['os-release']+'
' + tr("Arch") + ''+app['files'][0]['os-arch']+'
' + tr("Size") + ''+humanize_size(app['files'][0]['size'],true)+'
' + tr("Hypervisor") + ''+app['files'][0]['hypervisor']+'
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("Description")+'
'+app['description'].replace(/\n/g, "
")+'
' + }; + + Sunstone.updateInfoPanelTab("appmarketplace_info_panel", "appmarketplace_info_tab", info_tab); + Sunstone.popUpInfoPanel("appmarketplace_info_panel"); +}; + +function infoListenerMarket(dataTable){ + $('tbody tr',dataTable).live("click",function(e){ + if ($(e.target).is('input')) {return true;} + + var aData = dataTable.fnGetData(this); + var id = aData["_id"]["$oid"]; + if (!id) return true; + + var count = $('tbody .check_item:checked', dataTable).length; + + //If ctrl is pressed we check the column instead of + //doing showinfo() + if (e.ctrlKey || count >= 1){ + $('.check_item',this).trigger('click'); + return false; + } + + popDialogLoading(); + + Sunstone.runAction('AppMarket.showinfo',id); + return false; + }); +} + + +/* + * onlyOneCheckboxListener: Only one box can be checked + */ + +function onlyOneCheckboxListener(dataTable) { + $('tbody input.check_item', dataTable).live("change", function(){ + var checked = $(this).is(':checked'); + $('input.check_item:checked', dataTable).removeAttr('checked'); + $(this).attr('checked', checked); + }); +} + +/* + * Document + */ + +$(document).ready(function(){ + dataTable_appmarket = $("#datatable_appmarketplace", main_tabs_context).dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "sPaginationType": "full_numbers", + "sDom" : '<"H"lfrC>t<"F"ip>', + "bAutoWidth":false, + "aoColumns": [ + { "bSortable": false, + "fnRender": function ( o, val ) { + //we render 1st column as a checkbox directly + return '' + }, + "sWidth" : "60px" + }, + { "mDataProp": "_id.$oid", "bVisible": false, "sWidth" : "200px" }, + { "mDataProp": "name" }, + { "mDataProp": "publisher" }, + { "mDataProp": "files.0.hypervisor", "sWidth" : "100px"}, + { "mDataProp": "files.0.os-arch", "sWidth" : "100px"}, + { "mDataProp": "files.0.format", "sWidth" : "100px"}, + { "mDataProp": "tags", "bVisible": false} + ], + "oLanguage": (datatable_lang != "") ? + { + sUrl: "locale/"+lang+"/"+datatable_lang + } : "" + }); + + + tableCheckboxesListener(dataTable_appmarket); + onlyOneCheckboxListener(dataTable_appmarket); + + infoListenerMarket(dataTable_appmarket); + + Sunstone.runAction('AppMarket.list'); +}); \ No newline at end of file From b29959098277624227c5d982e228ffb5563b225a Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 13:00:29 +0200 Subject: [PATCH 03/10] appmarket: Add appmarket routes --- ...appplace_client.rb => appmarket_client.rb} | 0 market/install.sh | 1 + market/sunstone/etc/sunstone-appmarket.conf | 13 +++++ .../public/js/user-plugins/appmarket.js | 0 .../apptools.appmarket.appliances.js | 9 ++-- market/sunstone/routes/appmarket.rb | 49 +++++++++++++++++++ 6 files changed, 69 insertions(+), 3 deletions(-) rename market/client/lib/{appplace_client.rb => appmarket_client.rb} (100%) create mode 100644 market/sunstone/etc/sunstone-appmarket.conf delete mode 100644 market/sunstone/public/js/user-plugins/appmarket.js diff --git a/market/client/lib/appplace_client.rb b/market/client/lib/appmarket_client.rb similarity index 100% rename from market/client/lib/appplace_client.rb rename to market/client/lib/appmarket_client.rb diff --git a/market/install.sh b/market/install.sh index 925673d947..a7b47b2c18 100755 --- a/market/install.sh +++ b/market/install.sh @@ -96,5 +96,6 @@ copy_files "sunstone/routes/*" "$SUNSTONE_LOCATION/routes" # Do not link the ETC files LINK="no" +copy_files "sunstone/etc/sunstone-appmarket.conf" "$ETC_LOCATION" copy_files "config/appmarket-server.conf" "$ETC_LOCATION" diff --git a/market/sunstone/etc/sunstone-appmarket.conf b/market/sunstone/etc/sunstone-appmarket.conf new file mode 100644 index 0000000000..7e31aa2db3 --- /dev/null +++ b/market/sunstone/etc/sunstone-appmarket.conf @@ -0,0 +1,13 @@ +################################################################################ +# AppMarket +################################################################################ + +# AppMarket username and password +# If no credentials are provided, an anonymous client will be used +# +#:marketplace_username: +#:marketplace_password: + +# AppMarket endpoint +# +:marketplace_url: https://marketplace.c12g.com/appliance \ No newline at end of file diff --git a/market/sunstone/public/js/user-plugins/appmarket.js b/market/sunstone/public/js/user-plugins/appmarket.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js b/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js index c37a65d9af..6984877fc9 100644 --- a/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js +++ b/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js @@ -18,7 +18,7 @@ var dataTable_appmarket; var AppMarket = { - "resource" : "MARKETPLACE", + "resource" : "APPMARKET", "show" : function(params){ OpenNebula.Action.show(params,AppMarket.resource); @@ -29,10 +29,10 @@ var AppMarket = { var callback = params.success; var callback_error = params.error; var timeout = params.timeout || false; - var request = OpenNebula.Helper.request('MARKETPLACE','list'); + var request = OpenNebula.Helper.request('APPMARKET','list'); $.ajax({ - url: 'marketplace', + url: 'appmarket', type: 'GET', data: {timeout: timeout}, dataType: "json", @@ -73,6 +73,9 @@ var appmarket_actions = { callback: function(request,response){ $('#img_name', $create_image_dialog).val(response['name']); $('#img_path', $create_image_dialog).val(response['links']['download']['href']); + $('#src_path_select input[value="path"]', $create_image_dialog).trigger('click'); + $('select#img_type', $create_image_dialog).val('OS'); + $('select#img_type', $create_image_dialog).trigger('change'); //remove any options from the custom vars dialog box $("#custom_var_image_box",$create_image_dialog).empty(); diff --git a/market/sunstone/routes/appmarket.rb b/market/sunstone/routes/appmarket.rb index e69de29bb2..73fdde48b6 100644 --- a/market/sunstone/routes/appmarket.rb +++ b/market/sunstone/routes/appmarket.rb @@ -0,0 +1,49 @@ +APPMARKET_CONF_FILE = ETC_LOCATION + "/sunstone-appmarket.conf" + +$: << RUBY_LIB_LOCATION+"/apptools/market" + +require 'appmarket_client' + +begin + appmarket_conf = YAML.load_file(APPMARKET_CONF_FILE) +rescue Exception => e + STDERR.puts "Error parsing config file #{APPMARKET_CONF_FILE}: #{e.message}" + exit 1 +end + +set :appmarket_config, appmarket_conf + +helpers do + def am_build_client + Market::ApplianceClient.new( + settings.appmarket_config[:marketplace_username], + settings.appmarket_config[:marketplace_password], + settings.appmarket_config[:marketplace_url], + "Sunstone") + end + + def am_format_response(response) + if CloudClient::is_error?(response) + error = Error.new(response.to_s) + [response.code.to_i, error.to_json] + else + [200, response.body] + end + end +end + +get '/appmarket' do + client = am_build_client + + response = client.list + + am_format_response(response) +end + +get '/appmarket/:id' do + client = am_build_client + + response = client.show(params[:id]) + + am_format_response(response) +end \ No newline at end of file From 1ea2ff5570147b6beacd8e8cea29a4ec90a67e45 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 13:00:45 +0200 Subject: [PATCH 04/10] appflow: Use prefix for sunstone methods --- flow/sunstone/routes/appflow.rb | 45 +++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/flow/sunstone/routes/appflow.rb b/flow/sunstone/routes/appflow.rb index f47ff4e725..acaba258ab 100644 --- a/flow/sunstone/routes/appflow.rb +++ b/flow/sunstone/routes/appflow.rb @@ -14,7 +14,7 @@ end set :appflow_config, appflow_conf helpers do - def build_client + def af_build_client flow_client = settings.cloud_auth.client(session[:user]) split_array = flow_client.one_auth.split(':') @@ -25,11 +25,12 @@ helpers do :password => split_array.join(':')) end - def format_response(resp) + def af_format_response(resp) if CloudClient::is_error?(resp) logger.error("[AppFlow] " + resp.to_s) - # TBD format error messages in JSON - error 500, resp.to_s + + error = Error.new(resp.to_s) + error resp.code.to_i, error.to_json else body resp.body.to_s end @@ -41,35 +42,35 @@ end ############################################################################## get '/service' do - client = build_client + client = af_build_client resp = client.get('/service') - format_response(resp) + af_format_response(resp) end get '/service/:id' do - client = build_client + client = af_build_client resp = client.get('/service/' + params[:id]) - format_response(resp) + af_format_response(resp) end delete '/service/:id' do - client = build_client + client = af_build_client resp = client.delete('/service/' + params[:id]) - format_response(resp) + af_format_response(resp) end post '/service/:id/action' do - client = build_client + client = af_build_client resp = client.post('/service/' + params[:id] + '/action', request.body.read) - format_response(resp) + af_format_response(resp) end ############################################################################## @@ -77,41 +78,41 @@ end ############################################################################## get '/service_template' do - client = build_client + client = af_build_client resp = client.get('/service_template') - format_response(resp) + af_format_response(resp) end get '/service_template/:id' do - client = build_client + client = af_build_client resp = client.get('/service_template/' + params[:id]) - format_response(resp) + af_format_response(resp) end delete '/service_template/:id' do - client = build_client + client = af_build_client resp = client.delete('/service_template/' + params[:id]) - format_response(resp) + af_format_response(resp) end post '/service_template/:id/action' do - client = build_client + client = af_build_client resp = client.post('/service_template/' + params[:id] + '/action', request.body.read) - format_response(resp) + af_format_response(resp) end post '/service_template' do - client = build_client + client = af_build_client resp = client.post('/service_template', request.body.read) - format_response(resp) + af_format_response(resp) end \ No newline at end of file From 76550807d414fbd66e05a358f217073a5eb30afc Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 13:15:07 +0200 Subject: [PATCH 05/10] appmarket: Change default endpoint for sunstone-appmarket --- flow/controllers/appflow-server.rb | 20 ++------------------ market/sunstone/etc/sunstone-appmarket.conf | 6 +++--- market/sunstone/routes/appmarket.rb | 6 +++--- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/flow/controllers/appflow-server.rb b/flow/controllers/appflow-server.rb index b009ed50eb..4ea16b95d9 100644 --- a/flow/controllers/appflow-server.rb +++ b/flow/controllers/appflow-server.rb @@ -121,7 +121,7 @@ get '/service' do end status 200 - #body Parser.render(service_pool) + body service_pool.to_json end @@ -135,7 +135,7 @@ get '/service/:id' do end status 200 - #body Parser.render(service) + body service.to_json end @@ -246,7 +246,6 @@ get '/service_template' do status 200 - #body Parser.render(s_template_pool) body s_template_pool.to_json end @@ -260,7 +259,6 @@ get '/service_template/:id' do status 200 - #body Parser.render(rc) body service_template.to_json end @@ -273,22 +271,9 @@ delete '/service_template/:id' do end status 201 - - #body Parser.render(rc) - #body service_template.to_json end post '/service_template' do - #template = Parser.json_to_hash(request.body.read) - - #begin - # Validator.validate(template) - #rescue - # error 403, - #end - - #template_xml = Parser.hash_to_xml(template) - s_template = OpenNebula::ServiceTemplate.new( OpenNebula::ServiceTemplate.build_xml, @client) @@ -332,7 +317,6 @@ post '/service_template/:id/action' do service.info - #body Parser.render(rc) body service.to_json when 'chown' if opts && opts['uid'] diff --git a/market/sunstone/etc/sunstone-appmarket.conf b/market/sunstone/etc/sunstone-appmarket.conf index 7e31aa2db3..6a5a3b1086 100644 --- a/market/sunstone/etc/sunstone-appmarket.conf +++ b/market/sunstone/etc/sunstone-appmarket.conf @@ -5,9 +5,9 @@ # AppMarket username and password # If no credentials are provided, an anonymous client will be used # -#:marketplace_username: -#:marketplace_password: +#:appmarket_username: +#:appmarket_password: # AppMarket endpoint # -:marketplace_url: https://marketplace.c12g.com/appliance \ No newline at end of file +:appmarket_url: https://localhost:6242 \ No newline at end of file diff --git a/market/sunstone/routes/appmarket.rb b/market/sunstone/routes/appmarket.rb index 73fdde48b6..e725f4071c 100644 --- a/market/sunstone/routes/appmarket.rb +++ b/market/sunstone/routes/appmarket.rb @@ -16,9 +16,9 @@ set :appmarket_config, appmarket_conf helpers do def am_build_client Market::ApplianceClient.new( - settings.appmarket_config[:marketplace_username], - settings.appmarket_config[:marketplace_password], - settings.appmarket_config[:marketplace_url], + settings.appmarket_config[:appmarket_username], + settings.appmarket_config[:appmarket_password], + settings.appmarket_config[:appmarket_url], "Sunstone") end From 11d8c06f0a83452874ce2f4b63a3ec51767de748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 21 Sep 2012 15:31:28 +0200 Subject: [PATCH 06/10] appflow: Bug #1486: Instead of crashing, if /var/log/one/appflow does not exist the error is logged and execution continues --- flow/lib/log.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/flow/lib/log.rb b/flow/lib/log.rb index 47a0dad4d5..9d6f4b70dc 100644 --- a/flow/lib/log.rb +++ b/flow/lib/log.rb @@ -22,6 +22,8 @@ class Log # Log.info("LCM", "Service 3 started", 3), it will be written in a # specific log for service number 3 + LOG_COMP = "LOG" + DEBUG_LEVEL = [ Logger::ERROR, # 0 Logger::WARN, # 1 @@ -129,13 +131,17 @@ class Log return true end - # TBD capture exception - open("#{LOG_LOCATION}/appflow/#{service_id}.log", 'a') do |f| - f << MSG_FORMAT % [ - Time.now.strftime(DATE_FORMAT), - Logger::SEV_LABEL[severity][0..0], - component, - message ] + begin + open("#{LOG_LOCATION}/appflow/#{service_id}.log", 'a') do |f| + f << MSG_FORMAT % [ + Time.now.strftime(DATE_FORMAT), + Logger::SEV_LABEL[severity][0..0], + component, + message ] + end + rescue => e + message = "Could not log into #{LOG_LOCATION}/appflow/#{service_id}.log: #{e.message}" + error LOG_COMP, message end end From 2aa0ac9057798c8f078cc85d42a91dbcf77af6cb Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 15:47:19 +0200 Subject: [PATCH 07/10] appenv: Improve appenv-dashboard --- .../user-plugins/apptools.appenv-dashboard.js | 61 ++++++++++++++++--- .../public/js/user-plugins/apptools.appenv.js | 3 +- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js b/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js index b8fa374a71..9d809b4f3a 100644 --- a/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js +++ b/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js @@ -13,22 +13,67 @@ // limitations under the License. // //--------------------------------------------------------------------------// +function updateSystemDashboard(what, json_info){ + var db = $('#appenv_dashboard_tab',main_tabs_context); + switch (what){ + case "environments": + var total_envs=json_info.length; + $('#appenv_total_environments',db).html(total_envs); + break; + }; +} + var appenv_dashboard_tmpl = '\ \ \ -\ +
\ +\ +\ + \ + \ + \ + \ + \ + \ +
\ +
\ +

' + tr("Summary of AppEnv resources") + '

\ +
\ +\ + \ + \ + \ + \ + \ +
Environments
\ +\ +
\ +
\ +
\ +
\ +

' + tr("Quickstart") + '

\ +
\ + \ +
\ +
\ +
\ +
\ \ \ \ diff --git a/env/sunstone/public/js/user-plugins/apptools.appenv.js b/env/sunstone/public/js/user-plugins/apptools.appenv.js index d8b03de205..509ac18b67 100644 --- a/env/sunstone/public/js/user-plugins/apptools.appenv.js +++ b/env/sunstone/public/js/user-plugins/apptools.appenv.js @@ -417,7 +417,7 @@ var appenv_info_panel = { } var appenvs_tab = { - title: "AppEnv", + title: "Environments", content: appenv_tab_content, buttons: appenv_buttons, tabClass: 'subTab', @@ -479,6 +479,7 @@ function updateAppEnvsView(request, appenvs_list){ updateView(appenv_list_array,dataTable_appenvs); //updateVResDashboard("images",images_list); + updateSystemDashboard('environments', appenv_list_array); } // Callback to update the information panel tabs and pop it up From 1322cc7ec38901638a9d0ac10f295195c00f230f Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 16:29:25 +0200 Subject: [PATCH 08/10] appenv: Rename method --- .../public/js/user-plugins/apptools.appenv-dashboard.js | 2 +- env/sunstone/public/js/user-plugins/apptools.appenv.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js b/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js index 9d809b4f3a..2dfcf4dfdb 100644 --- a/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js +++ b/env/sunstone/public/js/user-plugins/apptools.appenv-dashboard.js @@ -13,7 +13,7 @@ // limitations under the License. // //--------------------------------------------------------------------------// -function updateSystemDashboard(what, json_info){ +function updateAppEnvDashboard(what, json_info){ var db = $('#appenv_dashboard_tab',main_tabs_context); switch (what){ case "environments": diff --git a/env/sunstone/public/js/user-plugins/apptools.appenv.js b/env/sunstone/public/js/user-plugins/apptools.appenv.js index 509ac18b67..f956bc25c3 100644 --- a/env/sunstone/public/js/user-plugins/apptools.appenv.js +++ b/env/sunstone/public/js/user-plugins/apptools.appenv.js @@ -479,7 +479,7 @@ function updateAppEnvsView(request, appenvs_list){ updateView(appenv_list_array,dataTable_appenvs); //updateVResDashboard("images",images_list); - updateSystemDashboard('environments', appenv_list_array); + updateAppEnvDashboard('environments', appenv_list_array); } // Callback to update the information panel tabs and pop it up From d26ce8d269d0b09e85110b3af419bb4399ac29e0 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 16:29:40 +0200 Subject: [PATCH 09/10] appflow: Improve appflow-dashboard --- .../apptools.appflow-dashboard.js | 67 ++++++++++++++++--- .../user-plugins/apptools.appflow.services.js | 1 + .../apptools.appflow.templates.js | 1 + 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/flow/sunstone/public/js/user-plugins/apptools.appflow-dashboard.js b/flow/sunstone/public/js/user-plugins/apptools.appflow-dashboard.js index 41100d112a..0699e81ab9 100644 --- a/flow/sunstone/public/js/user-plugins/apptools.appflow-dashboard.js +++ b/flow/sunstone/public/js/user-plugins/apptools.appflow-dashboard.js @@ -13,22 +13,73 @@ // limitations under the License. // //--------------------------------------------------------------------------// +function updateAppFlowDashboard(what, json_info){ + var db = $('#appflow_dashboard_tab',main_tabs_context); + switch (what){ + case "templates": + $('#appflow_total_templates',db).html(json_info.length); + break; + case "services": + $('#appflow_total_services',db).html(json_info.length); + break; + }; +} + var appflow_dashboard_tmpl = '\
\
\ -

' + tr("AppEnv - A tool to manage environments") + '

\ +

' + tr("AppEnv") + '

\
\ -\ -

appenv logoAppEnv performs the automatic installation and configuration of the software stack that constitutes an application environment. With AppEnv you can easily define software configurations for your VMs and share them with other users.

\ -

 

\ -

 

\ -

 

\ -

 

\ +

\ + appenv logo\ + AppEnv performs the automatic installation and configuration of the software stack that constitutes an application environment. With AppEnv you can easily define software configurations for your VMs and share them with other users.\ +

\ +

'+tr("You can find further information on the following links:")+'

\ + \
\
\
\ \ -\ +
\ +\ +\ + \ + \ + \ + \ + \ + \ +
\ +
\ +

' + tr("Summary of AppFlow resources") + '

\ +
\ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
Templates
Services
\ +\ +
\ +
\ +
\ +
\ +

' + tr("Quickstart") + '

\ + \ +
\ +
\ +
\ \ \ \ diff --git a/flow/sunstone/public/js/user-plugins/apptools.appflow.services.js b/flow/sunstone/public/js/user-plugins/apptools.appflow.services.js index fa8b91939e..bc8bba2d6d 100644 --- a/flow/sunstone/public/js/user-plugins/apptools.appflow.services.js +++ b/flow/sunstone/public/js/user-plugins/apptools.appflow.services.js @@ -398,6 +398,7 @@ function updateServicesView(request, services_list){ updateView(service_list_array,dataTable_services); //updateVResDashboard("images",images_list); + updateAppFlowDashboard('services', service_list_array); } // Callback to refresh the list of Virtual Machines diff --git a/flow/sunstone/public/js/user-plugins/apptools.appflow.templates.js b/flow/sunstone/public/js/user-plugins/apptools.appflow.templates.js index 21a655c40b..02da5419e3 100644 --- a/flow/sunstone/public/js/user-plugins/apptools.appflow.templates.js +++ b/flow/sunstone/public/js/user-plugins/apptools.appflow.templates.js @@ -423,6 +423,7 @@ function updateServiceTemplatesView(request, service_templates_list){ updateView(service_template_list_array,dataTable_service_templates); //updateVResDashboard("images",images_list); + updateAppFlowDashboard('templates', service_template_list_array); } // Callback to update the information panel tabs and pop it up From 3ac5610cafcc4654e900045c3e7eaf2cc82850d4 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 21 Sep 2012 16:39:07 +0200 Subject: [PATCH 10/10] appmarket: Improve appmarket-dashboard --- .../apptools.appmarket-dashboard.js | 48 +++++++++++++++---- .../apptools.appmarket.appliances.js | 1 + 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/market/sunstone/public/js/user-plugins/apptools.appmarket-dashboard.js b/market/sunstone/public/js/user-plugins/apptools.appmarket-dashboard.js index 31e26774af..a59c44d38b 100644 --- a/market/sunstone/public/js/user-plugins/apptools.appmarket-dashboard.js +++ b/market/sunstone/public/js/user-plugins/apptools.appmarket-dashboard.js @@ -13,22 +13,54 @@ // limitations under the License. // //--------------------------------------------------------------------------// +function updateAppMarketDashboard(what, json_info){ + var db = $('#appmarket_dashboard_tab',main_tabs_context); + switch (what){ + case "appliances": + $('#appmarket_total_appliances',db).html(json_info.length); + break; + }; +} + var appmarket_dashboard_tmpl = '\
\
\ -

' + tr("Appflow - A tool to manage environments") + '

\ +

' + tr("Appflow - A tool to manage environments") + '

\
\ -\ -

appflow logoAppFlow enables the automatic execution of multi-tiered applications. With AppFlow you can define multi-tier applications composed of interconnected VMs and manage them as a single entity.

\ -

 

\ -

 

\ -

 

\ -

 

\ +

\ + appflow logo\ + AppFlow enables the automatic execution of multi-tiered applications. With AppFlow you can define multi-tier applications composed of interconnected VMs and manage them as a single entity.\ +

\ +

'+tr("You can find further information on the following links:")+'

\ + \
\
\
\ \ -\ +
\ +\ +\ + \ + \ + \ +
\ +
\ +

' + tr("Summary of AppMarket resources") + '

\ +
\ +\ + \ + \ + \ + \ + \ +
Appliances
\ +\ +
\ +
\ +
\ +
\ \ \ \ diff --git a/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js b/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js index 6984877fc9..c8a4f3ad4f 100644 --- a/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js +++ b/market/sunstone/public/js/user-plugins/apptools.appmarket.appliances.js @@ -54,6 +54,7 @@ var appmarket_actions = { //data can be added to the table directly, without further //processing updateView(res.appliances,dataTable_appmarket); + updateAppMarketDashboard('appliances', res.appliances); }, error: onError },
\
\ -

' + tr("AppEnv - Image repository") + '

\ +

' + tr("AppMarket") + '

\
\ -\ -

appflow logoAppMarket builds a centralized catalog of cloud applications. With AppMarket you can build a private repository to share and distribute virtual appliances across OpenNebula instances.

\ -

 

\ -

 

\ -

 

\ -

 

\ +

\ + appmarket logo\ + AppMarket builds a centralized catalog of cloud applications. With AppMarket you can build a private repository to share and distribute virtual appliances across OpenNebula instances.\ +

\ +

'+tr("You can find further information on the following links:")+'

\ + \
\
\