|
@@ -32,7 +32,8 @@ import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
|
|
|
import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
|
|
|
import TextBlock from 'sentry/views/settings/components/text/textBlock';
|
|
|
-import {Associations} from 'sentry/views/settings/projectSourceMaps/associations';
|
|
|
+import {DebugIdBundleList} from 'sentry/views/settings/projectSourceMaps/debugIdBundleList';
|
|
|
+import {useDeleteDebugIdBundle} from 'sentry/views/settings/projectSourceMaps/useDeleteDebugIdBundle';
|
|
|
|
|
|
enum SortBy {
|
|
|
ASC_ADDED = 'date_added',
|
|
@@ -209,7 +210,7 @@ export function ProjectSourceMaps({location, router, project}: Props) {
|
|
|
[
|
|
|
debugIdBundlesEndpoint,
|
|
|
{
|
|
|
- query: {query, cursor, sortBy},
|
|
|
+ query: {query, cursor, sortBy: SortBy.DESC_MODIFIED},
|
|
|
},
|
|
|
],
|
|
|
{
|
|
@@ -219,6 +220,10 @@ export function ProjectSourceMaps({location, router, project}: Props) {
|
|
|
}
|
|
|
);
|
|
|
|
|
|
+ const {mutate: deleteDebugIdBundle} = useDeleteDebugIdBundle({
|
|
|
+ onSuccess: () => debugIdBundlesRefetch(),
|
|
|
+ });
|
|
|
+
|
|
|
const handleSearch = useCallback(
|
|
|
(newQuery: string) => {
|
|
|
router.push({
|
|
@@ -256,31 +261,21 @@ export function ProjectSourceMaps({location, router, project}: Props) {
|
|
|
});
|
|
|
}, [location, router, sortBy]);
|
|
|
|
|
|
- const handleDelete = useCallback(
|
|
|
+ const handleDeleteReleaseArtifacts = useCallback(
|
|
|
async (name: string) => {
|
|
|
addLoadingMessage(t('Removing artifacts\u2026'));
|
|
|
try {
|
|
|
- await api.requestPromise(
|
|
|
- tabDebugIdBundlesActive ? debugIdBundlesEndpoint : sourceMapsEndpoint,
|
|
|
- {
|
|
|
- method: 'DELETE',
|
|
|
- query: tabDebugIdBundlesActive ? {bundleId: name} : {name},
|
|
|
- }
|
|
|
- );
|
|
|
- tabDebugIdBundlesActive ? debugIdBundlesRefetch() : archivesRefetch();
|
|
|
+ await api.requestPromise(sourceMapsEndpoint, {
|
|
|
+ method: 'DELETE',
|
|
|
+ query: {name},
|
|
|
+ });
|
|
|
+ archivesRefetch();
|
|
|
addSuccessMessage(t('Artifacts removed.'));
|
|
|
} catch {
|
|
|
addErrorMessage(t('Unable to remove artifacts. Please try again.'));
|
|
|
}
|
|
|
},
|
|
|
- [
|
|
|
- api,
|
|
|
- sourceMapsEndpoint,
|
|
|
- tabDebugIdBundlesActive,
|
|
|
- debugIdBundlesRefetch,
|
|
|
- archivesRefetch,
|
|
|
- debugIdBundlesEndpoint,
|
|
|
- ]
|
|
|
+ [api, sourceMapsEndpoint, archivesRefetch]
|
|
|
);
|
|
|
|
|
|
const currentBundleType = tabDebugIdBundlesActive
|
|
@@ -407,64 +402,48 @@ export function ProjectSourceMaps({location, router, project}: Props) {
|
|
|
onSearch={handleSearch}
|
|
|
query={query}
|
|
|
/>
|
|
|
- <Table
|
|
|
- headers={tableHeaders
|
|
|
- .filter(header => header.enabledFor.includes(currentBundleType))
|
|
|
- .map(header => header.component)}
|
|
|
- emptyMessage={
|
|
|
- query
|
|
|
- ? tct('No [tabName] match your search query.', {
|
|
|
- tabName: tabDebugIdBundlesActive
|
|
|
- ? t('artifact bundles')
|
|
|
- : t('release bundles'),
|
|
|
- })
|
|
|
- : tct('No [tabName] found for this project.', {
|
|
|
- tabName: tabDebugIdBundlesActive
|
|
|
- ? t('artifact bundles')
|
|
|
- : t('release bundles'),
|
|
|
- })
|
|
|
- }
|
|
|
- isEmpty={
|
|
|
- (tabDebugIdBundlesActive ? debugIdBundlesData ?? [] : archivesData ?? [])
|
|
|
- .length === 0
|
|
|
- }
|
|
|
- isLoading={tabDebugIdBundlesActive ? debugIdBundlesLoading : archivesLoading}
|
|
|
- >
|
|
|
- {tabDebugIdBundlesActive
|
|
|
- ? debugIdBundlesData?.map(data => (
|
|
|
- <SourceMapsTableRow
|
|
|
- key={data.bundleId}
|
|
|
- bundleType={SourceMapsBundleType.DEBUG_ID}
|
|
|
- dateModified={data.dateModified}
|
|
|
- date={data.date}
|
|
|
- fileCount={data.fileCount}
|
|
|
- name={data.bundleId}
|
|
|
- onDelete={handleDelete}
|
|
|
- link={`/settings/${organization.slug}/projects/${
|
|
|
- project.slug
|
|
|
- }/source-maps/artifact-bundles/${encodeURIComponent(data.bundleId)}`}
|
|
|
- idColumnDetails={
|
|
|
- <Associations
|
|
|
- associations={data.associations}
|
|
|
- loading={debugIdBundlesLoading}
|
|
|
- />
|
|
|
- }
|
|
|
- />
|
|
|
- ))
|
|
|
- : archivesData?.map(data => (
|
|
|
- <SourceMapsTableRow
|
|
|
- key={data.name}
|
|
|
- bundleType={SourceMapsBundleType.RELEASE}
|
|
|
- date={data.date}
|
|
|
- fileCount={data.fileCount}
|
|
|
- name={data.name}
|
|
|
- onDelete={handleDelete}
|
|
|
- link={`/settings/${organization.slug}/projects/${
|
|
|
- project.slug
|
|
|
- }/source-maps/release-bundles/${encodeURIComponent(data.name)}`}
|
|
|
- />
|
|
|
- ))}
|
|
|
- </Table>
|
|
|
+ {tabDebugIdBundlesActive ? (
|
|
|
+ <DebugIdBundleList
|
|
|
+ isLoading={debugIdBundlesLoading}
|
|
|
+ debugIdBundles={debugIdBundlesData}
|
|
|
+ project={project}
|
|
|
+ onDelete={bundleId =>
|
|
|
+ deleteDebugIdBundle({bundleId, projectSlug: project.slug})
|
|
|
+ }
|
|
|
+ emptyMessage={
|
|
|
+ query
|
|
|
+ ? t('No artifact bundles match your search query.')
|
|
|
+ : t('No artifact bundles found for this project.')
|
|
|
+ }
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <Table
|
|
|
+ headers={tableHeaders
|
|
|
+ .filter(header => header.enabledFor.includes(currentBundleType))
|
|
|
+ .map(header => header.component)}
|
|
|
+ emptyMessage={
|
|
|
+ query
|
|
|
+ ? t('No release bundles match your search query.')
|
|
|
+ : t('No release bundles found for this project.')
|
|
|
+ }
|
|
|
+ isEmpty={(archivesData ?? []).length === 0}
|
|
|
+ isLoading={archivesLoading}
|
|
|
+ >
|
|
|
+ {archivesData?.map(data => (
|
|
|
+ <SourceMapsTableRow
|
|
|
+ key={data.name}
|
|
|
+ bundleType={SourceMapsBundleType.RELEASE}
|
|
|
+ date={data.date}
|
|
|
+ fileCount={data.fileCount}
|
|
|
+ name={data.name}
|
|
|
+ onDelete={handleDeleteReleaseArtifacts}
|
|
|
+ link={`/settings/${organization.slug}/projects/${
|
|
|
+ project.slug
|
|
|
+ }/source-maps/release-bundles/${encodeURIComponent(data.name)}`}
|
|
|
+ />
|
|
|
+ ))}
|
|
|
+ </Table>
|
|
|
+ )}
|
|
|
<Pagination
|
|
|
pageLinks={
|
|
|
tabDebugIdBundlesActive
|