Page MenuHomePhabricator

D10953.id26303.diff
No OneTemporary

D10953.id26303.diff

diff --git a/src/applications/passphrase/query/PassphraseCredentialQuery.php b/src/applications/passphrase/query/PassphraseCredentialQuery.php
--- a/src/applications/passphrase/query/PassphraseCredentialQuery.php
+++ b/src/applications/passphrase/query/PassphraseCredentialQuery.php
@@ -9,6 +9,8 @@
private $providesTypes;
private $isDestroyed;
private $allowConduit;
+ private $nameContains;
+ private $descriptionContains;
private $needSecrets;
@@ -42,6 +44,16 @@
return $this;
}
+ public function withNameContains($name_contains) {
+ $this->nameContains = $name_contains;
+ return $this;
+ }
+
+ public function withDescriptionContains($description_contains) {
+ $this->descriptionContains = $description_contains;
+ return $this;
+ }
+
public function needSecrets($need_secrets) {
$this->needSecrets = $need_secrets;
return $this;
@@ -140,6 +152,20 @@
(int)$this->allowConduit);
}
+ if (strlen($this->nameContains)) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'name LIKE %~',
+ $this->nameContains);
+ }
+
+ if (strlen($this->descriptionContains)) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'description LIKE %~',
+ $this->descriptionContains);
+ }
+
return $this->formatWhereClause($where);
}
diff --git a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
--- a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
+++ b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
@@ -17,6 +17,8 @@
$saved->setParameter(
'isDestroyed',
$this->readBoolFromRequest($request, 'isDestroyed'));
+ $saved->setParameter('name', $request->getStr('name'));
+ $saved->setParameter('description', $request->getStr('description'));
return $saved;
}
@@ -29,6 +31,16 @@
$query->withIsDestroyed($destroyed);
}
+ $name = $saved->getParameter('name');
+ if (strlen($name)) {
+ $query->withNameContains($name);
+ }
+
+ $description = $saved->getParameter('description');
+ if (strlen($description)) {
+ $query->withDescriptionContains($description);
+ }
+
return $query;
}
@@ -36,7 +48,11 @@
AphrontFormView $form,
PhabricatorSavedQuery $saved_query) {
- $form->appendChild(
+ $name = $saved_query->getParameter('name');
+ $description = $saved_query->getParameter('description');
+
+ $form
+ ->appendChild(
id(new AphrontFormSelectControl())
->setName('isDestroyed')
->setLabel(pht('Status'))
@@ -46,7 +62,17 @@
'' => pht('Show All Credentials'),
'false' => pht('Show Only Active Credentials'),
'true' => pht('Show Only Destroyed Credentials'),
- )));
+ )))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setName('name')
+ ->setLabel(pht('Name Contains'))
+ ->setValue($name))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setName('description')
+ ->setLabel(pht('Description Contains'))
+ ->setValue($description));
}
protected function getURI($path) {

File Metadata

Mime Type
text/plain
Expires
Jul 22 2025, 6:35 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8553646
Default Alt Text
D10953.id26303.diff (3 KB)

Event Timeline