Add functions to return processes from Service
This commit is contained in:
parent
7403fb7a5e
commit
1cdf61f8fe
@ -5,9 +5,8 @@ import { Process } from 'pkg/sdk_client';
|
|||||||
import chatStyle from '../../../public/style/chat.css?inline';
|
import chatStyle from '../../../public/style/chat.css?inline';
|
||||||
import { Database } from '../../services/database.service';
|
import { Database } from '../../services/database.service';
|
||||||
|
|
||||||
const service = await Service.getInstance();
|
let myProcesses = (await Services.getInstance()).getMyProcesses();
|
||||||
let myProcesses = service.getMyProcesses();
|
let allProcesses = (await Services.getInstance()).getAllProcesses();
|
||||||
let allProcesses = service.getProcesses();
|
|
||||||
|
|
||||||
// Initialize function, create initial tokens with itens that are already selected by the user
|
// Initialize function, create initial tokens with itens that are already selected by the user
|
||||||
export async function init() {
|
export async function init() {
|
||||||
@ -546,40 +545,3 @@ async function getDescription(processId: string, process: Process): Promise<stri
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// async function getProcesses(): Promise<Set<string>> {
|
|
||||||
// const service = await Services.getInstance();
|
|
||||||
// const processes = await service.getProcesses();
|
|
||||||
// const processIds = new Set<string>(Object.keys(processes));
|
|
||||||
|
|
||||||
// return processIds;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async function getMyProcesses(): Promise<Set<string>> {
|
|
||||||
// const service = await Services.getInstance();
|
|
||||||
// try {
|
|
||||||
// const processes = await service.getProcesses();
|
|
||||||
// const userProcessSet = new Set<string>();
|
|
||||||
|
|
||||||
// for (const [processId, process] of Object.entries(processes)) {
|
|
||||||
// let roles;
|
|
||||||
// try {
|
|
||||||
// roles = await service.getRoles(process);
|
|
||||||
// // console.log("ROLES: ", roles);
|
|
||||||
|
|
||||||
// const hasCurrentUser = service.rolesContainsUs(roles);
|
|
||||||
|
|
||||||
// if (hasCurrentUser) {
|
|
||||||
// userProcessSet.add(processId);
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return userProcessSet;
|
|
||||||
|
|
||||||
// } catch (e) {
|
|
||||||
// console.error("Failed to get processes:", e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
@ -24,7 +24,9 @@ export default class Services {
|
|||||||
private localAddress: string | null = null;
|
private localAddress: string | null = null;
|
||||||
private pairedAddresses: string[] = [];
|
private pairedAddresses: string[] = [];
|
||||||
private sdkClient: any;
|
private sdkClient: any;
|
||||||
private processes: IProcess[] | null = null;
|
// private processes: IProcess[] | null = null;
|
||||||
|
private processes: Set = new Set();
|
||||||
|
private myProcesses: Set = new Set();
|
||||||
private notifications: any[] | null = null;
|
private notifications: any[] | null = null;
|
||||||
private subscriptions: { element: Element; event: string; eventHandler: string }[] = [];
|
private subscriptions: { element: Element; event: string; eventHandler: string }[] = [];
|
||||||
private database: any;
|
private database: any;
|
||||||
@ -1300,4 +1302,12 @@ export default class Services {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getMyProcesses(): Promise<Set<>> {
|
||||||
|
return this.myProcesses;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAllProcesses(): Promise<Set<>> {
|
||||||
|
return this.processes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user