Browse Source

Revert "feat(starfish): Create service selector component" (#52303)

Ash Anand 1 year ago
parent
commit
4b60067911

+ 0 - 43
static/app/views/starfish/components/starfishProjectSelector.tsx

@@ -1,43 +0,0 @@
-import {updateProjects} from 'sentry/actionCreators/pageFilters';
-import {CompactSelect} from 'sentry/components/compactSelect';
-import ProjectBadge from 'sentry/components/idBadge/projectBadge';
-import {Project} from 'sentry/types';
-import usePageFilters from 'sentry/utils/usePageFilters';
-import useProjects from 'sentry/utils/useProjects';
-import useRouter from 'sentry/utils/useRouter';
-
-const ALLOWED_PROJECT_IDS = new Set(['1', '4504120414765056']);
-
-export function StarfishProjectSelector() {
-  const {projects} = useProjects();
-  const {selection} = usePageFilters();
-  const router = useRouter();
-
-  const projectOptions = projects
-    .filter(project => ALLOWED_PROJECT_IDS.has(project.id))
-    .map(project => ({
-      label: <ProjectOptionLabel project={project} />,
-      value: project.id,
-    }));
-
-  const selectedOption =
-    projectOptions.find(option =>
-      selection.projects.includes(parseInt(option.value, 10))
-    ) ?? projectOptions[0];
-
-  const handleProjectChange = option =>
-    updateProjects([parseInt(option.value, 10)], router);
-
-  return (
-    <CompactSelect
-      menuWidth={250}
-      options={projectOptions}
-      defaultValue={selectedOption?.value}
-      onChange={handleProjectChange}
-    />
-  );
-}
-
-function ProjectOptionLabel({project}: {project: Project}) {
-  return <ProjectBadge project={project} avatarSize={20} disableLink />;
-}

+ 4 - 1
static/app/views/starfish/modules/DBModule.tsx

@@ -4,6 +4,7 @@ import {
   PageErrorAlert,
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
+import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {ModuleName} from 'sentry/views/starfish/types';
 import SpansView from 'sentry/views/starfish/views/spans/spansView';
 
@@ -20,7 +21,9 @@ export default function DBModule() {
         <Layout.Body>
           <Layout.Main fullWidth>
             <PageErrorAlert />
-            <SpansView moduleName={ModuleName.DB} />
+            <StarfishPageFilterContainer>
+              <SpansView moduleName={ModuleName.DB} />
+            </StarfishPageFilterContainer>
           </Layout.Main>
         </Layout.Body>
       </PageErrorProvider>

+ 4 - 1
static/app/views/starfish/modules/HTTPModule.tsx

@@ -4,6 +4,7 @@ import {
   PageErrorAlert,
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
+import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {ModuleName} from 'sentry/views/starfish/types';
 import SpansView from 'sentry/views/starfish/views/spans/spansView';
 
@@ -20,7 +21,9 @@ export default function HTTPModule() {
         <Layout.Body>
           <Layout.Main fullWidth>
             <PageErrorAlert />
-            <SpansView moduleName={ModuleName.HTTP} />
+            <StarfishPageFilterContainer>
+              <SpansView moduleName={ModuleName.HTTP} />
+            </StarfishPageFilterContainer>
           </Layout.Main>
         </Layout.Body>
       </PageErrorProvider>

+ 5 - 6
static/app/views/starfish/views/spans/spansView.tsx

@@ -2,13 +2,11 @@ import {Fragment} from 'react';
 import styled from '@emotion/styled';
 import pick from 'lodash/pick';
 
-import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
 import {space} from 'sentry/styles/space';
 import {fromSorts} from 'sentry/utils/discover/eventView';
 import type {Sort} from 'sentry/utils/discover/fields';
 import {useLocation} from 'sentry/utils/useLocation';
 import StarfishDatePicker from 'sentry/views/starfish/components/datePicker';
-import {StarfishProjectSelector} from 'sentry/views/starfish/components/starfishProjectSelector';
 import {ModuleName} from 'sentry/views/starfish/types';
 import {QueryParameterNames} from 'sentry/views/starfish/views/queryParameters';
 import {ActionSelector} from 'sentry/views/starfish/views/spans/selectors/actionSelector';
@@ -52,8 +50,7 @@ export default function SpansView(props: Props) {
 
   return (
     <Fragment>
-      <FilterOptionsContainer condensed>
-        <StarfishProjectSelector />
+      <FilterOptionsContainer>
         <StarfishDatePicker />
       </FilterOptionsContainer>
 
@@ -100,7 +97,9 @@ const PaddedContainer = styled('div')`
   margin: 0 ${space(2)};
 `;
 
-const FilterOptionsContainer = styled(PageFilterBar)`
-  margin: 0 ${space(2)};
+const FilterOptionsContainer = styled(PaddedContainer)`
+  display: flex;
+  flex-direction: row;
+  gap: ${space(1)};
   margin-bottom: ${space(2)};
 `;

+ 0 - 2
static/app/views/starfish/views/webServiceView/starfishLanding.tsx

@@ -14,7 +14,6 @@ import {
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
 import StarfishDatePicker from 'sentry/views/starfish/components/datePicker';
-import {StarfishProjectSelector} from 'sentry/views/starfish/components/starfishProjectSelector';
 
 import {StarfishView} from './starfishView';
 
@@ -31,7 +30,6 @@ type Props = {
 export function StarfishLanding(props: Props) {
   const pageFilters: React.ReactNode = (
     <PageFilterBar condensed>
-      <StarfishProjectSelector />
       <StarfishDatePicker />
     </PageFilterBar>
   );