[Kimchi-devel] [PATCH 2/3] UI: Template with VM Image - Edit

huoyuxin at linux.vnet.ibm.com huoyuxin at linux.vnet.ibm.com
Fri Sep 5 07:27:28 UTC 2014


From: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>

Signed-off-by: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.template_edit_main.js |    8 ++++++++
 ui/pages/template-edit.html.tmpl       |    6 +++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index 97d6b6c..cb43091 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -23,6 +23,14 @@ kimchi.template_edit_main = function() {
     kimchi.retrieveTemplate(kimchi.selectedTemplate, function(template) {
         origDisks =  template.disks;
         origPool = template.storagepool;
+        for(var i=0;i<template.disks.length;i++){
+            if(template.disks[i].base){
+                template["vm-image"] = template.disks[i].base;
+                $('#templ-edit-cdrom').addClass('hide-content');
+                $('#templ-edit-vm-image').removeClass('hide-content');
+                break;
+            }
+        }
         for ( var prop in template) {
             var value = template[prop];
             if (prop == 'graphics') {
diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
index 15d3a97..5a71d91 100644
--- a/ui/pages/template-edit.html.tmpl
+++ b/ui/pages/template-edit.html.tmpl
@@ -81,7 +81,7 @@
                 </div>
             </fieldset>
             <fieldset class="template-edit-fieldset">
-                <div>
+                <div id="templ-edit-cdrom">
                     <div class="template-edit-wrapper-label">
                         <label for="template-edit-cdrom-textbox">$_("CDROM")</label>
                     </div>
@@ -89,6 +89,10 @@
                         <input id="template-edit-cdrom-textbox" name="cdrom" type="text" disabled="disabled"/>
                     </div>
                 </div>
+                <div id="templ-edit-vm-image" class="hide-content">
+                    <div class="template-edit-wrapper-label">$_("Image File")</div>
+                    <div class="template-edit-wrapper-controls"><input name="vm-image" type="text" disabled/></div>
+                </div>
                 <div>
                     <div class="template-edit-wrapper-label">
                         <label>$_("Graphics")</label>
-- 
1.7.1




More information about the Kimchi-devel mailing list