Update http functions overview page to show functions in searchable nested directory

This commit is contained in:
Peter Stockings
2025-11-19 17:28:35 +11:00
parent b210188556
commit 00c0d19e3e
8 changed files with 366 additions and 207 deletions

View File

@@ -23,8 +23,10 @@ const Editor = {
// Name + version
this.name = vnode.attrs.name || "foo";
this.path = vnode.attrs.path || "";
this.versionNumber = vnode.attrs.versionNumber || "1";
this.nameEditing = false;
this.pathEditing = false;
// Editor defaults
this.jsValue = vnode.attrs.jsValue || "";
@@ -151,6 +153,7 @@ const Editor = {
try {
let payload = {
name: this.name,
path: this.path,
script_content: this.jsValue,
environment_info: this.jsonValue,
is_public: this.isPublic,
@@ -175,6 +178,7 @@ const Editor = {
}
: {
name: this.name,
path: this.path,
script_content: this.jsValue,
environment_info: this.jsonValue,
is_public: this.isPublic,
@@ -296,6 +300,27 @@ const Editor = {
},
[
m("span", { class: "inline-flex items-center" }, [
// Path
!this.pathEditing
? m(
"span",
{
class: "font-mono text-gray-500 mr-1",
onclick: () => (this.pathEditing = true),
},
this.path ? `${this.path}/` : "/"
)
: m("input", {
class:
"bg-gray-50 border border-gray-300 text-sm rounded-lg p-1.5 dark:bg-gray-700 dark:border-gray-600 w-24 mr-1",
value: this.path,
placeholder: "path",
oninput: (e) => (this.path = e.target.value),
onblur: () => (this.pathEditing = false),
autofocus: true,
}),
// Name
!this.nameEditing
? m(
"span",
@@ -348,21 +373,37 @@ const Editor = {
: null,
// If adding a new function
this.isAdd
? m("div", { class: "w-full" }, [
m(
"label",
{ class: "block mb-2 text-sm font-medium" },
"Function name"
),
m("input", {
type: "text",
class: "bg-gray-50 border w-full p-2.5 rounded-lg",
placeholder: "foo",
required: true,
value: this.name,
oninput: (e) => (this.name = e.target.value),
}),
this.isAdd
? m("div", { class: "flex space-x-2 w-full" }, [
m("div", { class: "w-1/3" }, [
m(
"label",
{ class: "block mb-2 text-sm font-medium" },
"Path"
),
m("input", {
type: "text",
class: "bg-gray-50 border w-full p-2.5 rounded-lg",
placeholder: "api/v1",
value: this.path,
oninput: (e) => (this.path = e.target.value),
}),
]),
m("div", { class: "w-2/3" }, [
m(
"label",
{ class: "block mb-2 text-sm font-medium" },
"Function name"
),
m("input", {
type: "text",
class: "bg-gray-50 border w-full p-2.5 rounded-lg",
placeholder: "foo",
required: true,
value: this.name,
oninput: (e) => (this.name = e.target.value),
}),
]),
])
: null,
])