Added JSDoc for src/components/settings/*

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
Matthew Nickson 2022-06-01 23:44:10 +01:00
parent 07888e43f1
commit d939d03690
No known key found for this signature in database
GPG key ID: BF229DCFD4748E05
5 changed files with 21 additions and 0 deletions

View file

@ -133,10 +133,15 @@ export default {
}, },
methods: { methods: {
/**
* Show the confimation dialog confirming the configuration
* be imported
*/
confirmImport() { confirmImport() {
this.$refs.confirmImport.show(); this.$refs.confirmImport.show();
}, },
/** Download a backup of the configuration */
downloadBackup() { downloadBackup() {
let time = dayjs().format("YYYY_MM_DD-hh_mm_ss"); let time = dayjs().format("YYYY_MM_DD-hh_mm_ss");
let fileName = `Uptime_Kuma_Backup_${time}.json`; let fileName = `Uptime_Kuma_Backup_${time}.json`;
@ -157,6 +162,10 @@ export default {
downloadItem.click(); downloadItem.click();
}, },
/**
* Import the specified backup file
* @returns {?string}
*/
importBackup() { importBackup() {
this.processing = true; this.processing = true;
let uploadItem = document.getElementById("import-backend").files; let uploadItem = document.getElementById("import-backend").files;

View file

@ -178,10 +178,12 @@ export default {
}, },
methods: { methods: {
/** Save the settings */
saveGeneral() { saveGeneral() {
localStorage.timezone = this.$root.userTimezone; localStorage.timezone = this.$root.userTimezone;
this.saveSettings(); this.saveSettings();
}, },
/** Get the base URL of the application */
autoGetPrimaryBaseURL() { autoGetPrimaryBaseURL() {
this.settings.primaryBaseURL = location.protocol + "//" + location.host; this.settings.primaryBaseURL = location.protocol + "//" + location.host;
}, },

View file

@ -90,6 +90,7 @@ export default {
}, },
methods: { methods: {
/** Get the current size of the database */
loadDatabaseSize() { loadDatabaseSize() {
log.debug("monitorhistory", "load database size"); log.debug("monitorhistory", "load database size");
this.$root.getSocket().emit("getDatabaseSize", (res) => { this.$root.getSocket().emit("getDatabaseSize", (res) => {
@ -102,6 +103,7 @@ export default {
}); });
}, },
/** Request that the database is shrunk */
shrinkDatabase() { shrinkDatabase() {
this.$root.getSocket().emit("shrinkDatabase", (res) => { this.$root.getSocket().emit("shrinkDatabase", (res) => {
if (res.ok) { if (res.ok) {
@ -113,10 +115,12 @@ export default {
}); });
}, },
/** Show the dialog to confirm clearing stats */
confirmClearStatistics() { confirmClearStatistics() {
this.$refs.confirmClearStatistics.show(); this.$refs.confirmClearStatistics.show();
}, },
/** Send the request to clear stats */
clearStatistics() { clearStatistics() {
this.$root.clearStatistics((res) => { this.$root.clearStatistics((res) => {
if (res.ok) { if (res.ok) {

View file

@ -120,14 +120,17 @@ export default {
this.$root.getSocket().emit(prefix + "leave"); this.$root.getSocket().emit(prefix + "leave");
}, },
methods: { methods: {
/** Start the Cloudflare tunnel */
start() { start() {
this.$root.getSocket().emit(prefix + "start", this.cloudflareTunnelToken); this.$root.getSocket().emit(prefix + "start", this.cloudflareTunnelToken);
}, },
/** Stop the Cloudflare tunnel */
stop() { stop() {
this.$root.getSocket().emit(prefix + "stop", this.currentPassword, (res) => { this.$root.getSocket().emit(prefix + "stop", this.currentPassword, (res) => {
this.$root.toastRes(res); this.$root.toastRes(res);
}); });
}, },
/** Remove the token for the Cloudflare tunnel */
removeToken() { removeToken() {
this.$root.getSocket().emit(prefix + "removeToken"); this.$root.getSocket().emit(prefix + "removeToken");
this.cloudflareTunnelToken = ""; this.cloudflareTunnelToken = "";

View file

@ -303,6 +303,7 @@ export default {
}, },
methods: { methods: {
/** Check new passwords match before saving them */
savePassword() { savePassword() {
if (this.password.newPassword !== this.password.repeatNewPassword) { if (this.password.newPassword !== this.password.repeatNewPassword) {
this.invalidPassword = true; this.invalidPassword = true;
@ -320,6 +321,7 @@ export default {
} }
}, },
/** Disable authentication for web app access */
disableAuth() { disableAuth() {
this.settings.disableAuth = true; this.settings.disableAuth = true;
@ -332,6 +334,7 @@ export default {
}, this.password.currentPassword); }, this.password.currentPassword);
}, },
/** Enable authentication for web app access */
enableAuth() { enableAuth() {
this.settings.disableAuth = false; this.settings.disableAuth = false;
this.saveSettings(); this.saveSettings();