1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

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
This commit is contained in:
epriestley 2019-04-12 12:42:02 -07:00
parent 80b7274e0b
commit f13709b13b
29 changed files with 232 additions and 124 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array( 'names' => array(
'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.css' => '3c8a0668',
'conpherence.pkg.js' => '020aebcf', 'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '4011a01e', 'core.pkg.css' => '77c4f199',
'core.pkg.js' => '69247edd', 'core.pkg.js' => '69247edd',
'differential.pkg.css' => '8d8360fb', 'differential.pkg.css' => '8d8360fb',
'differential.pkg.js' => '67e02996', 'differential.pkg.js' => '67e02996',
@ -173,7 +173,7 @@ return array(
'rsrc/css/phui/phui-segment-bar-view.css' => '5166b370', 'rsrc/css/phui/phui-segment-bar-view.css' => '5166b370',
'rsrc/css/phui/phui-spacing.css' => 'b05cadc3', 'rsrc/css/phui/phui-spacing.css' => 'b05cadc3',
'rsrc/css/phui/phui-status.css' => 'e5ff8be0', '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-timeline-view.css' => '1e348e4b',
'rsrc/css/phui/phui-two-column-view.css' => '01e6991e', 'rsrc/css/phui/phui-two-column-view.css' => '01e6991e',
'rsrc/css/phui/workboards/phui-workboard-color.css' => 'e86de308', 'rsrc/css/phui/workboards/phui-workboard-color.css' => 'e86de308',
@ -862,7 +862,7 @@ return array(
'phui-segment-bar-view-css' => '5166b370', 'phui-segment-bar-view-css' => '5166b370',
'phui-spacing-css' => 'b05cadc3', 'phui-spacing-css' => 'b05cadc3',
'phui-status-list-view-css' => 'e5ff8be0', 'phui-status-list-view-css' => 'e5ff8be0',
'phui-tag-view-css' => '29409667', 'phui-tag-view-css' => '8519160a',
'phui-theme-css' => '35883b37', 'phui-theme-css' => '35883b37',
'phui-timeline-view-css' => '1e348e4b', 'phui-timeline-view-css' => '1e348e4b',
'phui-two-column-view-css' => '01e6991e', 'phui-two-column-view-css' => '01e6991e',

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboard_ngrams;

View file

@ -0,0 +1 @@
DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboardpanel_ngrams;

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -2919,7 +2919,9 @@ phutil_register_library_map(array(
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/dashboard/PhabricatorDashboardEditController.php', 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/dashboard/PhabricatorDashboardEditController.php',
'PhabricatorDashboardEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardEditEngine.php', 'PhabricatorDashboardEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardEditEngine.php',
'PhabricatorDashboardFavoritesInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardFavoritesInstallWorkflow.php', 'PhabricatorDashboardFavoritesInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardFavoritesInstallWorkflow.php',
'PhabricatorDashboardFerretEngine' => 'applications/dashboard/engine/PhabricatorDashboardFerretEngine.php',
'PhabricatorDashboardFullLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardFullLayoutMode.php', 'PhabricatorDashboardFullLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardFullLayoutMode.php',
'PhabricatorDashboardFulltextEngine' => 'applications/dashboard/engine/PhabricatorDashboardFulltextEngine.php',
'PhabricatorDashboardHalfLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardHalfLayoutMode.php', 'PhabricatorDashboardHalfLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardHalfLayoutMode.php',
'PhabricatorDashboardHomeInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardHomeInstallWorkflow.php', 'PhabricatorDashboardHomeInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardHomeInstallWorkflow.php',
'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php', 'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php',
@ -2930,7 +2932,6 @@ phutil_register_library_map(array(
'PhabricatorDashboardLayoutTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardLayoutTransaction.php', 'PhabricatorDashboardLayoutTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardLayoutTransaction.php',
'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php', 'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php',
'PhabricatorDashboardNameTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php', 'PhabricatorDashboardNameTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php',
'PhabricatorDashboardNgrams' => 'applications/dashboard/storage/PhabricatorDashboardNgrams.php',
'PhabricatorDashboardObjectInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php', 'PhabricatorDashboardObjectInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php',
'PhabricatorDashboardOneThirdLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardOneThirdLayoutMode.php', 'PhabricatorDashboardOneThirdLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardOneThirdLayoutMode.php',
'PhabricatorDashboardPanel' => 'applications/dashboard/storage/PhabricatorDashboardPanel.php', 'PhabricatorDashboardPanel' => 'applications/dashboard/storage/PhabricatorDashboardPanel.php',
@ -2941,9 +2942,10 @@ phutil_register_library_map(array(
'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php', 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php',
'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php', 'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php',
'PhabricatorDashboardPanelEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.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', 'PhabricatorDashboardPanelListController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelListController.php',
'PhabricatorDashboardPanelNameTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php', 'PhabricatorDashboardPanelNameTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php',
'PhabricatorDashboardPanelNgrams' => 'applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php',
'PhabricatorDashboardPanelPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php', 'PhabricatorDashboardPanelPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php',
'PhabricatorDashboardPanelPropertyTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelPropertyTransaction.php', 'PhabricatorDashboardPanelPropertyTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelPropertyTransaction.php',
'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php', 'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php',
@ -8900,7 +8902,8 @@ phutil_register_library_map(array(
'PhabricatorFlaggableInterface', 'PhabricatorFlaggableInterface',
'PhabricatorDestructibleInterface', 'PhabricatorDestructibleInterface',
'PhabricatorProjectInterface', 'PhabricatorProjectInterface',
'PhabricatorNgramsInterface', 'PhabricatorFulltextInterface',
'PhabricatorFerretInterface',
'PhabricatorDashboardPanelContainerInterface', 'PhabricatorDashboardPanelContainerInterface',
), ),
'PhabricatorDashboardAdjustController' => 'PhabricatorDashboardController', 'PhabricatorDashboardAdjustController' => 'PhabricatorDashboardController',
@ -8916,7 +8919,9 @@ phutil_register_library_map(array(
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
'PhabricatorDashboardEditEngine' => 'PhabricatorEditEngine', 'PhabricatorDashboardEditEngine' => 'PhabricatorEditEngine',
'PhabricatorDashboardFavoritesInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow', 'PhabricatorDashboardFavoritesInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow',
'PhabricatorDashboardFerretEngine' => 'PhabricatorFerretEngine',
'PhabricatorDashboardFullLayoutMode' => 'PhabricatorDashboardLayoutMode', 'PhabricatorDashboardFullLayoutMode' => 'PhabricatorDashboardLayoutMode',
'PhabricatorDashboardFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorDashboardHalfLayoutMode' => 'PhabricatorDashboardLayoutMode', 'PhabricatorDashboardHalfLayoutMode' => 'PhabricatorDashboardLayoutMode',
'PhabricatorDashboardHomeInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow', 'PhabricatorDashboardHomeInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow',
'PhabricatorDashboardIconSet' => 'PhabricatorIconSet', 'PhabricatorDashboardIconSet' => 'PhabricatorIconSet',
@ -8927,7 +8932,6 @@ phutil_register_library_map(array(
'PhabricatorDashboardLayoutTransaction' => 'PhabricatorDashboardTransactionType', 'PhabricatorDashboardLayoutTransaction' => 'PhabricatorDashboardTransactionType',
'PhabricatorDashboardListController' => 'PhabricatorDashboardController', 'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
'PhabricatorDashboardNameTransaction' => 'PhabricatorDashboardTransactionType', 'PhabricatorDashboardNameTransaction' => 'PhabricatorDashboardTransactionType',
'PhabricatorDashboardNgrams' => 'PhabricatorSearchNgrams',
'PhabricatorDashboardObjectInstallWorkflow' => 'PhabricatorDashboardInstallWorkflow', 'PhabricatorDashboardObjectInstallWorkflow' => 'PhabricatorDashboardInstallWorkflow',
'PhabricatorDashboardOneThirdLayoutMode' => 'PhabricatorDashboardLayoutMode', 'PhabricatorDashboardOneThirdLayoutMode' => 'PhabricatorDashboardLayoutMode',
'PhabricatorDashboardPanel' => array( 'PhabricatorDashboardPanel' => array(
@ -8936,7 +8940,8 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorFlaggableInterface', 'PhabricatorFlaggableInterface',
'PhabricatorDestructibleInterface', 'PhabricatorDestructibleInterface',
'PhabricatorNgramsInterface', 'PhabricatorFulltextInterface',
'PhabricatorFerretInterface',
'PhabricatorDashboardPanelContainerInterface', 'PhabricatorDashboardPanelContainerInterface',
), ),
'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController',
@ -8945,9 +8950,10 @@ phutil_register_library_map(array(
'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController',
'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine', 'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine',
'PhabricatorDashboardPanelFerretEngine' => 'PhabricatorFerretEngine',
'PhabricatorDashboardPanelFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController',
'PhabricatorDashboardPanelNameTransaction' => 'PhabricatorDashboardPanelTransactionType', 'PhabricatorDashboardPanelNameTransaction' => 'PhabricatorDashboardPanelTransactionType',
'PhabricatorDashboardPanelNgrams' => 'PhabricatorSearchNgrams',
'PhabricatorDashboardPanelPHIDType' => 'PhabricatorPHIDType', 'PhabricatorDashboardPanelPHIDType' => 'PhabricatorPHIDType',
'PhabricatorDashboardPanelPropertyTransaction' => 'PhabricatorDashboardPanelTransactionType', 'PhabricatorDashboardPanelPropertyTransaction' => 'PhabricatorDashboardPanelTransactionType',
'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',

View file

@ -0,0 +1,18 @@
<?php
final class PhabricatorDashboardFerretEngine
extends PhabricatorFerretEngine {
public function getApplicationName() {
return 'dashboard';
}
public function getScopeName() {
return 'dashboard';
}
public function newSearchEngine() {
return new PhabricatorDashboardSearchEngine();
}
}

View file

@ -0,0 +1,23 @@
<?php
final class PhabricatorDashboardFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$dashboard = $object;
$document->setDocumentTitle($dashboard->getName());
$document->addRelationship(
$dashboard->isArchived()
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
$dashboard->getPHID(),
PhabricatorDashboardDashboardPHIDType::TYPECONST,
PhabricatorTime::getNow());
}
}

View file

@ -0,0 +1,18 @@
<?php
final class PhabricatorDashboardPanelFerretEngine
extends PhabricatorFerretEngine {
public function getApplicationName() {
return 'dashboard';
}
public function getScopeName() {
return 'panel';
}
public function newSearchEngine() {
return new PhabricatorDashboardPanelSearchEngine();
}
}

View file

@ -0,0 +1,23 @@
<?php
final class PhabricatorDashboardPanelFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$panel = $object;
$document->setDocumentTitle($panel->getName());
$document->addRelationship(
$panel->getIsArchived()
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
$panel->getPHID(),
PhabricatorDashboardPanelPHIDType::TYPECONST,
PhabricatorTime::getNow());
}
}

View file

@ -34,12 +34,6 @@ final class PhabricatorDashboardPanelQuery
return $this; return $this;
} }
public function withNameNgrams($ngrams) {
return $this->withNgramsConstraint(
id(new PhabricatorDashboardPanelNgrams()),
$ngrams);
}
protected function loadPage() { protected function loadPage() {
return $this->loadStandardPage($this->newResultObject()); return $this->loadStandardPage($this->newResultObject());
} }

View file

@ -42,20 +42,12 @@ final class PhabricatorDashboardPanelSearchEngine
$query->withAuthorPHIDs($map['authorPHIDs']); $query->withAuthorPHIDs($map['authorPHIDs']);
} }
if ($map['name'] !== null) {
$query->withNameNgrams($map['name']);
}
return $query; return $query;
} }
protected function buildCustomSearchFields() { protected function buildCustomSearchFields() {
return array( return array(
id(new PhabricatorSearchTextField())
->setLabel(pht('Name Contains'))
->setKey('name')
->setDescription(pht('Search for panels by name substring.')),
id(new PhabricatorSearchDatasourceField()) id(new PhabricatorSearchDatasourceField())
->setLabel(pht('Authored By')) ->setLabel(pht('Authored By'))
->setKey('authorPHIDs') ->setKey('authorPHIDs')

View file

@ -34,12 +34,6 @@ final class PhabricatorDashboardQuery
return $this; return $this;
} }
public function withNameNgrams($ngrams) {
return $this->withNgramsConstraint(
id(new PhabricatorDashboardNgrams()),
$ngrams);
}
protected function loadPage() { protected function loadPage() {
return $this->loadStandardPage($this->newResultObject()); return $this->loadStandardPage($this->newResultObject());
} }
@ -70,28 +64,28 @@ final class PhabricatorDashboardQuery
if ($this->ids !== null) { if ($this->ids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'id IN (%Ld)', 'dashboard.id IN (%Ld)',
$this->ids); $this->ids);
} }
if ($this->phids !== null) { if ($this->phids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'phid IN (%Ls)', 'dashboard.phid IN (%Ls)',
$this->phids); $this->phids);
} }
if ($this->statuses !== null) { if ($this->statuses !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'status IN (%Ls)', 'dashboard.status IN (%Ls)',
$this->statuses); $this->statuses);
} }
if ($this->authorPHIDs !== null) { if ($this->authorPHIDs !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'authorPHID IN (%Ls)', 'dashboard.authorPHID IN (%Ls)',
$this->authorPHIDs); $this->authorPHIDs);
} }

