Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14750661
D17520.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D17520.id.diff
View Options
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php b/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php
@@ -12,6 +12,8 @@
$v_engine = $request->getURIData('engineKey');
$v_query = $request->getURIData('queryKey');
+ $e_name = true;
+
// Validate Engines
$engines = PhabricatorApplicationSearchEngine::getAllEngines();
foreach ($engines as $name => $engine) {
@@ -26,8 +28,20 @@
// Validate Queries
$engine = $engines[$v_engine];
$engine->setViewer($viewer);
- $queries = array_keys($engine->loadEnabledNamedQueries());
- if (!in_array($v_query, $queries)) {
+ $good_query = false;
+ if ($engine->isBuiltinQuery($v_engine)) {
+ $good_query = true;
+ } else {
+ $saved_query = id(new PhabricatorSavedQueryQuery())
+ ->setViewer($viewer)
+ ->withEngineClassNames(array($v_engine))
+ ->withQueryKeys(array($v_query))
+ ->executeOne();
+ if ($saved_query) {
+ $good_query = true;
+ }
+ }
+ if (!$good_query) {
return new Aphront404Response();
}
@@ -38,6 +52,7 @@
$v_name = $request->getStr('name');
if (!$v_name) {
$errors[] = pht('You must provide a name for this panel.');
+ $e_name = pht('Required');
}
$dashboard = id(new PhabricatorDashboardQuery())
@@ -127,7 +142,7 @@
$options = mpull($dashboards, 'getName', 'getID');
asort($options);
- $redirect_uri = '#'; // ??
+ $redirect_uri = $engine->getQueryResultsPageURI($v_query);
$form = id(new AphrontFormView())
->setUser($viewer)
@@ -138,7 +153,8 @@
id(new AphrontFormTextControl())
->setLabel(pht('Name'))
->setName('name')
- ->setValue($v_name))
+ ->setValue($v_name)
+ ->setError($e_name))
->appendChild(
id(new AphrontFormSelectControl())
->setUser($this->getViewer())
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 11:55 AM (7 h, 4 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7032539
Default Alt Text
D17520.id.diff (2 KB)
Attached To
Mode
D17520: Add better error checking to 'Add to Dashboard'
Attached
Detach File
Event Timeline
Log In to Comment