diff --git a/app/Http/Controllers/DynamicAnalysisController.php b/app/Http/Controllers/DynamicAnalysisController.php index fe47cb73f6..0de314ebe8 100644 --- a/app/Http/Controllers/DynamicAnalysisController.php +++ b/app/Http/Controllers/DynamicAnalysisController.php @@ -29,7 +29,7 @@ public function viewDynamicAnalysisFile(int $buildid, int $fileid): View [ 'build-id' => $buildid, 'dynamic-analysis-id' => $fileid, - 'link' => url("queryTests.php?project={$this->project->Name}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$da?->name}&date={$this->date}"), + 'link' => url("queryTests.php?project={$this->project->Name}&date={$this->date}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$da?->name}"), ], ); } diff --git a/app/cdash/app/Controller/Api/TestOverview.php b/app/cdash/app/Controller/Api/TestOverview.php index 63c8d41f16..73c7978a14 100644 --- a/app/cdash/app/Controller/Api/TestOverview.php +++ b/app/cdash/app/Controller/Api/TestOverview.php @@ -191,7 +191,7 @@ public function getResponse(): array round(($test['failed'] / $total_runs) * 100, 2); $test_response['timeoutpercent'] = round(($test['timeout'] / $total_runs) * 100, 2); - $test_response['link'] = "queryTests.php?project={$this->project->Name}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$name}&date={$this->date}"; + $test_response['link'] = "queryTests.php?project={$this->project->Name}&date={$this->date}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$name}"; $test_response['totalruns'] = $total_runs; $test_response['prettytime'] = time_difference($test['time'], true, '', true); $test_response['time'] = $test['time']; diff --git a/app/cdash/app/Controller/Api/ViewTest.php b/app/cdash/app/Controller/Api/ViewTest.php index 7ea71b64ba..c6d551fd3b 100644 --- a/app/cdash/app/Controller/Api/ViewTest.php +++ b/app/cdash/app/Controller/Api/ViewTest.php @@ -690,7 +690,7 @@ public static function marshal($data, $buildid, $projectname, $projectshowtestti 'execTime' => time_difference($data['time'], true, '', true), 'execTimeFull' => (float) $data['time'], 'details' => $data['details'], - 'summaryLink' => "queryTests.php?project={$projectname}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=" . urlencode($data['testname']) . "&date={$testdate}", + 'summaryLink' => "queryTests.php?project={$projectname}&date={$testdate}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=" . urlencode($data['testname']), 'summary' => 'Summary', /* Default value later replaced by AJAX */ 'detailsLink' => "tests/{$data['buildtestid']}", ]; diff --git a/app/cdash/include/filterdataFunctions.php b/app/cdash/include/filterdataFunctions.php index db6c433a58..1ed021d094 100644 --- a/app/cdash/include/filterdataFunctions.php +++ b/app/cdash/include/filterdataFunctions.php @@ -969,6 +969,11 @@ function get_filterurl() $filterurl = htmlentities($_GET['filterstring'], ENT_QUOTES); // ...but we need ampersands to pass through unescaped, so convert them back. $filterurl = str_replace('&', '&', $filterurl); + + // Remove &date= and &limit= from filterurl to avoid duplicates when next/prev links are built. + $filterurl = preg_replace('/&date=[^&]*/', '', $filterurl); + $filterurl = preg_replace('/&limit=[^&]*/', '', $filterurl); + return $filterurl; } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 4680fc42c8..a4b8635fae 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -13122,6 +13122,12 @@ parameters: count: 1 path: app/cdash/include/filterdataFunctions.php + - + rawMessage: 'Parameter #3 $subject of function preg_replace expects array|string, string|null given.' + identifier: argument.type + count: 1 + path: app/cdash/include/filterdataFunctions.php + - rawMessage: Unreachable statement - code above always terminates. identifier: deadCode.unreachable diff --git a/resources/js/angular/services/filters.js b/resources/js/angular/services/filters.js index 97f9584464..4ecf8340d2 100644 --- a/resources/js/angular/services/filters.js +++ b/resources/js/angular/services/filters.js @@ -17,7 +17,8 @@ export function filtersSvc() { var str = new String(window.location); var idx = str.indexOf("&filtercount=", 0); if (idx > 0) { - return str.substr(idx); + var filterstring = str.substr(idx); + return filterstring.replace(/&date=[^&]*/, "").replace(/&limit=[^&]*/, ""); } else { return ""; diff --git a/resources/js/vue/components/BuildTestsPage.vue b/resources/js/vue/components/BuildTestsPage.vue index bfb18c8b9a..215e6ce991 100644 --- a/resources/js/vue/components/BuildTestsPage.vue +++ b/resources/js/vue/components/BuildTestsPage.vue @@ -337,7 +337,7 @@ export default { history: { value: '', text: 'History', - 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()}`, + 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}`, }, ...this.pinnedMeasurements.reduce((acc, name) => ({ ...acc, diff --git a/resources/js/vue/components/TestDetailsPage.vue b/resources/js/vue/components/TestDetailsPage.vue index 22ba7dd0a4..5e2d6515ec 100644 --- a/resources/js/vue/components/TestDetailsPage.vue +++ b/resources/js/vue/components/TestDetailsPage.vue @@ -24,7 +24,7 @@ {{ test.name }} diff --git a/tests/Browser/Pages/TestDetailsPageTest.php b/tests/Browser/Pages/TestDetailsPageTest.php index 610680672f..2cba00f3e7 100644 --- a/tests/Browser/Pages/TestDetailsPageTest.php +++ b/tests/Browser/Pages/TestDetailsPageTest.php @@ -142,7 +142,7 @@ public function testTestHistoryLink(): void $this->build->save(); $this->browse(function (Browser $browser) use ($test): void { - $url = url('queryTests.php') . '?project=' . $this->project->name . '&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=' . $test->testname . '&date=' . $this->build->starttime->toDateString(); + $url = url('queryTests.php') . '?project=' . $this->project->name . '&date=' . $this->build->starttime->toDateString() . '&filtercount=1&showfilters=1&field1=testname&compare1=61&value1=' . $test->testname; $browser->visit("/tests/{$test->id}") ->waitForLink($test->testname)