From 4492059a2bac9a4e6b3da2228f88b1670bbfd018 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 22 May 2023 16:57:17 +0200 Subject: [PATCH] refactor: function settings --- .../function-[function]/settings/+page.svelte | 527 +----------------- .../settings/dangerZone.svelte | 33 ++ .../{delete.svelte => deleteModal.svelte} | 0 .../settings/executeFunction.svelte | 36 ++ .../settings/updateName.svelte | 66 +++ .../settings/updatePermissions.svelte | 78 +++ .../settings/updateSchedule.svelte | 71 +++ .../settings/updateTimeout.svelte | 66 +++ .../settings/updateVariables.svelte | 233 ++++++++ ...les.svelte => uploadVariablesModal.svelte} | 0 10 files changed, 599 insertions(+), 511 deletions(-) create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/dangerZone.svelte rename src/routes/console/project-[project]/functions/function-[function]/settings/{delete.svelte => deleteModal.svelte} (100%) create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/executeFunction.svelte create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/updateName.svelte create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/updatePermissions.svelte create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/updateSchedule.svelte create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/updateTimeout.svelte create mode 100644 src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte rename src/routes/console/project-[project]/functions/function-[function]/settings/{uploadVariables.svelte => uploadVariablesModal.svelte} (100%) 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 94aadbc6c..85f8265db 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 @@ -1,520 +1,25 @@ - -
-
- technology -
-
- {$func.name} - -

{$func.runtime}

-
-
- -
-
-

Function ID: {$func.$id}

-

Created at: {toLocaleDateTime($func.$createdAt)}

-

Updated at: {toLocaleDateTime($func.$updatedAt)}

-
-
-
- - - - -
- -
- - Name - - -
    - -
-
- - - - -
-
- -
- - Execute Access -

- Choose who can execute this function using the client API. For more information, - check out the - Permissions Guide - . -

- - - - - - - -
-
- + + + - -
- - Schedule -

- Set a Cron schedule to trigger your function. Leave blank for no schedule. - More details on Cron syntax here. -

- - - - - - - - - -
-
- - - Variables -

Set the variables (or secret keys) that will be passed to your function at runtime.

- -
- - -
- {@const limit = 10} - {@const sum = data.variables.total} - {#if sum} -
- - - Key - Value - - - - {#each data.variables.variables.slice(offset, offset + limit) as variable, i} - - - - {variable.key} - - - - - - - - - - - { - selectedVar = variable; - showVariablesDropdown[i] = false; - showVariablesModal = true; - }}> - Edit - - { - handleVariableDeleted(variable); - showVariablesDropdown[i] = false; - }}> - Delete - - - - - - {/each} - -
- -
-

Total variables: {sum}

- -
-
- {:else} - (showVariablesModal = !showVariablesModal)}> - Create a variable to get started - - {/if} -
-
- -
- - Timeout -

- Limit the execution time of your function. Maximum value is 900 seconds (15 - minutes). -

- - - - - - - - - -
-
- - - Delete Function -

- The function will be permanently deleted, including all deployments associated with it. - This action is irreversible. -

- - - -
{$func.name}
-
-

Last Updated: {toLocaleDateTime($func.$updatedAt)}

-
-
- - - - -
+ + + +
- - -{#if showVariablesModal} - -{/if} -{#if showVariablesUpload} - -{/if} diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/dangerZone.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/dangerZone.svelte new file mode 100644 index 000000000..d5ec9fbf4 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/dangerZone.svelte @@ -0,0 +1,33 @@ + + + + Delete Function +

+ The function will be permanently deleted, including all deployments associated with it. This + action is irreversible. +

+ + + +
{$func.name}
+
+

Last Updated: {toLocaleDateTime($func.$updatedAt)}

+
+
+ + + + +
+ + diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/delete.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/deleteModal.svelte similarity index 100% rename from src/routes/console/project-[project]/functions/function-[function]/settings/delete.svelte rename to src/routes/console/project-[project]/functions/function-[function]/settings/deleteModal.svelte diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/executeFunction.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/executeFunction.svelte new file mode 100644 index 000000000..194b18bed --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/executeFunction.svelte @@ -0,0 +1,36 @@ + + + +
+
+ technology +
+
+ {$func.name} + +

{$func.runtime}

+
+
+ +
+
+

Function ID: {$func.$id}

+

Created at: {toLocaleDateTime($func.$createdAt)}

+

Updated at: {toLocaleDateTime($func.$updatedAt)}

+
+
+
+ + + + +
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/updateName.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/updateName.svelte new file mode 100644 index 000000000..431d12e5f --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateName.svelte @@ -0,0 +1,66 @@ + + +
+ + Name + + +
    + +
+
+ + + + +
+
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/updatePermissions.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/updatePermissions.svelte new file mode 100644 index 000000000..369f936a9 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updatePermissions.svelte @@ -0,0 +1,78 @@ + + +
+ + Execute Access +

+ Choose who can execute this function using the client API. For more information, check + out the + Permissions Guide + . +

+ + + + + + + +
+
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/updateSchedule.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/updateSchedule.svelte new file mode 100644 index 000000000..e60ba6e99 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateSchedule.svelte @@ -0,0 +1,71 @@ + + +
+ + Schedule +

+ Set a Cron schedule to trigger your function. Leave blank for no schedule. + More details on Cron syntax here. +

+ + + + + + + + + +
+
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/updateTimeout.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/updateTimeout.svelte new file mode 100644 index 000000000..94489f929 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateTimeout.svelte @@ -0,0 +1,66 @@ + + +
+ + Timeout +

Limit the execution time of your function. Maximum value is 900 seconds (15 minutes).

+ + + + + + + + + +
+
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte new file mode 100644 index 000000000..c3915babc --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte @@ -0,0 +1,233 @@ + + + + Variables +

Set the variables (or secret keys) that will be passed to your function at runtime.

+ +
+ + +
+ {@const limit = 10} + {@const sum = variableList.total} + {#if sum} +
+ + + Key + Value + + + + {#each variableList.variables.slice(offset, offset + limit) as variable, i} + + + + {variable.key} + + + + + + + + + + + { + selectedVar = variable; + showVariablesDropdown[i] = false; + showVariablesModal = true; + }}> + Edit + + { + handleVariableDeleted(variable); + showVariablesDropdown[i] = false; + }}> + Delete + + + + + + {/each} + +
+ +
+

Total variables: {sum}

+ +
+
+ {:else} + (showVariablesModal = !showVariablesModal)}> + Create a variable to get started + + {/if} +
+
+ +{#if showVariablesModal} + +{/if} +{#if showVariablesUpload} + +{/if} diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariables.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariablesModal.svelte similarity index 100% rename from src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariables.svelte rename to src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariablesModal.svelte