profiling + research + download
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
<script setup>
|
||||
import { useLayout } from '@/layout/composables/layout';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { onMounted, computed, ref, watch } from 'vue';
|
||||
import AppFooter from './AppFooter.vue';
|
||||
import AppSidebar from './AppSidebar.vue';
|
||||
import AppTopbar from './AppTopbar.vue';
|
||||
import { UserPrefStore } from '../stores/UserPrefStore.js';
|
||||
|
||||
const { layoutConfig, layoutState, isSidebarActive, resetMenu } = useLayout();
|
||||
|
||||
const outsideClickListener = ref(null);
|
||||
const userPrefStore = UserPrefStore();
|
||||
|
||||
onMounted(() => {
|
||||
console.log("layout onmouted");
|
||||
userPrefStore.fetchUserData();
|
||||
});
|
||||
|
||||
watch(isSidebarActive, (newVal) => {
|
||||
if (newVal) {
|
||||
@@ -53,7 +60,7 @@ const isOutsideClicked = (event) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="layout-wrapper" :class="containerClass">
|
||||
<div v-if="userPrefStore.userLoaded" class="layout-wrapper" :class="containerClass">
|
||||
<app-topbar></app-topbar>
|
||||
<div class="layout-sidebar">
|
||||
<app-sidebar></app-sidebar>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<script setup>
|
||||
import AppMenu from './AppMenu.vue';
|
||||
import { onMounted } from 'vue';
|
||||
import { UserPrefStore } from '../stores/UserPrefStore.js';
|
||||
|
||||
const userPrefStore = UserPrefStore();
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -2,14 +2,41 @@
|
||||
import logo from '@/assets/Apollo_simple_logo.webp';
|
||||
import { useLayout } from '@/layout/composables/layout';
|
||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { watch, ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
//import AppConfigurator from './AppConfigurator.vue';
|
||||
import AppProfileMenu from './AppProfileMenu.vue';
|
||||
import { UserPrefStore } from '../stores/UserPrefStore.js';
|
||||
|
||||
const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout();
|
||||
const auth = useAuth();
|
||||
const logoSrc = ref(logo);
|
||||
const userPrefStore = UserPrefStore();
|
||||
const router = useRouter();
|
||||
const selectedApp = ref(userPrefStore.getSelApp);
|
||||
const route = useRoute();
|
||||
|
||||
async function updateApplication() {
|
||||
await userPrefStore.setSelectedApp(selectedApp.value);
|
||||
|
||||
// here scenario_store.fetchApplicationScenarios();
|
||||
|
||||
}
|
||||
|
||||
function redirectProject() {
|
||||
router.push({ name: 'projects-list' }); // Specifica il percorso per la pagina "Projects"
|
||||
}
|
||||
|
||||
function appUpdated() {
|
||||
selectedApp.value = userPrefStore.getSelApp;
|
||||
}
|
||||
|
||||
const isDropdownDisabled = computed(() => {
|
||||
return route.path === '/projects'
|
||||
});
|
||||
|
||||
watch(() => userPrefStore.getSelApp, appUpdated, { immediate: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -34,6 +61,18 @@ const logoSrc = ref(logo);
|
||||
<button type="button" class="layout-topbar-action" @click="toggleDarkMode">
|
||||
<i :class="['pi', { 'pi-moon': isDarkTheme, 'pi-sun': !isDarkTheme }]"></i>
|
||||
</button>
|
||||
|
||||
<div class="topbar-project">
|
||||
<button @click="redirectProject()" class="p-button p-button-outlined"
|
||||
v-tooltip="'Click to change the project'"> {{ userPrefStore.user.selectedProject.fe_name
|
||||
}}</button>
|
||||
<!-- <span v-if="userPrefStore.user.selectedProject">
|
||||
<small>PROJECT:</small> {{ userPrefStore.user.selectedProject.fe_name }}
|
||||
</span> -->
|
||||
</div>
|
||||
<Dropdown v-model="selectedApp" :options="userPrefStore.availableApp" optionLabel="fe_name"
|
||||
placeholder="Select an Application" class="dropdown-list menu-list" @change="updateApplication()"
|
||||
:disabled="isDropdownDisabled" />
|
||||
<!--div class="relative">
|
||||
<button
|
||||
v-styleclass="{ selector: '@next', enterFromClass: 'hidden', enterActiveClass: 'animate-scalein', leaveToClass: 'hidden', leaveActiveClass: 'animate-fadeout', hideOnOutsideClick: true }"
|
||||
|
||||
25
src/main.js
25
src/main.js
@@ -1,3 +1,4 @@
|
||||
import { createPinia } from 'pinia';
|
||||
import PrimeVue from 'primevue/config';
|
||||
import ConfirmationService from 'primevue/confirmationservice';
|
||||
import ToastService from 'primevue/toastservice';
|
||||
@@ -12,8 +13,8 @@ import '@/assets/styles.scss';
|
||||
import '@/assets/tailwind.css';
|
||||
import Aura from '@primevue/themes/aura';
|
||||
import axios from 'axios';
|
||||
|
||||
axios.defaults.baseURL = import.meta.env.VITE_BACKEND_URL; //'http://localhost:8082'
|
||||
import { LoadingStore } from './stores/LoadingStore.js';
|
||||
axios.defaults.baseURL = 'http://localhost:8082'//import.meta.env.VITE_BACKEND_URL; //'http://localhost:8082'
|
||||
console.log(import.meta.env.VITE_BACKEND_URL);
|
||||
|
||||
|
||||
@@ -44,9 +45,11 @@ var auth = createAuth({
|
||||
});
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
|
||||
app.use(router);
|
||||
app.use(auth);
|
||||
app.use(pinia);
|
||||
|
||||
const MyPreset = definePreset(Aura, {
|
||||
semantic: {
|
||||
@@ -69,3 +72,21 @@ app.use(ConfirmationService);
|
||||
app.component('BlockViewer', BlockViewer);
|
||||
|
||||
app.mount('#app');
|
||||
|
||||
const loadingStore = LoadingStore()
|
||||
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
loadingStore.another_loading = true;
|
||||
return config
|
||||
}, function (error) {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
axios.interceptors.response.use(function (response) {
|
||||
loadingStore.another_loading = false;
|
||||
|
||||
return response;
|
||||
}, function (error) {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
@@ -11,6 +11,11 @@ const router = createRouter({
|
||||
auth: true
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/projects',
|
||||
name: 'projects-list',
|
||||
component: () => import('@/views/pages/ProjectList.vue')
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
name: 'dashboard',
|
||||
|
||||
11
src/service/KsDocumentService.js
Normal file
11
src/service/KsDocumentService.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import axios from 'axios';
|
||||
export const KsDocumentService = {
|
||||
getKsDocuments() {
|
||||
return axios.get('/fe-api/ksdocuments')
|
||||
},
|
||||
downloadKsDocument(doc) {
|
||||
return axios.post('/fe-api/ksdocuments/downloadKSDocument', doc, { responseType: "blob", });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
26
src/service/ProjectService.js
Normal file
26
src/service/ProjectService.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import axios from 'axios';
|
||||
export const ProjectService = {
|
||||
|
||||
getUserProjects() {
|
||||
return axios.get('/userProjects')
|
||||
|
||||
}
|
||||
,
|
||||
getUserApplications() {
|
||||
return axios.get('/userApplications')
|
||||
|
||||
}
|
||||
,
|
||||
updateSelectedProject(data) {
|
||||
return axios.post('/updateSelectedProject', data)
|
||||
|
||||
}
|
||||
,
|
||||
updateSelectedApplication(data) {
|
||||
return axios.post('/updateSelectedApplication', data)
|
||||
}
|
||||
|
||||
/* {
|
||||
projectName: selectedProjectName
|
||||
}*/
|
||||
}
|
||||
38
src/stores/KsDocumentStore.js
Normal file
38
src/stores/KsDocumentStore.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import { KsDocumentService } from '../service/KsDocumentService';
|
||||
import { LoadingStore } from './LoadingStore';
|
||||
|
||||
|
||||
export const KsDocumentStore = defineStore('ksdocument_store', () => {
|
||||
|
||||
const lstKsDocument = ref([])
|
||||
const selectedKsDocument = ref(null)
|
||||
const loadingStore = LoadingStore()
|
||||
|
||||
|
||||
async function fetchKsDocument() {
|
||||
console.log("i'm in");
|
||||
loadingStore.scenario_loading = true;
|
||||
await KsDocumentService.getKsDocuments().then(resp => {
|
||||
lstKsDocument.value = resp.data;
|
||||
console.log("lstKsDocument", lstKsDocument.value);
|
||||
loadingStore.scenario_loading = false;
|
||||
});
|
||||
|
||||
}
|
||||
const ksDocument = computed(() => {
|
||||
return lstKsDocument.value
|
||||
})
|
||||
|
||||
const getSelectedKsDocument = computed(() => {
|
||||
return selectedKsDocument.value
|
||||
})
|
||||
|
||||
async function setSelectedKsDocument(ksDoc){
|
||||
selectedKsDocument.value = ksDoc
|
||||
console.log("selectedExecScenario", selectedKsDocument.value);
|
||||
}
|
||||
|
||||
return { fetchKsDocument, selectedKsDocument, lstKsDocument, ksDocument, getSelectedKsDocument, setSelectedKsDocument}
|
||||
})
|
||||
35
src/stores/LoadingStore.js
Normal file
35
src/stores/LoadingStore.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
|
||||
export const LoadingStore = defineStore('loading_store', () => {
|
||||
|
||||
|
||||
const scenario_loading = ref(false)
|
||||
const user_loading = ref(false)
|
||||
const another_loading = ref(false)
|
||||
const exectuion_loading = ref(false)
|
||||
const re_loading = ref(false)
|
||||
|
||||
const isLoading = computed(() => {
|
||||
return scenario_loading.value || user_loading.value || another_loading.value || exectuion_loading.value || re_loading.value
|
||||
})
|
||||
|
||||
const loadingType = computed(() => {
|
||||
if(exectuion_loading.value) return 'ai'
|
||||
if(re_loading.value) return 'ai'
|
||||
if(scenario_loading.value) return 'data'
|
||||
if(user_loading.value) return 'data'
|
||||
if(another_loading.value) return 'data'
|
||||
return 'none'
|
||||
})
|
||||
|
||||
return {isLoading,
|
||||
user_loading,
|
||||
scenario_loading,
|
||||
another_loading,
|
||||
exectuion_loading,
|
||||
re_loading,
|
||||
loadingType
|
||||
}
|
||||
})
|
||||
73
src/stores/UserPrefStore.js
Normal file
73
src/stores/UserPrefStore.js
Normal file
@@ -0,0 +1,73 @@
|
||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import { ProjectService } from '../service/ProjectService';
|
||||
import { LoadingStore } from './LoadingStore';
|
||||
|
||||
export const UserPrefStore = defineStore('userpref_store', () => {
|
||||
|
||||
const user = ref(null)
|
||||
const userLoaded = ref(false)
|
||||
const selectedApp = ref(null)
|
||||
const loadingStore = LoadingStore()
|
||||
|
||||
|
||||
async function fetchUserData(){
|
||||
console.log("fetchUserData");
|
||||
const auth = useAuth();
|
||||
loadingStore.user_loading = true;
|
||||
await auth.fetch().then((fetchedUser) => {
|
||||
|
||||
user.value = fetchedUser.data.data;
|
||||
selectedApp.value = user.value.selectedApplication;
|
||||
userLoaded.value = true;
|
||||
loadingStore.user_loading = false;
|
||||
}).catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
};
|
||||
|
||||
async function updateSelectedProject(project) {
|
||||
try {
|
||||
loadingStore.user_loading = true;
|
||||
selectedApp.value = null;
|
||||
// Aspetta che l'aggiornamento del progetto finisca
|
||||
await ProjectService.updateSelectedProject(project);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Errore durante l'aggiornamento del progetto:", error);
|
||||
} finally {
|
||||
// Assicurati che il caricamento venga disabilitato anche in caso di errore
|
||||
loadingStore.user_loading = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
async function setSelectedApp(app){
|
||||
loadingStore.user_loading = true;
|
||||
await ProjectService.updateSelectedApplication(app);
|
||||
selectedApp.value = app;
|
||||
loadingStore.user_loading = false;
|
||||
}
|
||||
|
||||
const selectedProject = computed(() => user.value.selectedProject)
|
||||
//const availableApp = computed(() => user.value.selectedProject.lstApplications)
|
||||
const availableApp = computed(() => {
|
||||
if (user.value.selectedProject!=null) {
|
||||
return user.value.selectedProject.lstApplications
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
});
|
||||
|
||||
const getSelApp = computed(() => {
|
||||
return selectedApp.value
|
||||
})
|
||||
|
||||
|
||||
|
||||
return { user,fetchUserData, selectedProject, availableApp, getSelApp, userLoaded,setSelectedApp,selectedApp,
|
||||
updateSelectedProject }
|
||||
})
|
||||
166
src/views/pages/ProjectList.vue
Normal file
166
src/views/pages/ProjectList.vue
Normal file
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Available Projects</h1>
|
||||
</div>
|
||||
<div v-if="loading" class="flex justify-center">
|
||||
<ProgressSpinner style="width: 50px; height: 50px; margin-top: 50px" strokeWidth="3" fill="transparent" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<DataView :value="filter" :layout="layout" paginator :rows="8">
|
||||
<template #header>
|
||||
<div class="header-container">
|
||||
<div class="search-bar">
|
||||
<i class="pi pi-search search-icon"></i>
|
||||
<InputText class="search-input" type="search" placeholder="Search" v-model="data.search"
|
||||
size="medium" variant="filled" />
|
||||
</div>
|
||||
<SelectButton v-model="layout" :options="options" :allowEmpty="false" class="layout-switch">
|
||||
<template #option="{ option }">
|
||||
<i :class="[option === 'list' ? 'pi pi-bars' : 'pi pi-table']" />
|
||||
</template>
|
||||
</SelectButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #list="slotProps">
|
||||
<div class="flex flex-col space-y-4 mt-2">
|
||||
<div v-for="(item, index) in slotProps.items" :key="index">
|
||||
<div class="flex flex-col sm:flex-row sm:items-center p-6 gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md"
|
||||
:class="{ 'border-t border-gray-200 dark:border-gray-700': index !== 0 }">
|
||||
<div class="flex flex-col flex-grow">
|
||||
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ item.fe_name }}</h3>
|
||||
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 mt-2">{{ item.description
|
||||
}}</p>
|
||||
</div>
|
||||
<div class="mt-auto flex justify-end">
|
||||
|
||||
<Button @click="openProject(item)" label="Load"
|
||||
class="flex-auto md:flex-initial text-white">
|
||||
<ChevronRightIcon
|
||||
class="w-5 h-10 text-white transition-transform transform hover:translate-x-1" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #grid="slotProps">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4 mt-2">
|
||||
<div v-for="(item, index) in slotProps.items" :key="index" class="p-2">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md flex flex-col h-full">
|
||||
<div class="p-4 flex flex-col flex-grow">
|
||||
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ item.fe_name }}</h3>
|
||||
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 mt-2">{{ item.description
|
||||
}}</p>
|
||||
</div>
|
||||
<div class="p-2 border-t border-gray-200 dark:border-gray-700 flex justify-end">
|
||||
<Button @click="openProject(item)" size="small" label="Load"
|
||||
class="flex-auto md:flex-initial text-white">
|
||||
<ChevronRightIcon
|
||||
class="w-6 h-5 text-white transition-transform transform hover:translate-x-1" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DataView>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ChevronRightIcon } from '@heroicons/vue/24/solid';
|
||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import DataView from 'primevue/dataview';
|
||||
import ProgressSpinner from 'primevue/progressspinner';
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { LoadingStore } from '../../stores/LoadingStore.js';
|
||||
import { UserPrefStore } from '../../stores/UserPrefStore.js';
|
||||
|
||||
|
||||
const loadingStore = LoadingStore()
|
||||
const userPrefStore = UserPrefStore();
|
||||
const auth = useAuth();
|
||||
const user = computed(() => auth.user());
|
||||
|
||||
|
||||
const router = useRouter()
|
||||
const layout = ref('grid');
|
||||
const options = ref(['list', 'grid']);
|
||||
const loading = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
data.projects = user.value.lstProjects;
|
||||
|
||||
});
|
||||
|
||||
|
||||
const data = reactive({
|
||||
search: null,
|
||||
projects: []
|
||||
})
|
||||
|
||||
const filter = computed(() => {
|
||||
|
||||
if (data.search) {
|
||||
|
||||
return data.projects.filter((item) => {
|
||||
return data.search
|
||||
.toLowerCase()
|
||||
.split(" ")
|
||||
.every((v) => item.name.toLowerCase().includes(v));
|
||||
});
|
||||
} else {
|
||||
return data.projects;
|
||||
}
|
||||
});
|
||||
|
||||
const openProject = async (project) => {
|
||||
try {
|
||||
// Esegui l'update del progetto
|
||||
await userPrefStore.updateSelectedProject(project);
|
||||
console.log('Progetto aggiornato e dati utente ricaricati');
|
||||
|
||||
router.push({ path: '/ksdocuments' });
|
||||
} catch (error) {
|
||||
console.error('Errore nel cambio progetto:', error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
color: #334155;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
border: none;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.search-input:focus {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
@@ -4,29 +4,49 @@ import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import { computed, ref } from 'vue';
|
||||
//import logo from '@/assets/Logo_Apollo_Transparent.png';
|
||||
import logo from '@/assets/apollo.jpg';
|
||||
import { useRouter } from 'vue-router';
|
||||
const auth = useAuth();
|
||||
|
||||
const { isDarkTheme } = useLayout();
|
||||
const username = ref('');
|
||||
const password = ref('');
|
||||
const logoSrc = ref(logo);
|
||||
const router = useRouter();
|
||||
|
||||
const logoUrl = computed(() => {
|
||||
return `/layout/images/${isDarkTheme ? 'logo-white' : 'logo-dark'}.svg`;
|
||||
});
|
||||
|
||||
const login = () => {
|
||||
console.log('Username: ', username.value);
|
||||
const login = async () => {
|
||||
try {
|
||||
await auth.login({
|
||||
data: {
|
||||
"username": username.value,
|
||||
"password": password.value
|
||||
},
|
||||
fetchUser: true
|
||||
}).then((response) => {
|
||||
console.log("1 user :", response.data.data);
|
||||
|
||||
auth.login({
|
||||
data: {
|
||||
"username": username.value,
|
||||
"password": password.value
|
||||
},
|
||||
redirect: '/ksdocuments',
|
||||
fetchUser: true,
|
||||
//url: '/api/auth/login'
|
||||
});
|
||||
if (!response.data.data.selectedProject) {
|
||||
router.push({ name: 'projects-list' });
|
||||
} else {
|
||||
router.push({ path: '/ksdocuments' });
|
||||
}
|
||||
|
||||
console.log("response", response);
|
||||
}).catch((err) => {
|
||||
console.log("error", err);
|
||||
error.value = 'Incorrect username or password. Please try again.';
|
||||
visible.value = true;
|
||||
|
||||
setTimeout(() => {
|
||||
visible.value = false;
|
||||
}, 3500);
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('Error ' + err);
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="card">
|
||||
<Toast />
|
||||
<ConfirmPopup></ConfirmPopup>
|
||||
<div v-if="loading" class="loading-container">
|
||||
<div v-if="loadingStore.another_loading" class="loading-container">
|
||||
<div class="spinner-container">
|
||||
<ProgressSpinner class="spinner" />
|
||||
<p class="loading-text">Loading data...</p>
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
|
||||
<DataTable v-model:filters="filters" :value="ksdocuments" paginator showGridlines :rows="10" dataKey="id"
|
||||
filterDisplay="menu" :loading="loading"
|
||||
filterDisplay="menu" :loading="loadingStore.another_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 ">
|
||||
@@ -103,6 +103,12 @@
|
||||
v-tooltip="'Delete the ingested Record'"
|
||||
:disabled="slotProps.data.ingestionStatus === 'NEW'"
|
||||
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'NEW' }" />
|
||||
<Button type="button" icon="pi pi-search" rounded @click="openSimilaritySearch(slotProps.data)"
|
||||
v-tooltip="'Similarity Search'" :disabled="slotProps.data.ingestionStatus === 'NEW'"
|
||||
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'NEW' }" />
|
||||
<Button type="button" icon="pi pi-download" rounded @click="downloadFile(slotProps.data)"
|
||||
v-tooltip="'Download file'" :disabled="slotProps.data.ingestionStatus === 'NEW'"
|
||||
:class="{ 'p-button-danger': slotProps.data.ingestionStatus === 'NEW' }" />
|
||||
</div>
|
||||
</template>
|
||||
</Column>
|
||||
@@ -120,7 +126,7 @@ import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
import { useConfirm } from "primevue/useconfirm";
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import Button from 'primevue/button';
|
||||
@@ -132,7 +138,10 @@ import InputText from 'primevue/inputtext';
|
||||
import ProgressSpinner from 'primevue/progressspinner';
|
||||
import Select from 'primevue/select';
|
||||
import Tag from 'primevue/tag';
|
||||
|
||||
import { KsDocumentService } from '../../../service/KsDocumentService';
|
||||
import { KsDocumentStore } from '../../../stores/KsDocumentStore';
|
||||
import { LoadingStore } from '../../../stores/LoadingStore';
|
||||
import { UserPrefStore } from '../../../stores/UserPrefStore';
|
||||
|
||||
const router = useRouter()
|
||||
const ksdocuments = ref(null);
|
||||
@@ -143,6 +152,9 @@ const confirm = useConfirm();
|
||||
const ingestionDialogVisible = ref(false);
|
||||
const ingestionResult = ref('');
|
||||
const filters = ref();
|
||||
const userPrefStore = UserPrefStore();
|
||||
const ksDocumentStore = KsDocumentStore();
|
||||
const loadingStore = LoadingStore();
|
||||
|
||||
const initFilters = () => {
|
||||
filters.value = {
|
||||
@@ -161,14 +173,29 @@ initFilters();
|
||||
const statuses = ref(['NEW', 'INGESTED', 'FAILED']); // Add your statuses here
|
||||
|
||||
onMounted(() => {
|
||||
axios.get('/fe-api/ksdocuments')
|
||||
.then(response => {
|
||||
ksdocuments.value = getCustomDatewithAllResponse(response.data);
|
||||
console.log(ksdocuments.value);
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
userPrefStore.fetchUserData().then(() => {
|
||||
updateDocuments();
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
watch(() => userPrefStore.getSelApp, updateDocuments, { immediate: true });
|
||||
|
||||
function updateDocuments() {
|
||||
//loading.value = true;
|
||||
ksDocumentStore.fetchKsDocument().then(() => {
|
||||
|
||||
ksdocuments.value = getCustomDatewithAllResponse();
|
||||
//loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Computed property to check if all documents are ingested
|
||||
const allDocumentsIngested = computed(() => {
|
||||
return ksdocuments.value && ksdocuments.value.every(doc => doc.ingestionStatus === 'INGESTED');
|
||||
@@ -185,8 +212,8 @@ const getStatus = (data) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getCustomDatewithAllResponse = (data) => {
|
||||
return [...(data || [])].map((d) => {
|
||||
const getCustomDatewithAllResponse = () => {
|
||||
return [...(ksDocumentStore.ksDocument || [])].map((d) => {
|
||||
d.ingestionDateFormat = new Date(d.ingestionDateFormat);
|
||||
return d;
|
||||
});
|
||||
@@ -196,11 +223,69 @@ const updateFilterModel = () => {
|
||||
console.log("updateFilterModel")
|
||||
}
|
||||
|
||||
// Variabile reattiva per il nome del file
|
||||
const filename = ref("");
|
||||
|
||||
// Funzione per scaricare il file
|
||||
const downloadFile = async (doc) => {
|
||||
/*if (!filename.value) {
|
||||
alert("Inserisci il nome del file.");
|
||||
return;
|
||||
}*/
|
||||
console.log("doc", doc)
|
||||
|
||||
try {
|
||||
|
||||
|
||||
//const response = await axios.post('/fe-api/ksdocuments/downloadKSDocument', doc, { responseType: "blob", });
|
||||
const response = await KsDocumentService.downloadKsDocument(doc);
|
||||
|
||||
console.log("response download", response);
|
||||
|
||||
const contentType = response.headers['content-type']; // Tipo MIME dinamico
|
||||
const blob = new Blob([response.data], { type: contentType });
|
||||
|
||||
// Crea un URL temporaneo per il download
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
|
||||
const fileName = doc.fileName;
|
||||
console.log("fileName", fileName)
|
||||
|
||||
// Imposta il nome e avvia il download
|
||||
link.setAttribute('download', fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
|
||||
// Crea un URL temporaneo per il download del file
|
||||
/*console.log("response download", response);
|
||||
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.setAttribute("download", filename.value); // Imposta il nome del file
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();*/
|
||||
} catch (error) {
|
||||
console.error("Errore durante il download:", error);
|
||||
alert("Errore durante il download. Controlla il nome del file.");
|
||||
}
|
||||
};
|
||||
|
||||
const editKsDocument = (data) => {
|
||||
console.log(data);
|
||||
router.push({ name: 'ks-document-edit', params: { id: data.id } });
|
||||
}
|
||||
|
||||
const openSimilaritySearch = (doc) => {
|
||||
console.log("doc", doc)
|
||||
ksDocumentStore.setSelectedKsDocument(doc).then(() => {
|
||||
router.push({ name: 'ks_similarity_search' });
|
||||
});
|
||||
}
|
||||
|
||||
const confirmDelete = (id) => {
|
||||
console.log("id", id);
|
||||
|
||||
|
||||
@@ -25,13 +25,15 @@
|
||||
<div class="col-12 md:col-6 mb-4">
|
||||
<span class="p-float-label">
|
||||
<label for="ksProjectName" v-tooltip="'Enter the project name here.'">KS Project Name</label>
|
||||
<InputText id="ksProjectName" v-model="formData.ksProjectName" required class="w-full" />
|
||||
<InputText id="ksProjectName" v-model="userPrefStore.selectedProject.internal_name" required
|
||||
class="w-full" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-12 md:col-6 mb-4">
|
||||
<span class="p-float-label">
|
||||
<label for="ksApplicationName" v-tooltip="'Enter the application name here.'">KS Application Name</label>
|
||||
<InputText id="ksApplicationName" v-model="formData.ksApplicationName" required class="w-full" />
|
||||
<InputText id="ksApplicationName" v-model="userPrefStore.getSelApp.internal_name" required
|
||||
class="w-full" />
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -105,10 +107,11 @@ import axios from 'axios';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { UserPrefStore } from '../../../stores/UserPrefStore';
|
||||
|
||||
const toast = useToast();
|
||||
const router = useRouter();
|
||||
|
||||
const userPrefStore = UserPrefStore();
|
||||
const documentTypeOptions = ref([
|
||||
{ name: 'Functional', value: 'functional' },
|
||||
{ name: 'Code Instruction', value: 'code_instruction' },
|
||||
@@ -145,8 +148,8 @@ const submitForm = async () => {
|
||||
|
||||
formDataToSend.append('description', formData.value.description);
|
||||
formDataToSend.append('type', formData.value.type);
|
||||
formDataToSend.append('ksApplicationName', formData.value.ksApplicationName);
|
||||
formDataToSend.append('ksProjectName', formData.value.ksProjectName);
|
||||
formDataToSend.append('ksApplicationName', userPrefStore.selectedProject.internal_name);
|
||||
formDataToSend.append('ksProjectName', userPrefStore.getSelApp.internal_name);
|
||||
formDataToSend.append('ksDocType', formData.value.ksDocType.value);
|
||||
formDataToSend.append('ksDocSource', formData.value.ksDocSource);
|
||||
formDataToSend.append('defaultChunkSize', formData.value.defaultChunkSize);
|
||||
|
||||
@@ -35,13 +35,22 @@ import Card from 'primevue/card';
|
||||
import ScrollPanel from 'primevue/scrollpanel';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { ref, watch } from 'vue';
|
||||
import { KsDocumentStore } from '../../../stores/KsDocumentStore';
|
||||
|
||||
const query = ref('');
|
||||
const dropdownItem = ref(null);
|
||||
const messages = ref([]);
|
||||
const toast = useToast();
|
||||
const dynamicCode = ref('');
|
||||
const filterQuery = ref("'KsApplicationName' == 'ATF'")
|
||||
const ksDocumentStore = KsDocumentStore();
|
||||
const doc = ksDocumentStore.getSelectedKsDocument;
|
||||
//const filterQuery = ref("'KsApplicationName' == 'ATF'")
|
||||
const filterQuery = ref("'KsApplicationName' == '" + doc.ingestionInfo.metadata.KsApplicationName
|
||||
+ "' AND " + "'KsProjectName' == '" + doc.ingestionInfo.metadata.KsProjectName
|
||||
+ "' AND " + "'KsFileSource' == '" + doc.ingestionInfo.metadata.KsFileSource
|
||||
+ "' AND " + "'KsDocSource' == '" + doc.ingestionInfo.metadata.KsDocSource
|
||||
+ "' AND " + "'KsDoctype' == '" + doc.ingestionInfo.metadata.KsDoctype + "'"
|
||||
)
|
||||
|
||||
const dropdownItems = [
|
||||
{ name: 'Documentation', code: 'setup-documentation' },
|
||||
|
||||
Reference in New Issue
Block a user