[Kimchi-devel] [PATCH] [Kimchi 2/3] Added UI validation for s390x Virtualization Template Edit Add Storage module
rajgupta at linux.vnet.ibm.com
rajgupta at linux.vnet.ibm.com
Thu Oct 13 08:22:25 UTC 2016
From: Rajat Gupta <rajggupta at linux.vnet.ibm.com>
Added UI validation for s390x Virtualization Template Edit Add Storage module
Signed-off-by: Rajat Gupta <rajggupta at linux.vnet.ibm.com>
---
ui/js/src/kimchi.template_edit_main.js | 57 ++++++++++++++++++++++++----------
ui/pages/i18n.json.tmpl | 1 +
2 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index b1f5123..3e4ae29 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -317,9 +317,30 @@ kimchi.template_edit_main = function() {
if (source == 'path') {
$(storageRow + ' span.storage-pool').hide();
$(storageRow + ' span.storage-path').show();
+ $(storageRow + ' span.storage-pool').removeClass('has-error');
+
+ if($(storageRow + ' input.storage-path').val()){
+ $(storageRow + ' span.storage-path').removeClass('has-error');
+ }else{
+ $(storageRow + ' span.storage-path').addClass('has-error');
+ }
} else {
+ if($(storageRow + ' select.selectStorageName').val()){
+ $(storageRow + ' span.storage-pool').removeClass('has-error');
+ }else{
+ $(storageRow + ' span.storage-pool').addClass('has-error');
+ }
$(storageRow + ' span.storage-pool').show();
$(storageRow + ' span.storage-path').hide();
+ $(storageRow + ' span.storage-path').removeClass('has-error');
+ }
+ });
+
+ $(storageRow + ' input.storage-path').on('change',function(){
+ if($(storageRow + ' input.storage-path').val()){
+ $(storageRow + ' span.storage-path').removeClass('has-error');
+ }else{
+ $(storageRow + ' span.storage-path').addClass('has-error');
}
});
@@ -835,23 +856,23 @@ kimchi.template_edit_main = function() {
interfacceForUpdate.push(thisdata);
break;
}
+ });
- if (networkForUpdate instanceof Array) {
- data.networks = networkForUpdate;
- } else if (networkForUpdate != null) {
- data.networks = [networkForUpdate];
- } else {
- data.networks = [];
- }
+ if (networkForUpdate instanceof Array) {
+ data.networks = networkForUpdate;
+ } else if (networkForUpdate != null) {
+ data.networks = [networkForUpdate];
+ } else {
+ data.networks = [];
+ }
- if (networkForUpdate instanceof Array) {
- data.interfaces = interfacceForUpdate;
- } else if (interfacceForUpdate != null) {
- data.interfaces = [interfacceForUpdate];
- } else {
- data.interfaces = [];
- }
- });
+ if (interfacceForUpdate instanceof Array) {
+ data.interfaces = interfacceForUpdate;
+ } else if (interfacceForUpdate != null) {
+ data.interfaces = [interfacceForUpdate];
+ } else {
+ data.interfaces = [];
+ }
}else {
var networks = $('.template-tab-body .item', '#form-template-interface');
var networkForUpdate = new Array();
@@ -879,7 +900,11 @@ kimchi.template_edit_main = function() {
$('.modal input[type="checkbox"]').prop('disabled', false);
$('.modal select').prop('disabled', false);
$('.modal .selectpicker').removeClass('disabled');
- wok.message.error(i18n['KCHTMPL6007M'], '#alert-modal-container');
+ if(kimchi.hostarch === s390xArch){
+ wok.message.error(i18n['KCHTMPL6008M'], '#alert-modal-container');
+ }else{
+ wok.message.error(i18n['KCHTMPL6007M'], '#alert-modal-container');
+ }
} else {
kimchi.updateTemplate($('#template-name').val(), data, function() {
kimchi.doListTemplates();
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index 399c58f..ba5812f 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -52,6 +52,7 @@
"KCHTMPL6005M": "$_("View Gallery")",
"KCHTMPL6006M": "$_("Not Available")",
"KCHTMPL6007M": "$_("Please check the invalid Storage Pools")",
+ "KCHTMPL6008M": "$_("Please check the invalid Storage Pools or Paths")",
"KCHVM6001M": "$_("This will delete the %1 virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
"KCHVM6002M": "$_("Power off Confirmation")",
--
2.1.0
More information about the Kimchi-devel
mailing list