From: Ondrej Lichtner <olichtne(a)redhat.com>
A command result is identified byt task_id, host_id and bg_id
(optional). host_id wasn't used until now which resulted in multiple
background command results being highlighted when they had the same
bg_id but different host_id. This fixes the issue.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
result_xslt/xml_to_html.js | 16 ++++++++++------
result_xslt/xml_to_html.xsl | 8 ++++----
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/result_xslt/xml_to_html.js b/result_xslt/xml_to_html.js
index 12176e4..97cfdc8 100644
--- a/result_xslt/xml_to_html.js
+++ b/result_xslt/xml_to_html.js
@@ -1,4 +1,4 @@
-window.toggleResultData = function (event, task_id, bg_id) {
+window.toggleResultData = function (event, task_id, host_id, bg_id) {
switch_display = function(elem){
if (elem.style.display == 'none'){
elem.style.display = '';
@@ -13,17 +13,19 @@ window.toggleResultData = function (event, task_id, bg_id) {
result_cell = row.cells[result_cell_i];
switch_display(result_cell);
- if (task_id !== undefined && bg_id !== undefined){
+ if (task_id !== undefined && host_id != undefined && bg_id !==
undefined){
rows = row.parentNode.rows;
for (i = 0; i < rows.length; ++i){
- if (rows[i].name ==
("task_id="+task_id+"bg_id="+bg_id)){
+ if (rows[i].name == ("task_id=" + task_id +
+ "host_id=" + host_id +
+ "bg_id=" + bg_id)){
switch_display(rows[i].cells[2]);
}
}
}
}
-window.highlightResultData = function (event, task_id, bg_id) {
+window.highlightResultData = function (event, task_id, host_id, bg_id) {
switch_background = function(elem){
if (elem.style.background == ''){
elem.style.background = 'lightblue';
@@ -35,10 +37,12 @@ window.highlightResultData = function (event, task_id, bg_id) {
cell = event.target.parentNode;
row = cell.parentNode;
- if (task_id !== undefined && bg_id !== undefined){
+ if (task_id !== undefined && host_id != undefined && bg_id !==
undefined){
rows = row.parentNode.rows;
for (i = 0; i < rows.length; ++i){
- if (rows[i].getAttribute("name") ==
("task_id="+task_id+"bg_id="+bg_id)){
+ if (rows[i].getAttribute("name") == ("task_id=" + task_id
+
+ "host_id=" + host_id +
+ "bg_id=" + bg_id)){
switch_background(rows[i]);
}
}
diff --git a/result_xslt/xml_to_html.xsl b/result_xslt/xml_to_html.xsl
index 0e85d01..c31de36 100644
--- a/result_xslt/xml_to_html.xsl
+++ b/result_xslt/xml_to_html.xsl
@@ -84,7 +84,7 @@
<xsl:template match="command">
<xsl:param name="task_id"/>
<tr class="tr_top">
- <xsl:attribute name="name">task_id=<xsl:value-of
select="$task_id"/>bg_id=<xsl:value-of
select="@proc_id"/></xsl:attribute>
+ <xsl:attribute name="name">task_id=<xsl:value-of
select="$task_id"/>host_id=<xsl:value-of
select="@host"/>bg_id=<xsl:value-of
select="@proc_id"/></xsl:attribute>
<xsl:choose>
<xsl:when test="@type='exec'">
<xsl:call-template name="cmd_exec"/>
@@ -300,7 +300,7 @@
<xsl:choose>
<xsl:when test="@bg_id">
<xsl:attribute name="onclick">
- toggleResultData(event, '<xsl:value-of
select="$task_id"/>', '<xsl:value-of
select="@bg_id"/>');
+ toggleResultData(event, '<xsl:value-of
select="$task_id"/>', '<xsl:value-of
select="@host"/>', '<xsl:value-of
select="@bg_id"/>');
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
@@ -317,7 +317,7 @@
<xsl:param name="task_id"/>
<button type="button">
<xsl:attribute name="onclick">
- highlightResultData(event, '<xsl:value-of
select="$task_id"/>', '<xsl:value-of
select="@bg_id"/>');
+ highlightResultData(event, '<xsl:value-of
select="$task_id"/>', '<xsl:value-of
select="@host"/>', '<xsl:value-of
select="@bg_id"/>');
</xsl:attribute>
Highlight result command
</button>
@@ -358,7 +358,7 @@
</xsl:when>
<xsl:otherwise>
<tr class="tr_bottom">
- <xsl:attribute name="name">task_id=<xsl:value-of
select="$task_id"/>bg_id=<xsl:value-of
select="@proc_id"/></xsl:attribute>
+ <xsl:attribute name="name">task_id=<xsl:value-of
select="$task_id"/>host_id=<xsl:value-of
select="@host"/>bg_id=<xsl:value-of
select="@proc_id"/></xsl:attribute>
<td>
</td>
<td>
--
2.1.0
Show replies by date