Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14400215
D17520.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.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
Mon, Dec 23, 6:58 PM (14 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6920040
Default Alt Text
D17520.diff (2 KB)
Attached To
Mode
D17520: Add better error checking to 'Add to Dashboard'
Attached
Detach File
Event Timeline
Log In to Comment