Reviewed by: Archana Singh <archus@linux.vnet.ibm.com>


On 09/13/2016 10:48 AM, rajgupta@linux.vnet.ibm.com wrote:
From: Rajat Gupta <rajgupta@linux.vnet.ibm.com>

Introducing Console for edit template module under virtualization

Signed-off-by: Rajat Gupta <rajgupta@linux.vnet.ibm.com>
---
 ui/js/src/kimchi.template_edit_main.js | 13 ++++++++++++-
 ui/pages/template-edit.html.tmpl       | 10 ++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index a2032cc..ad6857f 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -62,6 +62,12 @@ kimchi.template_edit_main = function() {
             }
             $('input[name="' + prop + '"]', templateEditMain).val(value);
         }
+        if(kimchi.hostarch == s390xArch){
+          $('.console', templateEditMain).show();
+          var consoleData = template.console ? template.console : '';
+          $('#template-edit-console', templateEditMain).val(consoleData);
+          $('#template-edit-console').selectpicker();
+        }

         $('#template-edit-memory-textbox').val(template.memory.current);
         $('#template-edit-max-memory-textbox').val(template.memory.maxmemory);
@@ -356,7 +362,12 @@ kimchi.template_edit_main = function() {
         $('.modal input[type="checkbox"]').prop('disabled', true);
         $('.modal select').prop('disabled', true);
         $('.modal .selectpicker').addClass('disabled');
-        var editableFields = ['name', 'memory', 'graphics', 'max-memory'];
+        if(kimchi.hostarch === s390xArch){
+          var editableFields = ['name', 'memory', 'graphics', 'max-memory', 'console'];
+        }else {
+          var editableFields = ['name', 'memory', 'graphics', 'max-memory'];
+        }
+
         var data = {};
         var disks = $('.template-tab-body .item', '#form-template-storage');
         var disksForUpdate = new Array();
diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
index 6cac885..d37df8d 100644
--- a/ui/pages/template-edit.html.tmpl
+++ b/ui/pages/template-edit.html.tmpl
@@ -73,6 +73,9 @@
                             <div class="template-edit-wrapper-label">
                                 <label>$_("Graphics")</label>
                             </div>
+                            <div class="template-edit-wrapper-label console" style="display:none">
+                                        <label>$_("Console")</label>
+                                    </div>
                         </div>
                         <div class="form-template-inline-wrapper">
                             <div class="template-edit-wrapper-controls">
@@ -104,6 +107,13 @@
                             <div class="template-edit-wrapper-controls">
                                     <select id="template-edit-graphics" name="graphics" class="form-control"  />
                             </div>
+                            <div class="template-edit-wrapper-controls console" style="display:none">
+                                            <select id="template-edit-console" name="console" class="form-control">
+                                              <option value=""></option>
+                                              <option value="sclp">$_("sclp")</option>
+                                              <option value="virtio">$_("virtio")</option>
+                                           </select>
+                                    </div>
                         </div>
                     </form>
                 </div>