Browse Source

ref(quick-start): Replace install with getting started link (#48776)

Priscila Oliveira 1 year ago
parent
commit
91524b090d

+ 31 - 1
static/app/components/onboardingWizard/taskConfig.tsx

@@ -58,6 +58,36 @@ function getIssueAlertUrl({projects, organization}: Options) {
   return `/organizations/${organization.slug}/alerts/${project.slug}/wizard/`;
 }
 
+function getOnboardingInstructionsUrl({projects, organization}: Options) {
+  // This shall never be the case, since this is step is locked until a project is created,
+  // but if the user falls into this case for some reason,
+  // he needs to select the platform again since it is not available as a parameter here
+  if (!projects || !projects.length) {
+    return `/getting-started/:projectId/`;
+  }
+
+  const allProjectsWithoutErrors = projects.every(project => !project.firstEvent);
+  // If all created projects don't have any errors,
+  // we ask the user to pick a project before navigating to the instructions
+  if (allProjectsWithoutErrors) {
+    return `/getting-started/:projectId/`;
+  }
+
+  // Pick the first project without an error
+  const firstProjectWithoutError = projects.find(project => !project.firstEvent);
+  // If all projects contain errors, this step will not be visible to the user,
+  // but if the user falls into this case for some reason, we pick the first project
+  const project = firstProjectWithoutError ?? projects[0];
+
+  let url = `/${organization.slug}/${project.slug}/getting-started/`;
+
+  if (project.platform) {
+    url = url + `${project.platform}/`;
+  }
+
+  return url;
+}
+
 function getMetricAlertUrl({projects, organization}: Options) {
   if (!projects || !projects.length) {
     return `/organizations/${organization.slug}/alerts/rules/`;
@@ -147,7 +177,7 @@ export function getOnboardingTasks({
       skippable: false,
       requisites: [OnboardingTaskKey.FIRST_PROJECT],
       actionType: 'app',
-      location: `/settings/${organization.slug}/projects/:projectId/install/`,
+      location: getOnboardingInstructionsUrl({projects, organization}),
       display: true,
       SupplementComponent: withApi(({api, task, onCompleteTask}: FirstEventWaiterProps) =>
         !!projects?.length && task.requisiteTasks.length === 0 && !task.completionSeen ? (

+ 6 - 15
static/app/routes.tsx

@@ -670,18 +670,6 @@ function buildRoutes() {
           component={make(() => import('sentry/views/settings/projectPlugins/details'))}
         />
       </Route>
-      <Route path="install/" name={t('Configuration')}>
-        <IndexRoute
-          component={make(() => import('sentry/views/projectInstall/overview'))}
-        />
-        <Route
-          path=":platform/"
-          name={t('Docs')}
-          component={make(
-            () => import('sentry/views/projectInstall/platformOrIntegration')
-          )}
-        />
-      </Route>
     </Route>
   );
 
@@ -2281,10 +2269,13 @@ function buildRoutes() {
           from="integrations/:providerKey/"
           to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
         />
-        <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
         <Redirect
-          from="install/:platform'"
-          to="/settings/:orgId/projects/:projectId/install/:platform/"
+          from="/settings/projects/:projectId/install/"
+          to="/getting-started/:projectId/"
+        />
+        <Redirect
+          from="/settings/projects/:projectId/install/:platform/"
+          to="/getting-started/:projectId/:platform/"
         />
       </Route>
       <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />

+ 0 - 4
static/app/views/settings/project/navigationConfiguration.tsx

@@ -117,10 +117,6 @@ export default function getConfiguration({
     {
       name: t('SDK Setup'),
       items: [
-        {
-          path: `${pathPrefix}/install/`,
-          title: t('Instrumentation'),
-        },
         {
           path: `${pathPrefix}/keys/`,
           title: t('Client Keys (DSN)'),