[bug] process page can find all processes

This commit is contained in:
NicolasCantu 2025-02-11 23:30:51 +01:00
parent 239ddae893
commit 8fbcb769d6

View File

@ -5,9 +5,6 @@ import { Process } from 'pkg/sdk_client';
import chatStyle from '../../../public/style/chat.css?inline';
import { Database } from '../../services/database.service';
let myProcesses = (await Services.getInstance()).getMyProcesses();
let allProcesses = (await Services.getInstance()).getAllProcesses();
// Initialize function, create initial tokens with itens that are already selected by the user
export async function init() {
@ -49,16 +46,6 @@ export async function init() {
wrapper.appendChild(search_div);
addPlaceholder(wrapper);
// await loadAllProcesses();
const database = await Database.getInstance();
try {
await database.updateMyProcesses({ myProcessesId: Array.from(myProcesses) });
} catch (error) {
console.error("Error updating my processes:", error);
}
}
function removePlaceholder(wrapper: HTMLElement) {
@ -176,10 +163,11 @@ async function populateAutocompleteList(select: HTMLSelectElement, query: string
let options_to_show = [];
console.log(myProcesses);
const service = await Services.getInstance();
const myProcesses = await service.getMyProcesses();
const allProcesses = new Set(Object.keys(await service.getProcesses()));
const mineArray = Array.from(myProcesses);
const allArray = Array.from(allProcesses).filter(id => !myProcesses.has(id));
const allArray = Array.from(allProcesses.difference(myProcesses));
const wrapper = select.parentNode;
const input_search = wrapper?.querySelector('.search-container');
@ -385,20 +373,6 @@ addSubscription(document, 'click', () => {
}
});
// async function loadAllProcesses() {
// try {
// const [allProcessesNew, myProcessesNew] = await Promise.all([
// getProcesses(),
// getMyProcesses()
// ]);
// myProcesses = myProcesses.union(myProcessesNew);
// allProcesses = allProcesses.union(allProcessesNew);
// } catch (error) {
// console.error("Error loading processes:", error);
// }
// }
async function showSelectedProcess(elem: MouseEvent) {
const container = getCorrectDOM('process-list-4nk-component') as HTMLElement;