Allow custom queries to be deleted

Summary:
Ref T2625. Currently, custom saved queries can be edited but not deleted. Allow them to be deleted. Also:

  - Clean up an unused property in `PhabricatorPasteViewController`.
  - Fix an issue with left nav highlighting of builtin queries.
  - Improve submit behavior for edits.
  - Add a cancel button on edits.

Test Plan: Saved, edited and deleted queries.

Reviewers: btrahan, blc

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2625

Differential Revision: https://secure.phabricator.com/D6059
This commit is contained in:
epriestley
2013-05-27 13:42:44 -07:00
parent 451ddd76bf
commit 3db82cb2ec
8 changed files with 99 additions and 8 deletions

View File

@@ -38,6 +38,11 @@ final class PhabricatorPasteQueriesController
$item->setBarColor('grey');
} else {
$item->addIcon('none', $date_created);
$item->addAction(
id(new PhabricatorMenuItemView())
->setIcon('delete')
->setHref('/search/delete/'.$named_query->getQueryKey().'/')
->setWorkflow(true));
$item->addAction(
id(new PhabricatorMenuItemView())
->setIcon('edit')

View File

@@ -2,13 +2,12 @@
final class PhabricatorPasteViewController extends PhabricatorPasteController {
private $id;
public function shouldAllowPublic() {
return true;
}
private $id;
private $handles;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}

View File

@@ -84,6 +84,10 @@ final class PhabricatorPasteSearchEngine
return '/paste/query/'.$query->getQueryKey().'/';
}
public function getQueryManagementURI() {
return '/paste/savedqueries/';
}
public function getBuiltinQueryNames() {
$names = array(
'all' => pht('All Pastes'),
@@ -99,6 +103,7 @@ final class PhabricatorPasteSearchEngine
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'all':