[Kimchi-devel] [PATCH] show template is local or remote

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Thu Jun 5 10:06:23 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

We do not need a backed to support a field to indicate the template
type.

We just ckeck it by the prefix of iso name.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
---
 ui/css/theme-default/template_list.css | 8 ++++++++
 ui/js/src/kimchi.template_main.js      | 6 ++++++
 ui/pages/tabs/templates.html.tmpl      | 1 +
 3 files changed, 15 insertions(+)

diff --git a/ui/css/theme-default/template_list.css b/ui/css/theme-default/template_list.css
index df84a8f..41a5258 100644
--- a/ui/css/theme-default/template_list.css
+++ b/ui/css/theme-default/template_list.css
@@ -194,6 +194,14 @@ template-hidden {
     width: 58px;
 }
 
+.template-icon img.template-type-icon-position {
+    width: 20px;
+    height: 20px;
+    position: relative;
+    top: -15px;
+    left: 49px;
+}
+
 .template-title-position {
     float: left;
     width: 120px;
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index b90e3f3..eaa5247 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -22,6 +22,12 @@ kimchi.doListTemplates = function() {
             var listHtml = '';
             var templateHtml = $('#templateTmpl').html();
             $.each(result, function(index, value) {
+                var isLocal = value.cdrom.startsWith("/");
+                if(isLocal){
+                    value.location = "images/theme-default/icon-local.png";
+                }else{
+                    value.location = "images/theme-default/icon-remote.png";
+                }
                 listHtml += kimchi.substitute(templateHtml, value);
             });
             $('#templateList').html(listHtml);
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index 6ae6640..5e6b5aa 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -50,6 +50,7 @@
 
             <div class="template-icon template-icon-position">
                 <img alt="" src="{icon}">
+                <img alt="" src="{location}" class="template-type-icon-position">
             </div>
             <div class="template-general template-title template-title-position">
                 <h2 class="title" title="{name}">{name}</h2>
-- 
1.9.3




More information about the Kimchi-devel mailing list