Skip to content

Commit

Permalink
Merge pull request #171 from buggregator/issue/#166-update-var-dump-c…
Browse files Browse the repository at this point in the history
…ontext

Issue/#166 update var dump context
  • Loading branch information
butschster committed Jun 13, 2024
2 parents 59d3e9b + 42653d8 commit f3c3036
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/screens/var-dump/ui/var-dump-page/var-dump-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const date = computed(() =>
/>
</section>

<section class="var-dump__body">
<section v-if="event.payload.context.source" class="var-dump__body">
<h3 class="var-dump__body-text">Source</h3>
<TableBase class="var-dump__body-table">
<TableBaseRow
Expand All @@ -54,7 +54,7 @@ const date = computed(() =>
</TableBase>
</section>

<section class="var-dump__body">
<section v-if="event.payload.context.request" class="var-dump__body">
<h3 class="var-dump__body-text">Request</h3>
<TableBase class="var-dump__body-table">
<template
Expand Down
31 changes: 20 additions & 11 deletions src/shared/ui/preview-card/preview-card-footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { withDefaults, defineProps, computed } from "vue";
import { IconSvg } from "../icon-svg";
// TODO: Move this to a shared file
const KEY_MAP = {
const KEY_MAP: { [key: string]: string } = {
php_version: "php",
laravel_version: "laravel",
symfony_version: "symfony",
Expand All @@ -25,16 +25,25 @@ const props = withDefaults(defineProps<Props>(), {
});
const mappedOrigins = computed(() =>
props.originConfig
? Object.entries(props.originConfig).reduce((acc, [key, value]) => {
// Filter out empty values
if (!value || value === "undefined") return acc;
const mappedKey = KEY_MAP[key] || key;
acc[mappedKey] = value;
return acc;
}, {} as { [key: string]: string })
: {}
Object.entries(props.originConfig || {}).reduce((acc, [key, value]) => {
const fileName = props.originConfig?.file || "";
if (
key === "name" &&
fileName.includes(value, fileName.length - value.length)
) {
return acc;
}
if (!value || value === "undefined") {
return acc;
}
const mappedKey = KEY_MAP[key] || key;
acc[mappedKey] = value;
return acc;
}, {} as { [key: string]: string })
);
</script>

Expand Down

0 comments on commit f3c3036

Please sign in to comment.