diff --git a/src/applications/config/controller/PhabricatorConfigWelcomeController.php b/src/applications/config/controller/PhabricatorConfigWelcomeController.php index 357f6f129a..010f3f7a5a 100644 --- a/src/applications/config/controller/PhabricatorConfigWelcomeController.php +++ b/src/applications/config/controller/PhabricatorConfigWelcomeController.php @@ -1,411 +1,411 @@ getViewer(); $nav = $this->buildSideNavView(); $nav->selectFilter('welcome/'); $title = pht('Installation Guide'); $header = id(new PHUIHeaderView()) ->setHeader($title) ->setProfileHeader(true); $crumbs = $this ->buildApplicationCrumbs() ->addTextCrumb($title) ->setBorder(true); $content = id(new PhabricatorConfigPageView()) ->setHeader($header) ->setContent($this->buildWelcomeScreen($request)); return $this->newPage() ->setTitle($title) ->setCrumbs($crumbs) ->setNavigation($nav) ->appendChild($content) ->addClass('white-background'); } public function buildWelcomeScreen(AphrontRequest $request) { $viewer = $request->getUser(); $this->requireResource('config-welcome-css'); $content = pht( "=== Install Phabricator ===\n\n". "You have successfully installed Phabricator. This screen will guide ". "you through configuration and orientation. ". "These steps are optional, and you can go through them in any order. ". "If you want to get back to this screen later on, you can find it in ". "the **Config** application under **Welcome Screen**."); $setup = array(); $setup[] = $this->newItem( $request, 'fa-check-square-o green', $content); $issues_resolved = !PhabricatorSetupCheck::getOpenSetupIssueKeys(); $setup_href = PhabricatorEnv::getURI('/config/issue/'); if ($issues_resolved) { $content = pht( "=== Resolve Setup Issues ===\n\n". "You've resolved (or ignored) all outstanding setup issues. ". "You can review issues in the **Config** application, under ". "**[[ %s | Setup Issues ]]**.", $setup_href); $icon = 'fa-check-square-o green'; } else { $content = pht( "=== Resolve Setup Issues ===\n\n". "You have some unresolved setup issues to take care of. Click ". "the link in the yellow banner at the top of the screen to see ". "them, or find them in the **Config** application under ". "**[[ %s | Setup Issues ]]**. ". "Although most setup issues should be resolved, sometimes an issue ". "is not applicable to an install. ". "If you don't intend to fix a setup issue (or don't want to fix ". "it for now), you can use the \"Ignore\" action to mark it as ". "something you don't plan to deal with.", $setup_href); $icon = 'fa-warning red'; } $setup[] = $this->newItem( $request, $icon, $content); $configs = id(new PhabricatorAuthProviderConfigQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->execute(); $auth_href = PhabricatorEnv::getURI('/auth/'); $have_auth = (bool)$configs; if ($have_auth) { $content = pht( "=== Login and Registration ===\n\n". "You've configured at least one authentication provider, so users ". "can register or log in. ". "To configure more providers or adjust settings, use the ". "**[[ %s | Auth Application ]]**.", $auth_href); $icon = 'fa-check-square-o green'; } else { $content = pht( "=== Login and Registration ===\n\n". "You haven't configured any authentication providers yet. ". "Authentication providers allow users to register accounts and ". "log in to Phabricator. You can configure Phabricator to accept ". "credentials like username and password, LDAP, or Google OAuth. ". "You can configure authentication using the ". "**[[ %s | Auth Application ]]**.", $auth_href); $icon = 'fa-warning red'; } $setup[] = $this->newItem( $request, $icon, $content); $config_href = PhabricatorEnv::getURI('/config/'); // Just load any config value at all; if one exists the install has figured // out how to configure things. $have_config = (bool)id(new PhabricatorConfigEntry())->loadAllWhere( '1 = 1 LIMIT 1'); if ($have_config) { $content = pht( "=== Configure Phabricator Settings ===\n\n". "You've configured at least one setting from the web interface. ". "To configure more settings later, use the ". "**[[ %s | Config Application ]]**.", $config_href); $icon = 'fa-check-square-o green'; } else { $content = pht( "=== Configure Phabricator Settings ===\n\n". 'Many aspects of Phabricator are configurable. To explore and '. 'adjust settings, use the **[[ %s | Config Application ]]**.', $config_href); $icon = 'fa-info-circle'; } $setup[] = $this->newItem( $request, $icon, $content); $settings_href = PhabricatorEnv::getURI('/settings/'); $preferences = id(new PhabricatorUserPreferencesQuery()) ->setViewer($viewer) ->withUsers(array($viewer)) ->executeOne(); $have_settings = ($preferences && $preferences->getPreferences()); if ($have_settings) { $content = pht( "=== Adjust Account Settings ===\n\n". "You've adjusted at least one setting on your account. ". "To make more adjustments, visit the ". "**[[ %s | Settings Application ]]**.", $settings_href); $icon = 'fa-check-square-o green'; } else { $content = pht( "=== Adjust Account Settings ===\n\n". 'You can configure settings for your account by clicking the '. 'wrench icon in the main menu bar, or visiting the '. '**[[ %s | Settings Application ]]** directly.', $settings_href); $icon = 'fa-info-circle'; } $setup[] = $this->newItem( $request, $icon, $content); $dashboard_href = PhabricatorEnv::getURI('/dashboard/'); $have_dashboard = (bool)PhabricatorDashboardInstall::getDashboard( $viewer, PhabricatorHomeApplication::DASHBOARD_DEFAULT, 'PhabricatorHomeApplication'); if ($have_dashboard) { $content = pht( "=== Customize Home Page ===\n\n". "You've installed a default dashboard to replace this welcome screen ". "on the home page. ". "You can still visit the welcome screen here at any time if you ". "have steps you want to complete later, or if you feel lonely. ". "If you've changed your mind about the dashboard you installed, ". "you can install a different default dashboard with the ". "**[[ %s | Dashboards Application ]]**.", $dashboard_href); $icon = 'fa-check-square-o green'; } else { $content = pht( "=== Customize Home Page ===\n\n". "When you're done setting things up, you can create a custom ". "dashboard and install it. Your dashboard will replace this ". "welcome screen on the Phabricator home page. ". "Dashboards can show users the information that's most important to ". "your organization. You can configure them to display things like: ". "a custom welcome message, a feed of recent activity, or a list of ". "open tasks, waiting reviews, recent commits, and so on. ". "After you install a default dashboard, it will replace this page. ". "You can find this page later by visiting the **Config** ". "application, under **Welcome Page**. ". "To get started building a dashboard, use the ". "**[[ %s | Dashboards Application ]]**. ", $dashboard_href); $icon = 'fa-info-circle'; } $setup[] = $this->newItem( $request, $icon, $content); $apps_href = PhabricatorEnv::getURI('/applications/'); $content = pht( "=== Explore Applications ===\n\n". "Phabricator is a large suite of applications that work together to ". "help you develop software, manage tasks, and communicate. A few of ". "the most commonly used applications are pinned to the left navigation ". "bar by default.\n\n". "To explore all of the Phabricator applications, adjust settings, or ". "uninstall applications you don't plan to use, visit the ". "**[[ %s | Applications Application ]]**. You can also click the ". "**Applications** button in the left navigation menu, or search for an ". "application by name in the main menu bar. ", $apps_href); $explore = array(); $explore[] = $this->newItem( $request, 'fa-globe', $content); // TODO: Restore some sort of "Support" link here, but just nuke it for // now as we figure stuff out. $differential_uri = PhabricatorEnv::getURI('/differential/'); $differential_create_uri = PhabricatorEnv::getURI( '/differential/diff/create/'); $differential_all_uri = PhabricatorEnv::getURI('/differential/query/all/'); $differential_user_guide = PhabricatorEnv::getDoclink( 'Differential User Guide'); $differential_vs_uri = PhabricatorEnv::getDoclink( 'User Guide: Review vs Audit'); $quick = array(); $quick[] = $this->newItem( $request, 'fa-gear', pht( "=== Quick Start: Code Review ===\n\n". "Review code with **[[ %s | Differential ]]**. ". "Engineers can use Differential to share, review, and approve ". "changes to source code. ". "To get started with code review:\n\n". " - **[[ %s | Create a Revision ]]** //(Copy and paste a diff from ". " the command line into the web UI to quickly get a feel for ". " review.)//\n". " - **[[ %s | View All Revisions ]]**\n\n". "For more information, see these articles in the documentation:\n\n". " - **[[ %s | Differential User Guide ]]**, for a general overview ". " of Differential.\n". " - **[[ %s | User Guide: Review vs Audit ]]**, for a discussion ". " of different code review workflows.", $differential_uri, $differential_create_uri, $differential_all_uri, $differential_user_guide, $differential_vs_uri)); $maniphest_uri = PhabricatorEnv::getURI('/maniphest/'); $maniphest_create_uri = PhabricatorEnv::getURI('/maniphest/task/edit/'); $maniphest_all_uri = PhabricatorEnv::getURI('/maniphest/query/all/'); $quick[] = $this->newItem( $request, 'fa-anchor', pht( "=== Quick Start: Bugs and Tasks ===\n\n". "Track bugs and tasks in Phabricator with ". "**[[ %s | Maniphest ]]**. ". "Users in all roles can use Maniphest to manage current and ". "planned work and to track bugs and issues. ". "To get started with bugs and tasks:\n\n". " - **[[ %s | Create a Task ]]**\n". " - **[[ %s | View All Tasks ]]**\n", $maniphest_uri, $maniphest_create_uri, $maniphest_all_uri)); $pholio_uri = PhabricatorEnv::getURI('/pholio/'); $pholio_create_uri = PhabricatorEnv::getURI('/pholio/new/'); $pholio_all_uri = PhabricatorEnv::getURI('/pholio/query/all/'); $quick[] = $this->newItem( $request, 'fa-camera-retro', pht( "=== Quick Start: Design Review ===\n\n". "Review proposed designs with **[[ %s | Pholio ]]**. ". "Designers can use Pholio to share images of what they're working on ". "and show off things they've made. ". "To get started with design review:\n\n". " - **[[ %s | Create a Mock ]]**\n". " - **[[ %s | View All Mocks ]]**", $pholio_uri, $pholio_create_uri, $pholio_all_uri)); - $diffusion_uri = PhabricatorEnv::getURI('/diffusion/'); + $diffusion_uri = PhabricatorEnv::getURI('/diffusion/edit/'); $diffusion_create_uri = PhabricatorEnv::getURI('/diffusion/create/'); $diffusion_all_uri = PhabricatorEnv::getURI('/diffusion/query/all/'); $diffusion_user_guide = PhabricatorEnv::getDoclink('Diffusion User Guide'); $diffusion_setup_guide = PhabricatorEnv::getDoclink( 'Diffusion User Guide: Repository Hosting'); $quick[] = $this->newItem( $request, 'fa-code', pht( "=== Quick Start: Repositories ===\n\n". "Manage and browse source code repositories with ". "**[[ %s | Diffusion ]]**. ". "Engineers can use Diffusion to browse and audit source code. ". "You can configure Phabricator to host repositories, or have it ". "track existing repositories hosted elsewhere (like GitHub, ". "Bitbucket, or an internal server). ". "To get started with repositories:\n\n". " - **[[ %s | Create a New Repository ]]**\n". " - **[[ %s | View All Repositories ]]**\n\n". "For more information, see these articles in the documentation:\n\n". " - **[[ %s | Diffusion User Guide ]]**, for a general overview of ". " Diffusion.\n". " - **[[ %s | Diffusion User Guide: Repository Hosting ]]**, ". " for instructions on configuring repository hosting.\n\n". "Phabricator supports Git, Mercurial and Subversion.", $diffusion_uri, $diffusion_create_uri, $diffusion_all_uri, $diffusion_user_guide, $diffusion_setup_guide)); $setup_header = new PHUIRemarkupView( $viewer, pht('=Setup and Configuration')); $explore_header = new PHUIRemarkupView( $viewer, pht('=Explore Phabricator')); $quick_header = new PHUIRemarkupView( $viewer, pht('=Quick Start Guide')); $document = id(new PHUIDocumentViewPro()) ->setFluid(true) ->appendChild($setup_header) ->appendChild($setup) ->appendChild($explore_header) ->appendChild($explore) ->appendChild($quick_header) ->appendChild($quick); return id(new PHUIBoxView()) ->appendChild($document); } private function newItem(AphrontRequest $request, $icon, $content) { $viewer = $request->getUser(); $icon = id(new PHUIIconView()) ->setIcon($icon.' fa-2x'); $content = new PHUIRemarkupView($viewer, $content); $icon = phutil_tag( 'div', array( 'class' => 'config-welcome-icon', ), $icon); $content = phutil_tag( 'div', array( 'class' => 'config-welcome-content', ), $content); $view = phutil_tag( 'div', array( 'class' => 'config-welcome-box grouped', ), array( $icon, $content, )); return $view; } } diff --git a/src/applications/home/controller/PhabricatorHomeMainController.php b/src/applications/home/controller/PhabricatorHomeMainController.php index 592478c894..fce4729a6d 100644 --- a/src/applications/home/controller/PhabricatorHomeMainController.php +++ b/src/applications/home/controller/PhabricatorHomeMainController.php @@ -1,230 +1,259 @@ getViewer(); $dashboard = PhabricatorDashboardInstall::getDashboard( $viewer, $viewer->getPHID(), get_class($this->getCurrentApplication())); if (!$dashboard) { $dashboard = PhabricatorDashboardInstall::getDashboard( $viewer, PhabricatorHomeApplication::DASHBOARD_DEFAULT, get_class($this->getCurrentApplication())); } if ($dashboard) { $content = id(new PhabricatorDashboardRenderingEngine()) ->setViewer($viewer) ->setDashboard($dashboard) ->renderDashboard(); } else { $content = $this->buildMainResponse(); } if (!$request->getURIData('only')) { $nav = $this->buildNav(); $nav->appendChild( array( $content, id(new PhabricatorGlobalUploadTargetView())->setUser($viewer), )); $content = $nav; } return $this->newPage() ->setTitle('Phabricator') ->addClass('phabricator-home') ->appendChild($content); } private function buildMainResponse() { require_celerity_resource('phabricator-dashboard-css'); $viewer = $this->getViewer(); $has_maniphest = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorManiphestApplication', $viewer); $has_diffusion = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorDiffusionApplication', $viewer); $has_differential = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorDifferentialApplication', $viewer); $revision_panel = null; if ($has_differential) { $revision_panel = $this->buildRevisionPanel(); } $tasks_panel = null; if ($has_maniphest) { $tasks_panel = $this->buildTasksPanel(); } $repository_panel = null; if ($has_diffusion) { $repository_panel = $this->buildRepositoryPanel(); } $feed_panel = $this->buildFeedPanel(); $dashboard = id(new AphrontMultiColumnView()) ->setFluidlayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_LARGE); $main_panel = phutil_tag( 'div', array( 'class' => 'homepage-panel', ), array( $revision_panel, $tasks_panel, $repository_panel, )); $dashboard->addColumn($main_panel, 'thirds'); $side_panel = phutil_tag( 'div', array( 'class' => 'homepage-side-panel', ), array( $feed_panel, )); $dashboard->addColumn($side_panel, 'third'); $view = id(new PHUIBoxView()) ->addClass('dashboard-view') ->appendChild($dashboard); return $view; } private function buildHomepagePanel($title, $href, $view) { $title = phutil_tag( 'a', array( 'href' => $href, ), $title); $icon = id(new PHUIIconView()) ->setIcon('fa-search') ->setHref($href); $header = id(new PHUIHeaderView()) ->setHeader($title) ->addActionItem($icon); $box = id(new PHUIObjectBoxView()) ->setHeader($header); if ($view->getObjectList()) { $box->setObjectList($view->getObjectList()); } if ($view->getContent()) { $box->appendChild($view->getContent()); } return $box; } private function buildRevisionPanel() { $viewer = $this->getViewer(); if (!$viewer->isLoggedIn()) { return null; } $engine = new DifferentialRevisionSearchEngine(); $engine->setViewer($viewer); $saved = $engine->buildSavedQueryFromBuiltin('active'); $query = $engine->buildQueryFromSavedQuery($saved); $pager = $engine->newPagerForSavedQuery($saved); $pager->setPageSize(15); $results = $engine->executeQuery($query, $pager); $view = $engine->renderResults($results, $saved); $title = pht('Active Revisions'); $href = '/differential/query/active/'; return $this->buildHomepagePanel($title, $href, $view); } private function buildTasksPanel() { $viewer = $this->getViewer(); $query = 'assigned'; $title = pht('Assigned Tasks'); $href = '/maniphest/query/assigned/'; if (!$viewer->isLoggedIn()) { $query = 'open'; $title = pht('Open Tasks'); $href = '/maniphest/query/open/'; } $engine = new ManiphestTaskSearchEngine(); $engine->setViewer($viewer); $saved = $engine->buildSavedQueryFromBuiltin($query); $query = $engine->buildQueryFromSavedQuery($saved); $pager = $engine->newPagerForSavedQuery($saved); $pager->setPageSize(15); $results = $engine->executeQuery($query, $pager); $view = $engine->renderResults($results, $saved); return $this->buildHomepagePanel($title, $href, $view); } public function buildFeedPanel() { $viewer = $this->getViewer(); $engine = new PhabricatorFeedSearchEngine(); $engine->setViewer($viewer); $saved = $engine->buildSavedQueryFromBuiltin('all'); $query = $engine->buildQueryFromSavedQuery($saved); $pager = $engine->newPagerForSavedQuery($saved); $pager->setPageSize(40); $results = $engine->executeQuery($query, $pager); $view = $engine->renderResults($results, $saved); + // Low tech NUX. + if (!$results && ($viewer->getIsAdmin() == 1)) { + $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); + if (!$instance) { + $content = pht(<<setObjectList($list); + $view->setNoDataString($welcome); + } $title = pht('Recent Activity'); $href = '/feed/'; return $this->buildHomepagePanel($title, $href, $view); } public function buildRepositoryPanel() { $viewer = $this->getViewer(); $engine = new PhabricatorRepositorySearchEngine(); $engine->setViewer($viewer); $saved = $engine->buildSavedQueryFromBuiltin('active'); $query = $engine->buildQueryFromSavedQuery($saved); $pager = $engine->newPagerForSavedQuery($saved); $pager->setPageSize(5); $results = $engine->executeQuery($query, $pager); $view = $engine->renderResults($results, $saved); $title = pht('Active Repositories'); $href = '/diffusion/'; return $this->buildHomepagePanel($title, $href, $view); } }