Add typing to KeyValueNew.ts.
This commit is contained in:
parent
e180c44e50
commit
bb6e5a7310
|
@ -1,6 +1,6 @@
|
||||||
import { HomePage } from "./pages/Home";
|
import { HomePage } from "./pages/Home";
|
||||||
import { KeyValueDeletePage } from "./pages/KeyValue/KeyValueDelete.js";
|
import { KeyValueDeletePage } from "./pages/KeyValue/KeyValueDelete.js";
|
||||||
import { KeyValueNewPage } from "./pages/KeyValue/KeyValueNew.js";
|
import { KeyValueNewPage } from "./pages/KeyValue/KeyValueNew";
|
||||||
import { KeyValueSecretEditPage } from "./pages/KeyValue/KeyValueSecretsEdit";
|
import { KeyValueSecretEditPage } from "./pages/KeyValue/KeyValueSecretsEdit";
|
||||||
import { KeyValueSecretPage } from "./pages/KeyValue/KeyValueSecret";
|
import { KeyValueSecretPage } from "./pages/KeyValue/KeyValueSecret";
|
||||||
import { KeyValueVersionsPage } from "./pages/KeyValue/KeyValueVersions";
|
import { KeyValueVersionsPage } from "./pages/KeyValue/KeyValueVersions";
|
||||||
|
|
|
@ -2,17 +2,21 @@ import { Page } from "../../types/Page";
|
||||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";
|
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils";
|
||||||
import { createOrUpdateSecret } from "../../api/createOrUpdateSecret";
|
import { createOrUpdateSecret } from "../../api/createOrUpdateSecret";
|
||||||
import { makeElement } from "../../htmlUtils";
|
import { makeElement } from "../../htmlUtils";
|
||||||
import { pageState } from "../../globalPageState.ts";
|
import { pageState } from "../../globalPageState";
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
|
|
||||||
export class KeyValueNewPage extends Page {
|
export class KeyValueNewPage extends Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
goBack() {
|
|
||||||
|
goBack(): void {
|
||||||
changePage("KEY_VALUE_VIEW");
|
changePage("KEY_VALUE_VIEW");
|
||||||
}
|
}
|
||||||
render() {
|
|
||||||
|
addKVNewForm: HTMLFormElement;
|
||||||
|
|
||||||
|
render(): void {
|
||||||
setTitleElement(pageState);
|
setTitleElement(pageState);
|
||||||
this.addKVNewForm = makeElement({
|
this.addKVNewForm = makeElement({
|
||||||
tag: "form",
|
tag: "form",
|
||||||
|
@ -46,7 +50,7 @@ export class KeyValueNewPage extends Page {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
});
|
}) as HTMLFormElement;
|
||||||
setPageContent(this.addKVNewForm);
|
setPageContent(this.addKVNewForm);
|
||||||
|
|
||||||
this.addKVNewForm.addEventListener("submit", function (e) {
|
this.addKVNewForm.addEventListener("submit", function (e) {
|
||||||
|
@ -55,9 +59,9 @@ export class KeyValueNewPage extends Page {
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
newKVSecretHandleForm() {
|
newKVSecretHandleForm(): void {
|
||||||
let formData = new FormData(this.addKVNewForm);
|
const formData = new FormData(this.addKVNewForm);
|
||||||
let path = formData.get("path");
|
const path = formData.get("path") as string;
|
||||||
let keyData = {};
|
let keyData = {};
|
||||||
|
|
||||||
if (["kv-v1", "cubbyhole"].includes(pageState.currentMountType)) {
|
if (["kv-v1", "cubbyhole"].includes(pageState.currentMountType)) {
|
||||||
|
@ -78,11 +82,11 @@ export class KeyValueNewPage extends Page {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get titleSuffix() {
|
get titleSuffix(): string {
|
||||||
return i18next.t("kv_new_suffix");
|
return i18next.t("kv_new_suffix");
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name(): string {
|
||||||
return i18next.t("kv_new_title");
|
return i18next.t("kv_new_title");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue