mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 11:13:26 +00:00
fix: correct template selection in install script
The script was incorrectly prefixing storage name twice when listing templates, resulting in ISOs:ISOs:vztmpl/... format instead of ISOs:vztmpl/... This caused template existence checks to fail and always trigger downloads. addresses #381
This commit is contained in:
@@ -42,7 +42,7 @@ const CompactNodeCard: Component<CompactNodeCardProps> = (props) => {
|
||||
|
||||
// Mini progress bar for compact mode
|
||||
const MiniProgressBar = (props: { value: number; type: 'cpu' | 'mem' | 'disk' }) => (
|
||||
<div class="w-20 h-2 bg-gray-200 dark:bg-gray-600 rounded-full overflow-hidden">
|
||||
<div class="w-[80px] h-2 bg-gray-200 dark:bg-gray-600 rounded-full overflow-hidden">
|
||||
<div
|
||||
class={`h-full transition-all ${
|
||||
props.value >= 90 ? 'bg-red-500' :
|
||||
|
||||
@@ -54,7 +54,7 @@ export function MetricBar(props: MetricBarProps) {
|
||||
|
||||
return (
|
||||
<div class="metric-text">
|
||||
<div class="relative w-full h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600">
|
||||
<div class="relative w-[120px] h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600">
|
||||
<div
|
||||
class={`absolute top-0 left-0 h-full ${progressColorClass()}`}
|
||||
style={{ width: `${width()}%` }}
|
||||
|
||||
@@ -15,7 +15,7 @@ const NodeCard: Component<NodeCardProps> = (props) => {
|
||||
// Early return if node data is incomplete
|
||||
if (!props.node || !props.node.memory || !props.node.disk) {
|
||||
return (
|
||||
<div class="bg-white dark:bg-gray-800 shadow-md rounded-lg p-3 border border-gray-200 dark:border-gray-700 flex flex-col gap-1 min-w-[160px] max-w-[200px]">
|
||||
<div class="bg-white dark:bg-gray-800 shadow-md rounded-lg p-3 border border-gray-200 dark:border-gray-700 flex flex-col gap-1 w-[180px]">
|
||||
<div class="text-sm text-gray-500">Loading node data...</div>
|
||||
</div>
|
||||
);
|
||||
@@ -68,7 +68,7 @@ const NodeCard: Component<NodeCardProps> = (props) => {
|
||||
}[colorClass] || 'bg-gray-500/70 dark:bg-gray-500/60';
|
||||
|
||||
return (
|
||||
<div class="w-full">
|
||||
<div class="w-[140px]">
|
||||
<div class="flex justify-between items-center mb-0.5">
|
||||
<span class="text-[10px] font-medium text-gray-600 dark:text-gray-400">{label}</span>
|
||||
<span class="text-[10px] font-medium text-gray-700 dark:text-gray-300">{percentage}%</span>
|
||||
@@ -131,7 +131,7 @@ const NodeCard: Component<NodeCardProps> = (props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div class={`bg-white dark:bg-gray-800 shadow-md rounded-lg p-3 flex flex-col gap-2 min-w-[160px] max-w-[200px] ${getBorderClass()} ${getBackgroundClass()}`}>
|
||||
<div class={`bg-white dark:bg-gray-800 shadow-md rounded-lg p-3 flex flex-col gap-2 w-[180px] ${getBorderClass()} ${getBackgroundClass()}`}>
|
||||
{/* Header */}
|
||||
<div class="flex justify-between items-center">
|
||||
<h3 class="text-xs font-semibold truncate text-gray-800 dark:text-gray-200 flex items-center gap-1">
|
||||
|
||||
@@ -70,7 +70,7 @@ const PBSCard: Component<PBSCardProps> = (props) => {
|
||||
}[colorClass] || 'bg-gray-500/60 dark:bg-gray-500/50';
|
||||
|
||||
return (
|
||||
<div class={`relative w-full h-3.5 rounded overflow-hidden ${bgColorClass}`}>
|
||||
<div class={`relative w-[180px] h-3.5 rounded overflow-hidden ${bgColorClass}`}>
|
||||
<div class={`absolute top-0 left-0 h-full ${progressColorClass}`} style={{ width: `${percentage}%` }} />
|
||||
<span class="absolute inset-0 flex items-center justify-center text-[10px] font-medium text-gray-800 dark:text-gray-100 leading-none">
|
||||
<span class="truncate px-1">{text}</span>
|
||||
@@ -125,7 +125,7 @@ const PBSCard: Component<PBSCardProps> = (props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div class={`bg-white dark:bg-gray-800 shadow-md rounded-lg p-2 flex flex-col gap-1 min-w-[250px] ${getBorderClass()}`}>
|
||||
<div class={`bg-white dark:bg-gray-800 shadow-md rounded-lg p-2 flex flex-col gap-1 w-[250px] ${getBorderClass()}`}>
|
||||
{/* Header */}
|
||||
<div class="flex justify-between items-center">
|
||||
<h3 class="text-sm font-semibold truncate text-gray-800 dark:text-gray-200 flex items-center gap-2">
|
||||
|
||||
@@ -269,7 +269,7 @@ const Storage: Component = () => {
|
||||
<Show when={viewMode() === 'node'}>
|
||||
<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden lg:table-cell">Shared</th>
|
||||
</Show>
|
||||
<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-[100px] sm:min-w-[150px] md:min-w-[200px]">Usage</th>
|
||||
<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[200px]">Usage</th>
|
||||
<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden sm:table-cell">Free</th>
|
||||
<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Total</th>
|
||||
</tr>
|
||||
@@ -361,7 +361,7 @@ const Storage: Component = () => {
|
||||
</Show>
|
||||
|
||||
<td class="p-0.5 px-1.5">
|
||||
<div class="relative w-full h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600">
|
||||
<div class="relative w-[200px] h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600">
|
||||
<div
|
||||
class={`absolute top-0 left-0 h-full ${getProgressBarColor(usagePercent)}`}
|
||||
style={{ width: `${usagePercent}%` }}
|
||||
|
||||
+4
-2
@@ -583,7 +583,8 @@ create_lxc_container() {
|
||||
# Collect templates from ALL template-capable storages
|
||||
local ALL_TEMPLATES=""
|
||||
for tmpl_storage in $TEMPLATE_STORAGES; do
|
||||
local STORAGE_TEMPLATES=$(pveam list "$tmpl_storage" 2>/dev/null | tail -n +2 | awk -v storage="$tmpl_storage" '{print storage ":" $1}' || true)
|
||||
# pveam list output already includes the storage prefix in the path
|
||||
local STORAGE_TEMPLATES=$(pveam list "$tmpl_storage" 2>/dev/null | tail -n +2 | awk '{print $1}' || true)
|
||||
if [[ -n "$STORAGE_TEMPLATES" ]]; then
|
||||
if [[ -n "$ALL_TEMPLATES" ]]; then
|
||||
ALL_TEMPLATES="${ALL_TEMPLATES}\n${STORAGE_TEMPLATES}"
|
||||
@@ -671,11 +672,12 @@ create_lxc_container() {
|
||||
fi
|
||||
|
||||
# Download template if it doesn't exist
|
||||
# For storage:vztmpl format, we need to check if template exists using pveam
|
||||
# Check if template exists - pveam list shows full paths like storage:vztmpl/file.tar.zst
|
||||
local TEMPLATE_EXISTS=false
|
||||
if [[ "$TEMPLATE" =~ ^([^:]+):vztmpl/(.+)$ ]]; then
|
||||
local STORAGE_NAME="${BASH_REMATCH[1]}"
|
||||
local TEMPLATE_FILE="${BASH_REMATCH[2]}"
|
||||
# Check if this exact template exists in pveam list
|
||||
if pveam list "$STORAGE_NAME" 2>/dev/null | grep -q "$TEMPLATE_FILE"; then
|
||||
TEMPLATE_EXISTS=true
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user