Skip to content

Commit

Permalink
* KDB: add progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
aliel authored and RezaRahemtola committed Sep 11, 2024
1 parent 23f6a23 commit 2df3e83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/pages/KnowledgeBase.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<section v-if="knowledgeBaseRef" class="max-sm:tw-mx-4 sm:tw-mx-10 tw-space-y-4 tw-my-5">
<q-linear-progress v-if="!knowledgeStore.isLoaded" class="tw-mt-20" indeterminate />
<section v-else-if="knowledgeBaseRef" class="max-sm:tw-mx-4 sm:tw-mx-10 tw-space-y-4 tw-my-5">
<q-btn class="tw-w-10 tw-h-10" to="/knowledge-base" unelevated>
<ltai-icon name="svguse:icons.svg#arrow-left" />
</q-btn>
Expand Down Expand Up @@ -161,6 +162,7 @@
</q-card-section>
</ltai-dialog>
</div>
<q-linear-progress v-if="uploadInProgress" indeterminate />
</section>
</template>
<script lang="ts" setup>
Expand Down Expand Up @@ -197,6 +199,7 @@ const showRenameKnowledgeBase = ref(false);
const showDeleteKnowledgeBaseConfirmation = ref(false);
const showRenameDocument = ref(false);
const showDeleteDocumentConfirmation = ref(false);
const uploadInProgress = ref(false);
watch(
() => route.params.id as string,
Expand Down Expand Up @@ -256,6 +259,8 @@ const uploadDocuments = async (event: any) => {
const encryptionKey = Buffer.from(knowledgeBaseIdentifierRef.value.encryption.key);
const encryptionIv = Buffer.from(knowledgeBaseIdentifierRef.value.encryption.iv);
uploadInProgress.value = true;
await Promise.all(
Array.from(target.files as FileList).map(async (file) => {
try {
Expand All @@ -275,6 +280,7 @@ const uploadDocuments = async (event: any) => {
}
}),
);
uploadInProgress.value = false;
knowledgeBaseRef.value.documents = knowledgeBaseRef.value.documents.concat(documents);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/KnowledgeBasesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
<knowledge-base-creation-dialog v-model="createKnowledgeDialog" @create="createKnowledgeBase" />
</div>

<q-linear-progress v-if="!knowledgeStore.isLoaded" indeterminate />
<empty-state
v-if="knowledgeStore.knowledgeBases.length === 0"
v-else-if="knowledgeStore.knowledgeBases.length === 0"
description="Create a Knowledge Base to get started"
image-alt="No knowledge base"
image-link="/assets/empty-states/knowledge-base.png"
Expand Down

0 comments on commit 2df3e83

Please sign in to comment.