multiple branches repository clone functionality implemented
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<Toast/>
|
||||
<ConfirmPopup></ConfirmPopup>
|
||||
<div v-if="loading" class="loading-container">
|
||||
<div class="spinner-container">
|
||||
<ProgressSpinner class="spinner" />
|
||||
<p class="loading-text">Loading data...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DataTable v-model:filters="filters" :value="ksdocuments" paginator showGridlines :rows="10" dataKey="id"
|
||||
filterDisplay="menu" :loading="loading"
|
||||
:globalFilterFields="['ingestionInfo.metadata.KsApplicationName', 'ingestionInfo.metadata.KsFileSources', 'ingestionInfo.metadata.KsDocSource', 'ingestionStatus', 'ingestionDateFormat']">
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between gap-4 p-4 ">
|
||||
<span class="text-xl font-bold">KS Documents</span>
|
||||
<span class="text-xl font-bold">Knowledge Source Documents</span>
|
||||
<div class="flex items-center gap-2 flex-grow">
|
||||
<IconField class="flex-grow">
|
||||
<InputIcon>
|
||||
@@ -29,14 +32,7 @@
|
||||
</template>
|
||||
<template #empty>No Records found</template>
|
||||
|
||||
<!--Column field="id" header="id" sortable style="min-width: 12rem">
|
||||
<template #body="slotProps">
|
||||
<Tag>ksdocuments: {{ slotProps.data.id }}</Tag>
|
||||
<Tag>ksingestioninfo: {{ slotProps.data.ingestionInfo.id }}</Tag>
|
||||
</template>
|
||||
</Column-->
|
||||
<!--Column field="ingestionInfo.id" header="ksingestioninfo id" sortable style="min-width: 12rem" /-->
|
||||
<Column field="ingestionInfo.metadata.KsApplicationName" header="KSApplicationName" sortable
|
||||
<Column field="ingestionInfo.metadata.KsApplicationName" header="ApplicationName" sortable
|
||||
style="min-width: 12rem">
|
||||
<template #body="{ data }">
|
||||
{{ data.ingestionInfo.metadata.KsApplicationName }}
|
||||
@@ -45,7 +41,7 @@
|
||||
<InputText v-model="filterModel.value" type="text" @input="filterCallback()" placeholder="Search by File" />
|
||||
</template>
|
||||
</Column>
|
||||
<Column field="ingestionInfo.metadata.KsFileSource" header="KsFileSource" sortable>
|
||||
<Column field="ingestionInfo.metadata.KsFileSource" header="FileSource" sortable>
|
||||
<template #body="{ data }">
|
||||
{{ data.ingestionInfo.metadata.KsFileSource }}
|
||||
</template>
|
||||
@@ -54,7 +50,7 @@
|
||||
placeholder="Search by File Name" />
|
||||
</template>
|
||||
</Column>
|
||||
<Column field="ingestionInfo.metadata.KsDocSource" header="KsDocSource" sortable style="min-width: 12rem">
|
||||
<Column field="ingestionInfo.metadata.KsDocSource" header="DocSource" sortable style="min-width: 12rem">
|
||||
<template #body="{ data }">
|
||||
{{ data.ingestionInfo.metadata.KsDocSource }}
|
||||
</template>
|
||||
@@ -75,7 +71,7 @@
|
||||
</Select>
|
||||
</template>
|
||||
</Column>
|
||||
<Column header="Ingestion Date" filterField="ingestionDateFormat" dataType="date" style="min-width: 10rem">
|
||||
<Column header="Date" filterField="ingestionDateFormat" dataType="date" style="min-width: 10rem">
|
||||
<template #body="{ data }">
|
||||
{{ formatDate(data.ingestionDate) }}
|
||||
</template>
|
||||
@@ -92,18 +88,9 @@
|
||||
<Button type="button" icon="pi pi-play" rounded @click="startIndividualngestion(slotProps.data.id)"
|
||||
v-tooltip="'Start Ingestion of document'" :disabled="slotProps.data.ingestionStatus === 'INGESTED'"
|
||||
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'INGESTED' }" />
|
||||
<Button type="button" icon="pi pi-trash" rounded @click="showConfirmDialog(slotProps.data.id)"
|
||||
<Button type="button" icon="pi pi-trash" rounded @click="confirmDelete(slotProps.data.id)"
|
||||
v-tooltip="'Delete the ingested Record'" :disabled="slotProps.data.ingestionStatus === 'NEW'"
|
||||
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'NEW' }" />
|
||||
|
||||
<Dialog header="Confirm Deletion" :visible="confirmDialogVisible" modal @hide="resetConfirmDialog"
|
||||
:style="{ width: '300px' }">
|
||||
<p>Are you sure you want to delete this record?</p>
|
||||
<template #footer>
|
||||
<Button label="No" icon="pi pi-times" @click="confirmDialogVisible = false"/>
|
||||
<Button label="Yes" icon="pi pi-check" @click="confirmDelete" class="p-button-danger" />
|
||||
</template>
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
</Column>
|
||||
@@ -120,6 +107,8 @@ import { FilterMatchMode, FilterOperator } from '@primevue/core/api';
|
||||
import axios from 'axios';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { useConfirm } from "primevue/useconfirm";
|
||||
import moment from 'moment';
|
||||
|
||||
import Button from 'primevue/button';
|
||||
@@ -137,14 +126,13 @@ import ProgressSpinner from 'primevue/progressspinner';
|
||||
const router = useRouter()
|
||||
const ksdocuments = ref(null);
|
||||
const loading = ref(true);
|
||||
const toast = useToast();
|
||||
const confirm = useConfirm();
|
||||
|
||||
const ingestionDialogVisible = ref(false);
|
||||
const ingestionResult = ref('');
|
||||
const filters = ref();
|
||||
|
||||
const confirmDialogVisible = ref(false);
|
||||
const recordToDelete = ref(null);
|
||||
|
||||
const initFilters = () => {
|
||||
filters.value = {
|
||||
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||
@@ -202,28 +190,25 @@ const editKsDocument = (data) => {
|
||||
router.push({ name: 'ks-document-edit', params: { id: data.id } });
|
||||
}
|
||||
|
||||
//delete functionality
|
||||
function showConfirmDialog(id) {
|
||||
recordToDelete.value = id;
|
||||
confirmDialogVisible.value = true;
|
||||
}
|
||||
const confirmDelete = (id) =>{
|
||||
console.log("id",id);
|
||||
|
||||
function confirmDelete() {
|
||||
if (recordToDelete.value !== null) {
|
||||
deleteRecordsFromVectorStore(recordToDelete.value);
|
||||
recordToDelete.value = null;
|
||||
}
|
||||
confirmDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function resetConfirmDialog() {
|
||||
recordToDelete.value = null;
|
||||
}
|
||||
|
||||
|
||||
const deleteRecordsFromVectorStore = (id) => {
|
||||
confirm.require({
|
||||
target: event.currentTarget,
|
||||
message: 'Are you sure you want to proceed?',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
rejectProps: {
|
||||
label: 'Cancel',
|
||||
severity: 'secondary',
|
||||
outlined: true
|
||||
},
|
||||
acceptProps: {
|
||||
label: 'Delete',
|
||||
severity: 'danger',
|
||||
},
|
||||
accept: () => {
|
||||
const documentToDelete = ksdocuments.value.find(doc => doc.id === id);
|
||||
|
||||
console.log("documentToDelete",documentToDelete)
|
||||
if (!documentToDelete) {
|
||||
console.error('Document not found');
|
||||
return;
|
||||
@@ -237,21 +222,29 @@ const deleteRecordsFromVectorStore = (id) => {
|
||||
ksFileSource: documentToDelete.ingestionInfo.metadata.KsFileSource,
|
||||
ksApplicationName: documentToDelete.ingestionInfo.metadata.KsApplicationName,
|
||||
};
|
||||
console.log("requestPayload",requestPayload)
|
||||
|
||||
axios.post('/fe-api/vector-store/deleteRecords', requestPayload)
|
||||
.then(response => {
|
||||
console.log('Delete resource:', response.data)
|
||||
ksdocuments.value = ksdocuments.value.filter(doc => doc.id !== id);
|
||||
console.log('ksdocuments.value',ksdocuments.value)
|
||||
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'deletion is in PROGRESS', life: 3000 });
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error deleting records: ', error)
|
||||
toast.add({ severity: 'error', summary: 'Error', detail: 'Error in Deletion', life: 3000 });
|
||||
});
|
||||
},
|
||||
reject: () => {
|
||||
toast.add({severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000})
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
//ingestion
|
||||
const startIndividualngestion = (id) => {
|
||||
axios.get(`/test/ingest_document/${id}`)
|
||||
//axios.get('/test/ingestion_loop')
|
||||
.then(response => {
|
||||
ingestionResult.value = response.data;
|
||||
if (response.data.status == "OK") {
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
<label for="tokenType">Git Token Type</label>
|
||||
<InputText id="tokenType" type="text" v-model="formData.tokenType" required class="w-full" />
|
||||
</div>
|
||||
<div class="col-12 mb-4">
|
||||
<!--div class="col-12 mb-4">
|
||||
<span class="p-float-label">
|
||||
<label for="repoPath">Repo Path</label>
|
||||
<InputText id="repoPath" v-model="formData.repoPath" required class="w-full" />
|
||||
</span>
|
||||
</div>
|
||||
</div-->
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="defaultChunkSize">Default Chunk Size</label>
|
||||
<InputNumber id="defaultChunkSize" v-model="formData.defaultChunkSize" required class="w-full" />
|
||||
@@ -100,7 +100,7 @@ const submitForm = async () => {
|
||||
formDataToSend.append('branch', formData.value.branch);
|
||||
formDataToSend.append('commitId', formData.value.commitId);
|
||||
formDataToSend.append('tokenType', formData.value.tokenType);
|
||||
formDataToSend.append('repoPath', formData.value.repoPath);
|
||||
//formDataToSend.append('repoPath', formData.value.repoPath);
|
||||
formDataToSend.append('defaultChunkSize', formData.value.defaultChunkSize);
|
||||
formDataToSend.append('minChunkSize', formData.value.minChunkSize);
|
||||
formDataToSend.append('maxNumberOfChunks', formData.value.maxNumberOfChunks);
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user