add all policy pages
This commit is contained in:
parent
ee93d882c8
commit
6089fe9501
89
src/main.tsx
89
src/main.tsx
|
@ -26,82 +26,15 @@ import { PageRouter } from "./pagerouter/PageRouter";
|
||||||
import { formatDistance } from "./formatDistance";
|
import { formatDistance } from "./formatDistance";
|
||||||
import { getSealStatus } from "./api/sys/getSealStatus";
|
import { getSealStatus } from "./api/sys/getSealStatus";
|
||||||
//import { pageList } from "./allPages";
|
//import { pageList } from "./allPages";
|
||||||
import { Component, render } from "preact";
|
import { render } from "preact";
|
||||||
import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine";
|
|
||||||
import { Home } from "./ui/pages/Home";
|
|
||||||
import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete";
|
|
||||||
import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView";
|
|
||||||
import { KeyValueEdit } from "./ui/pages/Secrets/KeyValue/KeyValueEdit";
|
|
||||||
import { KeyValueList } from "./ui/pages/Secrets/KeyValue/KeyValueList";
|
|
||||||
import { Login } from "./ui/pages/Login";
|
|
||||||
import { Me } from "./ui/pages/Me";
|
|
||||||
import { NavBar } from "./ui/elements/NavBar";
|
import { NavBar } from "./ui/elements/NavBar";
|
||||||
import { NewKVEngine } from "./ui/pages/Secrets/NewEngines/NewKVEngine";
|
|
||||||
import { NewSecretsEngine } from "./ui/pages/Secrets/NewSecretsEngine";
|
|
||||||
import { NewTOTPEngine } from "./ui/pages/Secrets/NewEngines/NewTOTPEngine";
|
|
||||||
import { NewTransitEngine } from "./ui/pages/Secrets/NewEngines/NewTransitEngine";
|
|
||||||
import { TransitNew } from "./ui/pages/Secrets/Transit/TransitNew";
|
|
||||||
import { PasswordGenerator } from "./ui/pages/PwGen";
|
|
||||||
import { Secrets } from "./ui/pages/Secrets/SecretsHome";
|
|
||||||
import { SetLanguage } from "./ui/pages/SetLanguage";
|
|
||||||
import { SetVaultURL } from "./ui/pages/SetVaultURL";
|
|
||||||
import { TOTPDelete } from "./ui/pages/Secrets/TOTP/TOTPDelete";
|
|
||||||
import { TOTPNew } from "./ui/pages/Secrets/TOTP/TOTPNew";
|
|
||||||
import { TOTPList } from "./ui/pages/Secrets/TOTP/TOTPList";
|
|
||||||
import { TransitList } from "./ui/pages/Secrets/Transit/TransitList";
|
|
||||||
import { TransitView } from "./ui/pages/Secrets/Transit/TransitView";
|
|
||||||
import { Unseal } from "./ui/pages/Unseal";
|
|
||||||
import { pageState } from "./globalPageState";
|
import { pageState } from "./globalPageState";
|
||||||
import { playground } from "./playground";
|
import { playground } from "./playground";
|
||||||
import Router from "preact-router";
|
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { KeyValueNew } from "./ui/pages/Secrets/KeyValue/KeyValueNew";
|
import { Main } from "./pages";
|
||||||
import { TransitDecrypt } from "./ui/pages/Secrets/Transit/TransitDecrypt";
|
|
||||||
import { TransitEncrypt } from "./ui/pages/Secrets/Transit/TransitEncrypt";
|
|
||||||
import { TransitRewrap } from "./ui/pages/Secrets/Transit/TransitRewrap";
|
|
||||||
|
|
||||||
async function onLoad(): Promise<void> {
|
async function onLoad(): Promise<void> {
|
||||||
const Main = () => (
|
document.documentElement.dir = pageState.pageDirection;
|
||||||
<Router>
|
|
||||||
<Home path="/" state={pageState} />
|
|
||||||
<Me path="/me" state={pageState} />
|
|
||||||
<Login path="/login" state={pageState} />
|
|
||||||
<PasswordGenerator path="/pw_gen" />
|
|
||||||
<SetVaultURL path="/set_vault_url" state={pageState} />
|
|
||||||
<Unseal path="/unseal" state={pageState} />
|
|
||||||
<SetLanguage path="/set_language" state={pageState} />
|
|
||||||
|
|
||||||
<Secrets path="/secrets" state={pageState} />
|
|
||||||
<DeleteSecretsEngine path="/secrets/delete_engine/:mount" state={pageState} />
|
|
||||||
|
|
||||||
<NewSecretsEngine path="/secrets/new_secrets_engine" />
|
|
||||||
<NewKVEngine path="/secrets/new_secrets_engine/kv" />
|
|
||||||
<NewTOTPEngine path="/secrets/new_secrets_engine/totp" />
|
|
||||||
<NewTransitEngine path="/secrets/new_secrets_engine/trasit" />
|
|
||||||
|
|
||||||
<KeyValueNew path="/secrets/kv/new/:baseMount/:secretPath*?" state={pageState} />
|
|
||||||
<KeyValueList path="/secrets/kv/list/:baseMount/:secretPath*?" state={pageState} />
|
|
||||||
<KeyValueView path="/secrets/kv/view/:item/:baseMount/:secretPath*?" state={pageState} />
|
|
||||||
<KeyValueEdit path="/secrets/kv/edit/:item/:baseMount/:secretPath*?" state={pageState} />
|
|
||||||
<KeyValueDelete path="/secrets/kv/delete/:item/:baseMount/:secretPath*?" state={pageState} />
|
|
||||||
|
|
||||||
<TOTPList path="/secrets/totp/list/:baseMount" state={pageState} />
|
|
||||||
<TOTPNew path="/secrets/totp/new/:baseMount" state={pageState} />
|
|
||||||
<TOTPDelete path="/secrets/totp/delete/:baseMount/:item" state={pageState} />
|
|
||||||
|
|
||||||
<TransitNew path="/secrets/transit/new/:baseMount" state={pageState} />
|
|
||||||
<TransitList path="/secrets/transit/list/:baseMount" state={pageState} />
|
|
||||||
<TransitView path="/secrets/transit/view/:baseMount/:secretItem" state={pageState} />
|
|
||||||
<TransitEncrypt path="/secrets/transit/encrypt/:baseMount/:secretItem" state={pageState} />
|
|
||||||
<TransitDecrypt path="/secrets/transit/decrypt/:baseMount/:secretItem" state={pageState} />
|
|
||||||
<TransitRewrap path="/secrets/transit/rewrap/:baseMount/:secretItem" state={pageState} />
|
|
||||||
|
|
||||||
|
|
||||||
<div default>
|
|
||||||
<p>PAGE NOT YET IMPLEMENTED</p>
|
|
||||||
</div>
|
|
||||||
</Router>
|
|
||||||
);
|
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<>
|
<>
|
||||||
|
@ -115,22 +48,8 @@ async function onLoad(): Promise<void> {
|
||||||
document.body,
|
document.body,
|
||||||
);
|
);
|
||||||
|
|
||||||
//const pageRouter = new PageRouter({
|
|
||||||
// pageList: pageList,
|
|
||||||
// state: pageState,
|
|
||||||
// pageTitleElement: document.querySelector("#pageTitle"),
|
|
||||||
// pageContentElement: document.querySelector("#pageContent"),
|
|
||||||
// resetElementContent: !true,
|
|
||||||
// onPageChange: async function () {
|
|
||||||
// pageState.currentPage = await pageRouter.getCurrentPageID();
|
|
||||||
// document.documentElement.dir = pageState.pageDirection;
|
|
||||||
// },
|
|
||||||
//});
|
|
||||||
//
|
|
||||||
//reloadNavBar(pageRouter);
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV == "development") {
|
if (process.env.NODE_ENV == "development") {
|
||||||
// await playground(pageRouter);
|
await playground();
|
||||||
}
|
}
|
||||||
|
|
||||||
//await pageRouter.changePage(pageState.currentPage);
|
//await pageRouter.changePage(pageState.currentPage);
|
||||||
|
|
84
src/pages.tsx
Normal file
84
src/pages.tsx
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
import Router from "preact-router";
|
||||||
|
import { pageState } from "./globalPageState";
|
||||||
|
|
||||||
|
import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine";
|
||||||
|
import { Home } from "./ui/pages/Home";
|
||||||
|
import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete";
|
||||||
|
import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView";
|
||||||
|
import { KeyValueEdit } from "./ui/pages/Secrets/KeyValue/KeyValueEdit";
|
||||||
|
import { KeyValueList } from "./ui/pages/Secrets/KeyValue/KeyValueList";
|
||||||
|
import { Login } from "./ui/pages/Login";
|
||||||
|
import { Me } from "./ui/pages/Me";
|
||||||
|
import { NewKVEngine } from "./ui/pages/Secrets/NewEngines/NewKVEngine";
|
||||||
|
import { NewSecretsEngine } from "./ui/pages/Secrets/NewSecretsEngine";
|
||||||
|
import { NewTOTPEngine } from "./ui/pages/Secrets/NewEngines/NewTOTPEngine";
|
||||||
|
import { NewTransitEngine } from "./ui/pages/Secrets/NewEngines/NewTransitEngine";
|
||||||
|
import { TransitNew } from "./ui/pages/Secrets/Transit/TransitNew";
|
||||||
|
import { PasswordGenerator } from "./ui/pages/PwGen";
|
||||||
|
import { Secrets } from "./ui/pages/Secrets/SecretsHome";
|
||||||
|
import { SetLanguage } from "./ui/pages/SetLanguage";
|
||||||
|
import { SetVaultURL } from "./ui/pages/SetVaultURL";
|
||||||
|
import { TOTPDelete } from "./ui/pages/Secrets/TOTP/TOTPDelete";
|
||||||
|
import { TOTPNew } from "./ui/pages/Secrets/TOTP/TOTPNew";
|
||||||
|
import { TOTPList } from "./ui/pages/Secrets/TOTP/TOTPList";
|
||||||
|
import { TransitList } from "./ui/pages/Secrets/Transit/TransitList";
|
||||||
|
import { TransitView } from "./ui/pages/Secrets/Transit/TransitView";
|
||||||
|
import { Unseal } from "./ui/pages/Unseal";
|
||||||
|
import { KeyValueNew } from "./ui/pages/Secrets/KeyValue/KeyValueNew";
|
||||||
|
import { TransitDecrypt } from "./ui/pages/Secrets/Transit/TransitDecrypt";
|
||||||
|
import { TransitEncrypt } from "./ui/pages/Secrets/Transit/TransitEncrypt";
|
||||||
|
import { TransitRewrap } from "./ui/pages/Secrets/Transit/TransitRewrap";
|
||||||
|
import { PoliciesHome } from "./ui/pages/Policies/PoliciesHome";
|
||||||
|
import { PolicyView } from "./ui/pages/Policies/PolicyView";
|
||||||
|
import { PolicyNew } from "./ui/pages/Policies/PolicyNew";
|
||||||
|
import { PolicyDelete } from "./ui/pages/Policies/PolicyDelete";
|
||||||
|
import { PolicyEdit } from "./ui/pages/Policies/PolicyEdit";
|
||||||
|
|
||||||
|
export const Main = () => (
|
||||||
|
<Router>
|
||||||
|
<Home path="/" state={pageState} />
|
||||||
|
<Me path="/me" state={pageState} />
|
||||||
|
<Login path="/login" state={pageState} />
|
||||||
|
<PasswordGenerator path="/pw_gen" />
|
||||||
|
<SetVaultURL path="/set_vault_url" state={pageState} />
|
||||||
|
<Unseal path="/unseal" state={pageState} />
|
||||||
|
<SetLanguage path="/set_language" state={pageState} />
|
||||||
|
|
||||||
|
<Secrets path="/secrets" state={pageState} />
|
||||||
|
<DeleteSecretsEngine path="/secrets/delete_engine/:mount" state={pageState} />
|
||||||
|
|
||||||
|
<NewSecretsEngine path="/secrets/new_secrets_engine" />
|
||||||
|
<NewKVEngine path="/secrets/new_secrets_engine/kv" />
|
||||||
|
<NewTOTPEngine path="/secrets/new_secrets_engine/totp" />
|
||||||
|
<NewTransitEngine path="/secrets/new_secrets_engine/trasit" />
|
||||||
|
|
||||||
|
<KeyValueNew path="/secrets/kv/new/:baseMount/:secretPath*?" state={pageState} />
|
||||||
|
<KeyValueList path="/secrets/kv/list/:baseMount/:secretPath*?" state={pageState} />
|
||||||
|
<KeyValueView path="/secrets/kv/view/:item/:baseMount/:secretPath*?" state={pageState} />
|
||||||
|
<KeyValueEdit path="/secrets/kv/edit/:item/:baseMount/:secretPath*?" state={pageState} />
|
||||||
|
<KeyValueDelete path="/secrets/kv/delete/:item/:baseMount/:secretPath*?" state={pageState} />
|
||||||
|
|
||||||
|
<TOTPList path="/secrets/totp/list/:baseMount" state={pageState} />
|
||||||
|
<TOTPNew path="/secrets/totp/new/:baseMount" state={pageState} />
|
||||||
|
<TOTPDelete path="/secrets/totp/delete/:baseMount/:item" state={pageState} />
|
||||||
|
|
||||||
|
<TransitNew path="/secrets/transit/new/:baseMount" state={pageState} />
|
||||||
|
<TransitList path="/secrets/transit/list/:baseMount" state={pageState} />
|
||||||
|
<TransitView path="/secrets/transit/view/:baseMount/:secretItem" state={pageState} />
|
||||||
|
<TransitEncrypt path="/secrets/transit/encrypt/:baseMount/:secretItem" state={pageState} />
|
||||||
|
<TransitDecrypt path="/secrets/transit/decrypt/:baseMount/:secretItem" state={pageState} />
|
||||||
|
<TransitRewrap path="/secrets/transit/rewrap/:baseMount/:secretItem" state={pageState} />
|
||||||
|
|
||||||
|
<PoliciesHome path="/policies" state={pageState} />
|
||||||
|
<PolicyNew path="/policies/new" state={pageState} />
|
||||||
|
<PolicyView path="/policies/view/:policyName" state={pageState} />
|
||||||
|
<PolicyEdit path="/policies/edit/:policyName" state={pageState} />
|
||||||
|
|
||||||
|
<PolicyDelete path="/policies/delete/:policyName" state={pageState} />
|
||||||
|
|
||||||
|
|
||||||
|
<div default>
|
||||||
|
<p>PAGE NOT YET IMPLEMENTED</p>
|
||||||
|
</div>
|
||||||
|
</Router>
|
||||||
|
);
|
|
@ -7,18 +7,7 @@ import i18next from "i18next";
|
||||||
// before rendering.
|
// before rendering.
|
||||||
// Also it only runs when process.env.NODE_ENV == "development"
|
// Also it only runs when process.env.NODE_ENV == "development"
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface Window {
|
|
||||||
pageState: PageState;
|
|
||||||
i18next: unknown;
|
|
||||||
router: PageRouter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Please empty this function before committing.
|
// Please empty this function before committing.
|
||||||
export async function playground(router: PageRouter): Promise<void> {
|
export async function playground(): Promise<void> {
|
||||||
console.log("Welcome to Playground!");
|
console.log("Welcome to Playground!");
|
||||||
window.pageState = router.state as PageState;
|
|
||||||
window.i18next = i18next;
|
|
||||||
window.router = router;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { CopyStateLinkButton } from "../ui/elements/CopyStateLinkButton";
|
import { render } from "preact";
|
||||||
import { PageRouter } from "../pagerouter/PageRouter";
|
import { PageRouter } from "../pagerouter/PageRouter";
|
||||||
import { PageState } from "../state/PageState";
|
import { PageState } from "../state/PageState";
|
||||||
import { render } from "preact";
|
import { CopyStateLinkButton } from "../ui/elements/CopyStateLinkButton";
|
||||||
|
|
||||||
export class Page {
|
export class Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -18,8 +18,8 @@ export class Page {
|
||||||
async renderPageTitle(): Promise<void> {
|
async renderPageTitle(): Promise<void> {
|
||||||
render(
|
render(
|
||||||
<>
|
<>
|
||||||
<span>{this.name}</span>
|
<span>{this.name}</span>
|
||||||
<CopyStateLinkButton state={this.state} />
|
<CopyStateLinkButton state={this.state} />
|
||||||
</>,
|
</>,
|
||||||
this.router.pageTitleElement,
|
this.router.pageTitleElement,
|
||||||
);
|
);
|
||||||
|
@ -34,4 +34,4 @@ export class Page {
|
||||||
this.router = router;
|
this.router = router;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
import { Grid, GridSizes } from "../elements/Grid";
|
import { Grid, GridSizes } from "../elements/Grid";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { Page } from "../../types/Page";
|
|
||||||
import { PageState } from "../../state/PageState";
|
import { PageState } from "../../state/PageState";
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { Tile } from "../elements/Tile";
|
import { Tile } from "../elements/Tile";
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DefaultPageProps } from "../../types/DefaultPageProps";
|
||||||
import { Form } from "../elements/Form";
|
import { Form } from "../elements/Form";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { MarginInline } from "../elements/MarginInline";
|
import { MarginInline } from "../elements/MarginInline";
|
||||||
import { Page } from "../../types/Page";
|
|
||||||
import { PageState } from "../../state/PageState";
|
import { PageState } from "../../state/PageState";
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { lookupSelf } from "../../api/sys/lookupSelf";
|
import { lookupSelf } from "../../api/sys/lookupSelf";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, JSX, createRef } from "preact";
|
import { Component, JSX, createRef } from "preact";
|
||||||
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { addClipboardNotifications, prePageChecks, setErrorText } from "../../pageUtils";
|
import { addClipboardNotifications, setErrorText } from "../../pageUtils";
|
||||||
import { getCapsPath } from "../../api/sys/getCapabilities";
|
import { getCapsPath } from "../../api/sys/getCapabilities";
|
||||||
import { renewSelf } from "../../api/sys/renewSelf";
|
import { renewSelf } from "../../api/sys/renewSelf";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
|
|
@ -1,63 +1,62 @@
|
||||||
import { Margin } from "../../elements/Margin";
|
import { Margin } from "../../elements/Margin";
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { PageState } from "../../../state/PageState";
|
|
||||||
import { getPolicies } from "../../../api/sys/policies/getPolicies";
|
import { getPolicies } from "../../../api/sys/policies/getPolicies";
|
||||||
import { prePageChecks } from "../../../pageUtils";
|
import { prePageChecks } from "../../../pageUtils";
|
||||||
import { render } from "preact";
|
import { Component } from "preact";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import { policyNewURL, policyViewURL } from "../pageLinks";
|
||||||
|
|
||||||
export class PoliciesHomePage extends Page {
|
export class PoliciesHome extends Component<DefaultPageProps, { policies: string[] }> {
|
||||||
constructor() {
|
async componentDidMount() {
|
||||||
super();
|
if (!(await prePageChecks(this.props.state))) return;
|
||||||
}
|
|
||||||
async goBack(): Promise<void> {
|
|
||||||
await this.router.changePage("HOME");
|
|
||||||
}
|
|
||||||
async render(): Promise<void> {
|
|
||||||
await this.router.setPageContent("");
|
|
||||||
if (!(await prePageChecks(this.router.state as PageState))) return;
|
|
||||||
|
|
||||||
let policies = await getPolicies();
|
let policies = await getPolicies();
|
||||||
policies = policies.sort();
|
policies = policies.sort();
|
||||||
policies = policies.filter(function (policy_name) {
|
policies = policies.filter(function (policy_name) {
|
||||||
return policy_name !== "root";
|
return policy_name !== "root";
|
||||||
});
|
});
|
||||||
|
this.setState({
|
||||||
|
policies: policies
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render(
|
render() {
|
||||||
<div>
|
if (!this.state.policies) return;
|
||||||
<p>
|
|
||||||
<button
|
|
||||||
class="uk-button uk-button-primary"
|
|
||||||
onClick={async () => {
|
|
||||||
await this.router.changePage("POLICY_NEW");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{i18next.t("policies_home_new_btn")}
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<Margin>
|
return (
|
||||||
<ul class="uk-nav uk-nav-default">
|
<>
|
||||||
{policies.map((policy: string) => (
|
<PageTitle title={i18next.t("policies_home_title")} />
|
||||||
<li>
|
<div>
|
||||||
<a
|
<p>
|
||||||
onClick={async () => {
|
<button
|
||||||
this.state.policyItem = policy;
|
class="uk-button uk-button-primary"
|
||||||
await this.router.changePage("POLICY_VIEW");
|
onClick={async () => {
|
||||||
}}
|
route(policyNewURL())
|
||||||
>
|
}}
|
||||||
{policy}
|
>
|
||||||
</a>
|
{i18next.t("policies_home_new_btn")}
|
||||||
</li>
|
</button>
|
||||||
))}
|
</p>
|
||||||
</ul>
|
|
||||||
</Margin>
|
<Margin>
|
||||||
</div>,
|
<ul class="uk-nav uk-nav-default">
|
||||||
this.router.pageContentElement,
|
{this.state.policies.map((policyName: string) => (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
onClick={async () => {
|
||||||
|
route(policyViewURL(policyName))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{policyName}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</Margin>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
|
||||||
return i18next.t("policies_home_title");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,35 @@
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { deletePolicy } from "../../../api/sys/policies/deletePolicy";
|
import { deletePolicy } from "../../../api/sys/policies/deletePolicy";
|
||||||
import { render } from "preact";
|
import { Component, render } from "preact";
|
||||||
import { setErrorText } from "../../../pageUtils";
|
import { setErrorText } from "../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
|
||||||
export class PolicyDeletePage extends Page {
|
export class PolicyDelete extends Component<DefaultPageProps> {
|
||||||
constructor() {
|
render() {
|
||||||
super();
|
const policyName = this.props.matches["policyName"];
|
||||||
}
|
return (
|
||||||
async goBack(): Promise<void> {
|
<>
|
||||||
await this.router.changePage("POLICY_VIEW");
|
<PageTitle title={i18next.t("policy_delete_title", {policy: policyName})} />
|
||||||
}
|
<div>
|
||||||
async render(): Promise<void> {
|
<h5>{i18next.t("policy_delete_text")}</h5>
|
||||||
render(
|
<button
|
||||||
<div>
|
class="uk-button uk-button-danger"
|
||||||
<h5>{i18next.t("policy_delete_text")}</h5>
|
onClick={async () => {
|
||||||
<button
|
try {
|
||||||
class="uk-button uk-button-danger"
|
await deletePolicy(policyName);
|
||||||
onClick={async () => {
|
route("/policies");
|
||||||
try {
|
} catch (e: unknown) {
|
||||||
await deletePolicy(this.state.policyItem);
|
const error = e as Error;
|
||||||
await this.router.changePage("POLICIES_HOME");
|
setErrorText(error.message);
|
||||||
} catch (e: unknown) {
|
}
|
||||||
const error = e as Error;
|
}}
|
||||||
setErrorText(error.message);
|
>
|
||||||
}
|
{i18next.t("policy_delete_btn")}
|
||||||
}}
|
</button>
|
||||||
>
|
</div>
|
||||||
{i18next.t("policy_delete_btn")}
|
</>
|
||||||
</button>
|
|
||||||
</div>,
|
|
||||||
this.router.pageContentElement,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
|
||||||
return i18next.t("policy_delete_title", {
|
|
||||||
policy: this.state.policyItem,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,21 +7,24 @@ import { createOrUpdatePolicy } from "../../../api/sys/policies/createOrUpdatePo
|
||||||
import { getPolicy } from "../../../api/sys/policies/getPolicy";
|
import { getPolicy } from "../../../api/sys/policies/getPolicy";
|
||||||
import { setErrorText } from "../../../pageUtils";
|
import { setErrorText } from "../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import { policyViewURL } from "../pageLinks";
|
||||||
|
|
||||||
type PolicyEditorProps = {
|
type PolicyEditorProps = {
|
||||||
page: Page;
|
policyName: string;
|
||||||
policy_name: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type PolicyEditorState =
|
type PolicyEditorState =
|
||||||
| {
|
| {
|
||||||
dataLoaded: false;
|
dataLoaded: false;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
dataLoaded: true;
|
dataLoaded: true;
|
||||||
policyData: string;
|
policyData: string;
|
||||||
code: string;
|
code: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class PolicyEditor extends Component<PolicyEditorProps, PolicyEditorState> {
|
export class PolicyEditor extends Component<PolicyEditorProps, PolicyEditorState> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -35,8 +38,8 @@ export class PolicyEditor extends Component<PolicyEditorProps, PolicyEditorState
|
||||||
if (!this.state.dataLoaded) return;
|
if (!this.state.dataLoaded) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await createOrUpdatePolicy(this.props.policy_name, this.state.code);
|
await createOrUpdatePolicy(this.props.policyName, this.state.code);
|
||||||
await this.props.page.router.changePage("POLICY_VIEW");
|
route(policyViewURL(this.props.policyName))
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
setErrorText(error.message);
|
setErrorText(error.message);
|
||||||
|
@ -50,7 +53,7 @@ export class PolicyEditor extends Component<PolicyEditorProps, PolicyEditorState
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadData(): Promise<void> {
|
async loadData(): Promise<void> {
|
||||||
const policyData = await getPolicy(this.props.policy_name);
|
const policyData = await getPolicy(this.props.policyName);
|
||||||
this.setState({
|
this.setState({
|
||||||
dataLoaded: true,
|
dataLoaded: true,
|
||||||
policyData: policyData,
|
policyData: policyData,
|
||||||
|
@ -91,25 +94,16 @@ export class PolicyEditor extends Component<PolicyEditorProps, PolicyEditorState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PolicyEditPage extends Page {
|
export class PolicyEdit extends Component<DefaultPageProps> {
|
||||||
constructor() {
|
render() {
|
||||||
super();
|
const policyName = this.props.matches["policyName"];
|
||||||
}
|
return (
|
||||||
async goBack(): Promise<void> {
|
<>
|
||||||
await this.router.changePage("POLICY_VIEW");
|
<PageTitle title={i18next.t("policy_edit_title", {policy: policyName})} />
|
||||||
}
|
<div>
|
||||||
async render(): Promise<void> {
|
<PolicyEditor policyName={policyName} />
|
||||||
render(
|
</div>
|
||||||
<div>
|
</>
|
||||||
<PolicyEditor page={this} policy_name={this.state.policyItem} />
|
|
||||||
</div>,
|
|
||||||
this.router.pageContentElement,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
|
||||||
return i18next.t("policy_edit_title", {
|
|
||||||
policy: this.state.policyItem,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,53 @@
|
||||||
import { Form } from "../../elements/Form";
|
import { Form } from "../../elements/Form";
|
||||||
import { Margin } from "../../elements/Margin";
|
import { Margin } from "../../elements/Margin";
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { createOrUpdatePolicy } from "../../../api/sys/policies/createOrUpdatePolicy";
|
import { createOrUpdatePolicy } from "../../../api/sys/policies/createOrUpdatePolicy";
|
||||||
import { getPolicies } from "../../../api/sys/policies/getPolicies";
|
import { getPolicies } from "../../../api/sys/policies/getPolicies";
|
||||||
import { render } from "preact";
|
import { Component } from "preact";
|
||||||
import { setErrorText } from "../../../pageUtils";
|
import { setErrorText } from "../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import { policyViewURL } from "../pageLinks";
|
||||||
|
|
||||||
export class PolicyNewPage extends Page {
|
export class PolicyNew extends Component<DefaultPageProps> {
|
||||||
constructor() {
|
render() {
|
||||||
super();
|
return (
|
||||||
}
|
<>
|
||||||
async goBack(): Promise<void> {
|
<PageTitle title={i18next.t("policy_new_title")} />
|
||||||
await this.router.changePage("POLICIES_HOME");
|
<div>
|
||||||
}
|
<Form
|
||||||
async render(): Promise<void> {
|
onSubmit={async (formData) => {
|
||||||
render(
|
const name = formData.get("name") as string;
|
||||||
<div>
|
if ((await getPolicies()).includes(name)) {
|
||||||
<Form
|
setErrorText(i18next.t("policy_new_already_exists"));
|
||||||
onSubmit={async (formData) => {
|
return;
|
||||||
const name = formData.get("name") as string;
|
}
|
||||||
if ((await getPolicies()).includes(name)) {
|
|
||||||
setErrorText(i18next.t("policy_new_already_exists"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await createOrUpdatePolicy(name, " ");
|
await createOrUpdatePolicy(name, " ");
|
||||||
this.state.policyItem = name;
|
route(policyViewURL(name));
|
||||||
await this.router.changePage("POLICY_VIEW");
|
} catch (e: unknown) {
|
||||||
} catch (e: unknown) {
|
const error = e as Error;
|
||||||
const error = e as Error;
|
setErrorText(error.message);
|
||||||
setErrorText(error.message);
|
}
|
||||||
}
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Margin>
|
||||||
<Margin>
|
<input
|
||||||
<input
|
class="uk-input uk-form-width-medium"
|
||||||
class="uk-input uk-form-width-medium"
|
name="name"
|
||||||
name="name"
|
placeholder={i18next.t("policy_new_name_placeholder")}
|
||||||
placeholder={i18next.t("policy_new_name_placeholder")}
|
required
|
||||||
required
|
/>
|
||||||
/>
|
</Margin>
|
||||||
</Margin>
|
<p class="uk-text-danger" id="errorText" />
|
||||||
<p class="uk-text-danger" id="errorText" />
|
<button class="uk-button uk-button-primary" type="submit">
|
||||||
<button class="uk-button uk-button-primary" type="submit">
|
{i18next.t("policy_new_create_btn")}
|
||||||
{i18next.t("policy_new_create_btn")}
|
</button>
|
||||||
</button>
|
</Form>
|
||||||
</Form>
|
</div>
|
||||||
</div>,
|
</>
|
||||||
this.router.pageContentElement,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
|
||||||
return i18next.t("policy_new_title");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,45 @@
|
||||||
import { CodeBlock } from "../../elements/CodeBlock";
|
import { CodeBlock } from "../../elements/CodeBlock";
|
||||||
import { Margin } from "../../elements/Margin";
|
import { Margin } from "../../elements/Margin";
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { PageState } from "../../../state/PageState";
|
|
||||||
import { getPolicy } from "../../../api/sys/policies/getPolicy";
|
import { getPolicy } from "../../../api/sys/policies/getPolicy";
|
||||||
import { prePageChecks } from "../../../pageUtils";
|
import { prePageChecks } from "../../../pageUtils";
|
||||||
import { render } from "preact";
|
import { Component } from "preact";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import { policyDeleteURL, policyEditURL } from "../pageLinks";
|
||||||
|
|
||||||
export class PolicyViewPage extends Page {
|
export class PolicyView extends Component<DefaultPageProps, {policy: string, policyName: string}> {
|
||||||
constructor() {
|
async componentDidMount() {
|
||||||
super();
|
if (!(await prePageChecks(this.props.state))) return;
|
||||||
|
console.log(this.props)
|
||||||
|
const policyName = this.props.matches["policyName"];
|
||||||
|
const policy = await getPolicy(policyName);
|
||||||
|
this.setState({
|
||||||
|
policy, policyName
|
||||||
|
})
|
||||||
}
|
}
|
||||||
async goBack(): Promise<void> {
|
|
||||||
await this.router.changePage("POLICIES_HOME");
|
|
||||||
}
|
|
||||||
async render(): Promise<void> {
|
|
||||||
await this.router.setPageContent("");
|
|
||||||
if (!(await prePageChecks(this.router.state as PageState))) return;
|
|
||||||
|
|
||||||
const policy = await getPolicy(this.state.policyItem);
|
render() {
|
||||||
|
if (!this.state.policy) return;
|
||||||
render(
|
return (
|
||||||
|
<>
|
||||||
|
<PageTitle title={i18next.t("policy_view_title", {policy: this.state.policyName})} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-primary"
|
class="uk-button uk-button-primary"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await this.router.changePage("POLICY_EDIT");
|
route(policyEditURL(this.state.policyName));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("policy_view_edit_btn")}
|
{i18next.t("policy_view_edit_btn")}
|
||||||
</button>
|
</button>
|
||||||
{this.state.policyItem !== "default" && (
|
{this.state.policyName !== "default" && (
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-danger"
|
class="uk-button uk-button-danger"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await this.router.changePage("POLICY_DELETE");
|
route(policyDeleteURL(this.state.policyName));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("policy_view_delete_btn")}
|
{i18next.t("policy_view_delete_btn")}
|
||||||
|
@ -44,16 +48,10 @@ export class PolicyViewPage extends Page {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Margin>
|
<Margin>
|
||||||
<CodeBlock language="hcl" code={policy} />
|
<CodeBlock language="hcl" code={this.state.policy} />
|
||||||
</Margin>
|
</Margin>
|
||||||
</div>,
|
</div>
|
||||||
this.router.pageContentElement,
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
|
||||||
return i18next.t("policy_view_title", {
|
|
||||||
policy: this.state.policyItem,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Component, render } from "preact";
|
||||||
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
import { Form } from "../../elements/Form";
|
import { Form } from "../../elements/Form";
|
||||||
import { MarginInline } from "../../elements/MarginInline";
|
import { MarginInline } from "../../elements/MarginInline";
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { deleteMount } from "../../../api/sys/deleteMount";
|
import { deleteMount } from "../../../api/sys/deleteMount";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Component, render } from "preact";
|
import { Component, render } from "preact";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { deleteSecret } from "../../../../api/kv/deleteSecret";
|
import { deleteSecret } from "../../../../api/kv/deleteSecret";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { CodeEditor } from "../../../elements/CodeEditor";
|
import { CodeEditor } from "../../../elements/CodeEditor";
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { createOrUpdateSecret } from "../../../../api/kv/createOrUpdateSecret";
|
import { createOrUpdateSecret } from "../../../../api/kv/createOrUpdateSecret";
|
||||||
import { getSecret } from "../../../../api/kv/getSecret";
|
import { getSecret } from "../../../../api/kv/getSecret";
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { CapabilitiesType, getCapabilitiesPath } from "../../../../api/sys/getCa
|
||||||
import { Component, JSX, createRef, render } from "preact";
|
import { Component, JSX, createRef, render } from "preact";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { DoesNotExistError } from "../../../../types/internalErrors";
|
import { DoesNotExistError } from "../../../../types/internalErrors";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { delSecretsEngineURL, kvListURL, kvNewURL, kvViewURL } from "../../pageLinks";
|
import { delSecretsEngineURL, kvListURL, kvNewURL, kvViewURL } from "../../pageLinks";
|
||||||
import { getMount } from "../../../../api/sys/getMounts";
|
import { getMount } from "../../../../api/sys/getMounts";
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Component, render } from "preact";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { PageTitle } from "../../../elements/PageTitle";
|
import { PageTitle } from "../../../elements/PageTitle";
|
||||||
import { kvListURL } from "../../pageLinks";
|
import { kvListURL } from "../../pageLinks";
|
||||||
import { newMount } from "../../../../api/sys/newMount";
|
import { newMount } from "../../../../api/sys/newMount";
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Component, render } from "preact";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { PageTitle } from "../../../elements/PageTitle";
|
import { PageTitle } from "../../../elements/PageTitle";
|
||||||
import { newMount } from "../../../../api/sys/newMount";
|
import { newMount } from "../../../../api/sys/newMount";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Component, render } from "preact";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { PageTitle } from "../../../elements/PageTitle";
|
import { PageTitle } from "../../../elements/PageTitle";
|
||||||
import { newMount } from "../../../../api/sys/newMount";
|
import { newMount } from "../../../../api/sys/newMount";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Component, render } from "preact";
|
import { Component, render } from "preact";
|
||||||
import { Grid, GridSizes } from "../../elements/Grid";
|
import { Grid, GridSizes } from "../../elements/Grid";
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { Tile } from "../../elements/Tile";
|
import { Tile } from "../../elements/Tile";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
import { MountType, getMounts } from "../../../api/sys/getMounts";
|
import { MountType, getMounts } from "../../../api/sys/getMounts";
|
||||||
import { Page } from "../../../types/Page";
|
|
||||||
import { PageState } from "../../../state/PageState";
|
import { PageState } from "../../../state/PageState";
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { getCapsPath } from "../../../api/sys/getCapabilities";
|
import { getCapsPath } from "../../../api/sys/getCapabilities";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Component, render } from "preact";
|
import { Component, render } from "preact";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { deleteTOTP } from "../../../../api/totp/deleteTOTP";
|
import { deleteTOTP } from "../../../../api/totp/deleteTOTP";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
|
||||||
import { QRScanner } from "../../../elements/QRScanner";
|
import { QRScanner } from "../../../elements/QRScanner";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { addNewTOTP } from "../../../../api/totp/addNewTOTP";
|
import { addNewTOTP } from "../../../../api/totp/addNewTOTP";
|
||||||
|
|
|
@ -67,4 +67,20 @@ export function transitRewrapSecretURL(baseMount: string, secret: string): strin
|
||||||
return `/secrets/transit/rewrap/${baseMount}/${secret}`;
|
return `/secrets/transit/rewrap/${baseMount}/${secret}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Policies
|
||||||
|
|
||||||
|
export function policyNewURL(): string {
|
||||||
|
return `/policies/new`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function policyViewURL(policyName: string): string {
|
||||||
|
return `/policies/view/${policyName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function policyEditURL(policyName: string): string {
|
||||||
|
return `/policies/edit/${policyName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function policyDeleteURL(policyName: string): string {
|
||||||
|
return `/policies/delete/${policyName}`;
|
||||||
|
}
|
Loading…
Reference in a new issue