Made link icon only show for http and keyword

The option to enable links to the monitors is now only available for
http and keyword monitor types. The link will also no longer be shown
on the edit page to prevent issues with the url not being present if
the monitor was not already enabled for sendUrl

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
pull/1741/head
Matthew Nickson 3 years ago
parent 6f57c4195a
commit 1b120f8a6f
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

@ -48,7 +48,10 @@
{{ monitor.element.name }} {{ monitor.element.name }}
</a> </a>
<p v-else class="item-name"> {{ monitor.element.name }} </p> <p v-else class="item-name"> {{ monitor.element.name }} </p>
<span title="Toggle Clickable Link"> <span
v-if="showLink(monitor, true)"
title="Toggle Clickable Link"
>
<font-awesome-icon <font-awesome-icon
v-if="editMode" v-if="editMode"
:class="{'link-active': monitor.element.sendUrl, 'btn-link': true}" :class="{'link-active': monitor.element.sendUrl, 'btn-link': true}"
@ -145,11 +148,17 @@ export default {
* Attempts to guess if a link should be shown based upon if * Attempts to guess if a link should be shown based upon if
* sendUrl is set and if the URL is default or not. * sendUrl is set and if the URL is default or not.
* @param {Object} monitor Monitor to check * @param {Object} monitor Monitor to check
* @param {boolean} [ignoreSendUrl=false] Should the presence of the sendUrl
* property be ignored. This will only work in edit mode.
* @returns {boolean} * @returns {boolean}
*/ */
showLink(monitor) { showLink(monitor, ignoreSendUrl = false) {
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://"; // We must check if there are any elements in monitorList to
// prevent undefined errors if it hasn't been loaded yet
if (this.$parent.editMode && ignoreSendUrl && Object.keys(this.$root.monitorList).length) {
return this.$root.monitorList[monitor.element.id].type === "http" || this.$root.monitorList[monitor.element.id].type === "keyword";
}
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://" && !this.editMode;
}, },
} }
}; };

Loading…
Cancel
Save