[PATCH V2] UI: template support spice

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> V1 -> V2 Declare local variable to avoid overwriting the value outer scope unintentionally. ShaoHe Feng (1): UI: template support spice ui/js/src/kimchi.template_edit_main.js | 14 ++++++++++++-- ui/pages/template-edit.html.tmpl | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) -- 1.8.4.2

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> The backend already support spice. Just need to add a graphics selection in template edit page. Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_edit_main.js | 14 ++++++++++++-- ui/pages/template-edit.html.tmpl | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js index 17e9a41..79c6427 100644 --- a/ui/js/src/kimchi.template_edit_main.js +++ b/ui/js/src/kimchi.template_edit_main.js @@ -22,10 +22,16 @@ kimchi.template_edit_main = function() { kimchi.retrieveTemplate(kimchi.selectedTemplate, function(template) { origDisks = template.disks; for ( var prop in template) { - $('input[name="' + prop + '"]', templateEditForm).val(template[prop]); + var value = template[prop]; + if (prop == 'graphics') { + value = value["type"]; + } + $('input[name="' + prop + '"]', templateEditForm).val(value); } var disks = template.disks; $('input[name="disks"]').val(disks[0].size); + var options = [{label: 'vnc', value: 'vnc'}, {label: 'spice', value: 'spice'}]; + kimchi.select('template-edit-graphics-list', options); kimchi.listStoragePools(function(result) { var options = []; if (result && result.length) { @@ -67,7 +73,7 @@ kimchi.template_edit_main = function() { }); $('#tmpl-edit-button-save').on('click', function() { - var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks']; + var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics']; var data = {}; $.each(editableFields, function(i, field) { /* Support only 1 disk at this moment */ @@ -75,6 +81,10 @@ kimchi.template_edit_main = function() { origDisks[0].size = Number($('#form-template-edit [name="' + field + '"]').val()); data[field] = origDisks; } + else if (field == 'graphics') { + var type = $('#form-template-edit [name="' + field + '"]').val(); + data[field] = {'type': type}; + } else { data[field] = $('#form-template-edit [name="' + field + '"]').val(); } diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl index 6056997..0f663d4 100644 --- a/ui/pages/template-edit.html.tmpl +++ b/ui/pages/template-edit.html.tmpl @@ -91,6 +91,21 @@ </div> <div> <div class="template-edit-wrapper-label"> + <label>$_("graphics")</label> + </div> + <div class="template-edit-wrapper-controls"> + <div class="btn dropdown popable"> + <input id="template-edit-graphics" name="graphics" type="hidden" /> + <span class="text" id="template-edit-graphics-label"></span><span class="arrow"></span> + <div class="popover" style="width: 100%"> + <ul class="select-list" id="template-edit-graphics-list" data-target="template-edit-graphics" data-label="template-edit-graphics-label"> + </ul> + </div> + </div> + </div> + </div> + <div> + <div class="template-edit-wrapper-label"> <label>$_("Storage Pool")</label> </div> <div class="template-edit-wrapper-controls"> -- 1.8.4.2

On 03/03/2014 03:56 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
The backend already support spice. Just need to add a graphics selection in template edit page.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> Reviewed-by: Hongliang Wang <hlwang@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_edit_main.js | 14 ++++++++++++-- ui/pages/template-edit.html.tmpl | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js index 17e9a41..79c6427 100644 --- a/ui/js/src/kimchi.template_edit_main.js +++ b/ui/js/src/kimchi.template_edit_main.js @@ -22,10 +22,16 @@ kimchi.template_edit_main = function() { kimchi.retrieveTemplate(kimchi.selectedTemplate, function(template) { origDisks = template.disks; for ( var prop in template) { - $('input[name="' + prop + '"]', templateEditForm).val(template[prop]); + var value = template[prop]; + if (prop == 'graphics') { + value = value["type"]; + } + $('input[name="' + prop + '"]', templateEditForm).val(value); } var disks = template.disks; $('input[name="disks"]').val(disks[0].size); + var options = [{label: 'vnc', value: 'vnc'}, {label: 'spice', value: 'spice'}]; + kimchi.select('template-edit-graphics-list', options); kimchi.listStoragePools(function(result) { var options = []; if (result && result.length) { @@ -67,7 +73,7 @@ kimchi.template_edit_main = function() { });
$('#tmpl-edit-button-save').on('click', function() { - var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks']; + var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics']; var data = {}; $.each(editableFields, function(i, field) { /* Support only 1 disk at this moment */ @@ -75,6 +81,10 @@ kimchi.template_edit_main = function() { origDisks[0].size = Number($('#form-template-edit [name="' + field + '"]').val()); data[field] = origDisks; } + else if (field == 'graphics') { + var type = $('#form-template-edit [name="' + field + '"]').val(); + data[field] = {'type': type}; + } else { data[field] = $('#form-template-edit [name="' + field + '"]').val(); } diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl index 6056997..0f663d4 100644 --- a/ui/pages/template-edit.html.tmpl +++ b/ui/pages/template-edit.html.tmpl @@ -91,6 +91,21 @@ </div> <div> <div class="template-edit-wrapper-label"> + <label>$_("graphics")</label> + </div> + <div class="template-edit-wrapper-controls"> + <div class="btn dropdown popable"> + <input id="template-edit-graphics" name="graphics" type="hidden" /> + <span class="text" id="template-edit-graphics-label"></span><span class="arrow"></span> + <div class="popover" style="width: 100%"> + <ul class="select-list" id="template-edit-graphics-list" data-target="template-edit-graphics" data-label="template-edit-graphics-label"> + </ul> + </div> + </div> + </div> + </div> + <div> + <div class="template-edit-wrapper-label"> <label>$_("Storage Pool")</label> </div> <div class="template-edit-wrapper-controls">

Reviewed-by: Shu Ming <shuming@linux.vnet.ibm.com> Tested-by: Shu Ming <shuming@linux.vnet.ibm.com> 2014/3/3 15:56, shaohef@linux.vnet.ibm.com:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
The backend already support spice. Just need to add a graphics selection in template edit page.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_edit_main.js | 14 ++++++++++++-- ui/pages/template-edit.html.tmpl | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js index 17e9a41..79c6427 100644 --- a/ui/js/src/kimchi.template_edit_main.js +++ b/ui/js/src/kimchi.template_edit_main.js @@ -22,10 +22,16 @@ kimchi.template_edit_main = function() { kimchi.retrieveTemplate(kimchi.selectedTemplate, function(template) { origDisks = template.disks; for ( var prop in template) { - $('input[name="' + prop + '"]', templateEditForm).val(template[prop]); + var value = template[prop]; + if (prop == 'graphics') { + value = value["type"]; + } + $('input[name="' + prop + '"]', templateEditForm).val(value); } var disks = template.disks; $('input[name="disks"]').val(disks[0].size); + var options = [{label: 'vnc', value: 'vnc'}, {label: 'spice', value: 'spice'}]; + kimchi.select('template-edit-graphics-list', options); kimchi.listStoragePools(function(result) { var options = []; if (result && result.length) { @@ -67,7 +73,7 @@ kimchi.template_edit_main = function() { });
$('#tmpl-edit-button-save').on('click', function() { - var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks']; + var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics']; var data = {}; $.each(editableFields, function(i, field) { /* Support only 1 disk at this moment */ @@ -75,6 +81,10 @@ kimchi.template_edit_main = function() { origDisks[0].size = Number($('#form-template-edit [name="' + field + '"]').val()); data[field] = origDisks; } + else if (field == 'graphics') { + var type = $('#form-template-edit [name="' + field + '"]').val(); + data[field] = {'type': type}; + } else { data[field] = $('#form-template-edit [name="' + field + '"]').val(); } diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl index 6056997..0f663d4 100644 --- a/ui/pages/template-edit.html.tmpl +++ b/ui/pages/template-edit.html.tmpl @@ -91,6 +91,21 @@ </div> <div> <div class="template-edit-wrapper-label"> + <label>$_("graphics")</label> + </div> + <div class="template-edit-wrapper-controls"> + <div class="btn dropdown popable"> + <input id="template-edit-graphics" name="graphics" type="hidden" /> + <span class="text" id="template-edit-graphics-label"></span><span class="arrow"></span> + <div class="popover" style="width: 100%"> + <ul class="select-list" id="template-edit-graphics-list" data-target="template-edit-graphics" data-label="template-edit-graphics-label"> + </ul> + </div> + </div> + </div> + </div> + <div> + <div class="template-edit-wrapper-label"> <label>$_("Storage Pool")</label> </div> <div class="template-edit-wrapper-controls">

Reviewed-by: Adam King <rak@linux.vnet.ibm.com> Tested-by: Adam King <rak@linux.vnet.ibm.com> One suggestion... We should provide a kimchi wide configuration to specify whether the default should be vnc as it is hardcoded now, or spice. If this is too much effort to add to this series, open an enhancement issue so we come back to it. On 03/03/2014 02:56 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
The backend already support spice. Just need to add a graphics selection in template edit page.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_edit_main.js | 14 ++++++++++++-- ui/pages/template-edit.html.tmpl | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js index 17e9a41..79c6427 100644 --- a/ui/js/src/kimchi.template_edit_main.js +++ b/ui/js/src/kimchi.template_edit_main.js @@ -22,10 +22,16 @@ kimchi.template_edit_main = function() { kimchi.retrieveTemplate(kimchi.selectedTemplate, function(template) { origDisks = template.disks; for ( var prop in template) { - $('input[name="' + prop + '"]', templateEditForm).val(template[prop]); + var value = template[prop]; + if (prop == 'graphics') { + value = value["type"]; + } + $('input[name="' + prop + '"]', templateEditForm).val(value); } var disks = template.disks; $('input[name="disks"]').val(disks[0].size); + var options = [{label: 'vnc', value: 'vnc'}, {label: 'spice', value: 'spice'}]; + kimchi.select('template-edit-graphics-list', options); kimchi.listStoragePools(function(result) { var options = []; if (result && result.length) { @@ -67,7 +73,7 @@ kimchi.template_edit_main = function() { });
$('#tmpl-edit-button-save').on('click', function() { - var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks']; + var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics']; var data = {}; $.each(editableFields, function(i, field) { /* Support only 1 disk at this moment */ @@ -75,6 +81,10 @@ kimchi.template_edit_main = function() { origDisks[0].size = Number($('#form-template-edit [name="' + field + '"]').val()); data[field] = origDisks; } + else if (field == 'graphics') { + var type = $('#form-template-edit [name="' + field + '"]').val(); + data[field] = {'type': type}; + } else { data[field] = $('#form-template-edit [name="' + field + '"]').val(); } diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl index 6056997..0f663d4 100644 --- a/ui/pages/template-edit.html.tmpl +++ b/ui/pages/template-edit.html.tmpl @@ -91,6 +91,21 @@ </div> <div> <div class="template-edit-wrapper-label"> + <label>$_("graphics")</label> + </div> + <div class="template-edit-wrapper-controls"> + <div class="btn dropdown popable"> + <input id="template-edit-graphics" name="graphics" type="hidden" /> + <span class="text" id="template-edit-graphics-label"></span><span class="arrow"></span> + <div class="popover" style="width: 100%"> + <ul class="select-list" id="template-edit-graphics-list" data-target="template-edit-graphics" data-label="template-edit-graphics-label"> + </ul> + </div> + </div> + </div> + </div> + <div> + <div class="template-edit-wrapper-label"> <label>$_("Storage Pool")</label> </div> <div class="template-edit-wrapper-controls">
-- Adam King <rak@linux.vnet.ibm.com> IBM CSI

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> update po Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- po/en_US.po | 25 ++++++++++++++++++++++++- po/kimchi.pot | 25 ++++++++++++++++++++++++- po/pt_BR.po | 25 ++++++++++++++++++++++++- po/zh_CN.po | 25 ++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 4 deletions(-) diff --git a/po/en_US.po b/po/en_US.po index aeff16e..c8aa3a9 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: kimchi 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-25 15:23-0300\n" +"POT-Creation-Date: 2014-03-03 20:24+0800\n" "PO-Revision-Date: 2013-07-11 17:32-0400\n" "Last-Translator: Crístian Viana <vianac@linux.vnet.ibm.com>\n" "Language-Team: English\n" @@ -576,6 +576,9 @@ msgstr "Disk (GB)" msgid "CDROM" msgstr "CDROM" +msgid "graphics" +msgstr "" + msgid "Storage Pool" msgstr "Storage Pool" @@ -747,6 +750,14 @@ msgid "Unable to start virtual machine %(name)s. Details: %(err)s" msgstr "" #, python-format +msgid "Unable to stop virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format +msgid "Unable to delete virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format msgid "Interface %(iface)s does not exist in virtual machine %(name)s" msgstr "" @@ -947,6 +958,18 @@ msgstr "" #, python-format msgid "" +"Unable to activate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" +"Unable to deactivate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" "Unable to deactivate pool %(name)s as it is associated with some templates" msgstr "" diff --git a/po/kimchi.pot b/po/kimchi.pot index abb7219..2976818 100755 --- a/po/kimchi.pot +++ b/po/kimchi.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-25 15:23-0300\n" +"POT-Creation-Date: 2014-03-03 20:24+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -564,6 +564,9 @@ msgstr "" msgid "CDROM" msgstr "" +msgid "graphics" +msgstr "" + msgid "Storage Pool" msgstr "" @@ -735,6 +738,14 @@ msgid "Unable to start virtual machine %(name)s. Details: %(err)s" msgstr "" #, python-format +msgid "Unable to stop virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format +msgid "Unable to delete virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format msgid "Interface %(iface)s does not exist in virtual machine %(name)s" msgstr "" @@ -935,6 +946,18 @@ msgstr "" #, python-format msgid "" +"Unable to activate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" +"Unable to deactivate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" "Unable to deactivate pool %(name)s as it is associated with some templates" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index db7c579..ff33304 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: kimchi 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-25 15:23-0300\n" +"POT-Creation-Date: 2014-03-03 20:24+0800\n" "PO-Revision-Date: 2013-06-27 10:48+0000\n" "Last-Translator: Crístian Viana <vianac@linux.vnet.ibm.com>\n" "Language-Team: Aline Manera <alinefm@br.ibm.com>\n" @@ -591,6 +591,9 @@ msgstr "Disco (GB)" msgid "CDROM" msgstr "CD-ROM" +msgid "graphics" +msgstr "" + msgid "Storage Pool" msgstr "Nome do Storage Pool" @@ -762,6 +765,14 @@ msgid "Unable to start virtual machine %(name)s. Details: %(err)s" msgstr "" #, python-format +msgid "Unable to stop virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format +msgid "Unable to delete virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format msgid "Interface %(iface)s does not exist in virtual machine %(name)s" msgstr "" @@ -962,6 +973,18 @@ msgstr "" #, python-format msgid "" +"Unable to activate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" +"Unable to deactivate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" "Unable to deactivate pool %(name)s as it is associated with some templates" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 0439b04..d2573d2 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: kimchi 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-25 15:23-0300\n" +"POT-Creation-Date: 2014-03-03 20:24+0800\n" "PO-Revision-Date: 2013-06-27 10:48+0000\n" "Last-Translator: ShaoHe Feng <shaohef@linux.vnet.ibm.com>\n" "Language-Team: ShaoHe Feng <shaohef@linux.vnet.ibm.com>\n" @@ -580,6 +580,9 @@ msgstr "磁盘(GB)" msgid "CDROM" msgstr "光驱" +msgid "graphics" +msgstr "显示" + msgid "Storage Pool" msgstr "存储池" @@ -751,6 +754,14 @@ msgid "Unable to start virtual machine %(name)s. Details: %(err)s" msgstr "" #, python-format +msgid "Unable to stop virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format +msgid "Unable to delete virtual machine %(name)s. Details: %(err)s" +msgstr "" + +#, python-format msgid "Interface %(iface)s does not exist in virtual machine %(name)s" msgstr "" @@ -951,6 +962,18 @@ msgstr "" #, python-format msgid "" +"Unable to activate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" +"Unable to deactivate NFS storage pool %(name)s. NFS server %(server)s is " +"unreachable." +msgstr "" + +#, python-format +msgid "" "Unable to deactivate pool %(name)s as it is associated with some templates" msgstr "" -- 1.8.4.2

On 03/03/2014 07:34 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
update po
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- po/en_US.po | 25 ++++++++++++++++++++++++- po/kimchi.pot | 25 ++++++++++++++++++++++++- po/pt_BR.po | 25 ++++++++++++++++++++++++- po/zh_CN.po | 25 ++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 4 deletions(-)
This would not apply for me Applying: UI: template support spice, update po error: patch failed: po/en_US.po:6 error: po/en_US.po: patch does not apply error: patch failed: po/kimchi.pot:8 error: po/kimchi.pot: patch does not apply error: patch failed: po/pt_BR.po:20 error: po/pt_BR.po: patch does not apply error: patch failed: po/zh_CN.po:20 error: po/zh_CN.po: patch does not apply -- Adam King <rak@linux.vnet.ibm.com> IBM CSI
participants (5)
-
Adam King
-
Aline Manera
-
Hongliang Wang
-
shaohef@linux.vnet.ibm.com
-
Shu Ming