work on a few things idk
This commit is contained in:
parent
814c73faca
commit
124cdb3a3e
|
@ -5,6 +5,7 @@ import { addClipboardNotifications } from "../../utils/clipboardNotifs";
|
||||||
import ClipboardJS from "clipboard";
|
import ClipboardJS from "clipboard";
|
||||||
import FileSaver from "file-saver";
|
import FileSaver from "file-saver";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "./InlineButtonBox";
|
||||||
|
|
||||||
export type CopyableBoxProps = {
|
export type CopyableBoxProps = {
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -34,7 +35,7 @@ export class CopyableBox extends Component<CopyableBoxProps> {
|
||||||
<h2>{this.props.title}</h2>
|
<h2>{this.props.title}</h2>
|
||||||
</div>
|
</div>
|
||||||
<CodeBlock code={this.props.contentString} />
|
<CodeBlock code={this.props.contentString} />
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
<Button
|
<Button
|
||||||
text={i18next.t("copy_box_download_btn")}
|
text={i18next.t("copy_box_download_btn")}
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -49,7 +50,7 @@ export class CopyableBox extends Component<CopyableBoxProps> {
|
||||||
{this.props.goBack && (
|
{this.props.goBack && (
|
||||||
<Button text={i18next.t("common_back")} color="secondary" onClick={this.props.goBack} />
|
<Button text={i18next.t("common_back")} color="secondary" onClick={this.props.goBack} />
|
||||||
)}
|
)}
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
9
src/ui/elements/InlineButtonBox.tsx
Normal file
9
src/ui/elements/InlineButtonBox.tsx
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { JSX } from "preact";
|
||||||
|
|
||||||
|
export type InlineButtonBoxProps = {
|
||||||
|
children?: JSX.Element | JSX.Element[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export function InlineButtonBox(props: InlineButtonBoxProps): JSX.Element {
|
||||||
|
return <div>{props.children}</div>;
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import { sendErrorNotification } from "../../../../elements/ErrorMessage";
|
||||||
import { toStr } from "../../../../../utils";
|
import { toStr } from "../../../../../utils";
|
||||||
import { userPassUserDeleteURL, userPassUserEditURL } from "../../../pageLinks";
|
import { userPassUserDeleteURL, userPassUserEditURL } from "../../../pageLinks";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../../../elements/InlineButtonBox";
|
||||||
|
|
||||||
export class UserPassUserView extends Component<DefaultPageProps, { user_data: UserType }> {
|
export class UserPassUserView extends Component<DefaultPageProps, { user_data: UserType }> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -36,7 +37,7 @@ export class UserPassUserView extends Component<DefaultPageProps, { user_data: U
|
||||||
<PageTitle title={i18next.t("userpass_user_view_title")} />
|
<PageTitle title={i18next.t("userpass_user_view_title")} />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
<Button
|
<Button
|
||||||
text={i18next.t("common_delete")}
|
text={i18next.t("common_delete")}
|
||||||
color="danger"
|
color="danger"
|
||||||
|
@ -47,7 +48,7 @@ export class UserPassUserView extends Component<DefaultPageProps, { user_data: U
|
||||||
color="primary"
|
color="primary"
|
||||||
route={userPassUserEditURL(baseMount, user)}
|
route={userPassUserEditURL(baseMount, user)}
|
||||||
/>
|
/>
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { policyNewURL, policyViewURL } from "../pageLinks";
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
import { sendErrorNotification } from "../../elements/ErrorMessage";
|
import { sendErrorNotification } from "../../elements/ErrorMessage";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../elements/InlineButtonBox";
|
||||||
|
|
||||||
export class PoliciesHome extends Component<DefaultPageProps, { policies: string[] }> {
|
export class PoliciesHome extends Component<DefaultPageProps, { policies: string[] }> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -32,9 +33,9 @@ export class PoliciesHome extends Component<DefaultPageProps, { policies: string
|
||||||
<>
|
<>
|
||||||
<PageTitle title={i18next.t("policies_home_title")} />
|
<PageTitle title={i18next.t("policies_home_title")} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
<Button text={i18next.t("common_new")} color="primary" route={policyNewURL()} />
|
<Button text={i18next.t("common_new")} color="primary" route={policyNewURL()} />
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
|
|
||||||
<Margin>
|
<Margin>
|
||||||
<ul class="uk-nav uk-nav-default">
|
<ul class="uk-nav uk-nav-default">
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { policyDeleteURL, policyEditURL } from "../pageLinks";
|
import { policyDeleteURL, policyEditURL } from "../pageLinks";
|
||||||
import { sendErrorNotification } from "../../elements/ErrorMessage";
|
import { sendErrorNotification } from "../../elements/ErrorMessage";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../elements/InlineButtonBox";
|
||||||
|
|
||||||
export class PolicyView extends Component<
|
export class PolicyView extends Component<
|
||||||
DefaultPageProps,
|
DefaultPageProps,
|
||||||
|
@ -32,7 +33,7 @@ export class PolicyView extends Component<
|
||||||
<>
|
<>
|
||||||
<PageTitle title={i18next.t("policy_view_title", { policy: this.state.policyName })} />
|
<PageTitle title={i18next.t("policy_view_title", { policy: this.state.policyName })} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
<Button
|
<Button
|
||||||
text={i18next.t("common_edit")}
|
text={i18next.t("common_edit")}
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -45,7 +46,7 @@ export class PolicyView extends Component<
|
||||||
route={policyDeleteURL(this.state.policyName)}
|
route={policyDeleteURL(this.state.policyName)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
|
|
||||||
<Margin>
|
<Margin>
|
||||||
<CodeBlock language="hcl" code={this.state.policy} />
|
<CodeBlock language="hcl" code={this.state.policy} />
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { delSecretsEngineURL, kvListURL, kvNewURL, kvViewURL } from "../../pageL
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
import { sendErrorNotification } from "../../../elements/ErrorMessage";
|
import { sendErrorNotification } from "../../../elements/ErrorMessage";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../../elements/InlineButtonBox";
|
||||||
|
|
||||||
export type KVKeysListProps = DefaultPageProps & {
|
export type KVKeysListProps = DefaultPageProps & {
|
||||||
baseMount: string;
|
baseMount: string;
|
||||||
|
@ -190,7 +191,7 @@ export class KeyValueList extends Component<DefaultPageProps, KeyValueListState>
|
||||||
secretPath={secretPath}
|
secretPath={secretPath}
|
||||||
item={this.props.matches["item"]}
|
item={this.props.matches["item"]}
|
||||||
/>
|
/>
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
{this.state.pathCaps.includes("create") && (
|
{this.state.pathCaps.includes("create") && (
|
||||||
<Button
|
<Button
|
||||||
text={i18next.t("kv_view_new_btn")}
|
text={i18next.t("kv_view_new_btn")}
|
||||||
|
@ -205,7 +206,7 @@ export class KeyValueList extends Component<DefaultPageProps, KeyValueListState>
|
||||||
route={delSecretsEngineURL(baseMount)}
|
route={delSecretsEngineURL(baseMount)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
{this.state.mountType == "cubbyhole" && <p>{i18next.t("kv_view_cubbyhole_text")}</p>}
|
{this.state.mountType == "cubbyhole" && <p>{i18next.t("kv_view_cubbyhole_text")}</p>}
|
||||||
<KVKeysList
|
<KVKeysList
|
||||||
settings={this.props.settings}
|
settings={this.props.settings}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { sendErrorNotification } from "../../elements/ErrorMessage";
|
import { sendErrorNotification } from "../../elements/ErrorMessage";
|
||||||
import { sortedObjectMap } from "../../../utils";
|
import { sortedObjectMap } from "../../../utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../elements/InlineButtonBox";
|
||||||
|
|
||||||
const supportedMountTypes = ["kv", "totp", "transit", "cubbyhole"];
|
const supportedMountTypes = ["kv", "totp", "transit", "cubbyhole"];
|
||||||
|
|
||||||
|
@ -79,8 +80,7 @@ export class Secrets extends Component<DefaultPageProps, SecretsState> {
|
||||||
<>
|
<>
|
||||||
<PageTitle title={i18next.t("secrets_home_page_title")} />
|
<PageTitle title={i18next.t("secrets_home_page_title")} />
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<InlineButtonBox>
|
||||||
<p>
|
|
||||||
{this.state.capabilities.includes("sudo") &&
|
{this.state.capabilities.includes("sudo") &&
|
||||||
this.state.capabilities.includes("create") && (
|
this.state.capabilities.includes("create") && (
|
||||||
<Button
|
<Button
|
||||||
|
@ -89,8 +89,7 @@ export class Secrets extends Component<DefaultPageProps, SecretsState> {
|
||||||
route={"/secrets/new_secrets_engine"}
|
route={"/secrets/new_secrets_engine"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
</div>
|
|
||||||
<div class="uk-margin-top">
|
<div class="uk-margin-top">
|
||||||
<ul class="uk-nav uk-nav-default">
|
<ul class="uk-nav uk-nav-default">
|
||||||
{Array.from(this.state.mountsMap).map((args: [string, MountType]) => {
|
{Array.from(this.state.mountsMap).map((args: [string, MountType]) => {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
import { removeDoubleSlash } from "../../../../utils";
|
import { removeDoubleSlash } from "../../../../utils";
|
||||||
import { sendErrorNotification } from "../../../elements/ErrorMessage";
|
import { sendErrorNotification } from "../../../elements/ErrorMessage";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../../elements/InlineButtonBox";
|
||||||
|
|
||||||
type TOTPGridItemProps = DefaultPageProps & {
|
type TOTPGridItemProps = DefaultPageProps & {
|
||||||
baseMount: string;
|
baseMount: string;
|
||||||
|
@ -206,7 +207,7 @@ export class TOTPList extends Component<DefaultPageProps, TOTPListState> {
|
||||||
<>
|
<>
|
||||||
<SecretTitleElement type="totp" baseMount={baseMount} />
|
<SecretTitleElement type="totp" baseMount={baseMount} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
{totpCaps.includes("create") && (
|
{totpCaps.includes("create") && (
|
||||||
<Button
|
<Button
|
||||||
text={i18next.t("common_new")}
|
text={i18next.t("common_new")}
|
||||||
|
@ -228,7 +229,7 @@ export class TOTPList extends Component<DefaultPageProps, TOTPListState> {
|
||||||
route={delSecretsEngineURL(baseMount)}
|
route={delSecretsEngineURL(baseMount)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
<div>
|
<div>
|
||||||
<TOTPListView {...this.props} totpItems={this.state.totpItems} />
|
<TOTPListView {...this.props} totpItems={this.state.totpItems} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { delSecretsEngineURL, transitNewSecretURL, transitViewSecretURL } from "
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
import { sendErrorNotification } from "../../../elements/ErrorMessage";
|
import { sendErrorNotification } from "../../../elements/ErrorMessage";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { InlineButtonBox } from "../../../elements/InlineButtonBox";
|
||||||
|
|
||||||
type TransitViewListState = {
|
type TransitViewListState = {
|
||||||
contentLoaded: boolean;
|
contentLoaded: boolean;
|
||||||
|
@ -96,7 +97,7 @@ export class TransitList extends Component<DefaultPageProps, { caps: Capabilitie
|
||||||
<>
|
<>
|
||||||
<SecretTitleElement type="transit" baseMount={baseMount} />
|
<SecretTitleElement type="transit" baseMount={baseMount} />
|
||||||
|
|
||||||
<p>
|
<InlineButtonBox>
|
||||||
{transitCaps.includes("create") && (
|
{transitCaps.includes("create") && (
|
||||||
<Button
|
<Button
|
||||||
text={i18next.t("common_new")}
|
text={i18next.t("common_new")}
|
||||||
|
@ -111,7 +112,7 @@ export class TransitList extends Component<DefaultPageProps, { caps: Capabilitie
|
||||||
route={delSecretsEngineURL(baseMount)}
|
route={delSecretsEngineURL(baseMount)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</p>
|
</InlineButtonBox>
|
||||||
<TransitViewListItem
|
<TransitViewListItem
|
||||||
settings={this.props.settings}
|
settings={this.props.settings}
|
||||||
api={this.props.api}
|
api={this.props.api}
|
||||||
|
|
9
src/ui/pages/Settings/KVLoadExportSettings.tsx
Normal file
9
src/ui/pages/Settings/KVLoadExportSettings.tsx
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { Component } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
|
|
||||||
|
export class KVLoadExportSettings extends Component<DefaultPageProps> {
|
||||||
|
render() {
|
||||||
|
// TODO: Do This
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import { KeyValueSettings } from "./KeyValue/KeyValueSettings";
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
import UIkit from "uikit";
|
import UIkit from "uikit";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { KVLoadExportSettings } from "./KVLoadExportSettings";
|
||||||
|
|
||||||
export function settingsSavedNotification() {
|
export function settingsSavedNotification() {
|
||||||
UIkit.notification(i18next.t("settings_saved_notification"), {
|
UIkit.notification(i18next.t("settings_saved_notification"), {
|
||||||
|
@ -22,6 +23,7 @@ export class Settings extends Component<DefaultPageProps> {
|
||||||
<Grid size={GridSizes.NORMAL}>
|
<Grid size={GridSizes.NORMAL}>
|
||||||
<GeneralSettings {...this.props} />
|
<GeneralSettings {...this.props} />
|
||||||
<KeyValueSettings {...this.props} />
|
<KeyValueSettings {...this.props} />
|
||||||
|
{/*<KVLoadExportSettings {...this.props} />*/}
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue