summaryrefslogtreecommitdiffstats
path: root/modules-available/passthrough
diff options
context:
space:
mode:
authorSimon Rettberg2021-09-30 17:44:30 +0200
committerSimon Rettberg2022-03-09 15:06:54 +0100
commitd736e75ade7a4472aefb72af9036f86016adcb42 (patch)
tree39e38d5dd687bc6d25cb1de45ce4b78423aa7984 /modules-available/passthrough
parent[passthrough] New module for managing hardware passthrough for QEMU (diff)
downloadslx-admin-d736e75ade7a4472aefb72af9036f86016adcb42.tar.gz
slx-admin-d736e75ade7a4472aefb72af9036f86016adcb42.tar.xz
slx-admin-d736e75ade7a4472aefb72af9036f86016adcb42.zip
[statistics] Adapt hw-data parsing to new json format for display
Diffstat (limited to 'modules-available/passthrough')
-rw-r--r--modules-available/passthrough/page.inc.php10
-rw-r--r--modules-available/passthrough/templates/hardware-list.html22
2 files changed, 7 insertions, 25 deletions
diff --git a/modules-available/passthrough/page.inc.php b/modules-available/passthrough/page.inc.php
index 3ab0696e..7dcc8215 100644
--- a/modules-available/passthrough/page.inc.php
+++ b/modules-available/passthrough/page.inc.php
@@ -68,6 +68,7 @@ class Page_Passthrough extends Page
$q = new HardwareQuery(HardwareInfo::PCI_DEVICE, null, false);
$q->addGlobalColumn('vendor');
$q->addGlobalColumn('device');
+ $q->addGlobalColumn('rev');
$q->addGlobalColumn('class');
$q->addGlobalColumn('@PASSTHROUGH');
$rows = [];
@@ -110,10 +111,11 @@ class Page_Passthrough extends Page
$missing[$row['vendor'] . ':' . $row['device']] = true;
}
}
- Render::addTemplate('hardware-list', [
- 'list' => $finalRows,
- 'missing_ids' => json_encode(array_keys($missing)),
- ]);
+ Render::addTemplate('hardware-list', ['list' => $finalRows]);
+ if (!empty($missing)) {
+ Render::addTemplate('js-pciquery',
+ ['missing_ids' => json_encode(array_keys($missing))], 'statistics');
+ }
}
/*
diff --git a/modules-available/passthrough/templates/hardware-list.html b/modules-available/passthrough/templates/hardware-list.html
index d331acb5..4bff0a39 100644
--- a/modules-available/passthrough/templates/hardware-list.html
+++ b/modules-available/passthrough/templates/hardware-list.html
@@ -18,7 +18,7 @@
</td>
{{/class_name}}
{{^class_name}}
- <td>{{vendor}}:{{device}}</td>
+ <td>{{vendor}}:{{device}} [{{rev}}]</td>
<td>
<table class="slx-ellipsis">
<tr>
@@ -101,25 +101,5 @@
$(this).append($('<option>').attr('value', gid).text(gid + ' (' + title + ')'));
});
});
- var missing = {{{missing_ids}}};
- var doQuery = function() {
- if (missing && missing.length > 0) {
- $.ajax({
- url: '?do=statistics', dataType: "json", method: "POST", data: {
- token: TOKEN,
- action: 'json-lookup',
- list: missing.splice(0, 10) // Query 10 at a time max
- }
- }).done(function (data) {
- if (!data)
- return;
- for (var k in data) {
- $('.query-' + k.replace(':', '-')).text(data[k]);
- }
- doQuery();
- });
- }
- }
- doQuery();
});
</script> \ No newline at end of file