[Kimchi-devel] [PATCHv4 3/3] Display all disk types in storage edit view

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Apr 29 10:11:35 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Instead of just displaying cdrom type in storage edit view,
Add disk type to storage display view to make sure
we get the right view after attach and detach new disk.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_edit_main.js |  5 ++---
 ui/pages/guest-edit.html.tmpl       | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 2ba6b79..0236e2d 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -34,15 +34,14 @@ kimchi.guest_edit_main = function() {
 
     var refreshCDROMs = function() {
         kimchi.listVMStorages({
-            vm: kimchi.selectedGuest,
-            storageType: 'cdrom'
+            vm: kimchi.selectedGuest
         }, function(storages) {
-            var rowHTML = $('#cdrom-row-tmpl').html();
             var container = $('#guest-edit-cdrom-row-container');
             $(container).empty();
 
             $.each(storages, function(index, storage) {
                 storage['vm'] = kimchi.selectedGuest;
+                rowHTML = $('#' + storage['type'] + '-row-tmpl').html();
                 var templated = kimchi.template(rowHTML, storage);
                 container.append(templated);
             });
diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
index 552b4c8..96d907e 100644
--- a/ui/pages/guest-edit.html.tmpl
+++ b/ui/pages/guest-edit.html.tmpl
@@ -159,7 +159,22 @@
         </span>
     <div>
 </script>
-
+<script id="disk-row-tmpl" type="text/html">
+    <div>
+        <div class="guest-edit-wrapper-label">
+            <label for="disk-{dev}">{dev}</label>
+        </div>
+        <div class="guest-edit-wrapper-controls">
+            <input id="disk-{dev}" name="disk" type="text"
+                data-vm="{vm}" data-dev="{dev}"
+                value="{path}" readonly="readonly" />
+            <button class="guest-edit-cdrom-button detach"
+                data-vm="{vm}" data-dev="{dev}"
+                title="$_("Detach")">
+            </button>
+        </div>
+    </div>
+</script>
 <script type="text/javascript">
     kimchi.guest_edit_main();
 </script>
-- 
1.8.3.2




More information about the Kimchi-devel mailing list