mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-04 10:58:25 +01:00
Lightly modernize OAuth server application view pages
Summary: Depends on D20624. Fixes T13330. The OAuth client pages are using some out-of-date rendering conventions; update them to modern conventions. Test Plan: Viewed a page, saw a modern header layout + curtain: {F6534135} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13330 Differential Revision: https://secure.phabricator.com/D20625
This commit is contained in:
parent
0e2cb6e7c4
commit
d22f6d219b
1 changed files with 48 additions and 45 deletions
|
@ -15,12 +15,11 @@ final class PhabricatorOAuthClientViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
$header = $this->buildHeaderView($client);
|
$header = $this->buildHeaderView($client);
|
||||||
$actions = $this->buildActionView($client);
|
|
||||||
$properties = $this->buildPropertyListView($client);
|
$properties = $this->buildPropertyListView($client);
|
||||||
$properties->setActionList($actions);
|
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs()
|
||||||
$crumbs->addTextCrumb($client->getName());
|
->addTextCrumb($client->getName())
|
||||||
|
->setBorder(true);
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$client,
|
$client,
|
||||||
|
@ -28,19 +27,27 @@ final class PhabricatorOAuthClientViewController
|
||||||
$timeline->setShouldTerminate(true);
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
$box = id(new PHUIObjectBoxView())
|
$box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->setHeaderText(pht('Details'))
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
->addPropertyList($properties);
|
->addPropertyList($properties);
|
||||||
|
|
||||||
$title = pht('OAuth Application: %s', $client->getName());
|
$title = pht('OAuth Application: %s', $client->getName());
|
||||||
|
|
||||||
return $this->newPage()
|
$curtain = $this->buildCurtain($client);
|
||||||
->setCrumbs($crumbs)
|
|
||||||
->setTitle($title)
|
$columns = id(new PHUITwoColumnView())
|
||||||
->appendChild(
|
->setHeader($header)
|
||||||
|
->setCurtain($curtain)
|
||||||
|
->setMainColumn(
|
||||||
array(
|
array(
|
||||||
$box,
|
$box,
|
||||||
$timeline,
|
$timeline,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
return $this->newPage()
|
||||||
|
->setCrumbs($crumbs)
|
||||||
|
->setTitle($title)
|
||||||
|
->appendChild($columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildHeaderView(PhabricatorOAuthServerClient $client) {
|
private function buildHeaderView(PhabricatorOAuthServerClient $client) {
|
||||||
|
@ -60,8 +67,9 @@ final class PhabricatorOAuthClientViewController
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildActionView(PhabricatorOAuthServerClient $client) {
|
private function buildCurtain(PhabricatorOAuthServerClient $client) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$actions = array();
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
$viewer,
|
$viewer,
|
||||||
|
@ -70,24 +78,19 @@ final class PhabricatorOAuthClientViewController
|
||||||
|
|
||||||
$id = $client->getID();
|
$id = $client->getID();
|
||||||
|
|
||||||
$view = id(new PhabricatorActionListView())
|
$actions[] = id(new PhabricatorActionView())
|
||||||
->setUser($viewer);
|
->setName(pht('Edit Application'))
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setWorkflow(!$can_edit)
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setHref($client->getEditURI());
|
||||||
|
|
||||||
$view->addAction(
|
$actions[] = id(new PhabricatorActionView())
|
||||||
id(new PhabricatorActionView())
|
->setName(pht('Show Application Secret'))
|
||||||
->setName(pht('Edit Application'))
|
->setIcon('fa-eye')
|
||||||
->setIcon('fa-pencil')
|
->setHref($this->getApplicationURI("client/secret/{$id}/"))
|
||||||
->setWorkflow(!$can_edit)
|
->setDisabled(!$can_edit)
|
||||||
->setDisabled(!$can_edit)
|
->setWorkflow(true);
|
||||||
->setHref($client->getEditURI()));
|
|
||||||
|
|
||||||
$view->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Show Application Secret'))
|
|
||||||
->setIcon('fa-eye')
|
|
||||||
->setHref($this->getApplicationURI("client/secret/{$id}/"))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(true));
|
|
||||||
|
|
||||||
$is_disabled = $client->getIsDisabled();
|
$is_disabled = $client->getIsDisabled();
|
||||||
if ($is_disabled) {
|
if ($is_disabled) {
|
||||||
|
@ -100,22 +103,26 @@ final class PhabricatorOAuthClientViewController
|
||||||
|
|
||||||
$disable_uri = $this->getApplicationURI("client/disable/{$id}/");
|
$disable_uri = $this->getApplicationURI("client/disable/{$id}/");
|
||||||
|
|
||||||
$view->addAction(
|
$actions[] = id(new PhabricatorActionView())
|
||||||
id(new PhabricatorActionView())
|
->setName($disable_text)
|
||||||
->setName($disable_text)
|
->setIcon($disable_icon)
|
||||||
->setIcon($disable_icon)
|
->setWorkflow(true)
|
||||||
->setWorkflow(true)
|
->setDisabled(!$can_edit)
|
||||||
->setDisabled(!$can_edit)
|
->setHref($disable_uri);
|
||||||
->setHref($disable_uri));
|
|
||||||
|
|
||||||
$view->addAction(
|
$actions[] = id(new PhabricatorActionView())
|
||||||
id(new PhabricatorActionView())
|
->setName(pht('Generate Test Token'))
|
||||||
->setName(pht('Generate Test Token'))
|
->setIcon('fa-plus')
|
||||||
->setIcon('fa-plus')
|
->setWorkflow(true)
|
||||||
->setWorkflow(true)
|
->setHref($this->getApplicationURI("client/test/{$id}/"));
|
||||||
->setHref($this->getApplicationURI("client/test/{$id}/")));
|
|
||||||
|
|
||||||
return $view;
|
$curtain = $this->newCurtainView($client);
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$curtain->addAction($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $curtain;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildPropertyListView(PhabricatorOAuthServerClient $client) {
|
private function buildPropertyListView(PhabricatorOAuthServerClient $client) {
|
||||||
|
@ -132,10 +139,6 @@ final class PhabricatorOAuthClientViewController
|
||||||
pht('Redirect URI'),
|
pht('Redirect URI'),
|
||||||
$client->getRedirectURI());
|
$client->getRedirectURI());
|
||||||
|
|
||||||
$view->addProperty(
|
|
||||||
pht('Created'),
|
|
||||||
phabricator_datetime($client->getDateCreated(), $viewer));
|
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue