Page MenuHomePhabricator

D19368.id46330.diff
No OneTemporary

D19368.id46330.diff

diff --git a/src/applications/almanac/query/AlmanacDeviceQuery.php b/src/applications/almanac/query/AlmanacDeviceQuery.php
--- a/src/applications/almanac/query/AlmanacDeviceQuery.php
+++ b/src/applications/almanac/query/AlmanacDeviceQuery.php
@@ -8,6 +8,7 @@
private $names;
private $namePrefix;
private $nameSuffix;
+ private $isClusterDevice;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -40,6 +41,11 @@
$ngrams);
}
+ public function withIsClusterDevice($is_cluster_device) {
+ $this->isClusterDevice = $is_cluster_device;
+ return $this;
+ }
+
public function newResultObject() {
return new AlmanacDevice();
}
@@ -90,6 +96,13 @@
$this->nameSuffix);
}
+ if ($this->isClusterDevice !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'device.isBoundToClusterService = %d',
+ (int)$this->isClusterDevice);
+ }
+
return $where;
}
diff --git a/src/applications/almanac/query/AlmanacDeviceSearchEngine.php b/src/applications/almanac/query/AlmanacDeviceSearchEngine.php
--- a/src/applications/almanac/query/AlmanacDeviceSearchEngine.php
+++ b/src/applications/almanac/query/AlmanacDeviceSearchEngine.php
@@ -25,6 +25,19 @@
->setLabel(pht('Exact Names'))
->setKey('names')
->setDescription(pht('Search for devices with specific names.')),
+ id(new PhabricatorSearchSelectField())
+ ->setLabel(pht('Cluster Device'))
+ ->setKey('isClusterDevice')
+ ->setOptions($this->getDeviceOptions())
+ ->setDefault('both'),
+ );
+ }
+
+ private function getDeviceOptions() {
+ return array(
+ 'true' => pht('Cluster Devices Only'),
+ 'false' => pht('Non-cluster Devices Only'),
+ 'both' => pht('Both Cluster and Non-cluster Devices'),
);
}
@@ -39,6 +52,15 @@
$query->withNames($map['names']);
}
+ switch ($map['isClusterDevice']) {
+ case 'true':
+ $query->withIsClusterDevice(true);
+ break;
+ case 'false':
+ $query->withIsClusterDevice(false);
+ break;
+ }
+
return $query;
}

File Metadata

Mime Type
text/plain
Expires
Mar 8 2025, 3:00 AM (6 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7366750
Default Alt Text
D19368.id46330.diff (2 KB)

Event Timeline