Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove json config view/download #231

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions src/components/ConfigPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
<v-card-text>
<v-tabs v-model="tab">
<v-tab value="yaml"> YAML </v-tab>
<v-tab value="json"> JSON </v-tab>
</v-tabs>
<v-window v-model="tab">
<v-window-item value="yaml">
<highlightjs language="yaml" :code="yamlCode" />
</v-window-item>
<v-window-item value="json">
<highlightjs language="json" :code="jsonCode" />
</v-window-item>
</v-window>
</v-card-text>
</v-card>
Expand Down Expand Up @@ -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);
Expand All @@ -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!");
};
Expand Down
Loading