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",
"line": "Line Messenger",
"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 -->
<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" />
<div class="form-text">
You should call this url every {{ monitor.interval }} seconds.<br />
@ -328,15 +328,11 @@ export default {
},
bodyPlaceholder() {
return `{
"id": 124357,
"username": "admin",
"password": "myAdminPassword"
}`;
return this.$t("BodyPlaceholder");
},
headersPlaceholder() {
return "Authorization: Bearer abc123\nContent-Type: application/json";
return this.$t("HeadersPlaceholder");
}
},
@ -441,13 +437,13 @@ export default {
try {
JSON.parse(this.monitor.body);
} catch (err) {
toast.error(this.$t("The request body is not valid JSON: ") + err.message);
toast.error(this.$t("BodyInvalidFormat") + err.message);
return false;
}
}
if (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;
}
}