Edit dashboard panels in a dialog instead of on a separate page
Summary: When you "Edit Panel" on a dashboard, pop a dialog instead of redirecting to a different page. Test Plan: Edited a panel from a dashboard; edited a panel from the panel workflow. Reviewers: chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D9499
This commit is contained in:
@@ -19,8 +19,10 @@ final class AphrontDialogView extends AphrontView {
|
||||
private $disableWorkflowOnSubmit;
|
||||
private $disableWorkflowOnCancel;
|
||||
private $width = 'default';
|
||||
private $errors;
|
||||
private $errors = array();
|
||||
private $flush;
|
||||
private $validationException;
|
||||
|
||||
|
||||
const WIDTH_DEFAULT = 'default';
|
||||
const WIDTH_FORM = 'form';
|
||||
@@ -162,6 +164,12 @@ final class AphrontDialogView extends AphrontView {
|
||||
return $this->disableWorkflowOnCancel;
|
||||
}
|
||||
|
||||
public function setValidationException(
|
||||
PhabricatorApplicationTransactionValidationException $ex = null) {
|
||||
$this->validationException = $ex;
|
||||
return $this;
|
||||
}
|
||||
|
||||
final public function render() {
|
||||
require_celerity_resource('aphront-dialog-view-css');
|
||||
|
||||
@@ -267,9 +275,19 @@ final class AphrontDialogView extends AphrontView {
|
||||
|
||||
$children = $this->renderChildren();
|
||||
|
||||
if ($this->errors) {
|
||||
$errors = $this->errors;
|
||||
|
||||
$ex = $this->validationException;
|
||||
$exception_errors = null;
|
||||
if ($ex) {
|
||||
foreach ($ex->getErrors() as $error) {
|
||||
$errors[] = $error->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$children = array(
|
||||
id(new AphrontErrorView())->setErrors($this->errors),
|
||||
id(new AphrontErrorView())->setErrors($errors),
|
||||
$children);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user