Make KeyValueVersions use tsx syntax.
This commit is contained in:
parent
a95c6d250f
commit
bc78661c49
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,8 @@
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { getSecretMetadata } from "../../../api/kv/getSecretMetadata";
|
import { getSecretMetadata } from "../../../api/kv/getSecretMetadata";
|
||||||
import { makeElement } from "z-makeelement";
|
|
||||||
import { objectToMap } from "../../../utils";
|
import { objectToMap } from "../../../utils";
|
||||||
|
import { render } from "preact";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
export class KeyValueVersionsPage extends Page {
|
export class KeyValueVersionsPage extends Page {
|
||||||
|
@ -16,34 +16,30 @@ export class KeyValueVersionsPage extends Page {
|
||||||
await this.router.changePage("KEY_VALUE_SECRET");
|
await this.router.changePage("KEY_VALUE_SECRET");
|
||||||
}
|
}
|
||||||
async render(): Promise<void> {
|
async render(): Promise<void> {
|
||||||
const versionsList = makeElement({
|
|
||||||
tag: "ul",
|
|
||||||
id: "versionsList",
|
|
||||||
class: ["uk-nav", "uk-nav-default"],
|
|
||||||
});
|
|
||||||
await this.router.setPageContent(versionsList);
|
|
||||||
|
|
||||||
const metadata = await getSecretMetadata(
|
const metadata = await getSecretMetadata(
|
||||||
this.state.baseMount,
|
this.state.baseMount,
|
||||||
this.state.secretPath,
|
this.state.secretPath,
|
||||||
this.state.secretItem,
|
this.state.secretItem,
|
||||||
);
|
);
|
||||||
|
const versions = Array.from(objectToMap(metadata.versions).keys());
|
||||||
|
|
||||||
objectToMap(metadata.versions).forEach((_, ver) => {
|
render(
|
||||||
versionsList.appendChild(
|
<ul class="uk-nav uk-nav-default">
|
||||||
makeElement({
|
{versions.map((ver) => (
|
||||||
tag: "li",
|
<li>
|
||||||
children: makeElement({
|
<a
|
||||||
tag: "a",
|
onClick={async () => {
|
||||||
text: `v${ver}`,
|
this.state.secretVersion = ver;
|
||||||
onclick: async () => {
|
await this.router.changePage("KEY_VALUE_SECRET");
|
||||||
this.state.secretVersion = ver;
|
}}
|
||||||
await this.router.changePage("KEY_VALUE_SECRET");
|
>
|
||||||
},
|
{`v${ver}`}
|
||||||
}),
|
</a>
|
||||||
}),
|
</li>
|
||||||
);
|
))}
|
||||||
});
|
</ul>,
|
||||||
|
this.router.pageContentElement,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPageTitle(): Promise<Element | string> {
|
async getPageTitle(): Promise<Element | string> {
|
Loading…
Reference in a new issue