multiple branches repository clone functionality implemented

This commit is contained in:
sumedh
2024-08-29 22:58:42 +05:30
parent 9a6d807054
commit 5318441cd9
3 changed files with 73 additions and 79 deletions

View File

@@ -201,31 +201,31 @@ const getCustomDatewithAllResponse = (data) => {
const ingestGitRepo = (repo) => {
axios
.get(`/test/ingest_repo/${repo.repoName}`)
.get(`/test/ingest_repo?repoName=${repo.repoName}&branchName=${repo.branch}`)
.then((response) => {
showPopup('Ingestion started', 'info');
toast.add({ severity: 'success', summary: 'Ingestion Summary', detail: 'Repository Ingestion Started', life: 3000 });
startPollingStatus(repo.repoName);
startPollingStatus(repo);
})
.catch((error) => {
showPopup('Error starting ingestion', 'error');
});
};
const startPollingStatus = (repoName) => {
const startPollingStatus = (repo) => {
if (checkStatusInterval) {
// Prevent starting multiple intervals if there's already one running
clearInterval(checkStatusInterval);
}
checkStatusInterval = setInterval(() => {
checkIngestionStatus(repoName);
checkIngestionStatus(repo);
}, 100000); // Poll every 1 minute
};
const checkIngestionStatus = (repoName) => {
const checkIngestionStatus = (repo) => {
axios
.get(`/test/check_ingestion_status/${repoName}`)
.get(`/test/check_ingestion_status?repoName=${repo.repoName}&branchName=${repo.branch}`)
.then((response) => {
const data = response.data;
if (data.status === 'INGESTED') {
@@ -329,7 +329,8 @@ const deleteRecordsFromVectorStore = (id) => {
ksDoctype: ksGitInfoToDelete.ksGitIngestionInfo.metadata.KsDoctype,
ksDocSource: ksGitInfoToDelete.ksGitIngestionInfo.metadata.KsDocSource,
ksFileSource: ksGitInfoToDelete.ksGitIngestionInfo.metadata.KsFileSource,
ksApplicationName: ksGitInfoToDelete.ksGitIngestionInfo.metadata.KsApplicationName
ksApplicationName: ksGitInfoToDelete.ksGitIngestionInfo.metadata.KsApplicationName,
ksBranch: ksGitInfoToDelete.ksGitIngestionInfo.metadata.KsBranch
};
axios.post('/fe-api/vector-store/deleteGitRecords', requestPayload)
@@ -360,7 +361,7 @@ const reIngestWithPullChanges = (data) =>{
severity: 'danger',
},
accept: () => {
axios.get('/test/reingest_repo/'+data.repoName)
axios.get('/test/reingest_repo?repoName=${data.repoName}&branchName=${data.branch}')
.then(response => {
console.log(response.data);
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'ReIngestion with latest pull from master started', life: 3000 });