Make it possible to hide some repository groups
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2018 06:58:36 +0000 (06:58 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2018 06:58:36 +0000 (06:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184632

Reviewed by Saam Barati.

Added the ability to hide repository groups in the custom analysis task configurator from the admin page.
Hidden repositroy groups will continue to function for existing test groups. This is purely an UI change.

* init-database.sql: Added repositorygroup_hidden as a new column to triggerable_repository_groups.
* public/admin/triggerables.php: Added a form field to hide a repository group.
* public/include/manifest-generator.php: Include hidden state in the manifest file.
* public/v3/components/custom-analysis-task-configurator.js:
(CustomAnalysisTaskConfigurator.prototype._renderRepositoryPanes): Filter out hidden repository groups.
* public/v3/models/triggerable.js:
(prototype.isHidden): Added.
* server-tests/api-manifest-tests.js: Updated an existing test case to test a hidden repository group.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230666 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/init-database.sql
Websites/perf.webkit.org/public/admin/triggerables.php
Websites/perf.webkit.org/public/include/manifest-generator.php
Websites/perf.webkit.org/public/v3/components/custom-analysis-task-configurator.js
Websites/perf.webkit.org/public/v3/models/triggerable.js
Websites/perf.webkit.org/server-tests/api-manifest-tests.js

index 0ca45ba..5e58b9c 100644 (file)
@@ -1,3 +1,22 @@
+2018-04-15  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Make it possible to hide some repository groups
+        https://bugs.webkit.org/show_bug.cgi?id=184632
+
+        Reviewed by Saam Barati.
+
+        Added the ability to hide repository groups in the custom analysis task configurator from the admin page.
+        Hidden repositroy groups will continue to function for existing test groups. This is purely an UI change.
+
+        * init-database.sql: Added repositorygroup_hidden as a new column to triggerable_repository_groups.
+        * public/admin/triggerables.php: Added a form field to hide a repository group.
+        * public/include/manifest-generator.php: Include hidden state in the manifest file.
+        * public/v3/components/custom-analysis-task-configurator.js:
+        (CustomAnalysisTaskConfigurator.prototype._renderRepositoryPanes): Filter out hidden repository groups.
+        * public/v3/models/triggerable.js:
+        (prototype.isHidden): Added.
+        * server-tests/api-manifest-tests.js: Updated an existing test case to test a hidden repository group.
+
 2018-04-06  Dewei Zhu  <dewei_zhu@apple.com>
 
         Added 'CommitSet.diff' which will be shared between multiple independent incoming changes.
index 52788f7..c4742e7 100644 (file)
@@ -244,6 +244,7 @@ CREATE TABLE triggerable_repository_groups (
     repositorygroup_name varchar(256) NOT NULL,
     repositorygroup_description varchar(256),
     repositorygroup_accepts_roots boolean NOT NULL DEFAULT FALSE,
+    repositorygroup_hidden boolean NOT NULL DEFAULT FALSE,
     CONSTRAINT repository_group_name_must_be_unique_for_triggerable UNIQUE(repositorygroup_triggerable, repositorygroup_name));
 
 CREATE TABLE triggerable_repositories (
index a0181f7..1198768 100644 (file)
@@ -23,6 +23,9 @@ if ($db) {
     } else if ($action == 'update-group-description') {
         if (update_field('triggerable_repository_groups', 'repositorygroup', 'description'))
             regenerate_manifest();
+    } else if ($action == 'update-group-hidden') {
+        if (update_field('triggerable_repository_groups', 'repositorygroup', 'hidden'))
+            regenerate_manifest();
     } else if ($action == 'update-group-accept-roots') {
         if (update_field('triggerable_repository_groups', 'repositorygroup', 'accepts_roots',
             Database::to_database_boolean(array_get($_POST, 'accepts'))))
@@ -39,7 +42,7 @@ if ($db) {
             regenerate_manifest();
         } else
             $db->rollback_transaction();
-    }  else if ($action == 'update-accept-patch') {
+    } else if ($action == 'update-accept-patch') {
         $group_id = intval($_POST['group']);
         $repositories_that_accepts_patch = array_get($_POST, 'repositories', array());
 
@@ -83,7 +86,7 @@ if ($db) {
         'disabled' => array('editing_mode' => 'boolean', 'post_insertion' => TRUE),
         'repositories' => array(
             'label' => 'Repository Groups',
-            'subcolumns'=> array('ID', 'Name', 'Description', 'Accepts Roots', 'Repositories', 'Accept patches'),
+            'subcolumns'=> array('ID', 'Name', 'Description', 'Hidden', 'Accepts Roots', 'Repositories', 'Accept patches'),
             'custom' => function ($triggerable_row) use (&$db, &$repository_rows) {
                 return generate_repository_list($db, $triggerable_row['triggerable_id'], $repository_rows);
             }),
@@ -115,6 +118,7 @@ function generate_repository_list($db, $triggerable_id, $repository_rows) {
         $group_id = $group_row['repositorygroup_id'];
         $group_name = $group_row['repositorygroup_name'];
         $group_description = $group_row['repositorygroup_description'];
+        $checked_if_hidden = Database::is_true($group_row['repositorygroup_hidden']) ? 'checked' : '';
         $checked_if_accepts_roots = Database::is_true($group_row['repositorygroup_accepts_roots']) ? 'checked' : '';
 
         $group_name_form = <<< END
@@ -133,6 +137,15 @@ END;
             </form>
 END;
 
+        $group_hidden_form = <<< END
+            <form method="POST">
+            <input type="hidden" name="action" value="update-group-hidden">
+            <input type="hidden" name="id" value="$group_id">
+            <input type="checkbox" name="hidden" $checked_if_hidden>
+            <button type="submit">Save</button>
+            </form>
+END;
+
         $group_accepts_roots = <<< END
             <form method="POST">
             <input type="hidden" name="action" value="update-group-accept-roots">
@@ -153,7 +166,7 @@ END;
             $repositories_that_accepts_patch[$repository_id] = Database::is_true($row['trigrepo_accepts_patch']);
         }
 
-        array_push($group_forms, array($group_id, $group_name_form, $group_description_form, $group_accepts_roots,
+        array_push($group_forms, array($group_id, $group_name_form, $group_description_form, $group_hidden_form, $group_accepts_roots,
             generate_repository_form('update-repositories', $group_id, generate_repository_checkboxes($db, $repository_rows, $repositories_in_group)),
             generate_repository_form('update-accept-patch', $group_id, generate_repository_checkboxes($db, $repository_rows, $repositories_that_accepts_patch)),
         ));
index e771419..e5436e3 100644 (file)
@@ -229,6 +229,7 @@ class ManifestGenerator {
                     'id' => $group_row['repositorygroup_id'],
                     'name' => $group_row['repositorygroup_name'],
                     'description' => $group_row['repositorygroup_description'],
+                    'hidden' => Database::is_true($group_row['repositorygroup_hidden']),
                     'acceptsCustomRoots' => Database::is_true($group_row['repositorygroup_accepts_roots']),
                     'repositories' => $repository_list));
                 // V2 UI compatibility.
index f1c1139..43f35b7 100644 (file)
@@ -367,7 +367,8 @@ class CustomAnalysisTaskConfigurator extends ComponentBase {
         if (!triggerable)
             return;
 
-        const repositoryGroups = TriggerableRepositoryGroup.sortByNamePreferringSmallerRepositories(triggerable.repositoryGroups());
+        const visibleRepositoryGroups = triggerable.repositoryGroups().filter((group) => !group.isHidden());
+        const repositoryGroups = TriggerableRepositoryGroup.sortByNamePreferringSmallerRepositories(visibleRepositoryGroups);
 
         const repositorySet = new Set;
         for (let group of repositoryGroups) {
index 3b1fb9c..d5ff3c4 100644 (file)
@@ -58,6 +58,7 @@ class TriggerableRepositoryGroup extends LabeledObject {
     {
         super(id, object);
         this._description = object.description;
+        this._isHidden = !!object.hidden;
         this._acceptsCustomRoots = !!object.acceptsCustomRoots;
         this._repositories = Repository.sortByNamePreferringOnesWithURL(object.repositories.map((item) => item.repository));
         this._patchAcceptingSet = new Set(object.repositories.filter((item) => item.acceptsPatch).map((item) => item.repository));
@@ -86,6 +87,7 @@ class TriggerableRepositoryGroup extends LabeledObject {
     }
 
     description() { return this._description || this.name(); }
+    isHidden() { return this._isHidden; }
     acceptsCustomRoots() { return this._acceptsCustomRoots; }
     repositories() { return this._repositories; }
 
index 9a895e4..4f3b0a4 100644 (file)
@@ -296,6 +296,7 @@ describe('/api/manifest', function () {
         return Promise.all([
             db.insert('repositories', {id: 11, name: 'WebKit', url: 'https://trac.webkit.org/$1'}),
             db.insert('repositories', {id: 9, name: 'macOS'}),
+            db.insert('repositories', {id: 16, name: 'Shared'}),
             db.insert('repositories', {id: 101, name: 'WebKit', owner: 9, url: 'https://trac.webkit.org/$1'}),
             db.insert('build_triggerables', {id: 200, name: 'build.webkit.org'}),
             db.insert('build_triggerables', {id: 201, name: 'ios-build.webkit.org'}),
@@ -321,12 +322,15 @@ describe('/api/manifest', function () {
             db.insert('triggerable_repository_groups', {id: 300, triggerable: 200, name: 'default'}),
             db.insert('triggerable_repository_groups', {id: 301, triggerable: 201, name: 'default'}),
             db.insert('triggerable_repository_groups', {id: 302, triggerable: 202, name: 'system-and-webkit'}),
-            db.insert('triggerable_repository_groups', {id: 312, triggerable: 202, name: 'system-and-roots', accepts_roots: true}),
+            db.insert('triggerable_repository_groups', {id: 303, triggerable: 202, name: 'system-and-roots', accepts_roots: true}),
+            db.insert('triggerable_repository_groups', {id: 304, triggerable: 202, name: 'webkit-and-shared', hidden: true}),
             db.insert('triggerable_repositories', {group: 300, repository: 11}),
             db.insert('triggerable_repositories', {group: 301, repository: 11}),
             db.insert('triggerable_repositories', {group: 302, repository: 11}),
+            db.insert('triggerable_repositories', {group: 304, repository: 11}),
             db.insert('triggerable_repositories', {group: 302, repository: 9}),
-            db.insert('triggerable_repositories', {group: 312, repository: 9}),
+            db.insert('triggerable_repositories', {group: 303, repository: 9}),
+            db.insert('triggerable_repositories', {group: 304, repository: 16}),
             db.insert('triggerable_configurations', {triggerable: 200, test: 1, platform: 46}),
             db.insert('triggerable_configurations', {triggerable: 200, test: 2, platform: 46}),
             db.insert('triggerable_configurations', {triggerable: 201, test: 1, platform: 23}),
@@ -348,6 +352,9 @@ describe('/api/manifest', function () {
             const macos = Repository.findById(9);
             assert.equal(macos.name(), 'macOS');
 
+            const shared = Repository.findById(16);
+            assert.equal(shared.name(), 'Shared');
+
             const someTest = Test.findById(1);
             assert.equal(someTest.name(), 'SomeTest');
 
@@ -386,7 +393,7 @@ describe('/api/manifest', function () {
             assert(macTriggerable.acceptedTests().has(someTest));
 
             const groups = macTriggerable.repositoryGroups();
-            assert.deepEqual(groups.length, 2);
+            assert.deepEqual(groups.length, 3);
             TriggerableRepositoryGroup.sortByName(groups);
 
             const emptyCustomSet = new CustomCommitSet;
@@ -401,21 +408,39 @@ describe('/api/manifest', function () {
             const cusomSetWithWebKit = new CustomCommitSet;
             cusomSetWithWebKit.setRevisionForRepository(webkit, '191622');
 
+            const cusomSetWithWebKitAndShared = new CustomCommitSet;
+            cusomSetWithWebKitAndShared.setRevisionForRepository(webkit, '191622');
+            cusomSetWithWebKitAndShared.setRevisionForRepository(shared, '86456');
+
             assert.equal(groups[0].name(), 'system-and-roots');
+            assert.equal(groups[0].isHidden(), false);
             assert.equal(groups[0].acceptsCustomRoots(), true);
             assert.deepEqual(Repository.sortByName(groups[0].repositories()), [macos]);
             assert.equal(groups[0].accepts(emptyCustomSet), false);
             assert.equal(groups[0].accepts(customSetWithOSX), true);
             assert.equal(groups[0].accepts(cusomSetWithOSXAndWebKit), false);
+            assert.equal(groups[0].accepts(cusomSetWithWebKitAndShared), false);
             assert.equal(groups[0].accepts(cusomSetWithWebKit), false);
 
             assert.equal(groups[1].name(), 'system-and-webkit');
+            assert.equal(groups[1].isHidden(), false);
             assert.equal(groups[1].acceptsCustomRoots(), false);
             assert.deepEqual(Repository.sortByName(groups[1].repositories()), [webkit, macos]);
             assert.equal(groups[1].accepts(emptyCustomSet), false);
             assert.equal(groups[1].accepts(customSetWithOSX), false);
             assert.equal(groups[1].accepts(cusomSetWithOSXAndWebKit), true);
+            assert.equal(groups[1].accepts(cusomSetWithWebKitAndShared), false);
             assert.equal(groups[1].accepts(cusomSetWithWebKit), false);
+
+            assert.equal(groups[2].name(), 'webkit-and-shared');
+            assert.equal(groups[2].isHidden(), true);
+            assert.equal(groups[2].acceptsCustomRoots(), false);
+            assert.deepEqual(Repository.sortByName(groups[2].repositories()), [shared, webkit]);
+            assert.equal(groups[2].accepts(emptyCustomSet), false);
+            assert.equal(groups[2].accepts(customSetWithOSX), false);
+            assert.equal(groups[2].accepts(cusomSetWithOSXAndWebKit), false);
+            assert.equal(groups[2].accepts(cusomSetWithWebKitAndShared), true);
+            assert.equal(groups[2].accepts(cusomSetWithWebKit), false);
         });
     });