Fix issue #242.
If the storage pool of a template has been deleted, when editing
this template, the storage pool field will show blank.
Signed-off-by: Xin Ding <xinding(a)linux.vnet.ibm.com>
---
ui/css/theme-default/template-edit.css | 4 ++++
ui/js/src/kimchi.template_edit_main.js | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/ui/css/theme-default/template-edit.css
b/ui/css/theme-default/template-edit.css
index 1a049c0..2f8a61a 100644
--- a/ui/css/theme-default/template-edit.css
+++ b/ui/css/theme-default/template-edit.css
@@ -73,3 +73,7 @@
.hidden-area {
display: none;
}
+
+.template-edit-fieldset .error {
+ color: red;
+}
diff --git a/ui/js/src/kimchi.template_edit_main.js
b/ui/js/src/kimchi.template_edit_main.js
index efe4a6f..d48b6ba 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -31,6 +31,8 @@ kimchi.template_edit_main = function() {
$('input[name="disks"]').val(disks[0].size);
kimchi.listStoragePools(function(result) {
var options = [];
+ var storagepoolLabel = template.storagepool.replace(/^\/storagepools\//,
'');
+ var storagepoolValid = false;
if (result && result.length) {
$.each(result, function(index, storagePool) {
if(storagePool.type !== 'kimchi-iso') {
@@ -38,9 +40,15 @@ kimchi.template_edit_main = function() {
label: storagePool.name,
value: '/storagepools/' + storagePool.name
});
+ if(storagepoolLabel === storagePool.name) {
+ storagepoolValid = true;
+ }
}
});
}
+ if(!storagepoolValid) {
+ $('#template-edit-storage-label').html('<span
class="error">' + storagepoolLabel + '</span>');
+ }
kimchi.select('template-edit-storagePool-list', options);
});
});
--
1.8.3.2
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups
"project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.