From f13709b13b68a7409d4be72e6c1a0dcd6b81d7db Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 12 Apr 2019 12:42:02 -0700 Subject: [PATCH] Update search indexes for Dashboards and Panels to Ferret, plus various minor fixes Summary: Depends on D20410. Ref T13272. Dashboards/Panels currently use older "ngram" indexing, which is a less-powerful precursor to Ferret. Throw away the ngram index and provide a Ferret index instead. Also: - Remove the NUX state, which links to the wrong place now and doesn't seem terribly important. - Add project tags to the search result list. - Make the "No Tags" tag a little less conspicious. Test Plan: - Indexed dashboards and panels. - Searched for dashboards and panels via SearchEngine using Ferret "query" field. - Searched for panels via "Add Existing Panel" datasource typeahead. - Searched for dashboards via "Add Menu Item > Dashboard" on a ProfileMenu via typeahead. - Viewed dashboard NUX state (no special state, but no more bad link to "/create/"). - Viewed dashboard list, saw project tags. - Viewed dashboards with no project tags ("No Tags" is now displayed but less visible). Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13272 Differential Revision: https://secure.phabricator.com/D20411 --- resources/celerity/map.php | 6 +-- .../20190412.dashboard.03.dashngrams.sql | 1 + .../20190412.dashboard.04.panelngrams.sql | 1 + .../20190412.dashboard.05.dferret.doc.sql | 9 ++++ .../20190412.dashboard.06.dferret.field.sql | 8 +++ .../20190412.dashboard.07.dferret.ngrams.sql | 5 ++ .../20190412.dashboard.08.dferret.cngrams.sql | 7 +++ .../20190412.dashboard.09.pferret.doc.sql | 9 ++++ .../20190412.dashboard.10.pferret.field.sql | 8 +++ .../20190412.dashboard.11.pferret.ngrams.sql | 5 ++ .../20190412.dashboard.12.pferret.cngrams.sql | 7 +++ src/__phutil_library_map__.php | 18 ++++--- .../PhabricatorDashboardFerretEngine.php | 18 +++++++ .../PhabricatorDashboardFulltextEngine.php | 23 ++++++++ .../PhabricatorDashboardPanelFerretEngine.php | 18 +++++++ ...habricatorDashboardPanelFulltextEngine.php | 23 ++++++++ .../query/PhabricatorDashboardPanelQuery.php | 6 --- .../PhabricatorDashboardPanelSearchEngine.php | 8 --- .../query/PhabricatorDashboardQuery.php | 14 ++--- .../PhabricatorDashboardSearchEngine.php | 53 +++++++++---------- .../storage/PhabricatorDashboard.php | 26 ++++----- .../storage/PhabricatorDashboardNgrams.php | 18 ------- .../storage/PhabricatorDashboardPanel.php | 26 ++++----- .../PhabricatorDashboardPanelNgrams.php | 18 ------- .../PhabricatorDashboardDatasource.php | 6 +++ .../PhabricatorDashboardPanelDatasource.php | 6 ++- .../phid/view/PHUIHandleTagListView.php | 2 +- src/view/phui/PHUITagView.php | 1 + webroot/rsrc/css/phui/phui-tag-view.css | 6 +++ 29 files changed, 232 insertions(+), 124 deletions(-) create mode 100644 resources/sql/autopatches/20190412.dashboard.03.dashngrams.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.04.panelngrams.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.05.dferret.doc.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.06.dferret.field.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.07.dferret.ngrams.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.08.dferret.cngrams.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.09.pferret.doc.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.10.pferret.field.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.11.pferret.ngrams.sql create mode 100644 resources/sql/autopatches/20190412.dashboard.12.pferret.cngrams.sql create mode 100644 src/applications/dashboard/engine/PhabricatorDashboardFerretEngine.php create mode 100644 src/applications/dashboard/engine/PhabricatorDashboardFulltextEngine.php create mode 100644 src/applications/dashboard/engine/PhabricatorDashboardPanelFerretEngine.php create mode 100644 src/applications/dashboard/engine/PhabricatorDashboardPanelFulltextEngine.php delete mode 100644 src/applications/dashboard/storage/PhabricatorDashboardNgrams.php delete mode 100644 src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index df4b00bd70..a28ddfe8b3 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.js' => '020aebcf', - 'core.pkg.css' => '4011a01e', + 'core.pkg.css' => '77c4f199', 'core.pkg.js' => '69247edd', 'differential.pkg.css' => '8d8360fb', 'differential.pkg.js' => '67e02996', @@ -173,7 +173,7 @@ return array( 'rsrc/css/phui/phui-segment-bar-view.css' => '5166b370', 'rsrc/css/phui/phui-spacing.css' => 'b05cadc3', 'rsrc/css/phui/phui-status.css' => 'e5ff8be0', - 'rsrc/css/phui/phui-tag-view.css' => '29409667', + 'rsrc/css/phui/phui-tag-view.css' => '8519160a', 'rsrc/css/phui/phui-timeline-view.css' => '1e348e4b', 'rsrc/css/phui/phui-two-column-view.css' => '01e6991e', 'rsrc/css/phui/workboards/phui-workboard-color.css' => 'e86de308', @@ -862,7 +862,7 @@ return array( 'phui-segment-bar-view-css' => '5166b370', 'phui-spacing-css' => 'b05cadc3', 'phui-status-list-view-css' => 'e5ff8be0', - 'phui-tag-view-css' => '29409667', + 'phui-tag-view-css' => '8519160a', 'phui-theme-css' => '35883b37', 'phui-timeline-view-css' => '1e348e4b', 'phui-two-column-view-css' => '01e6991e', diff --git a/resources/sql/autopatches/20190412.dashboard.03.dashngrams.sql b/resources/sql/autopatches/20190412.dashboard.03.dashngrams.sql new file mode 100644 index 0000000000..2f1b572a8b --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.03.dashngrams.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboard_ngrams; diff --git a/resources/sql/autopatches/20190412.dashboard.04.panelngrams.sql b/resources/sql/autopatches/20190412.dashboard.04.panelngrams.sql new file mode 100644 index 0000000000..e06d817c6e --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.04.panelngrams.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboardpanel_ngrams; diff --git a/resources/sql/autopatches/20190412.dashboard.05.dferret.doc.sql b/resources/sql/autopatches/20190412.dashboard.05.dferret.doc.sql new file mode 100644 index 0000000000..2073a5b578 --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.05.dferret.doc.sql @@ -0,0 +1,9 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_fdocument ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + objectPHID VARBINARY(64) NOT NULL, + isClosed BOOL NOT NULL, + authorPHID VARBINARY(64), + ownerPHID VARBINARY(64), + epochCreated INT UNSIGNED NOT NULL, + epochModified INT UNSIGNED NOT NULL +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.06.dferret.field.sql b/resources/sql/autopatches/20190412.dashboard.06.dferret.field.sql new file mode 100644 index 0000000000..b8845f5686 --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.06.dferret.field.sql @@ -0,0 +1,8 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_ffield ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + documentID INT UNSIGNED NOT NULL, + fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT}, + rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, + termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, + normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT} +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.07.dferret.ngrams.sql b/resources/sql/autopatches/20190412.dashboard.07.dferret.ngrams.sql new file mode 100644 index 0000000000..3279e7dc27 --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.07.dferret.ngrams.sql @@ -0,0 +1,5 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_fngrams ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + documentID INT UNSIGNED NOT NULL, + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT} +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.08.dferret.cngrams.sql b/resources/sql/autopatches/20190412.dashboard.08.dferret.cngrams.sql new file mode 100644 index 0000000000..0ee815d175 --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.08.dferret.cngrams.sql @@ -0,0 +1,7 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_fngrams_common ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}, + needsCollection BOOL NOT NULL, + UNIQUE KEY `key_ngram` (ngram), + KEY `key_collect` (needsCollection) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.09.pferret.doc.sql b/resources/sql/autopatches/20190412.dashboard.09.pferret.doc.sql new file mode 100644 index 0000000000..827a4245ed --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.09.pferret.doc.sql @@ -0,0 +1,9 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_fdocument ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + objectPHID VARBINARY(64) NOT NULL, + isClosed BOOL NOT NULL, + authorPHID VARBINARY(64), + ownerPHID VARBINARY(64), + epochCreated INT UNSIGNED NOT NULL, + epochModified INT UNSIGNED NOT NULL +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.10.pferret.field.sql b/resources/sql/autopatches/20190412.dashboard.10.pferret.field.sql new file mode 100644 index 0000000000..f63521d87b --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.10.pferret.field.sql @@ -0,0 +1,8 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_ffield ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + documentID INT UNSIGNED NOT NULL, + fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT}, + rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, + termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, + normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT} +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.11.pferret.ngrams.sql b/resources/sql/autopatches/20190412.dashboard.11.pferret.ngrams.sql new file mode 100644 index 0000000000..a197ec0272 --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.11.pferret.ngrams.sql @@ -0,0 +1,5 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_fngrams ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + documentID INT UNSIGNED NOT NULL, + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT} +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20190412.dashboard.12.pferret.cngrams.sql b/resources/sql/autopatches/20190412.dashboard.12.pferret.cngrams.sql new file mode 100644 index 0000000000..95426fcf1d --- /dev/null +++ b/resources/sql/autopatches/20190412.dashboard.12.pferret.cngrams.sql @@ -0,0 +1,7 @@ +CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_fngrams_common ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}, + needsCollection BOOL NOT NULL, + UNIQUE KEY `key_ngram` (ngram), + KEY `key_collect` (needsCollection) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ffc4ba3c0e..983831de81 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2919,7 +2919,9 @@ phutil_register_library_map(array( 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/dashboard/PhabricatorDashboardEditController.php', 'PhabricatorDashboardEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardEditEngine.php', 'PhabricatorDashboardFavoritesInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardFavoritesInstallWorkflow.php', + 'PhabricatorDashboardFerretEngine' => 'applications/dashboard/engine/PhabricatorDashboardFerretEngine.php', 'PhabricatorDashboardFullLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardFullLayoutMode.php', + 'PhabricatorDashboardFulltextEngine' => 'applications/dashboard/engine/PhabricatorDashboardFulltextEngine.php', 'PhabricatorDashboardHalfLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardHalfLayoutMode.php', 'PhabricatorDashboardHomeInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardHomeInstallWorkflow.php', 'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php', @@ -2930,7 +2932,6 @@ phutil_register_library_map(array( 'PhabricatorDashboardLayoutTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardLayoutTransaction.php', 'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php', 'PhabricatorDashboardNameTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php', - 'PhabricatorDashboardNgrams' => 'applications/dashboard/storage/PhabricatorDashboardNgrams.php', 'PhabricatorDashboardObjectInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php', 'PhabricatorDashboardOneThirdLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardOneThirdLayoutMode.php', 'PhabricatorDashboardPanel' => 'applications/dashboard/storage/PhabricatorDashboardPanel.php', @@ -2941,9 +2942,10 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php', 'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php', 'PhabricatorDashboardPanelEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php', + 'PhabricatorDashboardPanelFerretEngine' => 'applications/dashboard/engine/PhabricatorDashboardPanelFerretEngine.php', + 'PhabricatorDashboardPanelFulltextEngine' => 'applications/dashboard/engine/PhabricatorDashboardPanelFulltextEngine.php', 'PhabricatorDashboardPanelListController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelListController.php', 'PhabricatorDashboardPanelNameTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php', - 'PhabricatorDashboardPanelNgrams' => 'applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php', 'PhabricatorDashboardPanelPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php', 'PhabricatorDashboardPanelPropertyTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelPropertyTransaction.php', 'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php', @@ -8900,7 +8902,8 @@ phutil_register_library_map(array( 'PhabricatorFlaggableInterface', 'PhabricatorDestructibleInterface', 'PhabricatorProjectInterface', - 'PhabricatorNgramsInterface', + 'PhabricatorFulltextInterface', + 'PhabricatorFerretInterface', 'PhabricatorDashboardPanelContainerInterface', ), 'PhabricatorDashboardAdjustController' => 'PhabricatorDashboardController', @@ -8916,7 +8919,9 @@ phutil_register_library_map(array( 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardEditEngine' => 'PhabricatorEditEngine', 'PhabricatorDashboardFavoritesInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow', + 'PhabricatorDashboardFerretEngine' => 'PhabricatorFerretEngine', 'PhabricatorDashboardFullLayoutMode' => 'PhabricatorDashboardLayoutMode', + 'PhabricatorDashboardFulltextEngine' => 'PhabricatorFulltextEngine', 'PhabricatorDashboardHalfLayoutMode' => 'PhabricatorDashboardLayoutMode', 'PhabricatorDashboardHomeInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow', 'PhabricatorDashboardIconSet' => 'PhabricatorIconSet', @@ -8927,7 +8932,6 @@ phutil_register_library_map(array( 'PhabricatorDashboardLayoutTransaction' => 'PhabricatorDashboardTransactionType', 'PhabricatorDashboardListController' => 'PhabricatorDashboardController', 'PhabricatorDashboardNameTransaction' => 'PhabricatorDashboardTransactionType', - 'PhabricatorDashboardNgrams' => 'PhabricatorSearchNgrams', 'PhabricatorDashboardObjectInstallWorkflow' => 'PhabricatorDashboardInstallWorkflow', 'PhabricatorDashboardOneThirdLayoutMode' => 'PhabricatorDashboardLayoutMode', 'PhabricatorDashboardPanel' => array( @@ -8936,7 +8940,8 @@ phutil_register_library_map(array( 'PhabricatorPolicyInterface', 'PhabricatorFlaggableInterface', 'PhabricatorDestructibleInterface', - 'PhabricatorNgramsInterface', + 'PhabricatorFulltextInterface', + 'PhabricatorFerretInterface', 'PhabricatorDashboardPanelContainerInterface', ), 'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController', @@ -8945,9 +8950,10 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine', + 'PhabricatorDashboardPanelFerretEngine' => 'PhabricatorFerretEngine', + 'PhabricatorDashboardPanelFulltextEngine' => 'PhabricatorFulltextEngine', 'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelNameTransaction' => 'PhabricatorDashboardPanelTransactionType', - 'PhabricatorDashboardPanelNgrams' => 'PhabricatorSearchNgrams', 'PhabricatorDashboardPanelPHIDType' => 'PhabricatorPHIDType', 'PhabricatorDashboardPanelPropertyTransaction' => 'PhabricatorDashboardPanelTransactionType', 'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', diff --git a/src/applications/dashboard/engine/PhabricatorDashboardFerretEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardFerretEngine.php new file mode 100644 index 0000000000..0150827c31 --- /dev/null +++ b/src/applications/dashboard/engine/PhabricatorDashboardFerretEngine.php @@ -0,0 +1,18 @@ +setDocumentTitle($dashboard->getName()); + + $document->addRelationship( + $dashboard->isArchived() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $dashboard->getPHID(), + PhabricatorDashboardDashboardPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } + +} diff --git a/src/applications/dashboard/engine/PhabricatorDashboardPanelFerretEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardPanelFerretEngine.php new file mode 100644 index 0000000000..b8bd0c31ab --- /dev/null +++ b/src/applications/dashboard/engine/PhabricatorDashboardPanelFerretEngine.php @@ -0,0 +1,18 @@ +setDocumentTitle($panel->getName()); + + $document->addRelationship( + $panel->getIsArchived() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $panel->getPHID(), + PhabricatorDashboardPanelPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } + +} diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php b/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php index 65f698cec9..dd32d1c9dc 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php @@ -34,12 +34,6 @@ final class PhabricatorDashboardPanelQuery return $this; } - public function withNameNgrams($ngrams) { - return $this->withNgramsConstraint( - id(new PhabricatorDashboardPanelNgrams()), - $ngrams); - } - protected function loadPage() { return $this->loadStandardPage($this->newResultObject()); } diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php index 87e908b9c2..dc50fa5d66 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php @@ -42,20 +42,12 @@ final class PhabricatorDashboardPanelSearchEngine $query->withAuthorPHIDs($map['authorPHIDs']); } - if ($map['name'] !== null) { - $query->withNameNgrams($map['name']); - } - return $query; } protected function buildCustomSearchFields() { return array( - id(new PhabricatorSearchTextField()) - ->setLabel(pht('Name Contains')) - ->setKey('name') - ->setDescription(pht('Search for panels by name substring.')), id(new PhabricatorSearchDatasourceField()) ->setLabel(pht('Authored By')) ->setKey('authorPHIDs') diff --git a/src/applications/dashboard/query/PhabricatorDashboardQuery.php b/src/applications/dashboard/query/PhabricatorDashboardQuery.php index df4df155e5..76854bffc1 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardQuery.php +++ b/src/applications/dashboard/query/PhabricatorDashboardQuery.php @@ -34,12 +34,6 @@ final class PhabricatorDashboardQuery return $this; } - public function withNameNgrams($ngrams) { - return $this->withNgramsConstraint( - id(new PhabricatorDashboardNgrams()), - $ngrams); - } - protected function loadPage() { return $this->loadStandardPage($this->newResultObject()); } @@ -70,28 +64,28 @@ final class PhabricatorDashboardQuery if ($this->ids !== null) { $where[] = qsprintf( $conn, - 'id IN (%Ld)', + 'dashboard.id IN (%Ld)', $this->ids); } if ($this->phids !== null) { $where[] = qsprintf( $conn, - 'phid IN (%Ls)', + 'dashboard.phid IN (%Ls)', $this->phids); } if ($this->statuses !== null) { $where[] = qsprintf( $conn, - 'status IN (%Ls)', + 'dashboard.status IN (%Ls)', $this->statuses); } if ($this->authorPHIDs !== null) { $where[] = qsprintf( $conn, - 'authorPHID IN (%Ls)', + 'dashboard.authorPHID IN (%Ls)', $this->authorPHIDs); } diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php index 32bd2e6d6e..ea3f69faab 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php @@ -21,10 +21,6 @@ final class PhabricatorDashboardSearchEngine protected function buildCustomSearchFields() { return array( - id(new PhabricatorSearchTextField()) - ->setLabel(pht('Name Contains')) - ->setKey('name') - ->setDescription(pht('Search for dashboards by name substring.')), id(new PhabricatorSearchDatasourceField()) ->setLabel(pht('Authored By')) ->setKey('authorPHIDs') @@ -93,10 +89,6 @@ final class PhabricatorDashboardSearchEngine $query->withAuthorPHIDs($map['authorPHIDs']); } - if ($map['name'] !== null) { - $query->withNameNgrams($map['name']); - } - if ($map['editable'] !== null) { $query->withCanEdit($map['editable']); } @@ -121,6 +113,17 @@ final class PhabricatorDashboardSearchEngine $handles = $viewer->loadHandles($phids); + if ($dashboards) { + $edge_query = id(new PhabricatorEdgeQuery()) + ->withSourcePHIDs(mpull($dashboards, 'getPHID')) + ->withEdgeTypes( + array( + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, + )); + + $edge_query->execute(); + } + $list = id(new PHUIObjectItemListView()) ->setViewer($viewer); @@ -132,10 +135,11 @@ final class PhabricatorDashboardSearchEngine ->setHref($dashboard->getURI()) ->setObject($dashboard); - $bg_color = 'bg-dark'; if ($dashboard->isArchived()) { $item->setDisabled(true); $bg_color = 'bg-grey'; + } else { + $bg_color = 'bg-dark'; } $icon = id(new PHUIIconView()) @@ -148,6 +152,17 @@ final class PhabricatorDashboardSearchEngine $author_name = $handles[$author_phid]->renderLink(); $item->addByline(pht('Author: %s', $author_name)); + $phid = $dashboard->getPHID(); + $project_phids = $edge_query->getDestinationPHIDs(array($phid)); + $project_handles = $viewer->loadHandles($project_phids); + + $item->addAttribute( + id(new PHUIHandleTagListView()) + ->setLimit(4) + ->setNoDataString(pht('No Tags')) + ->setSlim(true) + ->setHandles($project_handles)); + $list->addItem($item); } @@ -158,24 +173,4 @@ final class PhabricatorDashboardSearchEngine return $result; } - protected function getNewUserBody() { - $create_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Create a Dashboard')) - ->setHref('/dashboard/create/') - ->setColor(PHUIButtonView::GREEN); - - $icon = $this->getApplication()->getIcon(); - $app_name = $this->getApplication()->getName(); - $view = id(new PHUIBigInfoView()) - ->setIcon($icon) - ->setTitle(pht('Welcome to %s', $app_name)) - ->setDescription( - pht('Customize your homepage with different panels and '. - 'search queries.')) - ->addAction($create_button); - - return $view; - } - } diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index c312cf5e2c..4081a40caf 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -10,7 +10,8 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO PhabricatorFlaggableInterface, PhabricatorDestructibleInterface, PhabricatorProjectInterface, - PhabricatorNgramsInterface, + PhabricatorFulltextInterface, + PhabricatorFerretInterface, PhabricatorDashboardPanelContainerInterface { protected $name; @@ -175,21 +176,22 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO $this->delete(); } - -/* -( PhabricatorNgramInterface )------------------------------------------ */ - - - public function newNgrams() { - return array( - id(new PhabricatorDashboardNgrams()) - ->setValue($this->getName()), - ); - } - /* -( PhabricatorDashboardPanelContainerInterface )------------------------ */ public function getDashboardPanelContainerPanelPHIDs() { return $this->getPanelPHIDs(); } +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + public function newFulltextEngine() { + return new PhabricatorDashboardFulltextEngine(); + } + +/* -( PhabricatorFerretInterface )----------------------------------------- */ + + public function newFerretEngine() { + return new PhabricatorDashboardFerretEngine(); + } + } diff --git a/src/applications/dashboard/storage/PhabricatorDashboardNgrams.php b/src/applications/dashboard/storage/PhabricatorDashboardNgrams.php deleted file mode 100644 index 7884ec43f9..0000000000 --- a/src/applications/dashboard/storage/PhabricatorDashboardNgrams.php +++ /dev/null @@ -1,18 +0,0 @@ -saveTransaction(); } - -/* -( PhabricatorNgramInterface )------------------------------------------ */ - - - public function newNgrams() { - return array( - id(new PhabricatorDashboardPanelNgrams()) - ->setValue($this->getName()), - ); - } - /* -( PhabricatorDashboardPanelContainerInterface )------------------------ */ public function getDashboardPanelContainerPanelPHIDs() { return $this->requireImplementation()->getSubpanelPHIDs($this); } +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + public function newFulltextEngine() { + return new PhabricatorDashboardPanelFulltextEngine(); + } + +/* -( PhabricatorFerretInterface )----------------------------------------- */ + + public function newFerretEngine() { + return new PhabricatorDashboardPanelFerretEngine(); + } + } diff --git a/src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php b/src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php deleted file mode 100644 index 536da8b751..0000000000 --- a/src/applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php +++ /dev/null @@ -1,18 +0,0 @@ -applyFerretConstraints( + $query, + id(new PhabricatorDashboard())->newFerretEngine(), + 'title', + $this->getRawQuery()); + $dashboards = $this->executeQuery($query); $results = array(); foreach ($dashboards as $dashboard) { diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php index 744bfe089d..9ad4901bbf 100644 --- a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php @@ -33,7 +33,11 @@ final class PhabricatorDashboardPanelDatasource $id = (int)$id; $query->withIDs(array($id)); } else { - $query->withNameNgrams($raw_query); + $this->applyFerretConstraints( + $query, + id(new PhabricatorDashboardPanel())->newFerretEngine(), + 'title', + $this->getRawQuery()); } $panels = $this->executeQuery($query); diff --git a/src/applications/phid/view/PHUIHandleTagListView.php b/src/applications/phid/view/PHUIHandleTagListView.php index abae359a16..18c53e9b91 100644 --- a/src/applications/phid/view/PHUIHandleTagListView.php +++ b/src/applications/phid/view/PHUIHandleTagListView.php @@ -122,7 +122,7 @@ final class PHUIHandleTagListView extends AphrontTagView { private function newPlaceholderTag() { return id(new PHUITagView()) ->setType(PHUITagView::TYPE_SHADE) - ->setColor(PHUITagView::COLOR_DISABLED) + ->setColor(PHUITagView::COLOR_PLACEHOLDER) ->setSlimShady($this->slim); } diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php index aa309a4bb6..b77ec5d70e 100644 --- a/src/view/phui/PHUITagView.php +++ b/src/view/phui/PHUITagView.php @@ -24,6 +24,7 @@ final class PHUITagView extends AphrontTagView { const COLOR_BLUEGREY = 'bluegrey'; const COLOR_CHECKERED = 'checkered'; const COLOR_DISABLED = 'disabled'; + const COLOR_PLACEHOLDER = 'placeholder'; const COLOR_OBJECT = 'object'; const COLOR_PERSON = 'person'; diff --git a/webroot/rsrc/css/phui/phui-tag-view.css b/webroot/rsrc/css/phui/phui-tag-view.css index 57529645a7..d0b2afce1d 100644 --- a/webroot/rsrc/css/phui/phui-tag-view.css +++ b/webroot/rsrc/css/phui/phui-tag-view.css @@ -441,6 +441,12 @@ a.phui-tag-view:hover.phui-tag-disabled .phui-tag-core { border-color: {$sh-disabledborder}; } +.phui-tag-placeholder .phui-tag-core { + border-color: transparent; + background-color: {$sh-disabledbackground}; + opacity: 0.5; +} + /* - Outline Tags -------------------------------------------------------------- Basic Tag with a bold border and white background