1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-02 02:40:58 +01:00

UI Improvements to Chatlog Application

Summary: Made improvements to the Chatlog application UI. Added Header & crumbs. Added service name and service type to the channel list table.Also made it less ugly :P

Test Plan: By checking out the chatlog application.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5081
This commit is contained in:
Afaque Hussain 2013-02-22 11:10:47 -08:00 committed by epriestley
parent 9b17870611
commit c864a73ad2
3 changed files with 27 additions and 20 deletions

View file

@ -4,12 +4,18 @@ final class PhabricatorChatLogChannelQuery
extends PhabricatorCursorPagedPolicyAwareQuery { extends PhabricatorCursorPagedPolicyAwareQuery {
private $channels; private $channels;
private $channelIDs;
public function withChannelNames(array $channels) { public function withChannelNames(array $channels) {
$this->channels = $channels; $this->channels = $channels;
return $this; return $this;
} }
public function withIDs(array $channel_ids) {
$this->channelIDs = $channel_ids;
return $this;
}
public function loadPage() { public function loadPage() {
$table = new PhabricatorChatLogChannel(); $table = new PhabricatorChatLogChannel();
$conn_r = $table->establishConnection('r'); $conn_r = $table->establishConnection('r');
@ -32,6 +38,14 @@ final class PhabricatorChatLogChannelQuery
$where[] = $this->buildPagingClause($conn_r); $where[] = $this->buildPagingClause($conn_r);
if ($this->channelIDs) {
$where[] = qsprintf(
$conn_r,
'id IN (%Ld)',
$this->channelIDs);
}
if ($this->channels) { if ($this->channels) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn_r,

View file

@ -39,12 +39,13 @@ final class PhabricatorChatLogChannelListController
'', '',
)); ));
$title = pht('Channel List.'); $title = pht('Channel List');
$header = id(new PhabricatorHeaderView()) $header = id(new PhabricatorHeaderView())
->setHeader($title); ->setHeader($title);
$panel = id(new AphrontPanelView()) $panel = id(new AphrontPanelView())
->appendChild($table)
->setNoBackground(true); ->setNoBackground(true);
$crumbs = $this $crumbs = $this
@ -54,16 +55,12 @@ final class PhabricatorChatLogChannelListController
->setName(pht('Channel List')) ->setName(pht('Channel List'))
->setHref($this->getApplicationURI())); ->setHref($this->getApplicationURI()));
$panel->appendChild( return $this->buildStandardPageResponse(
array( array(
$crumbs, $crumbs,
$header, $header,
$table $panel,
)); ),
return $this->buildStandardPageResponse(
$panel,
array( array(
'title' => 'Channel List', 'title' => 'Channel List',
)); ));

View file

@ -4,11 +4,9 @@ final class PhabricatorChatLogChannelLogController
extends PhabricatorChatLogController { extends PhabricatorChatLogController {
private $channelID; private $channelID;
private $channelName;
public function willProcessRequest(array $data) { public function willProcessRequest(array $data) {
$this->channelID = $data['channelID']; $this->channelID = $data['channelID'];
$this->channelName = $data['channelName'];
} }
public function processRequest() { public function processRequest() {
@ -26,15 +24,13 @@ final class PhabricatorChatLogChannelLogController
->setViewer($user) ->setViewer($user)
->withChannelIDs(array($this->channelID)); ->withChannelIDs(array($this->channelID));
$channels = id(new PhabricatorChatLogChannelQuery()) $channel = id(new PhabricatorChatLogChannelQuery())
->setViewer($user) ->setViewer($user)
->execute(); ->withIDs(array($this->channelID))
->executeOne();
foreach ($channels as $channel) { if (!$channel) {
if ($channel->getID() == $this->channelID) { return new Aphront404Response();
$this->channelName = $channel->getChannelName();
break;
}
} }
list($after, $before, $map) = $this->getPagingParameters($request, $query); list($after, $before, $map) = $this->getPagingParameters($request, $query);
@ -138,14 +134,13 @@ final class PhabricatorChatLogChannelLogController
->buildApplicationCrumbs() ->buildApplicationCrumbs()
->addCrumb( ->addCrumb(
id(new PhabricatorCrumbView()) id(new PhabricatorCrumbView())
->setName($this->channelName) ->setName($channel->getChannelName())
->setHref($uri)); ->setHref($uri));
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user) ->setUser($user)
->setMethod('GET') ->setMethod('GET')
->setAction($uri) ->setAction($uri)
->appendChild($crumbs)
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Date') ->setLabel('Date')
@ -158,6 +153,7 @@ final class PhabricatorChatLogChannelLogController
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array( array(
$crumbs,
hsprintf( hsprintf(
'<div class="phabricator-chat-log-panel">%s<br />%s%s</div>', '<div class="phabricator-chat-log-panel">%s<br />%s%s</div>',
$form->render(), $form->render(),