Add ability to set commit messages when editing functions

This commit is contained in:
Peter Stockings
2025-12-02 20:36:55 +11:00
parent 2253c8f7a7
commit 46339cc4cf
6 changed files with 63 additions and 3 deletions

View File

@@ -65,6 +65,10 @@ const FunctionHistory = {
"div.text-sm.text-gray-600.dark:text-gray-400",
new Date(version.versioned_at).toLocaleString()
),
version.commit_message && m(
"div.text-xs.text-gray-500.dark:text-gray-500.italic.mt-1",
version.commit_message
),
]
);
})

View File

@@ -66,6 +66,9 @@ const Editor = {
this.aiModalOpen = false;
this.aiModalContent = "";
this.aiModalTitle = "";
// Commit Message
this.commitMessage = "";
},
oncreate() {
@@ -248,6 +251,7 @@ const Editor = {
is_enabled: this.isEnabled,
description: this.description,
runtime: this.runtime,
commit_message: this.commitMessage,
}
: {
name: this.name,
@@ -259,6 +263,7 @@ const Editor = {
log_response: this.logResponse,
runtime: this.runtime,
description: this.description,
commit_message: this.commitMessage,
};
const response = await m.request({
@@ -946,6 +951,18 @@ const Editor = {
]),
],
// Commit Message Input (only show for edit mode)
this.isEdit && m("div", { class: "flex flex-col space-y-2 pt-2" }, [
m("label", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, "Commit Message (Optional)"),
m("textarea", {
class: "w-full p-2 border rounded bg-white dark:bg-gray-700 dark:border-gray-600 text-sm",
rows: 2,
placeholder: "Describe the changes you made...",
value: this.commitMessage,
oninput: (e) => (this.commitMessage = e.target.value)
})
]),
m(
"div",
{ class: "flex items-center justify-end space-x-3 pt-2" },