Skip to content

Commit

Permalink
Fixes 1974: Added manual snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Jan 10, 2024
1 parent 1e5c556 commit 2e801ab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/Pages/ContentListTable/ContentListTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
FilterData,
IntrospectRepositoryRequestItem,
ContentOrigin,
triggerSnapshot,
} from '../../services/Content/ContentApi';
import { SkeletonTable } from '@patternfly/react-component-groups';

Expand Down Expand Up @@ -284,6 +285,17 @@ const ContentListTable = () => {
},
]
: []),
{
isDisabled: actionTakingPlace || rowData?.status === 'Retrying',
title: 'Trigger Snapshot',
onClick: () => {
try {
triggerSnapshot(rowData?.uuid);
} catch (error) {
console.error('Error triggering snapshot:', error);
}
},
},
{
isDisabled: actionTakingPlace || rowData?.status == 'Retrying',
title: 'Introspect Now',
Expand Down
20 changes: 15 additions & 5 deletions src/services/Content/ContentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,22 @@ export const introspectRepository: (
return data;
};

export const triggerSnapshot: (repositoryUUID: string) => Promise<void> = async (
repositoryUUID,
) => {
const { data } = await axios.post(
`/api/content-sources/v1.0/repositories/${repositoryUUID}/snapshot/`,
{},
);
return data;
};

export const getRepoConfigFile: (
repo_uuid: string,
snapshot_uuid: string,
repo_uuid: string,
snapshot_uuid: string,
) => Promise<string> = async (repo_uuid, snapshot_uuid) => {
const { data } = await axios.get(
`/api/content-sources/v1/repositories/${repo_uuid}/snapshots/${snapshot_uuid}/config.repo`
const { data } = await axios.get(
`/api/content-sources/v1/repositories/${repo_uuid}/snapshots/${snapshot_uuid}/config.repo`,
);
return data;
}
};

0 comments on commit 2e801ab

Please sign in to comment.