[Kimchi-devel] [PATCH] [Kimchi 1/2] Wok issue #174: Let Wok create the whole navigation bar

Aline Manera alinefm at linux.vnet.ibm.com
Wed Oct 26 14:34:37 UTC 2016


Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_main.js    |  6 +++++-
 ui/js/src/kimchi.network.js       |  6 +++++-
 ui/js/src/kimchi.storage_main.js  |  6 +++++-
 ui/js/src/kimchi.template_main.js |  6 +++++-
 ui/pages/i18n.json.tmpl           |  4 ++++
 ui/pages/tabs/guests.html.tmpl    | 19 -------------------
 ui/pages/tabs/network.html.tmpl   | 19 -------------------
 ui/pages/tabs/storage.html.tmpl   | 19 -------------------
 ui/pages/tabs/templates.html.tmpl | 19 -------------------
 9 files changed, 24 insertions(+), 80 deletions(-)

diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index 8bbeea8..21ab262 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -383,8 +383,12 @@ kimchi.guest_main = function() {
         // Default to showing list
         kimchi.showGuestList();
     }
+
+    var toolsHtml = '<li><a id="vm-add" class="btn-tool" href="javascript:void(0);">'
+    toolsHtml += '<i class="fa fa-plus-circle"></i><span>' + i18n['KCHVM6010M'] + '</span></a></li>'
+
     if (wok.tabMode['guests'] === 'admin') {
-        $('.tools').attr('style', 'display');
+        $('#toolbar ul.tools').html(toolsHtml);
         $("#vm-add").on("click", function(event) {
             wok.window.open('plugins/kimchi/guest-add.html');
         });
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 7ce5b28..ea15228 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -24,8 +24,12 @@ kimchi.NETWORK_TYPE_VEPA = "vepa";
 
 kimchi.initNetwork = function() {
     $('body').removeClass('wok-list wok-gallery');
+
+    var toolsHtml = '<li><a id="networkAdd" class="btn-tool" href="javascript:void(0);">'
+    toolsHtml += '<i class="fa fa-plus-circle"></i><span>' + i18n['KCHNET6003M'] + '</span></a></li>'
+
     if(wok.tabMode['network'] === 'admin') {
-        $('.tools').attr('style','display');
+        $('#toolbar ul.tools').html(toolsHtml);
         $('#networkGrid .wok-nw-grid-header span:last-child').attr('style','display');
         kimchi.initNetworkCreation();
     }
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 832d3fc..bfde50c 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -745,8 +745,12 @@ kimchi.initLogicalPoolExtend = function() {
 
 kimchi.storage_main = function() {
     $('body').removeClass('wok-list wok-gallery');
+
+    var toolsHtml = '<li><a id="storage-pool-add" class="btn-tool" href="javascript:void(0);">'
+    toolsHtml += '<i class="fa fa-plus-circle"></i><span>' + i18n['KCHPOOL6020M'] + '</span></a></li>'
+
     if(wok.tabMode['storage'] === 'admin') {
-        $('.tools').attr('style','display');
+        $('#toolbar ul.tools').html(toolsHtml);
         $('#storage-pool-add').on('click', function() {
             wok.window.open('plugins/kimchi/storagepool-add.html');
         });
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index cf98a7b..8755167 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -157,6 +157,10 @@ kimchi.hideTitle = function() {
 
 kimchi.template_main = function() {
     $('body').addClass('wok-list');
+
+    var toolsHtml = '<li><a id="template-add" class="btn-tool" href="javascript:void(0);">'
+    toolsHtml += '<i class="fa fa-plus-circle"></i><span>' + i18n['KCHTMPL6001M'] + '</span></a></li>'
+
     var viewFound = kimchi.readTemplateView("templateView");
     if (viewFound) {
         if(viewFound === "gallery") {
@@ -172,7 +176,7 @@ kimchi.template_main = function() {
     }
 
     if (wok.tabMode['templates'] === 'admin') {
-        $('.tools').attr('style', 'display');
+        $('#toolbar ul.tools').html(toolsHtml);
         $("#template-add").on("click", function(event) {
             wok.window.open({
                 url: 'plugins/kimchi/template-add.html',
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index ba5812f..f018e77 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -46,6 +46,7 @@
 
     "KCHTMPL6001W": "$_("No ISO found")",
 
+    "KCHTMPL6001M": "$_("Add Template")",
     "KCHTMPL6002M": "$_("This may take a long time. Do you want to continue?")",
     "KCHTMPL6003M": "$_("This will permanently delete the %1 template. Would you like to continue?")",
     "KCHTMPL6004M": "$_("View Table")",
@@ -66,6 +67,7 @@
     "KCHVM6007M": "$_("Note the %1 guest OS may ignore this request. Would you like to continue?")",
     "KCHVM6008M": "$_("Virtual Machine delete Confirmation")",
     "KCHVM6009M": "$_("The %1 virtual machine is not persistent. Power Off will delete it. Continue?")",
+    "KCHVM6010M": "$_("Add Guest")",
 
     "KCHVM0001E": "$_("Input is not a number")",
     "KCHVM0002E": "$_("Memory value cannot be higher than Max Memory value")",
@@ -91,6 +93,7 @@
 
     "KCHNET6001M": "$_("unavailable")",
     "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on the %1 network.")",
+    "KCHNET6003M": "$_("Add Network")",
     "KCHNET6004M": "$_("The %1 network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")",
     "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")",
 
@@ -113,6 +116,7 @@
     "KCHPOOL6017M": "$_("This will permanently wipe the following storage volumes: %1")",
     "KCHPOOL6018M": "$_("Wipe Confirmation")",
     "KCHPOOL6019M": "$_("Select one or more partitions to be added to the logical pool %1:")",
+    "KCHPOOL6020M": "$_("Add Storage")",
 
     "KCHPOOL6005E": "$_("Invalid NFS mount path.")",
     "KCHPOOL6006E": "$_("No logical device selected.")",
diff --git a/ui/pages/tabs/guests.html.tmpl b/ui/pages/tabs/guests.html.tmpl
index af68d66..37c9ce2 100644
--- a/ui/pages/tabs/guests.html.tmpl
+++ b/ui/pages/tabs/guests.html.tmpl
@@ -34,25 +34,6 @@
 </head>
 <body>
 <div id="guests-root-container">
-    <nav class="navbar navbar-default toolbar">
-        <div class="container">
-            <!-- Brand and toggle get grouped for better mobile display -->
-            <div class="navbar-header">
-              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#toolbar" aria-expanded="false">
-                <span class="sr-only">$_("Toggle navigation")</span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-              </button>
-            </div>
-            <!-- Collect the nav links, forms, and other content for toggling -->
-            <div class="collapse navbar-collapse" id="toolbar">
-                <ul class="nav navbar-nav navbar-right tools" display="none">
-                    <li><a id="vm-add" class="btn-tool" href="javascript:void(0);"><i class="fa fa-plus-circle"></i><span>$_("Add a Guest")</span></a></li>
-                </ul>
-            </div>
-        </div>
-    </nav>
     <div id="guest-content-container">
         <div class="container">
             <div class="row grid-control hidden">
diff --git a/ui/pages/tabs/network.html.tmpl b/ui/pages/tabs/network.html.tmpl
index 7e2825d..edffed0 100644
--- a/ui/pages/tabs/network.html.tmpl
+++ b/ui/pages/tabs/network.html.tmpl
@@ -30,25 +30,6 @@
 </head>
 <body>
 <div id="network-root-container">
-    <nav class="navbar navbar-default toolbar">
-        <div class="container">
-            <!-- Brand and toggle get grouped for better mobile display -->
-            <div class="navbar-header">
-              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#toolbar" aria-expanded="false">
-                <span class="sr-only">$_("Toggle navigation")</span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-              </button>
-            </div>
-            <!-- Collect the nav links, forms, and other content for toggling -->
-            <div class="collapse navbar-collapse" id="toolbar">
-                <ul class="nav navbar-nav navbar-right tools" display="none">
-                    <li><a id="networkAdd" class="btn-tool" href="javascript:void(0);"><i class="fa fa-plus-circle"></i><span>$_("Add a Network")</span></a></li>
-                </ul>
-            </div>
-        </div>
-    </nav>
     <div id="network-content-container">
         <div class="container">
             <div class="row grid-control">
diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl
index bcaff60..5468138 100644
--- a/ui/pages/tabs/storage.html.tmpl
+++ b/ui/pages/tabs/storage.html.tmpl
@@ -29,25 +29,6 @@
 </head>
 <body>
 <div id="storage-root-container">
-    <nav class="navbar navbar-default toolbar">
-        <div class="container">
-            <!-- Brand and toggle get grouped for better mobile display -->
-            <div class="navbar-header">
-              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#toolbar" aria-expanded="false">
-                <span class="sr-only">$_("Toggle navigation")</span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-              </button>
-            </div>
-            <!-- Collect the nav links, forms, and other content for toggling -->
-            <div class="collapse navbar-collapse" id="toolbar">
-                <ul class="nav navbar-nav navbar-right tools" display="none">
-                    <li><a id="storage-pool-add" class="btn-tool" href="javascript:void(0);"><i class="fa fa-plus-circle"></i><span>$_("Add a Storage")</span></a></li>
-                </ul>
-            </div>
-        </div>
-    </nav>
     <div class='storage'>
         <div class="container">
             <div class="row grid-control">
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index 1d3bdf3..2207292 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -29,25 +29,6 @@
 </head>
 <body>
     <div id="templates-root-container">
-        <nav class="navbar navbar-default toolbar">
-            <div class="container">
-                <!-- Brand and toggle get grouped for better mobile display -->
-                <div class="navbar-header">
-                  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#toolbar" aria-expanded="false">
-                    <span class="sr-only">$_("Toggle navigation")</span>
-                    <span class="icon-bar"></span>
-                    <span class="icon-bar"></span>
-                    <span class="icon-bar"></span>
-                </button>
-            </div>
-            <!-- Collect the nav links, forms, and other content for toggling -->
-            <div class="collapse navbar-collapse" id="toolbar">
-                <ul class="nav navbar-nav navbar-right tools" display="none">
-                    <li><a id="template-add" class="btn-tool" href="javascript:void(0);"><i class="fa fa-plus-circle"></i><span>$_("Add Template")</span></a></li>
-                </ul>
-            </div>
-        </div>
-    </nav>
     <div class="templates">
         <div id="templates-container" class="container hidden">
             <div class="row grid-control empty-when-logged-off">
-- 
2.7.4




More information about the Kimchi-devel mailing list