View file

@ -21,10 +21,6 @@ final class PhabricatorDashboardSearchEngine
protected function buildCustomSearchFields() { protected function buildCustomSearchFields() {
return array( return array(
id(new PhabricatorSearchTextField())
->setLabel(pht('Name Contains'))
->setKey('name')
->setDescription(pht('Search for dashboards by name substring.')),
id(new PhabricatorSearchDatasourceField()) id(new PhabricatorSearchDatasourceField())
->setLabel(pht('Authored By')) ->setLabel(pht('Authored By'))
->setKey('authorPHIDs') ->setKey('authorPHIDs')
@ -93,10 +89,6 @@ final class PhabricatorDashboardSearchEngine
$query->withAuthorPHIDs($map['authorPHIDs']); $query->withAuthorPHIDs($map['authorPHIDs']);
} }
if ($map['name'] !== null) {
$query->withNameNgrams($map['name']);
}
if ($map['editable'] !== null) { if ($map['editable'] !== null) {
$query->withCanEdit($map['editable']); $query->withCanEdit($map['editable']);
} }
@ -121,6 +113,17 @@ final class PhabricatorDashboardSearchEngine
$handles = $viewer->loadHandles($phids); $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()) $list = id(new PHUIObjectItemListView())
->setViewer($viewer); ->setViewer($viewer);
@ -132,10 +135,11 @@ final class PhabricatorDashboardSearchEngine
->setHref($dashboard->getURI()) ->setHref($dashboard->getURI())
->setObject($dashboard); ->setObject($dashboard);
$bg_color = 'bg-dark';
if ($dashboard->isArchived()) { if ($dashboard->isArchived()) {
$item->setDisabled(true); $item->setDisabled(true);
$bg_color = 'bg-grey'; $bg_color = 'bg-grey';
} else {
$bg_color = 'bg-dark';
} }
$icon = id(new PHUIIconView()) $icon = id(new PHUIIconView())
@ -148,6 +152,17 @@ final class PhabricatorDashboardSearchEngine
$author_name = $handles[$author_phid]->renderLink(); $author_name = $handles[$author_phid]->renderLink();
$item->addByline(pht('Author: %s', $author_name)); $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); $list->addItem($item);
} }
@ -158,24 +173,4 @@ final class PhabricatorDashboardSearchEngine
return $result; 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;
}
} }

