mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
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
This commit is contained in:
parent
c46be2a70b
commit
0bf0718fad
2 changed files with 24 additions and 0 deletions
|
@ -8,6 +8,7 @@ final class AlmanacDeviceQuery
|
||||||
private $names;
|
private $names;
|
||||||
private $namePrefix;
|
private $namePrefix;
|
||||||
private $nameSuffix;
|
private $nameSuffix;
|
||||||
|
private $isClusterDevice;
|
||||||
|
|
||||||
public function withIDs(array $ids) {
|
public function withIDs(array $ids) {
|
||||||
$this->ids = $ids;
|
$this->ids = $ids;
|
||||||
|
@ -40,6 +41,11 @@ final class AlmanacDeviceQuery
|
||||||
$ngrams);
|
$ngrams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withIsClusterDevice($is_cluster_device) {
|
||||||
|
$this->isClusterDevice = $is_cluster_device;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function newResultObject() {
|
public function newResultObject() {
|
||||||
return new AlmanacDevice();
|
return new AlmanacDevice();
|
||||||
}
|
}
|
||||||
|
@ -90,6 +96,13 @@ final class AlmanacDeviceQuery
|
||||||
$this->nameSuffix);
|
$this->nameSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->isClusterDevice !== null) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn,
|
||||||
|
'device.isBoundToClusterService = %d',
|
||||||
|
(int)$this->isClusterDevice);
|
||||||
|
}
|
||||||
|
|
||||||
return $where;
|
return $where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,13 @@ final class AlmanacDeviceSearchEngine
|
||||||
->setLabel(pht('Exact Names'))
|
->setLabel(pht('Exact Names'))
|
||||||
->setKey('names')
|
->setKey('names')
|
||||||
->setDescription(pht('Search for devices with specific names.')),
|
->setDescription(pht('Search for devices with specific names.')),
|
||||||
|
id(new PhabricatorSearchThreeStateField())
|
||||||
|
->setLabel(pht('Cluster Device'))
|
||||||
|
->setKey('isClusterDevice')
|
||||||
|
->setOptions(
|
||||||
|
pht('Both Cluster and Non-cluster Devices'),
|
||||||
|
pht('Cluster Devices Only'),
|
||||||
|
pht('Non-cluster Devices Only')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +46,10 @@ final class AlmanacDeviceSearchEngine
|
||||||
$query->withNames($map['names']);
|
$query->withNames($map['names']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($map['isClusterDevice'] !== null) {
|
||||||
|
$query->withIsClusterDevice($map['isClusterDevice']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue