[Kimchi-devel] [PATCH V3] Enhancement: PCI Device information enhancement

Aline Manera alinefm at linux.vnet.ibm.com
Thu Oct 30 13:37:54 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
Tested-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 10/28/2014 09:04 AM, Wen Wang wrote:
> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>
> V2 -> V3:
> 1) Deal with translations issues
> 2) Changed the tip display format
>
> V1 -> V2:
> 1) Changed the API name to "getPCIDeviceCompanion".
> 2) Changed for a more specific way of detecting the related devices.
> 3) Added the "Affected devices" to the tip with aligned format.
> 4) tip will when the pointer hang over any section of the affected line.
>
> This patch provide the way that shows more specific PCI device
> information by hanging the mouse on top of device name.
>
> Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.api.js             |   14 ++++++++++++++
>   ui/js/src/kimchi.guest_edit_main.js |   24 ++++++++++++++++++++++++
>   ui/pages/i18n.json.tmpl             |    7 +++++++
>   3 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
> index 8a6e416..ebf826b 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -1129,6 +1129,20 @@ var kimchi = {
>           });
>       },
>
> +    getPCIDeviceCompanions : function(pcidev, suc, err) {
> +        kimchi.requestJSON({
> +            url : kimchi.url + 'host/devices?_passthrough_affected_by=' + pcidev,
> +            type : 'GET',
> +            contentType : 'application/json',
> +            dataType : 'json',
> +            resend : true,
> +            success : suc,
> +            error : err ? err : function(data) {
> +                kimchi.message.error(data.responseJSON.reason);
> +            }
> +        });
> +    },
> +
>       getISCSITargets : function(server, port, suc, err) {
>           server = encodeURIComponent(server);
>           port = port ? '&_server_port='+encodeURIComponent(port) : '';
> diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
> index 030e112..ed8c689 100644
> --- a/ui/js/src/kimchi.guest_edit_main.js
> +++ b/ui/js/src/kimchi.guest_edit_main.js
> @@ -407,6 +407,30 @@ kimchi.guest_edit_main = function() {
>                                   });
>                               }
>                           });
> +                        kimchi.getPCIDeviceCompanions(hostPCIs[i].name, function(infoData) {
> +                            var pciTitle = i18n["KCHVMED6007M"] + "\n";
> +                            var haveCompanions = false;
> +                            for(var p=0; p<infoData.length; p++) {
> +                                if(infoData[p].device_type === "net") {
> +                                    haveCompanions = true;
> +                                    pciTitle += "   " + infoData[p].name + "\n";
> +                                    pciTitle += "      " + i18n["KCHVMED6001M"] + " " + infoData[p].interface;
> +                                    pciTitle += ", " + i18n["KCHVMED6002M"] + " " + infoData[p].address;
> +                                    pciTitle += ", " + i18n["KCHVMED6003M"] + " " + infoData[p].link_type + "\n";
> +                                } else if(infoData[p].device_type === "storage") {
> +                                    haveCompanions = true;
> +                                    pciTitle += "   " + infoData[p].name + "\n";
> +                                    pciTitle += "      " + i18n["KCHVMED6004M"] + " " + infoData[p].block;
> +                                    pciTitle += ", " + i18n["KCHVMED6005M"] + " " + infoData[p].drive_type;
> +                                    pciTitle += ", " + i18n["KCHVMED6006M"] + " " + infoData[p].model + "\n";
> +                                }
> +                            }
> +                            for(var q=0; q<infoData.length; q++) {
> +                                haveCompanions && $(".name", "#" + infoData[q].parent).attr("title", pciTitle);
> +                                haveCompanions && $(".product", "#" + infoData[q].parent).attr("title", pciTitle);
> +                                haveCompanions && $(".vendor", "#" + infoData[q].parent).attr("title", pciTitle);
> +                            }
> +                        });
>                       }
>                   });
>               });
> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
> index 75f1e43..ac2ca83 100644
> --- a/ui/pages/i18n.json.tmpl
> +++ b/ui/pages/i18n.json.tmpl
> @@ -139,6 +139,13 @@
>       "KCHVMCD6008M": "$_("Successfully detached!")",
>       "KCHVMCD6009M": "$_("This disk will be detached permanently and you can re-attach it. Continue to detach it?")",
>
> +    "KCHVMED6001M": "$_("interface:")",
> +    "KCHVMED6002M": "$_("address:")",
> +    "KCHVMED6003M": "$_("link_type:")",
> +    "KCHVMED6004M": "$_("block:")",
> +    "KCHVMED6005M": "$_("drive_type:")",
> +    "KCHVMED6006M": "$_("model:")",
> +    "KCHVMED6007M": "$_("Affected devices:")",
>
>       "KCHNET6001E": "$_("The VLAN id must be between 1 and 4094.")",
>




More information about the Kimchi-devel mailing list