fix(environment-variable-warning): enhance warning logic to check for problematic variable values
This commit is contained in:
parent
f81d36cc4e
commit
dd80d26ff0
1 changed files with 9 additions and 4 deletions
|
|
@ -4,13 +4,18 @@
|
||||||
problematicVars: @js($problematicVariables),
|
problematicVars: @js($problematicVariables),
|
||||||
get showWarning() {
|
get showWarning() {
|
||||||
const currentKey = $wire.key;
|
const currentKey = $wire.key;
|
||||||
|
const currentValue = $wire.value;
|
||||||
const isBuildtime = $wire.is_buildtime;
|
const isBuildtime = $wire.is_buildtime;
|
||||||
|
|
||||||
if (!isBuildtime || !currentKey) return false;
|
if (!isBuildtime || !currentKey) return false;
|
||||||
if (!this.problematicVars.hasOwnProperty(currentKey)) return false;
|
if (!this.problematicVars.hasOwnProperty(currentKey)) return false;
|
||||||
|
|
||||||
// Always show warning for known problematic variables when set as buildtime
|
const config = this.problematicVars[currentKey];
|
||||||
return true;
|
if (!config || !config.problematic_values) return false;
|
||||||
|
|
||||||
|
// Check if current value matches any problematic values
|
||||||
|
const lowerValue = String(currentValue).toLowerCase();
|
||||||
|
return config.problematic_values.some(pv => pv.toLowerCase() === lowerValue);
|
||||||
},
|
},
|
||||||
get warningMessage() {
|
get warningMessage() {
|
||||||
if (!this.showWarning) return null;
|
if (!this.showWarning) return null;
|
||||||
|
|
@ -25,8 +30,8 @@
|
||||||
return `Recommendation: ${config.recommendation}`;
|
return `Recommendation: ${config.recommendation}`;
|
||||||
}
|
}
|
||||||
}" x-if="showWarning">
|
}" x-if="showWarning">
|
||||||
<div class="p-3 rounded-lg bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800">
|
<x-callout type="warning" title="Caution">
|
||||||
<div class="text-sm text-yellow-700 dark:text-yellow-300" x-text="warningMessage"></div>
|
<div class="text-sm text-yellow-700 dark:text-yellow-300" x-text="warningMessage"></div>
|
||||||
<div class="text-sm text-yellow-700 dark:text-yellow-300" x-text="recommendation"></div>
|
<div class="text-sm text-yellow-700 dark:text-yellow-300" x-text="recommendation"></div>
|
||||||
</div>
|
</x-callout>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue