mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-02 02:40:58 +01:00
Fix some beta/install Application issues
Summary: Currently, we give you an "Install" button for Beta apps even when "phabricator.show-beta-applications" is disabled. This is unclear. Instead, disable the button and tell the user about the config when it is clicked. Arguably, we should restructure this so you can selectively install "Beta" apps without setting the config, but almost all the beta apps are terrible so just make things consistent for now. Test Plan: Tried to install a beta app without beta apps enabled. Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D5652
This commit is contained in:
parent
9087e4805e
commit
9bbce8de42
2 changed files with 36 additions and 17 deletions
|
@ -36,7 +36,6 @@ final class PhabricatorApplicationDetailViewController
|
||||||
if ($selected->isInstalled()) {
|
if ($selected->isInstalled()) {
|
||||||
$status_tag->setName(pht('Installed'));
|
$status_tag->setName(pht('Installed'));
|
||||||
$status_tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN);
|
$status_tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$status_tag->setName(pht('Uninstalled'));
|
$status_tag->setName(pht('Uninstalled'));
|
||||||
$status_tag->setBackgroundColor(PhabricatorTagView::COLOR_RED);
|
$status_tag->setBackgroundColor(PhabricatorTagView::COLOR_RED);
|
||||||
|
@ -50,7 +49,6 @@ final class PhabricatorApplicationDetailViewController
|
||||||
$header->addTag($beta_tag);
|
$header->addTag($beta_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$header->addTag($status_tag);
|
$header->addTag($status_tag);
|
||||||
|
|
||||||
$properties = $this->buildPropertyView($selected);
|
$properties = $this->buildPropertyView($selected);
|
||||||
|
@ -93,13 +91,20 @@ final class PhabricatorApplicationDetailViewController
|
||||||
->setHref(
|
->setHref(
|
||||||
$this->getApplicationURI(get_class($selected).'/uninstall/')));
|
$this->getApplicationURI(get_class($selected).'/uninstall/')));
|
||||||
} else {
|
} else {
|
||||||
$view->addAction(
|
$action = id(new PhabricatorActionView())
|
||||||
id(new PhabricatorActionView())
|
->setName(pht('Install'))
|
||||||
->setName(pht('Install'))
|
->setIcon('new')
|
||||||
->setIcon('new')
|
->setWorkflow(true)
|
||||||
->setWorkflow(true)
|
->setHref(
|
||||||
->setHref(
|
$this->getApplicationURI(get_class($selected).'/install/'));
|
||||||
$this->getApplicationURI(get_class($selected).'/install/')));
|
|
||||||
|
$beta_enabled = PhabricatorEnv::getEnvConfig(
|
||||||
|
'phabricator.show-beta-applications');
|
||||||
|
if ($selected->isBeta() && !$beta_enabled) {
|
||||||
|
$action->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$view->addAction($action);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$view->addAction(
|
$view->addAction(
|
||||||
|
|
|
@ -23,31 +23,45 @@ final class PhabricatorApplicationUninstallController
|
||||||
|
|
||||||
$view_uri = $this->getApplicationURI('view/'.$this->application);
|
$view_uri = $this->getApplicationURI('view/'.$this->application);
|
||||||
|
|
||||||
if ($request->isDialogFormPost()) {
|
$beta_enabled = PhabricatorEnv::getEnvConfig(
|
||||||
$this->manageApplication();
|
'phabricator.show-beta-applications');
|
||||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dialog = id(new AphrontDialogView())
|
$dialog = id(new AphrontDialogView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->addCancelButton($view_uri);
|
->addCancelButton($view_uri);
|
||||||
|
|
||||||
|
if ($selected->isBeta() && !$beta_enabled) {
|
||||||
|
$dialog
|
||||||
|
->setTitle(pht('Beta Applications Not Enabled'))
|
||||||
|
->appendChild(
|
||||||
|
pht(
|
||||||
|
'To manage beta applications, enable them by setting %s in your '.
|
||||||
|
'Phabricator configuration.',
|
||||||
|
phutil_tag('tt', array(), 'phabricator.show-beta-applications')));
|
||||||
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->isDialogFormPost()) {
|
||||||
|
$this->manageApplication();
|
||||||
|
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->action == 'install') {
|
if ($this->action == 'install') {
|
||||||
if ($selected->canUninstall()) {
|
if ($selected->canUninstall()) {
|
||||||
$dialog->setTitle('Confirmation')
|
$dialog->setTitle('Confirmation')
|
||||||
->appendChild(
|
->appendChild(
|
||||||
'Install '. $selected->getName(). ' application ?')
|
'Install '. $selected->getName(). ' application?')
|
||||||
->addSubmitButton('Install');
|
->addSubmitButton('Install');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$dialog->setTitle('Information')
|
$dialog->setTitle('Information')
|
||||||
->appendChild('You cannot install a installed application.');
|
->appendChild('You cannot install an installed application.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($selected->canUninstall()) {
|
if ($selected->canUninstall()) {
|
||||||
$dialog->setTitle('Confirmation')
|
$dialog->setTitle('Confirmation')
|
||||||
->appendChild(
|
->appendChild(
|
||||||
'Really Uninstall '. $selected->getName(). ' application ?')
|
'Really Uninstall '. $selected->getName(). ' application?')
|
||||||
->addSubmitButton('Uninstall');
|
->addSubmitButton('Uninstall');
|
||||||
} else {
|
} else {
|
||||||
$dialog->setTitle('Information')
|
$dialog->setTitle('Information')
|
||||||
|
@ -65,7 +79,7 @@ final class PhabricatorApplicationUninstallController
|
||||||
$list = $config_entry->getValue();
|
$list = $config_entry->getValue();
|
||||||
$uninstalled = PhabricatorEnv::getEnvConfig($key);
|
$uninstalled = PhabricatorEnv::getEnvConfig($key);
|
||||||
|
|
||||||
if ($uninstalled[$this->application]) {
|
if (isset($uninstalled[$this->application])) {
|
||||||
unset($list[$this->application]);
|
unset($list[$this->application]);
|
||||||
} else {
|
} else {
|
||||||
$list[$this->application] = true;
|
$list[$this->application] = true;
|
||||||
|
|
Loading…
Reference in a new issue