Skip to content

Commit 3f4fb1c

Browse files
Revamp /builds/<id>/configure (#3262)
This PR continues our ongoing effort to modernize the site, completely rethinking the design of `/builds/<id>/configure`. Like most of the recent refactors, this PR deprecates the API endpoint used by the legacy page in favor of the new GraphQL API. Example for builds without subprojects or all-at-once builds where all child builds share a configure: <img width="2834" height="1386" alt="image" src="https://github.com/user-attachments/assets/be7c98dd-d850-4ea4-8fcc-8200a681d3aa" /> Example for subproject builds with separate configures for each build: <img width="2832" height="1518" alt="image" src="https://github.com/user-attachments/assets/85154d9c-9e83-4dbf-b2b6-576a5697eaf4" />
1 parent 439b4aa commit 3f4fb1c

File tree

13 files changed

+628
-259
lines changed

13 files changed

+628
-259
lines changed

app/Http/Controllers/BuildController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public function configure(int $build_id): View
6262
{
6363
$this->setBuildById($build_id);
6464

65-
return $this->vue('build-configure', 'Configure', [], false);
65+
return $this->vue('build-configure', 'Configure', [
66+
'build-id' => $this->build->Id,
67+
]);
6668
}
6769

6870
public function notes(int $build_id): View
@@ -1022,6 +1024,7 @@ public function apiViewConfigure(): JsonResponse
10221024
$this->setBuildById((int) $_GET['buildid']);
10231025

10241026
$response = begin_JSON_response();
1027+
$response['deprecated'] = 'This endpoint will be removed in the next major version of CDash.';
10251028

10261029
$date = TestingDay::get($this->project, $this->build->StartTime);
10271030
get_dashboard_JSON($this->project->Name, $date, $response);

app/Models/Configure.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace App\Models;
44

5+
use Database\Factories\ConfigureFactory;
56
use Illuminate\Database\Eloquent\Builder;
7+
use Illuminate\Database\Eloquent\Factories\HasFactory;
68
use Illuminate\Database\Eloquent\Model;
79
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
810

@@ -18,6 +20,9 @@
1820
*/
1921
class Configure extends Model
2022
{
23+
/** @use HasFactory<ConfigureFactory> */
24+
use HasFactory;
25+
2126
protected $table = 'configure';
2227

2328
public $timestamps = false;

app/cdash/app/Model/Build.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ public function GetConfigures(): PDOStatement|false
700700
b.configureerrors, b.configurewarnings
701701
FROM configure c
702702
JOIN build2configure b2c ON b2c.configureid = c.id
703-
JOIN subproject sp ON sp.id = b.subprojectid
704703
JOIN build b ON b.id = b2c.buildid
704+
JOIN subproject sp ON sp.id = b.subprojectid
705705
WHERE b.parentid = ?');
706706
} elseif (count($configure_rows) === 1) {
707707
// One configure row is shared by all the SubProjects.

app/cdash/tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ set_property(TEST /Feature/GraphQL/SiteTypeTest APPEND PROPERTY RUN_SERIAL TRUE)
212212

213213
add_feature_test(/Feature/GraphQL/BuildTypeTest)
214214

215+
add_feature_test(/Feature/GraphQL/ConfigureTypeTest)
216+
215217
add_feature_test(/Feature/GraphQL/TestTypeTest)
216218

217219
add_feature_test(/Feature/GraphQL/TestMeasurementTypeTest)
@@ -349,6 +351,8 @@ add_browser_test(/Browser/Pages/BuildTargetsPageTest)
349351

350352
add_browser_test(/Browser/Pages/BuildTestsPageTest)
351353

354+
add_browser_test(/Browser/Pages/BuildConfigurePageTest)
355+
352356
add_php_test(image)
353357
set_tests_properties(image PROPERTIES DEPENDS /CDash/XmlHandler/UpdateHandler)
354358

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Database\Factories;
4+
5+
use App\Models\Configure;
6+
use Illuminate\Database\Eloquent\Factories\Factory;
7+
use Illuminate\Support\Str;
8+
use Random\RandomException;
9+
10+
/**
11+
* @extends Factory<Configure>
12+
*/
13+
class ConfigureFactory extends Factory
14+
{
15+
/**
16+
* Define the model's default state.
17+
*
18+
* @return array<string, mixed>
19+
*
20+
* @throws RandomException
21+
*/
22+
public function definition(): array
23+
{
24+
return [
25+
'command' => Str::uuid()->toString(),
26+
'log' => Str::uuid()->toString(),
27+
'status' => 0,
28+
'warnings' => 0,
29+
'crc32' => random_int(0, 1000000),
30+
];
31+
}
32+
33+
public function withWarnings(int $numWarnings): static
34+
{
35+
return $this->state(fn (array $attributes) => [
36+
'warnings' => $numWarnings,
37+
]);
38+
}
39+
}

graphql/schema.graphql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,19 @@ type RemoveUserMutationPayload implements MutationPayloadInterface {
367367
}
368368

369369

370+
"Configure."
371+
type Configure {
372+
"Unique primary key."
373+
id: ID! @filterable
374+
375+
command: String! @filterable
376+
377+
log: String! @filterable
378+
379+
returnValue: Int! @rename(attribute: "status") @filterable
380+
}
381+
382+
370383
"Build."
371384
type Build {
372385
"Unique primary key."
@@ -512,6 +525,8 @@ type Build {
512525
files: [UploadedFile!]! @hasMany(relation: "uploadedFiles", type: CONNECTION, scopes: ["files"]) @orderBy(column: "id", direction: ASC)
513526

514527
subProject: SubProject! @belongsTo
528+
529+
configure: Configure @hasOneThrough
515530
}
516531

517532

0 commit comments

Comments
 (0)