diff --git a/src/routes/console/project-[project]/functions/function/[function]/settings/+page.svelte b/src/routes/console/project-[project]/functions/function/[function]/settings/+page.svelte index 4bed65b6e..0305631e4 100644 --- a/src/routes/console/project-[project]/functions/function/[function]/settings/+page.svelte +++ b/src/routes/console/project-[project]/functions/function/[function]/settings/+page.svelte @@ -5,6 +5,7 @@ Button, InputNumber, InputSelect, + InputText, InputCron, Form, FormList @@ -22,6 +23,7 @@ import Upload from './uploadVariables.svelte'; import { toLocaleDateTime } from '$lib/helpers/date'; import { variableList } from '../../../store'; + import { breadcrumbs, title } from '$lib/stores/layout'; const functionId = $page.params.function; let showDelete = false; @@ -32,6 +34,7 @@ let showVariablesDropdown = []; let timeout = 0; let deployment: Models.Deployment = null; + let functionName: string = null; onMount(async () => { if ($func?.$id !== functionId) { @@ -39,7 +42,8 @@ } await variableList.load(functionId); deployment = await func.getDeployment(functionId, $func.deployment); - timeout = $func.timeout; + timeout ??= $func.timeout; + functionName ??= $func.name; }); let options = [ @@ -47,6 +51,26 @@ { label: 'minutes', value: 'minutes' } ]; + async function updateName() { + try { + await sdkForProject.functions.update(functionId, functionName, $func.execute); + $func.name = functionName; + title.set(functionName); + const breadcrumb = $breadcrumbs.get($breadcrumbs.size); + breadcrumb.title = functionName; + $breadcrumbs = $breadcrumbs.set($breadcrumbs.size, breadcrumb); + addNotification({ + message: 'Name has been updated', + type: 'success' + }); + } catch (error) { + addNotification({ + message: error.message, + type: 'error' + }); + } + } + async function updateTimeout() { try { await sdkForProject.functions.update( @@ -184,6 +208,28 @@ +
+