View file

@ -10,7 +10,8 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO
PhabricatorFlaggableInterface, PhabricatorFlaggableInterface,
PhabricatorDestructibleInterface, PhabricatorDestructibleInterface,
PhabricatorProjectInterface, PhabricatorProjectInterface,
PhabricatorNgramsInterface, PhabricatorFulltextInterface,
PhabricatorFerretInterface,
PhabricatorDashboardPanelContainerInterface { PhabricatorDashboardPanelContainerInterface {
protected $name; protected $name;
@ -175,21 +176,22 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO
$this->delete(); $this->delete();
} }
/* -( PhabricatorNgramInterface )------------------------------------------ */
public function newNgrams() {
return array(
id(new PhabricatorDashboardNgrams())
->setValue($this->getName()),
);
}
/* -( PhabricatorDashboardPanelContainerInterface )------------------------ */ /* -( PhabricatorDashboardPanelContainerInterface )------------------------ */
public function getDashboardPanelContainerPanelPHIDs() { public function getDashboardPanelContainerPanelPHIDs() {
return $this->getPanelPHIDs(); return $this->getPanelPHIDs();
} }
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PhabricatorDashboardFulltextEngine();
}
/* -( PhabricatorFerretInterface )----------------------------------------- */
public function newFerretEngine() {
return new PhabricatorDashboardFerretEngine();
}
} }

