From 07aee7099cff9101b81a49af5f9bdf3e82e03aa8 Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Sun, 23 Jan 2022 13:48:26 +0000 Subject: [PATCH] please someone stop me working on this project --- src/ui/elements/CopyableBox.tsx | 1 - .../pages/Secrets/KeyValue/KeyValueDelete.tsx | 5 ++-- .../pages/Secrets/KeyValue/KeyValueEdit.tsx | 9 ++++--- .../pages/Secrets/KeyValue/KeyValueList.tsx | 11 +++++--- src/ui/pages/Secrets/KeyValue/KeyValueNew.tsx | 14 +++++------ .../Secrets/KeyValue/KeyValueVersions.tsx | 5 ++-- .../pages/Secrets/KeyValue/KeyValueView.tsx | 3 ++- src/ui/pages/Secrets/KeyValue/kvPathUtils.ts | 25 +++++++++++++++++++ src/ui/pages/Secrets/SecretTitleElement.tsx | 5 +--- src/ui/pages/pageLinks.tsx | 21 +++++++++++----- 10 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 src/ui/pages/Secrets/KeyValue/kvPathUtils.ts diff --git a/src/ui/elements/CopyableBox.tsx b/src/ui/elements/CopyableBox.tsx index 049f53a..0771300 100644 --- a/src/ui/elements/CopyableBox.tsx +++ b/src/ui/elements/CopyableBox.tsx @@ -23,7 +23,6 @@ export class CopyableBox extends Component { } componentDidMount(): void { - console.log(this.copyButtonRef.current); const clipboard = new ClipboardJS(this.copyButtonRef.current); addClipboardNotifications(clipboard, 600); } diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx index 248d761..7e9d43a 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx @@ -7,13 +7,14 @@ import { SecretTitleElement } from "../SecretTitleElement"; import { kvListURL, kvViewURL } from "../../pageLinks"; import { route } from "preact-router"; import i18next from "i18next"; +import { splitKVPath } from "./kvPathUtils"; export class KeyValueDelete extends Component { errorMessageRef = createRef(); async onDelete() { const baseMount = this.props.matches["baseMount"]; - const secretPath = this.props.matches["secretPath"].split("/"); + const secretPath = splitKVPath(this.props.matches["secretPath"]); const item = this.props.matches["item"]; const version = this.props.matches["version"]; @@ -35,7 +36,7 @@ export class KeyValueDelete extends Component { render() { const baseMount = this.props.matches["baseMount"]; - const secretPath = this.props.matches["secretPath"].split("/"); + const secretPath = splitKVPath(this.props.matches["secretPath"]); const item = this.props.matches["item"]; return ( diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx index 55f97b1..7e1810c 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx @@ -15,6 +15,7 @@ import { } from "../../../../utils/dataInterchange"; import { sortedObjectMap } from "../../../../utils"; import i18next from "i18next"; +import { combineKVPath, splitKVPath } from "./kvPathUtils"; export type KVEditProps = DefaultPageProps & { baseMount: string; @@ -82,10 +83,11 @@ export class KVEditor extends Component { } try { + const combined = combineKVPath(this.props.secretPath, this.props.secretItem) await this.props.api.createOrUpdateSecret( this.props.baseMount, - this.props.secretPath.map((e) => e + "/"), - this.props.secretItem, + combined.secretPath, + combined.secretItem, parseData(editorContent, this.state.syntax), ); window.history.back(); @@ -116,7 +118,6 @@ export class KVEditor extends Component {