[Kimchi-devel] [PATCH] Bugfix Issue#398 UI: Add information when no cdrom exists

Aline Manera alinefm at linux.vnet.ibm.com
Wed Jul 30 20:24:02 UTC 2014


On 07/28/2014 04:21 AM, wenwang at linux.vnet.ibm.com wrote:
> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>
> Add one line "No CDROM found" under "Manage Media" diaguage when there
> is no CDROM found for an VM.

I have talked to Yu Xin to we display the same edit dialog when VM is 
running or not.
And enable/disable the fields accordingly.
That way the "Manage Media" will be replaced by "Edit" and its 
funtionality will be under "Storage" tab that already handle when no 
cdrom is available.


> Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.guest_media_main.js |   15 ++++++++++-----
>   ui/pages/guest-media.html.tmpl       |    5 +++++
>   2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/ui/js/src/kimchi.guest_media_main.js b/ui/js/src/kimchi.guest_media_main.js
> index d6dee2e..60d12ba 100644
> --- a/ui/js/src/kimchi.guest_media_main.js
> +++ b/ui/js/src/kimchi.guest_media_main.js
> @@ -23,14 +23,19 @@ kimchi.guest_media_main = function() {
>               storageType: 'cdrom'
>           }, function(storages) {
>               var rowHTML = $('#cdrom-row-tmpl').html();
> +            var noCDROMHTML = $('#empty-cdrom-tmpl').html();
>               var container = $('#guest-edit-cdrom-row-container');
>               $(container).empty();
>
> -            $.each(storages, function(index, storage) {
> -                storage['vm'] = kimchi.selectedGuest;
> -                var templated = kimchi.substitute(rowHTML, storage);
> -                container.append(templated);
> -            });
> +            if(storages.length > 0) {
> +                $.each(storages, function(index, storage) {
> +                    storage['vm'] = kimchi.selectedGuest;
> +                    var templated = kimchi.substitute(rowHTML, storage);
> +                    container.append(templated);
> +                });
> +            } else {
> +                container.append(noCDROMHTML);
> +            }
>
>               var replaceCDROM = function(event) {
>                   event.preventDefault();
> diff --git a/ui/pages/guest-media.html.tmpl b/ui/pages/guest-media.html.tmpl
> index 83ad6ab..fe2e8ef 100644
> --- a/ui/pages/guest-media.html.tmpl
> +++ b/ui/pages/guest-media.html.tmpl
> @@ -51,6 +51,11 @@
>           </div>
>       </div>
>   </script>
> +<script id="empty-cdrom-tmpl" type="text/html">
> +    <div>
> +        $_("No CDROM found.")
> +    </div>
> +</script>
>
>   <script type="text/javascript">
>       kimchi.guest_media_main();




More information about the Kimchi-devel mailing list