[Kimchi-devel] [PATCH V2] Enhancement: PCI Device information enhancement
Wen Wang
wenwang at linux.vnet.ibm.com
Tue Oct 28 10:17:33 UTC 2014
ACK
On 10/28/2014 05:47 PM, Yu Xin Huo wrote:
> On 10/27/2014 3:42 PM, Wen Wang wrote:
>> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>>
>> 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 | 25 +++++++++++++++++++++++++
>> 2 files changed, 39 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..2a9c1ab 100644
>> --- a/ui/js/src/kimchi.guest_edit_main.js
>> +++ b/ui/js/src/kimchi.guest_edit_main.js
>> @@ -407,6 +407,31 @@ kimchi.guest_edit_main = function() {
>> });
>> }
>> });
>> + kimchi.getPCIDeviceCompanions(hostPCIs[i].name, function(infoData) {
>> + var pciTitle = "";
>> + if(infoData.length>0) {
> The 'if' can be removed as 'for' circle already checked
> 'p<infoData.lengt' and 'q<infoData.length'.
>> + for(var p=0; p<infoData.length; p++) {
>> + if(infoData[p].device_type ===
>> "net") {
>> + pciTitle += "Affected
>> devices:\n";
> Translation?
>> + pciTitle += infoData[p].name + "\n";
>> + pciTitle += " " +
>> "interface: " + infoData[p].interface;
> Translation?
>> + pciTitle += ", address: " + infoData[p].address;
>> + pciTitle += ", link_type: "
>> + infoData[p].link_type + "\n";
>> + } else
>> if(infoData[p].device_type === "storage") {
>> + pciTitle += "Affected
>> devices:\n";
>> + pciTitle += infoData[p].name
>> + "\n";
>> + pciTitle += " " + "block:
>> " + infoData[p].block;
>> + pciTitle += ", drive_type: "
>> + infoData[p].drive_type;
>> + pciTitle += ", model: " +
>> infoData[p].model + "\n";
>> + }
>> + }
> All labels need to be translated, remove hardcoding in javascript.
>> + for(var q=0; q<infoData.length; q++) {
>> + pciTitle === "" || $(".name",
>> "#" + infoData[q].parent).attr("title", pciTitle);
>> + pciTitle === "" || $(".product",
>> "#" + infoData[q].parent).attr("title", pciTitle);
>> + pciTitle === "" || $(".vendor",
>> "#" + infoData[q].parent).attr("title", pciTitle);
>> + }
>> + }
>> + });
>> }
>> });
>> });
>
>
More information about the Kimchi-devel
mailing list