From 3147482acf52b281c02812f2a6f71160b79490b6 Mon Sep 17 00:00:00 2001 From: Chaos Date: Wed, 14 Dec 2022 15:07:03 +0000 Subject: [PATCH] Add hybrid mode to KV View --- src/settings/Settings.ts | 11 ++- src/translations/en.js | 1 + .../pages/Secrets/KeyValue/KeyValueView.tsx | 86 ++++++++++++++----- .../KeyValue/KeyValueViewSettings.tsx | 16 ++++ 4 files changed, 92 insertions(+), 22 deletions(-) diff --git a/src/settings/Settings.ts b/src/settings/Settings.ts index 9f37b16..1811040 100644 --- a/src/settings/Settings.ts +++ b/src/settings/Settings.ts @@ -118,7 +118,7 @@ export class Settings { } get kvAlwaysCodeView(): boolean { - const value = this.storage.getItem("kvAlwaysCodeView") || false; + const value = this.storage.getItem("kvAlwaysCodeView") || "false"; return value == "true"; } set kvAlwaysCodeView(value: boolean) { @@ -126,6 +126,15 @@ export class Settings { this.alertChange("kvAlwaysCodeView"); } + get kvUseHybridView(): boolean { + const value = this.storage.getItem("kvUseHybridView") || "true"; + return value == "true"; + } + set kvUseHybridView(value: boolean) { + this.storage.setItem("kvUseHybridView", String(value)); + this.alertChange("kvUseHybridView"); + } + get kvEditorDefaultLanguage(): string { return this.storage.getItem("kvEditorDefaultLanguage") || "yaml"; } diff --git a/src/translations/en.js b/src/translations/en.js index 8e9ea0f..2c49055 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -89,6 +89,7 @@ module.exports = { settings_kv_editor_indent: "Editor Indent", settings_kv_always_view_in_code_mode: "Always view in code mode", settings_kv_hide_values: "Hide values with key (comma seporated)", + settings_kv_use_hybrid_mode: "Show Secrets in hybrid mode", // Set Vault URL Page set_vault_url_title: "Set Vault URL", diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx index 49f551f..4c4e83c 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx @@ -113,25 +113,6 @@ export class KVSecretNormalVew extends Component { ); })} - - {(() => { - if (this.props.data.has("__vaultui_totp_path")) { - const value = this.props.data.get("__vaultui_totp_path") as string; - const baseMount = value.split("/")[0]; - const totpKey = value.split("/")[1]; - - return ( -

- -