Correct typing in showProcess

This commit is contained in:
NicolasCantu 2025-06-05 15:36:51 +02:00
parent 26ba3e6e93
commit b828e5197a

View File

@ -855,23 +855,38 @@ private async showProcess(): Promise<void> {
if (container) { if (container) {
const service = await Services.getInstance(); const service = await Services.getInstance();
const myProcesses = await service.getMyProcesses(); const myProcesses = await service.getMyProcesses();
let myProcessesData = await Promise.all(myProcesses.map(async processId => { if (myProcesses && myProcesses.length != 0) {
const myProcessesDataUnfiltered: { name: string, publicData: Record<string, any> }[] = await Promise.all(myProcesses.map(async processId => {
const process = await service.getProcess(processId); const process = await service.getProcess(processId);
const lastState = service.getLastCommitedState(process); const lastState = service.getLastCommitedState(process);
if (!lastState) { if (!lastState) {
return null; return {
name: '',
publicData: {}
};
} }
const description = await service.decryptAttribute(processId, lastState, 'description'); const description = await service.decryptAttribute(processId, lastState, 'description');
const name = description ? description : 'N/A'; const name = description ? description : 'N/A';
const publicData = await service.getPublicData(process); const publicData = await service.getPublicData(process);
console.log(publicData); if (!publicData) {
return {
name: '',
publicData: {}
};
}
return { return {
name: name, name: name,
publicData: publicData publicData: publicData
}; };
})); }));
myProcessesData = myProcessesData.filter(process => process !== null); const myProcessesData = myProcessesDataUnfiltered.filter(
(p) => p.name !== '' && Object.keys(p.publicData).length != 0
);
createProcessTab(container, myProcessesData); createProcessTab(container, myProcessesData);
} else {
createProcessTab(container, []);
}
} }
} }