From 6e25d4c67b1a158c86c275b4e9c76288b2f297cf Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 5 Sep 2017 19:30:52 -0700 Subject: [PATCH] Update Settings for WHITE_CONFIG style boxes Summary: Updates settings panel UI for new white box, cleans up other various UI nitpicks. Test Plan: Click through each setting that had a local setting page. Edit Engine pages will follow up on another diff. Reviewers: epriestley Reviewed By: epriestley Spies: Korvin Differential Revision: https://secure.phabricator.com/D18526 --- resources/celerity/map.php | 6 +-- .../PhabricatorConduitTokensSettingsPanel.php | 11 ++--- ...OAuthServerAuthorizationsSettingsPanel.php | 4 +- .../PhabricatorActivitySettingsPanel.php | 5 +-- ...PhabricatorEmailAddressesSettingsPanel.php | 24 +++++------ ...abricatorEmailPreferencesSettingsPanel.php | 2 +- ...abricatorExternalAccountsSettingsPanel.php | 35 ++++++---------- .../PhabricatorMultiFactorSettingsPanel.php | 37 +++++++---------- .../PhabricatorNotificationsSettingsPanel.php | 19 +++------ .../PhabricatorPasswordSettingsPanel.php | 40 ++++++++++--------- .../panel/PhabricatorSSHKeysSettingsPanel.php | 9 +---- .../PhabricatorSessionsSettingsPanel.php | 27 +++++-------- .../panel/PhabricatorSettingsPanel.php | 17 ++++++++ .../panel/PhabricatorTokensSettingsPanel.php | 18 +++------ webroot/rsrc/css/phui/phui-header-view.css | 4 -- 15 files changed, 109 insertions(+), 149 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 8ca8f081df..d82341b47d 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'e68cf1fa', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => 'ebbf04f7', + 'core.pkg.css' => '03264689', 'core.pkg.js' => '6c085267', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '45951e9e', @@ -157,7 +157,7 @@ return array( 'rsrc/css/phui/phui-form-view.css' => 'ae9f8d16', 'rsrc/css/phui/phui-form.css' => '7aaa04e3', 'rsrc/css/phui/phui-head-thing.css' => 'fd311e5f', - 'rsrc/css/phui/phui-header-view.css' => '369275d6', + 'rsrc/css/phui/phui-header-view.css' => '67fab16d', 'rsrc/css/phui/phui-hovercard.css' => 'f0592bcf', 'rsrc/css/phui/phui-icon-set-selector.css' => '87db8fee', 'rsrc/css/phui/phui-icon.css' => '5c4a5de6', @@ -843,7 +843,7 @@ return array( 'phui-form-css' => '7aaa04e3', 'phui-form-view-css' => 'ae9f8d16', 'phui-head-thing-view-css' => 'fd311e5f', - 'phui-header-view-css' => '369275d6', + 'phui-header-view-css' => '67fab16d', 'phui-hovercard' => '1bd28176', 'phui-hovercard-view-css' => 'f0592bcf', 'phui-icon-set-selector-css' => '87db8fee', diff --git a/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php b/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php index 3da467e4f4..2075582386 100644 --- a/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php +++ b/src/applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php @@ -88,18 +88,19 @@ final class PhabricatorConduitTokensSettingsPanel )); $generate_button = id(new PHUIButtonView()) - ->setText(pht('Generate API Token')) + ->setText(pht('Generate Token')) ->setHref('/conduit/token/edit/?objectPHID='.$user->getPHID()) ->setTag('a') ->setWorkflow(true) ->setIcon('fa-plus'); $terminate_button = id(new PHUIButtonView()) - ->setText(pht('Terminate All Tokens')) + ->setText(pht('Terminate Tokens')) ->setHref('/conduit/token/terminate/?objectPHID='.$user->getPHID()) ->setTag('a') ->setWorkflow(true) - ->setIcon('fa-exclamation-triangle'); + ->setIcon('fa-exclamation-triangle') + ->setColor(PHUIButtonView::RED); $header = id(new PHUIHeaderView()) ->setHeader(pht('Active API Tokens')) @@ -108,8 +109,8 @@ final class PhabricatorConduitTokensSettingsPanel $panel = id(new PHUIObjectBoxView()) ->setHeader($header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($table); + ->setBackground(PHUIObjectBoxView::WHITE_CONFIG) + ->appendChild($table); return $panel; } diff --git a/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php b/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php index cfc0bc91a8..37e85ab53b 100644 --- a/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php +++ b/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php @@ -134,8 +134,8 @@ final class PhabricatorOAuthServerAuthorizationsSettingsPanel $panel = id(new PHUIObjectBoxView()) ->setHeader($header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($table); + ->setBackground(PHUIObjectBoxView::WHITE_CONFIG) + ->appendChild($table); return $panel; } diff --git a/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php b/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php index 0b3533f287..50f951d661 100644 --- a/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorActivitySettingsPanel.php @@ -46,10 +46,7 @@ final class PhabricatorActivitySettingsPanel extends PhabricatorSettingsPanel { ->setLogs($logs) ->setHandles($handles); - $panel = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Account Activity Logs')) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($table); + $panel = $this->newBox(pht('Account Activity Logs'), $table); $pager_box = id(new PHUIBoxView()) ->addMargin(PHUI::MARGIN_LARGE) diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php index 66fd0396ad..1bdb95f568 100644 --- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php @@ -138,24 +138,18 @@ final class PhabricatorEmailAddressesSettingsPanel $editable, )); - $view = new PHUIObjectBoxView(); - $header = new PHUIHeaderView(); - $header->setHeader(pht('Email Addresses')); - + $button = null; if ($editable) { - $button = new PHUIButtonView(); - $button->setText(pht('Add New Address')); - $button->setTag('a'); - $button->setHref($uri->alter('new', 'true')); - $button->setIcon('fa-plus'); - $button->addSigil('workflow'); - $header->addActionLink($button); + $button = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-plus') + ->setText(pht('Add New Address')) + ->setHref($uri->alter('new', 'true')) + ->addSigil('workflow') + ->setColor(PHUIButtonView::GREY); } - $view->setHeader($header); - $view->setTable($table); - $view->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); - return $view; + return $this->newBox(pht('Email Addresses'), $table, array($button)); } private function returnNewAddressResponse( diff --git a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php index 77364e0aa0..faa79889ed 100644 --- a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php @@ -136,7 +136,7 @@ final class PhabricatorEmailPreferencesSettingsPanel ->setHeaderText(pht('Email Preferences')) ->setFormSaved($request->getStr('saved')) ->setFormErrors($errors) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->setBackground(PHUIObjectBoxView::WHITE_CONFIG) ->setForm($form); return $form_box; diff --git a/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php b/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php index 068c58d549..e380248a83 100644 --- a/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php @@ -31,12 +31,10 @@ final class PhabricatorExternalAccountsSettingsPanel )) ->execute(); - $linked_head = id(new PHUIHeaderView()) - ->setHeader(pht('Linked Accounts and Authentication')); + $linked_head = pht('Linked Accounts and Authentication'); $linked = id(new PHUIObjectItemListView()) ->setUser($viewer) - ->setFlush(true) ->setNoDataString(pht('You have no linked accounts.')); $login_accounts = 0; @@ -47,7 +45,7 @@ final class PhabricatorExternalAccountsSettingsPanel } foreach ($accounts as $account) { - $item = id(new PHUIObjectItemView()); + $item = new PHUIObjectItemView(); $provider = idx($providers, $account->getProviderKey()); if ($provider) { @@ -94,12 +92,10 @@ final class PhabricatorExternalAccountsSettingsPanel $linked->addItem($item); } - $linkable_head = id(new PHUIHeaderView()) - ->setHeader(pht('Add External Account')); + $linkable_head = pht('Add External Account'); $linkable = id(new PHUIObjectItemListView()) ->setUser($viewer) - ->setFlush(true) ->setNoDataString( pht('Your account is linked with all available providers.')); @@ -118,26 +114,19 @@ final class PhabricatorExternalAccountsSettingsPanel $link_uri = '/auth/link/'.$provider->getProviderKey().'/'; - $item = id(new PHUIObjectItemView()); - $item->setHeader($provider->getProviderName()); - $item->setHref($link_uri); - $item->addAction( - id(new PHUIListItemView()) - ->setIcon('fa-link') - ->setHref($link_uri)); + $item = id(new PHUIObjectItemView()) + ->setHeader($provider->getProviderName()) + ->setHref($link_uri) + ->addAction( + id(new PHUIListItemView()) + ->setIcon('fa-link') + ->setHref($link_uri)); $linkable->addItem($item); } - $linked_box = id(new PHUIObjectBoxView()) - ->setHeader($linked_head) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setObjectList($linked); - - $linkable_box = id(new PHUIObjectBoxView()) - ->setHeader($linkable_head) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setObjectList($linkable); + $linked_box = $this->newBox($linked_head, $linked); + $linkable_box = $this->newBox($linkable_head, $linkable); return array( $linked_box, diff --git a/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php b/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php index 68d1812616..ae653e0f70 100644 --- a/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php @@ -101,34 +101,27 @@ final class PhabricatorMultiFactorSettingsPanel true, )); - $panel = new PHUIObjectBoxView(); - $header = new PHUIHeaderView(); - $help_uri = PhabricatorEnv::getDoclink( 'User Guide: Multi-Factor Authentication'); - $help_button = id(new PHUIButtonView()) + $buttons = array(); + + $buttons[] = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-plus') + ->setText(pht('Add Auth Factor')) + ->setHref($this->getPanelURI('?new=true')) + ->setWorkflow(true) + ->setColor(PHUIButtonView::GREY); + + $buttons[] = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-book') ->setText(pht('Help')) ->setHref($help_uri) - ->setTag('a') - ->setIcon('fa-info-circle'); + ->setColor(PHUIButtonView::GREY); - $create_button = id(new PHUIButtonView()) - ->setText(pht('Add Authentication Factor')) - ->setHref($this->getPanelURI('?new=true')) - ->setTag('a') - ->setWorkflow(true) - ->setIcon('fa-plus'); - - $header->setHeader(pht('Authentication Factors')); - $header->addActionLink($help_button); - $header->addActionLink($create_button); - - $panel->setHeader($header); - $panel->setTable($table); - $panel->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); - - return $panel; + return $this->newBox(pht('Authentication Factors'), $table, $buttons); } private function processNew(AphrontRequest $request) { diff --git a/src/applications/settings/panel/PhabricatorNotificationsSettingsPanel.php b/src/applications/settings/panel/PhabricatorNotificationsSettingsPanel.php index d61ece6da5..e75c2b99ee 100644 --- a/src/applications/settings/panel/PhabricatorNotificationsSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorNotificationsSettingsPanel.php @@ -152,24 +152,17 @@ final class PhabricatorNotificationsSettingsPanel id(new AphrontFormSubmitControl()) ->setValue(pht('Save Preference'))); - $test_button = id(new PHUIButtonView()) + $button = id(new PHUIButtonView()) ->setTag('a') + ->setIcon('fa-send-o') ->setWorkflow(true) ->setText(pht('Send Test Notification')) ->setHref('/notification/test/') - ->setIcon('fa-exclamation-triangle'); + ->setColor(PHUIButtonView::GREY); - $form_box = id(new PHUIObjectBoxView()) - ->setHeader( - id(new PHUIHeaderView()) - ->setHeader(pht('Notifications')) - ->addActionLink($test_button)) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->appendChild(array( - $saved_box, - $status_box, - $form, - )); + $form_content = array($saved_box, $status_box, $form); + $form_box = $this->newBox( + pht('Notifications'), $form_content, array($button)); $browser_status_box = id(new PHUIInfoView()) ->setID($browser_status_id) diff --git a/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php b/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php index 2a1b482c80..c1250fca23 100644 --- a/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorPasswordSettingsPanel.php @@ -91,7 +91,7 @@ final class PhabricatorPasswordSettingsPanel extends PhabricatorSettingsPanel { // is changed here the CSRF token check will fail. $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); - $envelope = new PhutilOpaqueEnvelope($pass); + $envelope = new PhutilOpaqueEnvelope($pass); id(new PhabricatorUserEditor()) ->setActor($user) ->changePassword($user, $envelope); @@ -172,45 +172,47 @@ final class PhabricatorPasswordSettingsPanel extends PhabricatorSettingsPanel { ->setDisableAutocomplete(true) ->setLabel(pht('New Password')) ->setError($e_new) - ->setName('new_pw')); - $form + ->setName('new_pw')) ->appendChild( id(new AphrontFormPasswordControl()) ->setDisableAutocomplete(true) ->setLabel(pht('Confirm Password')) ->setCaption($len_caption) ->setError($e_conf) - ->setName('conf_pw')); - $form + ->setName('conf_pw')) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Change Password'))); - $form->appendChild( - id(new AphrontFormStaticControl()) - ->setLabel(pht('Current Algorithm')) - ->setValue(PhabricatorPasswordHasher::getCurrentAlgorithmName( - new PhutilOpaqueEnvelope($user->getPasswordHash())))); + $properties = id(new PHUIPropertyListView()); - $form->appendChild( - id(new AphrontFormStaticControl()) - ->setLabel(pht('Best Available Algorithm')) - ->setValue(PhabricatorPasswordHasher::getBestAlgorithmName())); + $properties->addProperty( + pht('Current Algorithm'), + PhabricatorPasswordHasher::getCurrentAlgorithmName( + new PhutilOpaqueEnvelope($user->getPasswordHash()))); - $form->appendRemarkupInstructions( - pht( - 'NOTE: Changing your password will terminate any other outstanding '. - 'login sessions.')); + $properties->addProperty( + pht('Best Available Algorithm'), + PhabricatorPasswordHasher::getBestAlgorithmName()); + $info_view = id(new PHUIInfoView()) + ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) + ->appendChild( + pht('Changing your password will terminate any other outstanding '. + 'login sessions.')); + + $algo_box = $this->newBox(pht('Password Algorithms'), $properties); $form_box = id(new PHUIObjectBoxView()) ->setHeaderText(pht('Change Password')) ->setFormSaved($request->getStr('saved')) ->setFormErrors($errors) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->setBackground(PHUIObjectBoxView::WHITE_CONFIG) ->setForm($form); return array( $form_box, + $algo_box, + $info_view, ); } diff --git a/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php b/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php index 3e339e9145..13944411ed 100644 --- a/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php @@ -45,14 +45,7 @@ final class PhabricatorSSHKeysSettingsPanel extends PhabricatorSettingsPanel { $viewer, $user); - $header->setHeader(pht('SSH Public Keys')); - $header->addActionLink($ssh_actions); - - $panel->setHeader($header); - $panel->setTable($table); - $panel->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); - - return $panel; + return $this->newBox(pht('SSH Public Keys'), $table, array($ssh_actions)); } } diff --git a/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php b/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php index fb60e40d81..eab18002a1 100644 --- a/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorSessionsSettingsPanel.php @@ -112,34 +112,27 @@ final class PhabricatorSessionsSettingsPanel extends PhabricatorSettingsPanel { 'action', )); - $terminate_button = id(new PHUIButtonView()) + $buttons = array(); + $buttons[] = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-warning') ->setText(pht('Terminate All Sessions')) ->setHref('/auth/session/terminate/all/') - ->setTag('a') ->setWorkflow(true) - ->setIcon('fa-exclamation-triangle'); - - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Active Login Sessions')) - ->addActionLink($terminate_button); + ->setColor(PHUIButtonView::RED); $hisec = ($viewer->getSession()->getHighSecurityUntil() - time()); if ($hisec > 0) { - $hisec_button = id(new PHUIButtonView()) + $buttons[] = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-lock') ->setText(pht('Leave High Security')) ->setHref('/auth/session/downgrade/') - ->setTag('a') ->setWorkflow(true) - ->setIcon('fa-lock'); - $header->addActionLink($hisec_button); + ->setColor(PHUIButtonView::RED); } - $panel = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->setTable($table) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); - - return $panel; + return $this->newBox(pht('Active Login Sessions'), $table, $buttons); } } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanel.php b/src/applications/settings/panel/PhabricatorSettingsPanel.php index eea48e540f..d2008f8857 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanel.php @@ -281,4 +281,21 @@ abstract class PhabricatorSettingsPanel extends Phobject { $editor->applyTransactions($preferences, $xactions); } + + public function newBox($title, $content, $actions = array()) { + $header = id(new PHUIHeaderView()) + ->setHeader($title); + + foreach ($actions as $action) { + $header->addActionLink($action); + } + + $view = id(new PHUIObjectBoxView()) + ->setHeader($header) + ->appendChild($content) + ->setBackground(PHUIObjectBoxView::WHITE_CONFIG); + + return $view; + } + } diff --git a/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php b/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php index d2cc0dedb6..f2021bafa5 100644 --- a/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorTokensSettingsPanel.php @@ -71,23 +71,15 @@ final class PhabricatorTokensSettingsPanel extends PhabricatorSettingsPanel { 'action', )); - $terminate_button = id(new PHUIButtonView()) + $button = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-warning') ->setText(pht('Revoke All')) ->setHref('/auth/token/revoke/all/') - ->setTag('a') ->setWorkflow(true) - ->setIcon('fa-exclamation-triangle'); + ->setColor(PHUIButtonView::RED); - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Temporary Tokens')) - ->addActionLink($terminate_button); - - $panel = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($table); - - return $panel; + return $this->newBox(pht('Temporary Tokens'), $table, array($button)); } } diff --git a/webroot/rsrc/css/phui/phui-header-view.css b/webroot/rsrc/css/phui/phui-header-view.css index e0fae307e2..18b1464e53 100644 --- a/webroot/rsrc/css/phui/phui-header-view.css +++ b/webroot/rsrc/css/phui/phui-header-view.css @@ -341,10 +341,6 @@ body .phui-header-shell.phui-bleed-header color: {$blacktext}; } -.phui-profile-header .phui-header-col3 { - vertical-align: top; -} - .phui-header-view .phui-tag-indigo a { color: {$sh-indigotext}; }