1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Provide a 'no dashboards' fallback state if you can't add any

Summary: Ref T10390. Catch if the user doesn't have any dashboards they can edit and give them a helpful message instead.

Test Plan: Clean install, no dashboards, Click "Add to Dashboard" on ApplicationSearch results, see no dashboards message

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10390

Differential Revision: https://secure.phabricator.com/D17528
This commit is contained in:
Chad Little 2017-03-21 11:24:54 -07:00
parent 3a838ba312
commit 5e423c5fe0

View file

@ -149,6 +149,19 @@ final class PhabricatorDashboardQueryPanelInstallController
$redirect_uri = $engine->getQueryResultsPageURI($v_query); $redirect_uri = $engine->getQueryResultsPageURI($v_query);
if (!$options) {
$notice = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->appendChild(pht('You do not have access to any dashboards. To '.
'continue, please create a dashboard first.'));
return $this->newDialog()
->setTitle(pht('No Dashboards'))
->setWidth(AphrontDialogView::WIDTH_FORM)
->appendChild($notice)
->addCancelButton($redirect_uri);
}
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($viewer) ->setUser($viewer)
->addHiddenInput('engine', $v_engine) ->addHiddenInput('engine', $v_engine)
@ -175,6 +188,7 @@ final class PhabricatorDashboardQueryPanelInstallController
->appendChild($form->buildLayoutView()) ->appendChild($form->buildLayoutView())
->addCancelButton($redirect_uri) ->addCancelButton($redirect_uri)
->addSubmitButton(pht('Add Panel')); ->addSubmitButton(pht('Add Panel'));
} }
} }