Skip to content
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
3 changes: 0 additions & 3 deletions static/app/router/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,6 @@ function buildRoutes(): RouteObject[] {
'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
)
),
deprecatedRouteProps: true,
},
{
path: 'new-internal/',
Expand All @@ -1125,7 +1124,6 @@ function buildRoutes(): RouteObject[] {
'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
)
),
deprecatedRouteProps: true,
},
{
path: ':appSlug/',
Expand All @@ -1136,7 +1134,6 @@ function buildRoutes(): RouteObject[] {
'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
)
),
deprecatedRouteProps: true,
},
{
path: ':appSlug/dashboard/',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {LocationFixture} from 'sentry-fixture/locationFixture';
import {OrganizationFixture} from 'sentry-fixture/organization';
import {RouterFixture} from 'sentry-fixture/routerFixture';
import {SentryAppFixture} from 'sentry-fixture/sentryApp';
import {SentryAppTokenFixture} from 'sentry-fixture/sentryAppToken';

Expand All @@ -10,14 +8,12 @@ import {
screen,
userEvent,
waitFor,
type RouterConfig,
} from 'sentry-test/reactTestingLibrary';
import selectEvent from 'sentry-test/selectEvent';

import SentryApplicationDetails from 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails';

const router = RouterFixture();
const location = LocationFixture();

describe('Sentry Application Details', () => {
let sentryApp: ReturnType<typeof SentryAppFixture>;
let token: ReturnType<typeof SentryAppTokenFixture>;
Expand All @@ -31,17 +27,14 @@ describe('Sentry Application Details', () => {
});

describe('Creating a new public Sentry App', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: '/sentry-apps/new-public/',
},
route: '/sentry-apps/new-public/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={LocationFixture({pathname: 'new-public/'})}
routes={router.routes}
routeParams={{}}
route={{}}
params={{}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down Expand Up @@ -141,17 +134,14 @@ describe('Sentry Application Details', () => {
});

describe('Creating a new internal Sentry App', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: '/sentry-apps/new-internal/',
},
route: '/sentry-apps/new-internal/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={LocationFixture({pathname: 'new-internal/'})}
routes={router.routes}
routeParams={{}}
route={{}}
params={{}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

it('does not show logo upload fields', () => {
Expand All @@ -175,17 +165,14 @@ describe('Sentry Application Details', () => {
});

describe('Renders public app', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: `/sentry-apps/sample-app/`,
},
route: '/sentry-apps/:appSlug/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={location}
routes={router.routes}
routeParams={{}}
route={{}}
params={{appSlug: sentryApp.slug}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down Expand Up @@ -240,17 +227,14 @@ describe('Sentry Application Details', () => {
});

describe('Renders for internal apps', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: `/sentry-apps/sample-app/`,
},
route: '/sentry-apps/:appSlug/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={location}
routes={router.routes}
routeParams={{}}
route={{}}
params={{appSlug: sentryApp.slug}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down Expand Up @@ -309,17 +293,14 @@ describe('Sentry Application Details', () => {
});

describe('Renders masked values', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: `/sentry-apps/sample-app/`,
},
route: '/sentry-apps/:appSlug/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={location}
routes={router.routes}
routeParams={{}}
route={{}}
params={{appSlug: sentryApp.slug}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down Expand Up @@ -359,17 +340,14 @@ describe('Sentry Application Details', () => {
});

describe('Editing internal app tokens', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: `/sentry-apps/sample-app/`,
},
route: '/sentry-apps/:appSlug/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={location}
routes={router.routes}
routeParams={{}}
route={{}}
params={{appSlug: sentryApp.slug}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down Expand Up @@ -449,17 +427,14 @@ describe('Sentry Application Details', () => {
});

describe('Editing an existing public Sentry App', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: `/sentry-apps/sample-app/`,
},
route: '/sentry-apps/:appSlug/',
};
function renderComponent() {
return render(
<SentryApplicationDetails
router={router}
location={location}
routes={router.routes}
routeParams={{}}
route={{}}
params={{appSlug: sentryApp.slug}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down Expand Up @@ -540,17 +515,14 @@ describe('Sentry Application Details', () => {
});

describe('Editing an existing public Sentry App with a scope error', () => {
const initialRouterConfig: RouterConfig = {
location: {
pathname: `/sentry-apps/sample-app/`,
},
route: '/sentry-apps/:appSlug/',
};
function renderComponent() {
render(
<SentryApplicationDetails
router={router}
location={location}
routes={router.routes}
routeParams={{}}
route={{}}
params={{appSlug: sentryApp.slug}}
/>
);
return render(<SentryApplicationDetails />, {initialRouterConfig});
}

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Avatar, Scope} from 'sentry/types/core';
import type {SentryApp, SentryAppAvatar} from 'sentry/types/integrations';
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
import type {InternalAppApiToken, NewInternalAppApiToken} from 'sentry/types/user';
import {
setApiQueryData,
Expand All @@ -49,7 +48,10 @@ import {
} from 'sentry/utils/queryClient';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import useApi from 'sentry/utils/useApi';
import {useLocation} from 'sentry/utils/useLocation';
import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';
import {useParams} from 'sentry/utils/useParams';
import ApiTokenRow from 'sentry/views/settings/account/apiTokenRow';
import {displayNewToken} from 'sentry/views/settings/components/newTokenHandler';
import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
Expand Down Expand Up @@ -150,7 +152,6 @@ class SentryAppFormModel extends FormModel {
}
}

type Props = RouteComponentProps<{appSlug?: string}>;
const makeSentryAppQueryKey = (appSlug?: string): ApiQueryKey => {
return [`/sentry-apps/${appSlug}/`];
};
Expand All @@ -159,9 +160,10 @@ const makeSentryAppApiTokensQueryKey = (appSlug?: string): ApiQueryKey => {
return [`/sentry-apps/${appSlug}/api-tokens/`];
};

export default function SentryApplicationDetails(props: Props) {
const {appSlug} = props.params;
const {router, location} = props;
export default function SentryApplicationDetails() {
const navigate = useNavigate();
const location = useLocation();
const {appSlug} = useParams<{appSlug: string}>();
const organization = useOrganization();
const [form] = useState<SentryAppFormModel>(() => new SentryAppFormModel());

Expand Down Expand Up @@ -230,7 +232,7 @@ export default function SentryApplicationDetails(props: Props) {
} else {
addSuccessMessage(t('%s successfully created.', data.name));
}
router.push(normalizeUrl(url));
navigate(normalizeUrl(url));
};

const handleSubmitError = (err: any) => {
Expand Down
Loading