From d1176cbdb717493c35b9cd8eb9bbd0d48c9654ec Mon Sep 17 00:00:00 2001 From: 12fab4 Date: Wed, 26 Feb 2025 11:53:36 +0100 Subject: [PATCH] fix: remove json config view/download --- src/components/ConfigPreview.vue | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/components/ConfigPreview.vue b/src/components/ConfigPreview.vue index ed5bb8cb..ee9ca79f 100644 --- a/src/components/ConfigPreview.vue +++ b/src/components/ConfigPreview.vue @@ -19,15 +19,11 @@ YAML - JSON - - - @@ -64,23 +60,12 @@ const props = defineProps<{ const tab = ref("yaml"); -const jsonCode = computed(() => JSON.stringify(props.config.serialize(), null, 2)); const yamlCode = computed(() => yaml.dump(props.config.serialize())); const downloadConfig = () => { - let filename = ""; - let contentType = ""; - let content = ""; - - if (tab.value === "json") { - filename = `${props.config._name}.json`; - contentType = "application/json"; - content = jsonCode.value; - } else if (tab.value === "yaml") { - filename = `${props.config._name}.yaml`; - contentType = "text/yaml"; - content = yamlCode.value; - } + const filename = `${props.config._name}.yaml`; + const contentType = "text/yaml"; + const content = yamlCode.value; const blob = new Blob([content], { type: contentType }); const url = URL.createObjectURL(blob); @@ -94,12 +79,7 @@ const downloadConfig = () => { }; const copyConfig = () => { - let content = ""; - if (tab.value === "json") { - content = jsonCode.value; - } else if (tab.value === "yaml") { - content = yamlCode.value; - } + const content = yamlCode.value; navigator.clipboard.writeText(content); notyf.success("Copied to clipboard!"); };