mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-17 19:54:39 -05:00
Added JSDoc for src/pages/*
Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
parent
2170229031
commit
b0476cfb5b
@ -51,6 +51,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/** Submit form data to add new status page */
|
||||||
async submit() {
|
async submit() {
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
|
||||||
|
@ -289,39 +289,47 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/** Request a test notification be sent for this monitor */
|
||||||
testNotification() {
|
testNotification() {
|
||||||
this.$root.getSocket().emit("testNotification", this.monitor.id);
|
this.$root.getSocket().emit("testNotification", this.monitor.id);
|
||||||
toast.success("Test notification is requested.");
|
toast.success("Test notification is requested.");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Show dialog to confirm pause */
|
||||||
pauseDialog() {
|
pauseDialog() {
|
||||||
this.$refs.confirmPause.show();
|
this.$refs.confirmPause.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Resume this monitor */
|
||||||
resumeMonitor() {
|
resumeMonitor() {
|
||||||
this.$root.getSocket().emit("resumeMonitor", this.monitor.id, (res) => {
|
this.$root.getSocket().emit("resumeMonitor", this.monitor.id, (res) => {
|
||||||
this.$root.toastRes(res);
|
this.$root.toastRes(res);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Request that this monitor is paused */
|
||||||
pauseMonitor() {
|
pauseMonitor() {
|
||||||
this.$root.getSocket().emit("pauseMonitor", this.monitor.id, (res) => {
|
this.$root.getSocket().emit("pauseMonitor", this.monitor.id, (res) => {
|
||||||
this.$root.toastRes(res);
|
this.$root.toastRes(res);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Show dialog to confirm deletion */
|
||||||
deleteDialog() {
|
deleteDialog() {
|
||||||
this.$refs.confirmDelete.show();
|
this.$refs.confirmDelete.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Show dialog to confirm clearing events */
|
||||||
clearEventsDialog() {
|
clearEventsDialog() {
|
||||||
this.$refs.confirmClearEvents.show();
|
this.$refs.confirmClearEvents.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Show dialog to confirm clearing heartbeats */
|
||||||
clearHeartbeatsDialog() {
|
clearHeartbeatsDialog() {
|
||||||
this.$refs.confirmClearHeartbeats.show();
|
this.$refs.confirmClearHeartbeats.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Request that this monitor is deleted */
|
||||||
deleteMonitor() {
|
deleteMonitor() {
|
||||||
this.$root.deleteMonitor(this.monitor.id, (res) => {
|
this.$root.deleteMonitor(this.monitor.id, (res) => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
@ -333,6 +341,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Request that this monitors events are cleared */
|
||||||
clearEvents() {
|
clearEvents() {
|
||||||
this.$root.clearEvents(this.monitor.id, (res) => {
|
this.$root.clearEvents(this.monitor.id, (res) => {
|
||||||
if (! res.ok) {
|
if (! res.ok) {
|
||||||
@ -341,6 +350,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Request that this monitors heartbeats are cleared */
|
||||||
clearHeartbeats() {
|
clearHeartbeats() {
|
||||||
this.$root.clearHeartbeats(this.monitor.id, (res) => {
|
this.$root.clearHeartbeats(this.monitor.id, (res) => {
|
||||||
if (! res.ok) {
|
if (! res.ok) {
|
||||||
@ -349,6 +359,11 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the correct title for the ping stat
|
||||||
|
* @param {boolean} [average=false] Is the statistic an average?
|
||||||
|
* @returns {string} Title formated dependant on monitor type
|
||||||
|
*/
|
||||||
pingTitle(average = false) {
|
pingTitle(average = false) {
|
||||||
let translationPrefix = "";
|
let translationPrefix = "";
|
||||||
if (average) {
|
if (average) {
|
||||||
|
@ -522,6 +522,7 @@ export default {
|
|||||||
this.dnsresolvetypeOptions = dnsresolvetypeOptions;
|
this.dnsresolvetypeOptions = dnsresolvetypeOptions;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/** Initialize the edit monitor form */
|
||||||
init() {
|
init() {
|
||||||
if (this.isAdd) {
|
if (this.isAdd) {
|
||||||
|
|
||||||
@ -578,6 +579,10 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate form input
|
||||||
|
* @returns {boolean} Is the form input valid?
|
||||||
|
*/
|
||||||
isInputValid() {
|
isInputValid() {
|
||||||
if (this.monitor.body) {
|
if (this.monitor.body) {
|
||||||
try {
|
try {
|
||||||
@ -598,6 +603,10 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit the form data for processing
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
async submit() {
|
async submit() {
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
|
||||||
@ -642,14 +651,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Added a Notification Event
|
/**
|
||||||
// Enable it if the notification is added in EditMonitor.vue
|
* Added a Notification Event
|
||||||
|
* Enable it if the notification is added in EditMonitor.vue
|
||||||
|
* @param {number} id ID of notification to add
|
||||||
|
*/
|
||||||
addedNotification(id) {
|
addedNotification(id) {
|
||||||
this.monitor.notificationIDList[id] = true;
|
this.monitor.notificationIDList[id] = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Added a Proxy Event
|
/**
|
||||||
// Enable it if the proxy is added in EditMonitor.vue
|
* Added a Proxy Event
|
||||||
|
* Enable it if the proxy is added in EditMonitor.vue
|
||||||
|
* @param {number} id ID of proxy to add
|
||||||
|
*/
|
||||||
addedProxy(id) {
|
addedProxy(id) {
|
||||||
this.monitor.proxyId = id;
|
this.monitor.proxyId = id;
|
||||||
},
|
},
|
||||||
|
@ -51,6 +51,11 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* Get the correct URL for the icon
|
||||||
|
* @param {string} icon Path for icon
|
||||||
|
* @returns {string} Correctly formatted path including port numbers
|
||||||
|
*/
|
||||||
icon(icon) {
|
icon(icon) {
|
||||||
if (icon === "/icon.svg") {
|
if (icon === "/icon.svg") {
|
||||||
return icon;
|
return icon;
|
||||||
|
@ -44,6 +44,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/** Go back 1 in browser history */
|
||||||
goBack() {
|
goBack() {
|
||||||
history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
|
@ -118,13 +118,17 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
// For desktop only, mobile do nothing
|
/**
|
||||||
|
* Load the general settings page
|
||||||
|
* For desktop only, mobile do nothing
|
||||||
|
*/
|
||||||
loadGeneralPage() {
|
loadGeneralPage() {
|
||||||
if (!this.currentPage && !this.$root.isMobile) {
|
if (!this.currentPage && !this.$root.isMobile) {
|
||||||
this.$router.push("/settings/general");
|
this.$router.push("/settings/general");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Load settings from server */
|
||||||
loadSettings() {
|
loadSettings() {
|
||||||
this.$root.getSocket().emit("getSettings", (res) => {
|
this.$root.getSocket().emit("getSettings", (res) => {
|
||||||
this.settings = res.data;
|
this.settings = res.data;
|
||||||
@ -149,9 +153,16 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for saving settings
|
||||||
|
* @callback saveSettingsCB
|
||||||
|
* @param {Object} res Result of operation
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save Settings
|
* Save Settings
|
||||||
* @param currentPassword (Optional) Only need for disableAuth to true
|
* @param {saveSettingsCB} [callback]
|
||||||
|
* @param {string} [currentPassword] Only need for disableAuth to true
|
||||||
*/
|
*/
|
||||||
saveSettings(callback, currentPassword) {
|
saveSettings(callback, currentPassword) {
|
||||||
this.$root.getSocket().emit("setSettings", this.settings, currentPassword, (res) => {
|
this.$root.getSocket().emit("setSettings", this.settings, currentPassword, (res) => {
|
||||||
|
@ -71,6 +71,10 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* Submit form data for processing
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
submit() {
|
submit() {
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
|
||||||
|
@ -332,6 +332,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
/** Override for the status page slug */
|
||||||
overrideSlug: {
|
overrideSlug: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
@ -582,10 +583,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide syntax highlighting for CSS
|
||||||
|
* @param {string} code Text to highlight
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
highlighter(code) {
|
highlighter(code) {
|
||||||
return highlight(code, languages.css);
|
return highlight(code, languages.css);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Update the heartbeat list and update favicon if neccessary */
|
||||||
updateHeartbeatList() {
|
updateHeartbeatList() {
|
||||||
// If editMode, it will use the data from websocket.
|
// If editMode, it will use the data from websocket.
|
||||||
if (! this.editMode) {
|
if (! this.editMode) {
|
||||||
@ -614,6 +621,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Enable editing mode */
|
||||||
edit() {
|
edit() {
|
||||||
if (this.hasToken) {
|
if (this.hasToken) {
|
||||||
this.$root.initSocketIO(true);
|
this.$root.initSocketIO(true);
|
||||||
@ -622,6 +630,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Save the status page */
|
||||||
save() {
|
save() {
|
||||||
let startTime = new Date();
|
let startTime = new Date();
|
||||||
this.config.slug = this.config.slug.trim().toLowerCase();
|
this.config.slug = this.config.slug.trim().toLowerCase();
|
||||||
@ -649,10 +658,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Show dialog confirming deletion */
|
||||||
deleteDialog() {
|
deleteDialog() {
|
||||||
this.$refs.confirmDelete.show();
|
this.$refs.confirmDelete.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Request deletion of this status page */
|
||||||
deleteStatusPage() {
|
deleteStatusPage() {
|
||||||
this.$root.getSocket().emit("deleteStatusPage", this.slug, (res) => {
|
this.$root.getSocket().emit("deleteStatusPage", this.slug, (res) => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
@ -664,10 +675,16 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns label for a specifed monitor
|
||||||
|
* @param {Object} monitor Object representing monitor
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
monitorSelectorLabel(monitor) {
|
monitorSelectorLabel(monitor) {
|
||||||
return `${monitor.name}`;
|
return `${monitor.name}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Add a group to the status page */
|
||||||
addGroup() {
|
addGroup() {
|
||||||
let groupName = this.$t("Untitled Group");
|
let groupName = this.$t("Untitled Group");
|
||||||
|
|
||||||
@ -681,27 +698,32 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Add a domain to the status page */
|
||||||
addDomainField() {
|
addDomainField() {
|
||||||
this.config.domainNameList.push("");
|
this.config.domainNameList.push("");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Discard changes to status page */
|
||||||
discard() {
|
discard() {
|
||||||
location.href = "/status/" + this.slug;
|
location.href = "/status/" + this.slug;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crop Success
|
* Set URL of new image after successful crop operation
|
||||||
|
* @param {string} imgDataUrl URL of image in data:// format
|
||||||
*/
|
*/
|
||||||
cropSuccess(imgDataUrl) {
|
cropSuccess(imgDataUrl) {
|
||||||
this.imgDataUrl = imgDataUrl;
|
this.imgDataUrl = imgDataUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Show image crop dialog if in edit mode */
|
||||||
showImageCropUploadMethod() {
|
showImageCropUploadMethod() {
|
||||||
if (this.editMode) {
|
if (this.editMode) {
|
||||||
this.showImageCropUpload = true;
|
this.showImageCropUpload = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Create an incident for this status page */
|
||||||
createIncident() {
|
createIncident() {
|
||||||
this.enableEditIncidentMode = true;
|
this.enableEditIncidentMode = true;
|
||||||
|
|
||||||
@ -716,6 +738,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Post the incident to the status page */
|
||||||
postIncident() {
|
postIncident() {
|
||||||
if (this.incident.title === "" || this.incident.content === "") {
|
if (this.incident.title === "" || this.incident.content === "") {
|
||||||
toast.error(this.$t("Please input title and content"));
|
toast.error(this.$t("Please input title and content"));
|
||||||
@ -735,14 +758,13 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/** Click Edit Button */
|
||||||
* Click Edit Button
|
|
||||||
*/
|
|
||||||
editIncident() {
|
editIncident() {
|
||||||
this.enableEditIncidentMode = true;
|
this.enableEditIncidentMode = true;
|
||||||
this.previousIncident = Object.assign({}, this.incident);
|
this.previousIncident = Object.assign({}, this.incident);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Cancel creation or editing of incident */
|
||||||
cancelIncident() {
|
cancelIncident() {
|
||||||
this.enableEditIncidentMode = false;
|
this.enableEditIncidentMode = false;
|
||||||
|
|
||||||
@ -752,16 +774,25 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Unpin the incident */
|
||||||
unpinIncident() {
|
unpinIncident() {
|
||||||
this.$root.getSocket().emit("unpinIncident", this.slug, () => {
|
this.$root.getSocket().emit("unpinIncident", this.slug, () => {
|
||||||
this.incident = null;
|
this.incident = null;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the relative time difference of a date from now
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
dateFromNow(date) {
|
dateFromNow(date) {
|
||||||
return dayjs.utc(date).fromNow();
|
return dayjs.utc(date).fromNow();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a domain from the status page
|
||||||
|
* @param {number} index Index of domain to remove
|
||||||
|
*/
|
||||||
removeDomain(index) {
|
removeDomain(index) {
|
||||||
this.config.domainNameList.splice(index, 1);
|
this.config.domainNameList.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user