1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-19 18:28:39 +01:00

Modernize "Test Console" and fix a minor display bug with "Always"

Summary:
  - Use the box view in the test console.
  - Let the test console load tasks and mocks. We should move this to the adapters (`canAdaptObject($object)` or something).
  - Fix a minor issue with "Always": hiding the whole cell could make the table layout weird in Safari, at least. Just hide the select instead.

Test Plan:
  - Used test console on task.
  - Used test console on mock.
  - Created (silly) rule with "Always" and also some other conditions.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7220
This commit is contained in:
epriestley 2013-10-04 15:17:01 -07:00
parent cad9e548bc
commit a235768d58
3 changed files with 21 additions and 21 deletions

View file

@ -1176,7 +1176,7 @@ celerity_register_resource_map(array(
),
'herald-rule-editor' =>
array(
'uri' => '/res/36222dde/rsrc/js/application/herald/HeraldRuleEditor.js',
'uri' => '/res/c42c0444/rsrc/js/application/herald/HeraldRuleEditor.js',
'type' => 'js',
'requires' =>
array(

View file

@ -31,6 +31,9 @@ final class HeraldTestConsoleController extends HeraldController {
}
if (!$errors) {
// TODO: Let the adapters claim objects instead.
if ($object instanceof DifferentialRevision) {
$adapter = HeraldDifferentialRevisionAdapter::newLegacyAdapter(
$object,
@ -43,6 +46,12 @@ final class HeraldTestConsoleController extends HeraldController {
$object->getRepository(),
$object,
$data);
} else if ($object instanceof ManiphestTask) {
$adapter = id(new HeraldManiphestTaskAdapter())
->setTask($object);
} else if ($object instanceof PholioMock) {
$adapter = id(new HeraldPholioMockAdapter())
->setMock($object);
} else {
throw new Exception("Can not build adapter for object!");
}
@ -77,10 +86,10 @@ final class HeraldTestConsoleController extends HeraldController {
$error_view = null;
}
$text = pht('Enter an object to test rules '.
'for, like a Diffusion commit (e.g., rX123) or a '.
'Differential revision (e.g., D123). You will be shown the '.
'results of a dry run on the object.');
$text = pht(
'Enter an object to test rules for, like a Diffusion commit (e.g., '.
'rX123) or a Differential revision (e.g., D123). You will be shown '.
'the results of a dry run on the object.');
$form = id(new AphrontFormView())
->setUser($user)
@ -96,13 +105,10 @@ final class HeraldTestConsoleController extends HeraldController {
id(new AphrontFormSubmitControl())
->setValue(pht('Test Rules')));
$nav = $this->buildSideNavView();
$nav->selectFilter('test');
$nav->appendChild(
array(
$error_view,
$form,
));
$box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Herald Test Console'))
->setFormError($error_view)
->setForm($form);
$crumbs = id($this->buildApplicationCrumbs())
->addCrumb(
@ -112,10 +118,9 @@ final class HeraldTestConsoleController extends HeraldController {
->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('Test Console')));
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage(
$nav,
$box,
array(
'title' => pht('Test Console'),
'device' => true,

View file

@ -165,13 +165,8 @@ JX.install('HeraldRuleEditor', {
this._onconditionchange(r);
var condition_name = this._config.conditions[row_id][1];
switch (condition_name) {
case 'unconditionally':
JX.DOM.hide(condition_cell);
break;
default:
JX.DOM.show(condition_cell);
break;
if (condition_name == 'unconditionally') {
JX.DOM.hide(condition_select);
}
},
_onconditionchange : function(r) {