mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
Show which capability is being edited in custom policy dialog
Summary: Fixes T7867. Test Plan: {F392844} Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7867 Differential Revision: https://secure.phabricator.com/D12716
This commit is contained in:
parent
a5402c46b2
commit
7c063c7d63
4 changed files with 30 additions and 25 deletions
|
@ -116,7 +116,7 @@ return array(
|
|||
'rsrc/css/font/font-source-sans-pro.css' => '8906c07b',
|
||||
'rsrc/css/font/phui-font-icon-base.css' => '3dad2ae3',
|
||||
'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82',
|
||||
'rsrc/css/layout/phabricator-hovercard-view.css' => 'f5f18f7d',
|
||||
'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670',
|
||||
'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c',
|
||||
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
|
||||
'rsrc/css/phui/calendar/phui-calendar-day.css' => '75b8cc4a',
|
||||
|
@ -411,7 +411,7 @@ return array(
|
|||
'rsrc/js/application/phortune/behavior-stripe-payment-form.js' => '3f5d6dbf',
|
||||
'rsrc/js/application/phortune/behavior-test-payment-form.js' => 'fc91ab6c',
|
||||
'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef',
|
||||
'rsrc/js/application/policy/behavior-policy-control.js' => '1ed33505',
|
||||
'rsrc/js/application/policy/behavior-policy-control.js' => '9a340b3d',
|
||||
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '5e9f347c',
|
||||
'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b',
|
||||
'rsrc/js/application/projects/behavior-project-boards.js' => '60292820',
|
||||
|
@ -639,7 +639,7 @@ return array(
|
|||
'javelin-behavior-pholio-mock-view' => 'e58bf807',
|
||||
'javelin-behavior-phui-object-box-tabs' => '2bfa2836',
|
||||
'javelin-behavior-phui-timeline-dropdown-menu' => '4d94d9c3',
|
||||
'javelin-behavior-policy-control' => '1ed33505',
|
||||
'javelin-behavior-policy-control' => '9a340b3d',
|
||||
'javelin-behavior-policy-rule-editor' => '5e9f347c',
|
||||
'javelin-behavior-ponder-votebox' => '4e9b766b',
|
||||
'javelin-behavior-project-boards' => '60292820',
|
||||
|
@ -734,7 +734,7 @@ return array(
|
|||
'phabricator-filetree-view-css' => 'fccf9f82',
|
||||
'phabricator-flag-css' => '5337623f',
|
||||
'phabricator-hovercard' => '7e8468ae',
|
||||
'phabricator-hovercard-view-css' => 'f5f18f7d',
|
||||
'phabricator-hovercard-view-css' => '44394670',
|
||||
'phabricator-keyboard-shortcut' => '1ae869f2',
|
||||
'phabricator-keyboard-shortcut-manager' => 'c1700f6f',
|
||||
'phabricator-main-menu-view' => '663e3810',
|
||||
|
@ -954,15 +954,6 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-reactor-dom',
|
||||
),
|
||||
'1ed33505' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'phuix-dropdown-menu',
|
||||
'phuix-action-list-view',
|
||||
'phuix-action-view',
|
||||
'javelin-workflow',
|
||||
),
|
||||
'2035b9cb' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
@ -1604,6 +1595,15 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-reactor-dom',
|
||||
),
|
||||
'9a340b3d' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'phuix-dropdown-menu',
|
||||
'phuix-action-list-view',
|
||||
'phuix-action-view',
|
||||
'javelin-workflow',
|
||||
),
|
||||
'9c2623f4' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
|
|
@ -3,13 +3,7 @@
|
|||
final class PhabricatorPolicyEditController
|
||||
extends PhabricatorPolicyController {
|
||||
|
||||
private $phid;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->phid = idx($data, 'phid');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
|
||||
|
@ -29,10 +23,11 @@ final class PhabricatorPolicyEditController
|
|||
'value' => null,
|
||||
);
|
||||
|
||||
if ($this->phid) {
|
||||
$phid = $request->getURIData('phid');
|
||||
if ($phid) {
|
||||
$policies = id(new PhabricatorPolicyQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($this->phid))
|
||||
->withPHIDs(array($phid))
|
||||
->execute();
|
||||
if (!$policies) {
|
||||
return new Aphront404Response();
|
||||
|
@ -208,10 +203,18 @@ final class PhabricatorPolicyEditController
|
|||
'defaultRule' => $default_rule,
|
||||
));
|
||||
|
||||
$title = pht('Custom Policy');
|
||||
|
||||
$key = $request->getStr('capability');
|
||||
if ($key) {
|
||||
$capability = PhabricatorPolicyCapability::getCapabilityByKey($key);
|
||||
$title = pht('Custom "%s" Policy', $capability->getCapabilityName());
|
||||
}
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setWidth(AphrontDialogView::WIDTH_FULL)
|
||||
->setUser($viewer)
|
||||
->setTitle(pht('Edit Policy'))
|
||||
->setTitle($title)
|
||||
->appendChild($form)
|
||||
->addSubmitButton(pht('Save Policy'))
|
||||
->addCancelButton('#');
|
||||
|
|
|
@ -179,6 +179,7 @@ final class AphrontFormPolicyControl extends AphrontFormControl {
|
|||
'icons' => $icons,
|
||||
'labels' => $labels,
|
||||
'value' => $this->getValue(),
|
||||
'capability' => $this->capability,
|
||||
'customPlaceholder' => $this->getCustomPolicyPlaceholder(),
|
||||
));
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ JX.behavior('policy-control', function(config) {
|
|||
var onselect;
|
||||
if (group == 'custom') {
|
||||
onselect = JX.bind(null, function(phid) {
|
||||
var uri = get_custom_uri(phid);
|
||||
var uri = get_custom_uri(phid, config.capability);
|
||||
|
||||
new JX.Workflow(uri)
|
||||
.setHandler(function(response) {
|
||||
|
@ -100,11 +100,12 @@ JX.behavior('policy-control', function(config) {
|
|||
/**
|
||||
* Get the workflow URI to create or edit a policy with a given PHID.
|
||||
*/
|
||||
var get_custom_uri = function(phid) {
|
||||
var get_custom_uri = function(phid, capability) {
|
||||
var uri = '/policy/edit/';
|
||||
if (phid != config.customPlaceholder) {
|
||||
uri += phid + '/';
|
||||
}
|
||||
uri += '?capability=' + capability;
|
||||
return uri;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue