1
0
Fork 0

Add clicky link to secret item for kv and transit

This commit is contained in:
ChaotiCryptidz 2022-01-11 14:47:35 +00:00
parent a8add31ff1
commit 65e82112a9

View file

@ -1,5 +1,5 @@
import { JSX } from "preact/jsx-runtime";
import { kvListURL } from "../pageLinks";
import { kvListURL, kvViewURL, transitViewSecretURL } from "../pageLinks";
import { route } from "preact-router";
type SecretTitleElementProps = {
@ -53,7 +53,21 @@ export function SecretTitleElement(props: SecretTitleElementProps): JSX.Element
</a>
);
})}
{item.length != 0 && <span>{item}</span>}
{item.length != 0 && (() => {
if (["kv", "transit"].includes(type)) {
return <a onClick={() => {
if (type == "kv") {
route(kvViewURL(baseMount, secretPath, item))
} else if (type == "transit") {
route(transitViewSecretURL(baseMount, item))
}
}}>{item}</a>
} else {
return <span>{item}</span>
}
})()}
{suffix.length != 0 && <span>{suffix}</span>}
</div>
</h3>