Skip to content

Commit ad04fee

Browse files
committed
Fix duplicate date query param on test query next/previous
The test query page expects the date query parameter to come before the filter parameters. This causes the next/previous buttons to not work, as described in #3719. Closes #3719.
1 parent a94573e commit ad04fee

9 files changed

Lines changed: 19 additions & 7 deletions

File tree

app/Http/Controllers/DynamicAnalysisController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function viewDynamicAnalysisFile(int $buildid, int $fileid): View
2929
[
3030
'build-id' => $buildid,
3131
'dynamic-analysis-id' => $fileid,
32-
'link' => url("queryTests.php?project={$this->project->Name}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$da?->name}&date={$this->date}"),
32+
'link' => url("queryTests.php?project={$this->project->Name}&date={$this->date}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$da?->name}"),
3333
],
3434
);
3535
}

app/cdash/app/Controller/Api/TestOverview.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function getResponse(): array
191191
round(($test['failed'] / $total_runs) * 100, 2);
192192
$test_response['timeoutpercent'] =
193193
round(($test['timeout'] / $total_runs) * 100, 2);
194-
$test_response['link'] = "queryTests.php?project={$this->project->Name}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$name}&date={$this->date}";
194+
$test_response['link'] = "queryTests.php?project={$this->project->Name}&date={$this->date}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$name}";
195195
$test_response['totalruns'] = $total_runs;
196196
$test_response['prettytime'] = time_difference($test['time'], true, '', true);
197197
$test_response['time'] = $test['time'];

app/cdash/app/Controller/Api/ViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ public static function marshal($data, $buildid, $projectname, $projectshowtestti
690690
'execTime' => time_difference($data['time'], true, '', true),
691691
'execTimeFull' => (float) $data['time'],
692692
'details' => $data['details'],
693-
'summaryLink' => "queryTests.php?project={$projectname}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=" . urlencode($data['testname']) . "&date={$testdate}",
693+
'summaryLink' => "queryTests.php?project={$projectname}&date={$testdate}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=" . urlencode($data['testname']),
694694
'summary' => 'Summary', /* Default value later replaced by AJAX */
695695
'detailsLink' => "tests/{$data['buildtestid']}",
696696
];

app/cdash/include/filterdataFunctions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,11 @@ function get_filterurl()
969969
$filterurl = htmlentities($_GET['filterstring'], ENT_QUOTES);
970970
// ...but we need ampersands to pass through unescaped, so convert them back.
971971
$filterurl = str_replace('&', '&', $filterurl);
972+
973+
// Remove &date= and &limit= from filterurl to avoid duplicates when next/prev links are built.
974+
$filterurl = preg_replace('/&date=[^&]*/', '', $filterurl);
975+
$filterurl = preg_replace('/&limit=[^&]*/', '', $filterurl);
976+
972977
return $filterurl;
973978
}
974979

phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13122,6 +13122,12 @@ parameters:
1312213122
count: 1
1312313123
path: app/cdash/include/filterdataFunctions.php
1312413124

13125+
-
13126+
rawMessage: 'Parameter #3 $subject of function preg_replace expects array<float|int|string>|string, string|null given.'
13127+
identifier: argument.type
13128+
count: 1
13129+
path: app/cdash/include/filterdataFunctions.php
13130+
1312513131
-
1312613132
rawMessage: Unreachable statement - code above always terminates.
1312713133
identifier: deadCode.unreachable

resources/js/angular/services/filters.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export function filtersSvc() {
1717
var str = new String(window.location);
1818
var idx = str.indexOf("&filtercount=", 0);
1919
if (idx > 0) {
20-
return str.substr(idx);
20+
var filterstring = str.substr(idx);
21+
return filterstring.replace(/&date=[^&]*/, "").replace(/&limit=[^&]*/, "");
2122
}
2223
else {
2324
return "";

resources/js/vue/components/BuildTestsPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export default {
337337
history: {
338338
value: '',
339339
text: 'History',
340-
href: `${this.$baseURL}/queryTests.php?project=${this.projectName}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=${edge.node.name}&date=${DateTime.fromISO(this.buildTime).toISODate()}`,
340+
href: `${this.$baseURL}/queryTests.php?project=${this.projectName}&date=${DateTime.fromISO(this.buildTime).toISODate()}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=${edge.node.name}`,
341341
},
342342
...this.pinnedMeasurements.reduce((acc, name) => ({
343343
...acc,

resources/js/vue/components/TestDetailsPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<a
2525
id="summary_link"
2626
class="tw-link tw-link-hover"
27-
:href="`${$baseURL}/queryTests.php?project=${build.project.name}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=${test.name}&date=${testingDay}`"
27+
:href="`${$baseURL}/queryTests.php?project=${build.project.name}&date=${testingDay}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=${test.name}`"
2828
>
2929
{{ test.name }}
3030
</a>

tests/Browser/Pages/TestDetailsPageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testTestHistoryLink(): void
142142
$this->build->save();
143143

144144
$this->browse(function (Browser $browser) use ($test): void {
145-
$url = url('queryTests.php') . '?project=' . $this->project->name . '&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=' . $test->testname . '&date=' . $this->build->starttime->toDateString();
145+
$url = url('queryTests.php') . '?project=' . $this->project->name . '&date=' . $this->build->starttime->toDateString() . '&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=' . $test->testname;
146146

147147
$browser->visit("/tests/{$test->id}")
148148
->waitForLink($test->testname)

0 commit comments

Comments
 (0)