From e74f87b07ccad219c5b00faa3bfab99c1311bd6c Mon Sep 17 00:00:00 2001 From: Federico Nembrini <25205086+FedericoNembrini@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:51:59 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20SWU:=20Add=20button=20to=20clear=20?= =?UTF-8?q?the=20Github=20Access=20Token=20(#4609)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add github token clear checkbox in software update plugin * Replace checkbox with action button for github access token removal in software update plugin * Fix action button title --- .../static/js/softwareupdate.js | 23 +++++++++++++++++++ .../templates/snippets/githubToken.jinja2 | 16 ++++++++----- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index 13dcbd37e..aba2cf5b7 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -241,6 +241,29 @@ $(function () { self.configurationDialog.modal(); }; + self.deleteGithubTokenApiKey = function () { + var data = { + plugins: { + softwareupdate: { + credentials: { + github: undefined + } + } + } + }; + + self.settings.saveData(data, { + success: function () { + self.performCheck(); + }, + complete: function () { + self.config_githubToken(""); + self.config_githubTokenSet(false); + }, + sending: true + }); + }; + self.savePluginSettings = function (viewModel, event) { var target = $(event.target); target.prepend(' '); diff --git a/src/octoprint/plugins/softwareupdate/templates/snippets/githubToken.jinja2 b/src/octoprint/plugins/softwareupdate/templates/snippets/githubToken.jinja2 index 133832211..2338ede6e 100644 --- a/src/octoprint/plugins/softwareupdate/templates/snippets/githubToken.jinja2 +++ b/src/octoprint/plugins/softwareupdate/templates/snippets/githubToken.jinja2 @@ -1,12 +1,16 @@
- - - - - - +
+ + + + + + + +
{{ _('Set this if you keep running into rate limiting issues. See here for how to obtain a token.', url="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token") }} + {{ _('Please note that the deletion of the access token is applied immediately, without having to "Confirm" first.') }}