Check if demo messaging process exists, create it if not

This commit is contained in:
NicolasCantu 2025-01-13 11:24:35 +01:00
parent 36257ebba7
commit 37e69790d9

View File

@ -37,20 +37,23 @@ export async function init() {
search_div.appendChild(dropdown_icon);
const processes = await getProcesses();
let hasMessaging = false;
for (const {key, value} of processes) {
const processName = await getDescription(key, value);
if (processName) {
console.log('adding process name to list:', processName);
if (processName === "messaging") {
hasMessaging = true;
}
const opt = new Option(processName);
opt.value = processName;
opt.setAttribute('data-process-id', key);
element.add(opt);
}
}
const { autocomplete_options } = getOptions(element);
if (autocomplete_options.length === 0) {
if (!hasMessaging) {
console.log('No existing processes - creating new messaging process');
await createMessagingProcess();