View file

@ -1,18 +0,0 @@
<?php
final class PhabricatorDashboardNgrams
extends PhabricatorSearchNgrams {
public function getNgramKey() {
return 'dashboard';
}
public function getColumnName() {
return 'name';
}
public function getApplicationName() {
return 'dashboard';
}
}

View file

@ -10,7 +10,8 @@ final class PhabricatorDashboardPanel
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorFlaggableInterface, PhabricatorFlaggableInterface,
PhabricatorDestructibleInterface, PhabricatorDestructibleInterface,
PhabricatorNgramsInterface, PhabricatorFulltextInterface,
PhabricatorFerretInterface,
PhabricatorDashboardPanelContainerInterface { PhabricatorDashboardPanelContainerInterface {
protected $name; protected $name;
@ -155,21 +156,22 @@ final class PhabricatorDashboardPanel
$this->saveTransaction(); $this->saveTransaction();
} }
/* -( PhabricatorNgramInterface )------------------------------------------ */
public function newNgrams() {
return array(
id(new PhabricatorDashboardPanelNgrams())
->setValue($this->getName()),
);
}
/* -( PhabricatorDashboardPanelContainerInterface )------------------------ */ /* -( PhabricatorDashboardPanelContainerInterface )------------------------ */
public function getDashboardPanelContainerPanelPHIDs() { public function getDashboardPanelContainerPanelPHIDs() {
return $this->requireImplementation()->getSubpanelPHIDs($this); return $this->requireImplementation()->getSubpanelPHIDs($this);
} }
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PhabricatorDashboardPanelFulltextEngine();
}
/* -( PhabricatorFerretInterface )----------------------------------------- */
public function newFerretEngine() {
return new PhabricatorDashboardPanelFerretEngine();
}
} }

