fix(edit-monitor): add translations to en.js

This commit is contained in:
Bert Verhelst 2021-10-05 09:20:24 +02:00
parent 6b44116245
commit afeb424dc0
2 changed files with 13 additions and 9 deletions

View File

@ -195,4 +195,12 @@ export default {
"pushbullet": "Pushbullet", "pushbullet": "Pushbullet",
"line": "Line Messenger", "line": "Line Messenger",
"mattermost": "Mattermost", "mattermost": "Mattermost",
Method: "Method",
Body: "Body",
Headers: "Headers",
PushUrl: "Push URL",
HeadersInvalidFormat: "Headers do not have a valid format: \"key: value <new line> key: value <new line>...\"",
BodyInvalidFormat: "The request body is not valid JSON: ",
BodyPlaceholder: "{\n\t\"id\": 124357,\n\t\"username\": \"admin\",\n\t\"password\": \"myAdminPassword\"\n}",
HeadersPlaceholder: "Authorization: Bearer abc123\nContent-Type: application/json",
}; };

View File

@ -86,7 +86,7 @@
<!-- Push URL --> <!-- Push URL -->
<div v-if="monitor.type === 'push' " class="my-3"> <div v-if="monitor.type === 'push' " class="my-3">
<label for="push-url" class="form-label">{{ $t("Push URL") }}</label> <label for="push-url" class="form-label">{{ $t("PushUrl") }}</label>
<CopyableInput id="push-url" v-model="pushURL" type="url" disabled="disabled" /> <CopyableInput id="push-url" v-model="pushURL" type="url" disabled="disabled" />
<div class="form-text"> <div class="form-text">
You should call this url every {{ monitor.interval }} seconds.<br /> You should call this url every {{ monitor.interval }} seconds.<br />
@ -328,15 +328,11 @@ export default {
}, },
bodyPlaceholder() { bodyPlaceholder() {
return `{ return this.$t("BodyPlaceholder");
"id": 124357,
"username": "admin",
"password": "myAdminPassword"
}`;
}, },
headersPlaceholder() { headersPlaceholder() {
return "Authorization: Bearer abc123\nContent-Type: application/json"; return this.$t("HeadersPlaceholder");
} }
}, },
@ -441,13 +437,13 @@ export default {
try { try {
JSON.parse(this.monitor.body); JSON.parse(this.monitor.body);
} catch (err) { } catch (err) {
toast.error(this.$t("The request body is not valid JSON: ") + err.message); toast.error(this.$t("BodyInvalidFormat") + err.message);
return false; return false;
} }
} }
if (this.monitor.headers) { if (this.monitor.headers) {
if (!/^([^:]+:.*)([\s]+[^:]+:.*)+$/g.test(this.monitor.headers)) { if (!/^([^:]+:.*)([\s]+[^:]+:.*)+$/g.test(this.monitor.headers)) {
toast.error(this.$t("Headers do not have a valid format: \"key: value<new line>key: value<new line>...\"")); toast.error(this.$t("HeadersInvalidFormat"));
return false; return false;
} }
} }