Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(workflow): Move team insights under stats in the sidebar #29398

Merged
merged 3 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions static/app/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -932,19 +932,6 @@ function buildRoutes() {
</Route>
);

const teamInsightsRoutes = (
<Route
path="/organizations/:orgId/teamInsights/"
componentPromise={() => import('app/views/teamInsights')}
component={SafeLazyLoad}
>
<IndexRoute
componentPromise={() => import('app/views/teamInsights/overview')}
component={SafeLazyLoad}
/>
</Route>
);

const dashboardRoutes = (
<Fragment>
<Route
Expand Down Expand Up @@ -1157,6 +1144,21 @@ function buildRoutes() {
/>
);

const teamStatsRoutes = (
<Route
path="/organizations/:orgId/stats/team/"
componentPromise={() => import('app/views/organizationStats/teamInsights')}
component={SafeLazyLoad}
>
<IndexRoute
componentPromise={() =>
import('app/views/organizationStats/teamInsights/overview')
}
component={SafeLazyLoad}
/>
</Route>
);

// TODO(mark) Long term this /queries route should go away and /discover
// should be the canonical route for discover2. We have a redirect right now
// as /discover was for discover 1 and most of the application is linking to
Expand Down Expand Up @@ -1768,7 +1770,6 @@ function buildRoutes() {
<Route component={errorHandler(OrganizationDetails)}>
{settingsRoutes}
{projectsRoutes}
{teamInsightsRoutes}
{dashboardRoutes}
{userFeedbackRoutes}
{issueListRoutes}
Expand All @@ -1778,6 +1779,7 @@ function buildRoutes() {
{releasesRoutes}
{activityRoutes}
{statsRoutes}
{teamStatsRoutes}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You like that new routes file scott 👁️ 👄 👁️

{discoverRoutes}
{performanceRoutes}
{adminManageRoutes}
Expand Down
55 changes: 55 additions & 0 deletions static/app/views/organizationStats/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {Fragment} from 'react';
import styled from '@emotion/styled';

import FeatureBadge from 'app/components/featureBadge';
import * as Layout from 'app/components/layouts/thirds';
import Link from 'app/components/links/link';
import {t} from 'app/locale';
import space from 'app/styles/space';
import {Organization} from 'app/types';

type Props = {
organization: Organization;
activeTab: 'stats' | 'team';
};

function StatsHeader({organization, activeTab}: Props) {
return (
<Fragment>
<BorderlessHeader>
<StyledHeaderContent>
<StyledLayoutTitle>{t('Stats')}</StyledLayoutTitle>
</StyledHeaderContent>
</BorderlessHeader>
<Layout.Header>
<Layout.HeaderNavTabs underlined>
<li className={`${activeTab === 'stats' ? 'active' : ''}`}>
<Link to={`/organizations/${organization.slug}/stats/`}>
{t('Usage Stats')}
</Link>
</li>
<li className={`${activeTab === 'team' ? 'active' : ''}`}>
<Link to={`/organizations/${organization.slug}/stats/team/`}>
{t('Team Stats')}
<FeatureBadge type="beta" />
</Link>
</li>
</Layout.HeaderNavTabs>
</Layout.Header>
</Fragment>
);
}

export default StatsHeader;

const BorderlessHeader = styled(Layout.Header)`
border-bottom: 0;
`;

const StyledHeaderContent = styled(Layout.HeaderContent)`
margin-bottom: 0;
`;

const StyledLayoutTitle = styled(Layout.Title)`
margin-top: ${space(0.5)};
`;
87 changes: 49 additions & 38 deletions static/app/views/organizationStats/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
RelativePeriod,
} from 'app/types';
import withOrganization from 'app/utils/withOrganization';
import HeaderTabs from 'app/views/organizationStats/header';

import {CHART_OPTIONS_DATACATEGORY, ChartDataTransform} from './usageChart';
import UsageStatsOrg from './usageStatsOrg';
Expand Down Expand Up @@ -264,48 +265,58 @@ export class OrganizationStats extends Component<Props> {

render() {
const {organization} = this.props;
const hasTeamInsights = organization.features.includes('team-insights');

return (
<SentryDocumentTitle title="Usage Stats">
<PageContent>
<PageHeader>
<PageHeading>{t('Organization Usage Stats')}</PageHeading>
</PageHeader>

<p>
{t(
'We collect usage metrics on three types of events: errors, transactions, and attachments. The charts below reflect events that Sentry has received across your entire organization. You can also find them broken down by project in the table.'
<Fragment>
{hasTeamInsights && (
<HeaderTabs organization={organization} activeTab="stats" />
)}

<PageContent>
{!hasTeamInsights && (
<Fragment>
<PageHeader>
<PageHeading>{t('Organization Usage Stats')}</PageHeading>
</PageHeader>
<p>
{t(
'We collect usage metrics on three types of events: errors, transactions, and attachments. The charts below reflect events that Sentry has received across your entire organization. You can also find them broken down by project in the table.'
)}
</p>
</Fragment>
)}
</p>

<PageGrid>
{this.renderPageControl()}

<ErrorBoundary mini>
<UsageStatsOrg
organization={organization}
dataCategory={this.dataCategory}
dataCategoryName={this.dataCategoryName}
dataDatetime={this.dataDatetime}
chartTransform={this.chartTransform}
handleChangeState={this.setStateOnUrl}
/>
</ErrorBoundary>
<ErrorBoundary mini>
<UsageStatsProjects
organization={organization}
dataCategory={this.dataCategory}
dataCategoryName={this.dataCategoryName}
dataDatetime={this.dataDatetime}
tableSort={this.tableSort}
tableQuery={this.tableQuery}
tableCursor={this.tableCursor}
handleChangeState={this.setStateOnUrl}
getNextLocations={this.getNextLocations}
/>
</ErrorBoundary>
</PageGrid>
</PageContent>

<PageGrid>
{this.renderPageControl()}

<ErrorBoundary mini>
<UsageStatsOrg
organization={organization}
dataCategory={this.dataCategory}
dataCategoryName={this.dataCategoryName}
dataDatetime={this.dataDatetime}
chartTransform={this.chartTransform}
handleChangeState={this.setStateOnUrl}
/>
</ErrorBoundary>
<ErrorBoundary mini>
<UsageStatsProjects
organization={organization}
dataCategory={this.dataCategory}
dataCategoryName={this.dataCategoryName}
dataDatetime={this.dataDatetime}
tableSort={this.tableSort}
tableQuery={this.tableQuery}
tableCursor={this.tableCursor}
handleChangeState={this.setStateOnUrl}
getNextLocations={this.getNextLocations}
/>
</ErrorBoundary>
</PageGrid>
</PageContent>
</Fragment>
</SentryDocumentTitle>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import withApi from 'app/utils/withApi';
import withOrganization from 'app/utils/withOrganization';
import withTeamsForUser from 'app/utils/withTeamsForUser';

import Header from '../header';

import DescriptionCard from './descriptionCard';
import HeaderTabs from './headerTabs';
import TeamAlertsTriggered from './teamAlertsTriggered';
import TeamIssuesReviewed from './teamIssuesReviewed';
import TeamMisery from './teamMisery';
Expand Down Expand Up @@ -165,14 +166,7 @@ function TeamInsightsOverview({

return (
<Fragment>
<BorderlessHeader>
<StyledHeaderContent>
<StyledLayoutTitle>{t('Projects')}</StyledLayoutTitle>
</StyledHeaderContent>
</BorderlessHeader>
<Layout.Header>
<HeaderTabs organization={organization} activeTab="teamInsights" />
</Layout.Header>
<Header organization={organization} activeTab="team" />

<Body>
{loadingTeams && <LoadingIndicator />}
Expand Down Expand Up @@ -349,18 +343,6 @@ const Body = styled(Layout.Body)`
}
`;

const BorderlessHeader = styled(Layout.Header)`
border-bottom: 0;
`;

const StyledHeaderContent = styled(Layout.HeaderContent)`
margin-bottom: 0;
`;

const StyledLayoutTitle = styled(Layout.Title)`
margin-top: ${space(0.5)};
`;

const ControlsWrapper = styled('div')`
display: grid;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import EventView from 'app/utils/discover/eventView';
import {getFieldRenderer} from 'app/utils/discover/fieldRenderers';
import type {Color} from 'app/utils/theme';

import {transactionSummaryRouteWithQuery} from '../performance/transactionSummary/utils';
import {transactionSummaryRouteWithQuery} from '../../performance/transactionSummary/utils';

type TeamMiseryProps = {
organization: Organization;
Expand Down
11 changes: 0 additions & 11 deletions static/app/views/projectsDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import flatten from 'lodash/flatten';
import uniqBy from 'lodash/uniqBy';

import {Client} from 'app/api';
import Feature from 'app/components/acl/feature';
import Button from 'app/components/button';
import IdBadge from 'app/components/idBadge';
import Link from 'app/components/links/link';
Expand All @@ -25,7 +24,6 @@ import {sortProjects} from 'app/utils';
import withApi from 'app/utils/withApi';
import withOrganization from 'app/utils/withOrganization';
import withTeamsForUser from 'app/utils/withTeamsForUser';
import TeamInsightsHeaderTabs from 'app/views/teamInsights/headerTabs';

import Resources from './resources';
import TeamSection from './teamSection';
Expand Down Expand Up @@ -93,11 +91,6 @@ function Dashboard({teams, params, organization, loadingTeams, error}: Props) {
{t('Create Project')}
</Button>
</ProjectsHeader>
<Feature organization={organization} features={['team-insights']}>
<TabsWrapper>
<TeamInsightsHeaderTabs organization={organization} activeTab="projects" />
</TabsWrapper>
</Feature>
</Fragment>
)}

Expand Down Expand Up @@ -144,10 +137,6 @@ const ProjectsHeader = styled('div')`
justify-content: space-between;
`;

const TabsWrapper = styled('div')`
padding: ${space(2)} ${space(4)} ${space(1)} ${space(4)};
`;

const OrganizationDashboardWrapper = styled('div')`
display: flex;
flex: 1;
Expand Down
28 changes: 0 additions & 28 deletions static/app/views/teamInsights/headerTabs.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary';

import ProjectsStore from 'app/stores/projectsStore';
import TeamInsightsContainer from 'app/views/teamInsights';
import TeamInsightsContainer from 'app/views/organizationStats/teamInsights';

describe('TeamInsightsContainer', () => {
afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import TeamStore from 'app/stores/teamStore';
import localStorage from 'app/utils/localStorage';
import {TeamInsightsOverview} from 'app/views/teamInsights/overview';
import {TeamInsightsOverview} from 'app/views/organizationStats/teamInsights/overview';

jest.mock('app/utils/localStorage');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {mountWithTheme, screen, waitFor} from 'sentry-test/reactTestingLibrary';

import TeamAlertsTriggered from 'app/views/teamInsights/teamAlertsTriggered';
import TeamAlertsTriggered from 'app/views/organizationStats/teamInsights/teamAlertsTriggered';

describe('TeamAlertsTriggered', () => {
it('should render graph of alerts triggered', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {mountWithTheme, screen, waitFor} from 'sentry-test/reactTestingLibrary';

import TeamIssuesReviewed from 'app/views/teamInsights/teamIssuesReviewed';
import TeamIssuesReviewed from 'app/views/organizationStats/teamInsights/teamIssuesReviewed';

describe('TeamIssuesReviewed', () => {
it('should render graph with table of issues reviewed', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
waitFor,
} from 'sentry-test/reactTestingLibrary';

import TeamMisery from 'app/views/teamInsights/teamMisery';
import TeamMisery from 'app/views/organizationStats/teamInsights/teamMisery';

describe('TeamMisery', () => {
it('should render misery from projects and expand hidden items', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {mountWithTheme, screen, waitFor} from 'sentry-test/reactTestingLibrary';

import TeamResolutionTime from 'app/views/teamInsights/teamResolutionTime';
import TeamResolutionTime from 'app/views/organizationStats/teamInsights/teamResolutionTime';

describe('TeamResolutionTime', () => {
it('should render graph of issue time to resolution', async () => {
Expand Down
Loading