View file

@ -1,18 +0,0 @@
<?php
final class PhabricatorDashboardPanelNgrams
extends PhabricatorSearchNgrams {
public function getNgramKey() {
return 'dashboardpanel';
}
public function getColumnName() {
return 'name';
}
public function getApplicationName() {
return 'dashboard';
}
}

View file

@ -18,6 +18,12 @@ final class PhabricatorDashboardDatasource
public function loadResults() { public function loadResults() {
$query = id(new PhabricatorDashboardQuery()); $query = id(new PhabricatorDashboardQuery());
$this->applyFerretConstraints(
$query,
id(new PhabricatorDashboard())->newFerretEngine(),
'title',
$this->getRawQuery());
$dashboards = $this->executeQuery($query); $dashboards = $this->executeQuery($query);
$results = array(); $results = array();
foreach ($dashboards as $dashboard) { foreach ($dashboards as $dashboard) {

View file

@ -33,7 +33,11 @@ final class PhabricatorDashboardPanelDatasource
$id = (int)$id; $id = (int)$id;
$query->withIDs(array($id)); $query->withIDs(array($id));
} else { } else {
$query->withNameNgrams($raw_query); $this->applyFerretConstraints(
$query,
id(new PhabricatorDashboardPanel())->newFerretEngine(),
'title',
$this->getRawQuery());
} }
$panels = $this->executeQuery($query); $panels = $this->executeQuery($query);

View file

@ -122,7 +122,7 @@ final class PHUIHandleTagListView extends AphrontTagView {
private function newPlaceholderTag() { private function newPlaceholderTag() {
return id(new PHUITagView()) return id(new PHUITagView())
->setType(PHUITagView::TYPE_SHADE) ->setType(PHUITagView::TYPE_SHADE)
->setColor(PHUITagView::COLOR_DISABLED) ->setColor(PHUITagView::COLOR_PLACEHOLDER)
->setSlimShady($this->slim); ->setSlimShady($this->slim);
} }

View file

@ -24,6 +24,7 @@ final class PHUITagView extends AphrontTagView {
const COLOR_BLUEGREY = 'bluegrey'; const COLOR_BLUEGREY = 'bluegrey';
const COLOR_CHECKERED = 'checkered'; const COLOR_CHECKERED = 'checkered';
const COLOR_DISABLED = 'disabled'; const COLOR_DISABLED = 'disabled';
const COLOR_PLACEHOLDER = 'placeholder';
const COLOR_OBJECT = 'object'; const COLOR_OBJECT = 'object';
const COLOR_PERSON = 'person'; const COLOR_PERSON = 'person';

View file

@ -441,6 +441,12 @@ a.phui-tag-view:hover.phui-tag-disabled .phui-tag-core {
border-color: {$sh-disabledborder}; border-color: {$sh-disabledborder};
} }
.phui-tag-placeholder .phui-tag-core {
border-color: transparent;
background-color: {$sh-disabledbackground};
opacity: 0.5;
}
/* - Outline Tags -------------------------------------------------------------- /* - Outline Tags --------------------------------------------------------------
Basic Tag with a bold border and white background Basic Tag with a bold border and white background