@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add isClusterDevice to Almanac query

Summary: Ref T13076. This will be used by the metric collection system to iterate over the cluster devices.

Test Plan: Created some cluster and non-cluster devices, searched and saw expected results.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T13076

Differential Revision: https://secure.phabricator.com/D19368

+24
+13
src/applications/almanac/query/AlmanacDeviceQuery.php
··· 8 8 private $names; 9 9 private $namePrefix; 10 10 private $nameSuffix; 11 + private $isClusterDevice; 11 12 12 13 public function withIDs(array $ids) { 13 14 $this->ids = $ids; ··· 38 39 return $this->withNgramsConstraint( 39 40 new AlmanacDeviceNameNgrams(), 40 41 $ngrams); 42 + } 43 + 44 + public function withIsClusterDevice($is_cluster_device) { 45 + $this->isClusterDevice = $is_cluster_device; 46 + return $this; 41 47 } 42 48 43 49 public function newResultObject() { ··· 88 94 $conn, 89 95 'device.name LIKE %<', 90 96 $this->nameSuffix); 97 + } 98 + 99 + if ($this->isClusterDevice !== null) { 100 + $where[] = qsprintf( 101 + $conn, 102 + 'device.isBoundToClusterService = %d', 103 + (int)$this->isClusterDevice); 91 104 } 92 105 93 106 return $where;
+11
src/applications/almanac/query/AlmanacDeviceSearchEngine.php
··· 25 25 ->setLabel(pht('Exact Names')) 26 26 ->setKey('names') 27 27 ->setDescription(pht('Search for devices with specific names.')), 28 + id(new PhabricatorSearchThreeStateField()) 29 + ->setLabel(pht('Cluster Device')) 30 + ->setKey('isClusterDevice') 31 + ->setOptions( 32 + pht('Both Cluster and Non-cluster Devices'), 33 + pht('Cluster Devices Only'), 34 + pht('Non-cluster Devices Only')), 28 35 ); 29 36 } 30 37 ··· 37 44 38 45 if ($map['names']) { 39 46 $query->withNames($map['names']); 47 + } 48 + 49 + if ($map['isClusterDevice'] !== null) { 50 + $query->withIsClusterDevice($map['isClusterDevice']); 40 51 } 41 52 42 53 return $query;