From f1ad6efe796e0702faec55557a94f0bbc4883807 Mon Sep 17 00:00:00 2001 From: dserv-nh <54544490+dserv-nh@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:36:41 +0200 Subject: [PATCH] feat: add git reset button --- js/components/GitContent.vue | 5 +++++ src/KirbyGit.php | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/js/components/GitContent.vue b/js/components/GitContent.vue index 482cecb..ffc33af 100644 --- a/js/components/GitContent.vue +++ b/js/components/GitContent.vue @@ -30,6 +30,7 @@ :buttons="[ { text: 'Pull', icon: 'download', click: pull }, { text: 'Push', icon: 'upload', click: push }, + { text: 'Discard all local changes', icon: 'reset-left', click: reset }, ]" /> @@ -136,6 +137,10 @@ export default { await panel.app.$api.post('/git-content/push') this.$reload() }, + reset: async function () { + await panel.app.$api.post('/git-content/reset') + this.$reload() + }, revert: async function () { this.$dialog("git-content/revert"); }, diff --git a/src/KirbyGit.php b/src/KirbyGit.php index cd65122..c46d0fc 100644 --- a/src/KirbyGit.php +++ b/src/KirbyGit.php @@ -38,6 +38,13 @@ public function getApiRoutes() return $kirbyGit->httpGitHelperAction('pull', "successfully pulled the content folder"); }, ], + [ + 'pattern' => 'git-content/reset', + 'method' => 'POST', + 'action' => function () use ($kirbyGit) { + return $kirbyGit->httpGitHelperAction('reset', "successfully reset the content folder"); + }, + ], [ 'pattern' => 'git-content/status', 'method' => 'GET',