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

Fixes 1974: Added manual snapshot #186

Merged
merged 14 commits into from
Jan 18, 2024
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;
}
};
Andrewgdewar marked this conversation as resolved.
Show resolved Hide resolved