diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index a9e0541373..a6e5aae4e9 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -1,4 +1,4 @@ -small_logo: images/opennebula-sunstone-v4.0-small.png +small_logo: images/opennebula-sunstone-v4.14-small.png provision_logo: images/one_small_logo.png enabled_tabs: dashboard-tab: true diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 3586c21e0e..eaa81d8979 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -1,4 +1,4 @@ -small_logo: images/opennebula-sunstone-v4.0-small.png +small_logo: images/opennebula-sunstone-v4.14-small.png provision_logo: images/one_small_logo.png enabled_tabs: dashboard-tab: true diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index af022fb4ce..6aa5a7cc6c 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -1,4 +1,4 @@ -small_logo: images/opennebula-sunstone-v4.0-small.png +small_logo: images/opennebula-sunstone-v4.14-small.png provision_logo: images/one_small_logo.png enabled_tabs: dashboard-tab: true diff --git a/src/sunstone/public/app/app.js b/src/sunstone/public/app/app.js index 52671d6ddb..ab3680d63b 100644 --- a/src/sunstone/public/app/app.js +++ b/src/sunstone/public/app/app.js @@ -9,6 +9,7 @@ define(function(require) { var Config = require('sunstone-config'); var OpenNebula = require('opennebula'); var Notifier = require('utils/notifier'); + var Menu = require('utils/menu'); var _tabs; if (Config.isTabEnabled(PROVISION_TAB_ID)) { @@ -65,6 +66,12 @@ define(function(require) { $(document).ready(function() { Sunstone.insertTabs(); + if (Config.isTabEnabled(PROVISION_TAB_ID)){ + Menu.insertProvision(); + }else{ + Menu.insert(); + } + _setupAccordion(); _setupCloseDropdownsOnClick(); _insertUserAndZoneSelector(); diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index 3105bd4076..c75c5d2384 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -109,7 +109,8 @@ define(function(require) { 'autoRefresh' : _config['view']['autorefresh'], 'tableOrder': _config['user_config']['table_order'], 'vncProxyPort': _config['system_config']['vnc_proxy_port'], - 'vncWSS': _config['user_config']['vnc_wss'] + 'vncWSS': _config['user_config']['vnc_wss'], + 'logo': (_config['view']["small_logo"] || "images/one_small_logo.png") } return Config; diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index e1422eafe5..a876b82de6 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -7,6 +7,7 @@ define(function(require) { var Config = require('sunstone-config'); var Locale = require('utils/locale'); var Notifier = require('utils/notifier'); + var Menu = require('utils/menu'); var TOP_INTERVAL = 10000; //ms var CONFIRM_DIALOG_ID = require('utils/dialogs/confirm/dialogId'); @@ -485,6 +486,9 @@ define(function(require) { return false; } + // Hide the menu in small windows + Menu.entryClick(); + // TODO check if necessary // last_selected_row = null; diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 2c91d3fd95..0d38985bcf 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -969,25 +969,12 @@ define(function(require) { var tab = $("#"+tab_name); if (Config.isTabEnabled(tab_name)) { - $('.right-header').prepend(TemplateHeader({'logo': Config.provision.logo})); + $('.right-header').prepend(TemplateHeader()); - $(".left-content").remove(); $(".right-content").addClass("large-centered small-centered"); $("#footer").removeClass("right"); $("#footer").addClass("large-centered small-centered"); - //$(".user-zone-info").remove(); - - $("#provision_logout").click(function(){ - OpenNebula.Auth.logout({ - success: function(){ - window.location.href = "login"; - } - }); - - return false; - }); - ProvisionVmsList.generate($(".provision_vms_list_section"), {active: true}); if (Config.isTabPanelEnabled("provision-tab", "templates")) { diff --git a/src/sunstone/public/app/tabs/provision-tab/header.hbs b/src/sunstone/public/app/tabs/provision-tab/header.hbs index bc08375551..d6f7c15b58 100644 --- a/src/sunstone/public/app/tabs/provision-tab/header.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/header.hbs @@ -1,10 +1,6 @@
- - -
-
    {{#isTabPanelEnabled "provision-tab" "users"}}
  • diff --git a/src/sunstone/public/app/utils/menu.js b/src/sunstone/public/app/utils/menu.js new file mode 100644 index 0000000000..ca1f716d57 --- /dev/null +++ b/src/sunstone/public/app/utils/menu.js @@ -0,0 +1,87 @@ +define(function(require) { + + var TopRowHTML = require('hbs!./menu/top-row'); + var ProvisionTopRowHTML = require('hbs!./menu/provision-top-row'); + var Config = require('sunstone-config'); + + return { + 'insert': _insert, + 'insertProvision': _insertProvision, + 'setup': _setup, + 'hide': _hide, + 'show': _show, + 'entryClick': _entryClick, + }; + + function _insert(){ + $('#top-row').html(TopRowHTML({logo: Config.logo})); + + _setup(); + } + + function _insertProvision(){ + $('#top-row').html(ProvisionTopRowHTML({logo: Config.provision.logo})); + + $("#menu-wrapper").remove(); + } + + function _setup(){ + $('#menu-toggle').on('click', function(){ + var hiding = $('.right-content').hasClass("large-10"); + + if(!hiding){ + $('.right-content').toggleClass('large-10'); + $('.right-content').toggleClass('large-12'); + } + + $('#menu-wrapper').toggle(200, function(){ + if(hiding){ + $('.right-content').toggleClass('large-10'); + $('.right-content').toggleClass('large-12'); + } + }); + }); + + var prevWindowLarge = Foundation.utils.is_large_up(); + + $(window).resize(function() { + if(Foundation.utils.is_large_up()){ + $('#menu-wrapper').removeClass("menu-small"); + + if(!prevWindowLarge){ // resizing from small to large, show menu + _show(); + } + + prevWindowLarge = true; + } else { + $('#menu-wrapper').addClass("menu-small"); + + if(prevWindowLarge){ // resizing from large to small, hide menu + _hide(); + } + + prevWindowLarge = false; + } + }); + + $(window).resize(); + } + + function _hide(){ + if($('#menu-wrapper').is(':visible')){ + $('#menu-toggle').click(); + } + } + + function _show(){ + if(!$('#menu-wrapper').is(':visible')){ + $('#menu-toggle').click(); + } + } + + function _entryClick(){ + if(!Foundation.utils.is_large_up()){ + _hide(); + } + } +}); diff --git a/src/sunstone/public/app/utils/menu/provision-top-row.hbs b/src/sunstone/public/app/utils/menu/provision-top-row.hbs new file mode 100644 index 0000000000..9991576ed9 --- /dev/null +++ b/src/sunstone/public/app/utils/menu/provision-top-row.hbs @@ -0,0 +1,13 @@ +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/sunstone/public/app/utils/menu/top-row.hbs b/src/sunstone/public/app/utils/menu/top-row.hbs new file mode 100644 index 0000000000..553005955c --- /dev/null +++ b/src/sunstone/public/app/utils/menu/top-row.hbs @@ -0,0 +1,14 @@ +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/sunstone/public/images/opennebula-sunstone-v4.14-small.png b/src/sunstone/public/images/opennebula-sunstone-v4.14-small.png new file mode 100644 index 0000000000..ca4f2355b7 Binary files /dev/null and b/src/sunstone/public/images/opennebula-sunstone-v4.14-small.png differ diff --git a/src/sunstone/public/scss/app.scss b/src/sunstone/public/scss/app.scss index b675608822..c2065b138f 100644 --- a/src/sunstone/public/scss/app.scss +++ b/src/sunstone/public/scss/app.scss @@ -171,27 +171,19 @@ input.search { // User settings and zone -.user-zone-container { - position: relative; - .user-zone-info { - position: absolute; - top: 0px; - right: 0px; - z-index: 1; +.user-zone-info { + .button { + background: #fff; + border: none; + margin-top: 8px; + } - .button { - background: #fff; - border: none; - } - - .button:hover { - background: #F5F5F5; - } + .button:hover { + background: #F5F5F5; } } - .white_button { background-color: #fff !important; border: none; @@ -263,7 +255,6 @@ input.search { .header-row { margin-bottom: 20px !important; - margin-top: 25px !important; .resource-id { color: #999; @@ -1312,3 +1303,14 @@ hr { padding: 0 0.5rem; } } + +.menu-small { + position: absolute; + z-index: 20; + box-shadow: 5px 10px 15px 5px rgba(0,0,0,.1); +} + +#menu-wrapper { + padding-top: 5px; + background-color: white +} \ No newline at end of file diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index cb1c9e11cd..8629036d07 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -60,13 +60,15 @@
+
+
+
-
+