Add translations to KeyValueSecretsEdit and fix build.
This commit is contained in:
parent
748036d98a
commit
368feeb76b
|
@ -4,6 +4,8 @@ import { verifyJSONString } from "../../utils.js";
|
||||||
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
|
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
|
||||||
import { makeElement } from "../../htmlUtils.js";
|
import { makeElement } from "../../htmlUtils.js";
|
||||||
import { CodeJar } from "codejar";
|
import { CodeJar } from "codejar";
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
|
|
||||||
export class KeyValueSecretEditPage extends Page {
|
export class KeyValueSecretEditPage extends Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -14,7 +16,10 @@ export class KeyValueSecretEditPage extends Page {
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
setTitleElement(pageState);
|
setTitleElement(pageState);
|
||||||
let loadingText = makeElement({ tag: "p", text: "Loading.." });
|
let loadingText = makeElement({
|
||||||
|
tag: "p",
|
||||||
|
text: i18next.t("kv_sec_edit_loading")
|
||||||
|
});
|
||||||
let editor = makeElement({
|
let editor = makeElement({
|
||||||
tag: "div",
|
tag: "div",
|
||||||
class: ["editor", "language-json"]
|
class: ["editor", "language-json"]
|
||||||
|
@ -22,7 +27,7 @@ export class KeyValueSecretEditPage extends Page {
|
||||||
let saveButton = makeElement({
|
let saveButton = makeElement({
|
||||||
tag: "button",
|
tag: "button",
|
||||||
class: ["uk-button", "uk-button-primary"],
|
class: ["uk-button", "uk-button-primary"],
|
||||||
text: "Save"
|
text: i18next.t("kv_sec_edit_btn")
|
||||||
});
|
});
|
||||||
setPageContent(makeElement({
|
setPageContent(makeElement({
|
||||||
tag: "div",
|
tag: "div",
|
||||||
|
@ -46,7 +51,7 @@ export class KeyValueSecretEditPage extends Page {
|
||||||
jar.updateCode(secretsJSON);
|
jar.updateCode(secretsJSON);
|
||||||
saveButton.onclick = function () {
|
saveButton.onclick = function () {
|
||||||
if (!verifyJSONString(jar.toString())) {
|
if (!verifyJSONString(jar.toString())) {
|
||||||
setErrorText("Invalid JSON");
|
setErrorText(i18next.t("kv_sec_edit_invalid_json_err"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
createOrUpdateSecret(
|
createOrUpdateSecret(
|
||||||
|
@ -65,10 +70,10 @@ export class KeyValueSecretEditPage extends Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
get titleSuffix() {
|
get titleSuffix() {
|
||||||
return " (edit)";
|
return i18next.t("kv_sec_edit_suffix");
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return "K/V Secrets Edit";
|
return i18next.t("kv_sec_edit_title");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ export { SetLanguagePage } from "./SetLanguage.js";
|
||||||
export { TOTPViewPage } from "./TOTP/TOTPView.js";
|
export { TOTPViewPage } from "./TOTP/TOTPView.js";
|
||||||
export { NewTOTPPage } from "./TOTP/NewTOTP.js";
|
export { NewTOTPPage } from "./TOTP/NewTOTP.js";
|
||||||
export { KeyValueViewPage } from "./KeyValue/KeyValueView.js";
|
export { KeyValueViewPage } from "./KeyValue/KeyValueView.js";
|
||||||
export { KeyValueSecretPage } from "./KeyValue/KeyValueSecrets.js";
|
export { KeyValueSecretPage } from "./KeyValue/KeyValueSecret.js";
|
||||||
export { KeyValueVersionsPage } from "./KeyValue/KeyValueVersions.js";
|
export { KeyValueVersionsPage } from "./KeyValue/KeyValueVersions.js";
|
||||||
export { KeyValueNewPage } from "./KeyValue/KeyValueNew.js";
|
export { KeyValueNewPage } from "./KeyValue/KeyValueNew.js";
|
||||||
export { KeyValueDeletePage } from "./KeyValue/KeyValueDelete.js";
|
export { KeyValueDeletePage } from "./KeyValue/KeyValueDelete.js";
|
||||||
|
|
|
@ -67,7 +67,13 @@ module.exports = {
|
||||||
"kv_secret_delete_all_btn": "Delete All Versions",
|
"kv_secret_delete_all_btn": "Delete All Versions",
|
||||||
"kv_secret_delete_version_btn": "Delete Version {{ version }}",
|
"kv_secret_delete_version_btn": "Delete Version {{ version }}",
|
||||||
"kv_secret_edit_btn": "Edit",
|
"kv_secret_edit_btn": "Edit",
|
||||||
"kv_secret_versions_btn": "Versions"
|
"kv_secret_versions_btn": "Versions",
|
||||||
|
|
||||||
|
// Key Value Secret Editor Page
|
||||||
|
"kv_sec_edit_title": "K/V Edit",
|
||||||
|
"kv_sec_edit_btn": "Edit",
|
||||||
|
"kv_sec_edit_loading": "Loading Editor..",
|
||||||
|
"kv_sec_edit_invalid_json_err": "Invalid JSON",
|
||||||
|
"kv_sec_edit_suffix": " (edit)",
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue