Skip to content

Commit

Permalink
Performance Dashboard should be able to gracefully handle hidden plat…
Browse files Browse the repository at this point in the history
…forms.

https://bugs.webkit.org/show_bug.cgi?id=252290
rdar://100648187

Reviewed by Ryosuke Niwa.

Fix a bug that analysis task page on performance dashboard does not load properly
when any platform in this task is hidden.

* Websites/perf.webkit.org/public/include/manifest-generator.php: Include 'platform_hidden'
field in platform manifest and stop filtering out hidden platforms in manifest.
* Websites/perf.webkit.org/public/v3/components/pane-selector.js:
(PaneSelector.prototype._renderPlatformList): Add code to ensure hidden platform does not
show in pane.
* Websites/perf.webkit.org/public/v3/models/platform.js: Added 'hidden' field and a 'isHidden'
function to indicate if a platform is hidden.
(Platform):
(Platform.prototype.isHidden):
* Websites/perf.webkit.org/public/v3/pages/charts-page.js: Filter out hidden platforms from
'ChartsPage.alternatePlatforms'.
(ChartsPage):
(ChartsPage.prototype.alternatePlatforms):
* Websites/perf.webkit.org/server-tests/api-manifest-tests.js: Added unit test for
'Platform.isHidden'.

Canonical link: https://commits.webkit.org/260325@main
  • Loading branch information
dewei-zhu committed Feb 15, 2023
1 parent b885453 commit e878206
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
Expand Up @@ -122,14 +122,13 @@ private function platforms($platform_table, $is_dashboard) {
$platforms = array();
if ($platform_table) {
foreach ($platform_table as $platform_row) {
if (Database::is_true($platform_row['platform_hidden']))
continue;
$id = $platform_row['platform_id'];
if (array_key_exists($id, $platform_metrics)) {
$platforms[$id] = array(
'name' => $platform_row['platform_name'],
'metrics' => $platform_metrics[$id]['metrics'],
'group' => $platform_row['platform_group'],
'hidden' => Database::is_true($platform_row['platform_hidden']),
'lastModified' => $platform_metrics[$id]['last_modified']);
}
}
Expand Down
Expand Up @@ -49,6 +49,8 @@ class PaneSelector extends ComponentBase {

if (currentMetric) {
for (var platform of Platform.sortByName(Platform.all())) {
if (platform.isHidden())
continue;
if (platform.hasMetric(currentMetric))
this._platformItems.push(this._createListItem(platform, platform.label()));
}
Expand Down
6 changes: 6 additions & 0 deletions Websites/perf.webkit.org/public/v3/models/platform.js
Expand Up @@ -6,6 +6,7 @@ class Platform extends LabeledObject {
super(id, object);
this._metrics = object.metrics;
this._lastModifiedByMetric = object.lastModifiedByMetric;
this._isHidden = object.hidden;
this._containingTests = null;

this.ensureNamedStaticMap('name')[object.name] = this;
Expand Down Expand Up @@ -54,6 +55,11 @@ class Platform extends LabeledObject {
return this._lastModifiedByMetric[metric.id()];
}

isHidden()
{
return this._isHidden;
}

group() { return this._group; }
}

Expand Down
2 changes: 1 addition & 1 deletion Websites/perf.webkit.org/public/v3/pages/charts-page.js
Expand Up @@ -251,7 +251,7 @@ class ChartsPage extends PageWithHeading {
}

return metric.platforms().filter(function (platform) {
return !existingPlatforms[platform.id()];
return !existingPlatforms[platform.id()] && !platform.isHidden();
});
}

Expand Down
35 changes: 35 additions & 0 deletions Websites/perf.webkit.org/server-tests/api-manifest-tests.js
Expand Up @@ -324,6 +324,41 @@ describe('/api/manifest', function () {
});
});

it("should generate manifest with platforms hidden field", async () => {
let db = TestServer.database();
await Promise.all([
db.insert('tests', {id: 1, name: 'SomeTest'}),
db.insert('tests', {id: 2, name: 'SomeOtherTest'}),
db.insert('tests', {id: 3, name: 'ChildTest', parent: 1}),
db.insert('tests', {id: 4, name: 'GrandChild', parent: 3}),
db.insert('aggregators', {id: 200, name: 'Total'}),
db.insert('test_metrics', {id: 5, test: 1, name: 'Time'}),
db.insert('test_metrics', {id: 6, test: 2, name: 'Time', aggregator: 200}),
db.insert('test_metrics', {id: 7, test: 2, name: 'Malloc', aggregator: 200}),
db.insert('test_metrics', {id: 8, test: 3, name: 'Time'}),
db.insert('test_metrics', {id: 9, test: 4, name: 'Time'}),
db.insert('platform_groups', {id: 1, name: 'ios'}),
db.insert('platform_groups', {id: 2, name: 'mac'}),
db.insert('platforms', {id: 23, name: 'iOS 9 iPhone 5s', group: 1, hidden: true}),
db.insert('platforms', {id: 46, name: 'Trunk Mavericks', group: 2}),
db.insert('test_configurations', {id: 101, metric: 5, platform: 46, type: 'current'}),
db.insert('test_configurations', {id: 102, metric: 6, platform: 46, type: 'current'}),
db.insert('test_configurations', {id: 103, metric: 7, platform: 46, type: 'current'}),
db.insert('test_configurations', {id: 104, metric: 8, platform: 46, type: 'current'}),
db.insert('test_configurations', {id: 105, metric: 9, platform: 46, type: 'current'}),
db.insert('test_configurations', {id: 106, metric: 5, platform: 23, type: 'current'}),
db.insert('test_configurations', {id: 107, metric: 5, platform: 23, type: 'baseline'}),
]);
const content = await TestServer.remoteAPI().getJSON('/api/manifest');
Manifest._didFetchManifest(content);
const ios9iphone5s = Platform.findById(23);
const mavericks = Platform.findById(46);
assert(ios9iphone5s);
assert(mavericks);
assert(ios9iphone5s.isHidden());
assert(!mavericks.isHidden());
});

it("should generate manifest with triggerables", () => {
let db = TestServer.database();
return Promise.all([
Expand Down

0 comments on commit e878206

Please sign in to comment.