{$i18n.t('Functions')} • {$WEBUI_NAME} { return await loadFunctionByUrl(localStorage.token, url); }} onImport={(func) => { sessionStorage.function = JSON.stringify({ ...func }); goto('/admin/functions/create'); }} /> {#if loaded}
{ console.log(importFiles); showConfirm = true; }} />
{$i18n.t('Functions')}
{filteredItems.length}
{ showImportModal = true; } }, { id: 'functions-import', label: $i18n.t('Import JSON'), onClick: () => functionsImportInputElement?.click(), visible: $user?.role === 'admin' }, { id: 'functions-export', label: $i18n.t('Export JSON'), onClick: downloadFunctions, visible: $user?.role === 'admin' && functions.length > 0 } ]} />
{#if query}
{/if}
{ if (e.deltaY !== 0) { e.preventDefault(); e.currentTarget.scrollLeft += e.deltaY; } }} >
{ localStorage.workspaceViewOption = value; await tick(); }} />
{#if (filteredItems ?? []).length !== 0}
{#each filteredItems as func (func.id)}
{ if (shouldIgnoreRowClick(e.target)) return; openFunction(func); }} on:keydown={(e) => { if (e.currentTarget !== e.target) return; if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openFunction(func); } }} >
{func.type}
{func.name}
{#if func?.meta?.manifest?.version}
v{func?.meta?.manifest?.version ?? ''}
{/if}
{dayjs(func.updated_at * 1000).fromNow()}
{#if func?.meta?.description}
{func?.meta?.description}
{/if}
{#if shiftKey} {:else} {#if func?.meta?.manifest?.funding_url ?? false} {/if}
{ goto(`/admin/functions/edit?id=${encodeURIComponent(func.id)}`); }} shareHandler={() => { shareHandler(func); }} cloneHandler={() => { cloneHandler(func); }} exportHandler={() => { exportHandler(func); }} deleteHandler={async () => { selectedFunction = func; showDeleteConfirm = true; }} toggleGlobalHandler={() => { if (['filter', 'action'].includes(func.type)) { toggleGlobalHandler(func); } }} onClose={() => { openFunctionMenuId = null; }} >
{/if}
{/each}
{:else}
😕
{$i18n.t('No functions found')}
{$i18n.t('Try adjusting your search or filter to find what you are looking for.')}
{/if}
{#if $config?.features.enable_community_sharing} {/if}
{ deleteHandler(selectedFunction); }} >
{$i18n.t('This will delete')} {selectedFunction.name}.
{ await tick(); models.set( await getModels( localStorage.token, $config?.features?.enable_direct_connections && ($settings?.directConnections ?? null), false, true ) ); }} /> { const reader = new FileReader(); reader.onload = async (event) => { const _functions = JSON.parse(event.target.result); console.log(_functions); for (let func of _functions) { if ('function' in func) { // Required for Community JSON import func = func.function; } const res = await createNewFunction(localStorage.token, func).catch((error) => { toast.error(`${error}`); return null; }); } toast.success($i18n.t('Functions imported successfully')); functions = await getFunctionList(localStorage.token); _functions.set(await getFunctions(localStorage.token)); models.set( await getModels( localStorage.token, $config?.features?.enable_direct_connections && ($settings?.directConnections ?? null), false, true ) ); importFiles = null; functionsImportInputElement.value = ''; }; reader.readAsText(importFiles[0]); }} >
{$i18n.t('Please carefully review the following warnings:')}
  • {$i18n.t('Functions allow arbitrary code execution.')}
  • {$i18n.t('Do not install functions from sources you do not fully trust.')}
{$i18n.t( 'I acknowledge that I have read and I understand the implications of my action. I am aware of the risks associated with executing arbitrary code and I have verified the trustworthiness of the source.' )}
{:else}
{/if}