Compare commits

...

7 commits

Author SHA1 Message Date
Ryo Hanafusa
e75a977447
Merge 061b549d16 into 6899603eb7 2024-11-09 15:30:21 +00:00
Abhigyan Mohanta
6899603eb7
fix #5314 Email Address Friendly Name Error (#5318)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
2024-11-09 23:30:08 +08:00
Ryo Hanafusa
061b549d16 send url always because it's used in showLink 2024-10-28 11:33:40 +00:00
Ryo Hanafusa
d3c3808dae revert showLink without the unused if-statement surrounding ignoreSendUrl 2024-10-28 11:33:02 +00:00
Ryo Hanafusa
61c68e2305
Merge branch 'master' into fix-issue-3794 2024-10-28 12:08:42 +09:00
Ryo Hanafusa
2fb3638bd7 convert sendUrl number -> boolean in toPublicJSON 2024-10-27 08:18:46 +00:00
Ryo Hanafusa
9af201924f Use the element's value for initial value to keep the changes in the dialog 2024-10-26 09:02:32 +00:00
3 changed files with 13 additions and 20 deletions

View file

@ -48,14 +48,11 @@ class Monitor extends BeanModel {
let obj = { let obj = {
id: this.id, id: this.id,
name: this.name, name: this.name,
sendUrl: this.sendUrl, sendUrl: !!this.sendUrl,
url: this.url,
type: this.type, type: this.type,
}; };
if (this.sendUrl) {
obj.url = this.url;
}
if (showTags) { if (showTags) {
obj.tags = await this.getTags(); obj.tags = await this.getTags();
} }

View file

@ -10,7 +10,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="my-3 form-check"> <div class="my-3 form-check">
<input id="show-clickable-link" v-model="monitor.isClickAble" class="form-check-input" type="checkbox" @click="toggleLink(monitor.group_index, monitor.monitor_index)" /> <input id="show-clickable-link" v-model="monitor.isClickable" class="form-check-input" type="checkbox" @click="toggleLink(monitor.group_index, monitor.monitor_index)" />
<label class="form-check-label" for="show-clickable-link"> <label class="form-check-label" for="show-clickable-link">
{{ $t("Show Clickable Link") }} {{ $t("Show Clickable Link") }}
</label> </label>
@ -54,6 +54,9 @@ export default {
monitor: { monitor: {
id: null, id: null,
name: null, name: null,
monitor_index: null,
group_index: null,
isClickable: null,
}, },
}; };
}, },
@ -77,7 +80,7 @@ export default {
name: monitor.element.name, name: monitor.element.name,
monitor_index: monitor.index, monitor_index: monitor.index,
group_index: group.index, group_index: group.index,
isClickAble: this.showLink(monitor), isClickable: this.showLink(monitor),
}; };
this.MonitorSettingDialog.show(); this.MonitorSettingDialog.show();
@ -98,17 +101,10 @@ 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 Should the presence of the sendUrl
* property be ignored. This will only work in edit mode.
* @returns {boolean} Should the link be shown? * @returns {boolean} Should the link be shown?
*/ */
showLink(monitor, ignoreSendUrl = false) { showLink(monitor) {
// We must check if there are any elements in monitorList to return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://";
// 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" || this.$root.monitorList[monitor.element.id].type === "json-query";
}
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://" && !this.editMode;
}, },
}, },
}; };

View file

@ -5,20 +5,20 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label> <label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label>
<input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="email" class="form-control" required> <input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="text" class="form-control" required>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label> <label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label>
<input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="email" class="form-control" required> <input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="text" class="form-control" required>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label> <label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
<input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="email" class="form-control"> <input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="text" class="form-control">
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div> <div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label> <label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
<input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="email" class="form-control"> <input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="text" class="form-control">
<small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small> <small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small>
</div> </div>
<div class="mb-3"> <div class="mb-3">