Admin v10
This commit is contained in:
@@ -10,183 +10,289 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-white">CDN Assets</h1>
|
||||
<p class="text-gray-400 mt-1">Browse and manage client assets</p>
|
||||
<p class="text-gray-400 mt-1">Browse CDN and manage tracked assets</p>
|
||||
</div>
|
||||
<a href="/admin/assets/edit" class="btn btn-primary flex items-center gap-2">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
||||
</svg>
|
||||
Add Asset
|
||||
</div>
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="flex gap-2 border-b border-gray-700">
|
||||
<a href="/admin/assets?tab=browse" class="px-4 py-2 @(Model.Tab == "browse" ? "text-white border-b-2 border-indigo-500" : "text-gray-400 hover:text-white")">
|
||||
Browse CDN
|
||||
</a>
|
||||
<a href="/admin/assets?tab=tracked" class="px-4 py-2 @(Model.Tab == "tracked" ? "text-white border-b-2 border-indigo-500" : "text-gray-400 hover:text-white")">
|
||||
Tracked Assets (@Model.TrackedCount)
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="card p-4">
|
||||
<form method="get" class="flex flex-wrap items-end gap-4">
|
||||
<div class="flex-1 min-w-[200px]">
|
||||
<label class="label">Search</label>
|
||||
<input type="text" name="search" value="@Model.Search" class="input" placeholder="Search by path..." />
|
||||
|
||||
@if (Model.Tab == "browse")
|
||||
{
|
||||
<!-- CDN Browser -->
|
||||
<div class="card p-4">
|
||||
<div class="flex items-center gap-4 mb-4">
|
||||
<label class="label mb-0">Category:</label>
|
||||
<div class="flex gap-2">
|
||||
<a href="/admin/assets?tab=browse&folder=textures/items" class="btn @(Model.Folder == "textures/items" ? "btn-primary" : "btn-secondary") text-sm">Items</a>
|
||||
<a href="/admin/assets?tab=browse&folder=textures/mobs" class="btn @(Model.Folder == "textures/mobs" ? "btn-primary" : "btn-secondary") text-sm">Mobs</a>
|
||||
<a href="/admin/assets?tab=browse&folder=textures/objects" class="btn @(Model.Folder == "textures/objects" ? "btn-primary" : "btn-secondary") text-sm">Objects</a>
|
||||
<a href="/admin/assets?tab=browse&folder=textures/spells" class="btn @(Model.Folder == "textures/spells" ? "btn-primary" : "btn-secondary") text-sm">Spells</a>
|
||||
<a href="/admin/assets?tab=browse&folder=textures/ui" class="btn @(Model.Folder == "textures/ui" ? "btn-primary" : "btn-secondary") text-sm">UI</a>
|
||||
<a href="/admin/assets?tab=browse&folder=scenes/mobs" class="btn @(Model.Folder == "scenes/mobs" ? "btn-primary" : "btn-secondary") text-sm">Mob Scenes</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-40">
|
||||
<label class="label">Type</label>
|
||||
<select name="type" class="input">
|
||||
<option value="">All Types</option>
|
||||
@foreach (var t in Enum.GetValues<ClientAssetType>())
|
||||
{
|
||||
<option value="@t" selected="@(Model.TypeFilter == t)">@t</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-secondary">Filter</button>
|
||||
<a href="/admin/assets" class="btn btn-secondary">Clear</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Stats -->
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-white">@Model.TotalCount</p>
|
||||
<p class="text-sm text-gray-400">Total Assets</p>
|
||||
|
||||
<p class="text-sm text-gray-500 mb-4">
|
||||
CDN Path: <code class="bg-gray-900 px-2 py-1 rounded">@Model.CdnBaseUrl/downloads/@Model.Folder/</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Manual Path Entry -->
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-indigo-400">@Model.TextureCount</p>
|
||||
<p class="text-sm text-gray-400">Textures</p>
|
||||
<form method="post" asp-page-handler="RegisterAsset" class="flex items-end gap-4">
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="flex-1">
|
||||
<label class="label">Register Asset by Path</label>
|
||||
<input type="text" name="filePath" class="input" placeholder="e.g., textures/items/sword.png" required />
|
||||
</div>
|
||||
<div class="w-40">
|
||||
<label class="label">Type</label>
|
||||
<select name="assetType" class="input">
|
||||
@foreach (var t in Enum.GetValues<ClientAssetType>())
|
||||
{
|
||||
<option value="@t">@t</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Register</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-green-400">@Model.SceneCount</p>
|
||||
<p class="text-sm text-gray-400">Scenes</p>
|
||||
</div>
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-yellow-400">@Model.ScriptCount</p>
|
||||
<p class="text-sm text-gray-400">Scripts</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Assets Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
@foreach (var asset in Model.Assets)
|
||||
|
||||
<!-- Preview Grid for common textures -->
|
||||
@if (Model.Folder?.StartsWith("textures/") == true)
|
||||
{
|
||||
<div class="card overflow-hidden group">
|
||||
<!-- Preview -->
|
||||
<div class="h-32 bg-gray-900 flex items-center justify-center relative">
|
||||
@if (asset.AssetType == ClientAssetType.Texture)
|
||||
{
|
||||
<img src="@Html.Raw(Model.CdnBaseUrl)/downloads/@asset.DownloadPath"
|
||||
alt="@asset.FilePath"
|
||||
class="max-h-full max-w-full object-contain"
|
||||
onerror="this.parentElement.innerHTML='<div class=\'text-gray-600 text-center\'><svg class=\'w-12 h-12 mx-auto\' fill=\'none\' stroke=\'currentColor\' viewBox=\'0 0 24 24\'><path stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z\'/></svg><p class=\'text-xs mt-1\'>Failed to load</p></div>'" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-gray-600 text-center">
|
||||
@switch (asset.AssetType)
|
||||
{
|
||||
case ClientAssetType.Scene:
|
||||
<svg class="w-12 h-12 mx-auto text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
|
||||
</svg>
|
||||
break;
|
||||
case ClientAssetType.Script:
|
||||
<svg class="w-12 h-12 mx-auto text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/>
|
||||
</svg>
|
||||
break;
|
||||
case ClientAssetType.Audio:
|
||||
<svg class="w-12 h-12 mx-auto text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"/>
|
||||
</svg>
|
||||
break;
|
||||
default:
|
||||
<svg class="w-12 h-12 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
||||
</svg>
|
||||
break;
|
||||
}
|
||||
<p class="text-xs mt-1">@asset.AssetType</p>
|
||||
</div>
|
||||
}
|
||||
<div class="card">
|
||||
<div class="p-4 border-b border-gray-700">
|
||||
<h2 class="text-lg font-semibold text-white">Preview - @Model.Folder</h2>
|
||||
<p class="text-sm text-gray-500">Click an image to copy its path, or use the register button to track it.</p>
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<div class="grid grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10 gap-2">
|
||||
@foreach (var file in Model.PreviewFiles)
|
||||
{
|
||||
var isTracked = Model.TrackedPaths.Contains(file);
|
||||
<div class="relative group">
|
||||
<div class="w-full aspect-square bg-gray-900 rounded border @(isTracked ? "border-green-600" : "border-gray-700") flex items-center justify-center overflow-hidden">
|
||||
<img src="@Html.Raw(Model.CdnBaseUrl)/downloads/@file"
|
||||
alt="@System.IO.Path.GetFileName(file)"
|
||||
class="max-w-full max-h-full object-contain"
|
||||
loading="lazy"
|
||||
onerror="this.parentElement.innerHTML='<span class=\'text-xs text-red-400\'>404</span>'" />
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 truncate mt-1" title="@file">@System.IO.Path.GetFileName(file)</p>
|
||||
|
||||
<!-- Hover actions -->
|
||||
<div class="absolute inset-0 bg-black/70 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-1 rounded">
|
||||
<button type="button" onclick="copyPath('@file')" class="p-1 bg-gray-700 rounded hover:bg-gray-600" title="Copy Path">
|
||||
<svg class="w-4 h-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</button>
|
||||
@if (!isTracked)
|
||||
{
|
||||
<form method="post" asp-page-handler="RegisterAsset" class="inline">
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" name="filePath" value="@file" />
|
||||
<input type="hidden" name="assetType" value="Texture" />
|
||||
<button type="submit" class="p-1 bg-green-700 rounded hover:bg-green-600" title="Register">
|
||||
<svg class="w-4 h-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="p-1 bg-green-900 rounded" title="Already tracked">
|
||||
<svg class="w-4 h-4 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
||||
</svg>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Type badge -->
|
||||
<div class="absolute top-2 right-2">
|
||||
<span class="badge @(asset.AssetType == ClientAssetType.Texture ? "badge-rare" : asset.AssetType == ClientAssetType.Scene ? "badge-uncommon" : "badge-common")">
|
||||
@asset.AssetType
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info -->
|
||||
<div class="p-3">
|
||||
<p class="text-sm text-white font-medium truncate" title="@asset.FilePath">
|
||||
@System.IO.Path.GetFileName(asset.FilePath)
|
||||
</p>
|
||||
<p class="text-xs text-gray-500 truncate" title="@asset.FilePath">
|
||||
@asset.FilePath
|
||||
</p>
|
||||
<div class="flex items-center justify-between mt-2 text-xs text-gray-400">
|
||||
<span>v@asset.Version</span>
|
||||
<span>@FormatFileSize(asset.FileSize)</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1 mt-2">
|
||||
@if (asset.IsRequired)
|
||||
{
|
||||
<span class="text-xs text-yellow-400">Required</span>
|
||||
}
|
||||
@if (!asset.IsEnabled)
|
||||
{
|
||||
<span class="text-xs text-red-400">Disabled</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions (hidden until hover) -->
|
||||
<div class="border-t border-gray-700 p-2 flex justify-end gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<a href="@Html.Raw(Model.CdnBaseUrl)/downloads/@asset.DownloadPath" target="_blank" class="p-1.5 hover:bg-gray-700 rounded text-gray-400" title="Download">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/>
|
||||
</svg>
|
||||
</a>
|
||||
<button type="button" onclick="copyToClipboard('@asset.FilePath')" class="p-1.5 hover:bg-gray-700 rounded text-gray-400" title="Copy Path">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</button>
|
||||
@if (!Model.PreviewFiles.Any())
|
||||
{
|
||||
<p class="text-gray-500 text-center py-8">
|
||||
Enter file names manually or check that assets exist at this CDN path.
|
||||
</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!Model.Assets.Any())
|
||||
{
|
||||
<div class="col-span-full card p-12 text-center">
|
||||
<svg class="w-16 h-16 mx-auto text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
<p class="text-gray-400 mt-4">No assets found.</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
@if (Model.TotalPages > 1)
|
||||
{
|
||||
<div class="flex items-center justify-between">
|
||||
<p class="text-sm text-gray-400">
|
||||
Showing @((Model.CurrentPage - 1) * Model.PageSize + 1)-@Math.Min(Model.CurrentPage * Model.PageSize, Model.TotalCount) of @Model.TotalCount
|
||||
</p>
|
||||
<div class="flex items-center gap-2">
|
||||
@if (Model.CurrentPage > 1)
|
||||
{
|
||||
<a href="@Model.GetPageUrl(Model.CurrentPage - 1)" class="btn btn-secondary">← Prev</a>
|
||||
}
|
||||
<span class="text-gray-400 px-2">@Model.CurrentPage / @Model.TotalPages</span>
|
||||
@if (Model.CurrentPage < Model.TotalPages)
|
||||
{
|
||||
<a href="@Model.GetPageUrl(Model.CurrentPage + 1)" class="btn btn-secondary">Next →</a>
|
||||
}
|
||||
</div>
|
||||
<!-- Quick Add Common Files -->
|
||||
<div class="card p-4">
|
||||
<h3 class="text-white font-medium mb-3">Quick Test - Enter filenames (comma separated)</h3>
|
||||
<form method="get" class="flex gap-4">
|
||||
<input type="hidden" name="tab" value="browse" />
|
||||
<input type="hidden" name="folder" value="@Model.Folder" />
|
||||
<input type="text" name="files" value="@Model.FileList" class="input flex-1" placeholder="e.g., sword.png, shield.png, potion.png" />
|
||||
<button type="submit" class="btn btn-secondary">Load Preview</button>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<!-- Tracked Assets -->
|
||||
<div class="card p-4">
|
||||
<form method="get" class="flex flex-wrap items-end gap-4">
|
||||
<input type="hidden" name="tab" value="tracked" />
|
||||
<div class="flex-1 min-w-[200px]">
|
||||
<label class="label">Search</label>
|
||||
<input type="text" name="search" value="@Model.Search" class="input" placeholder="Search by path..." />
|
||||
</div>
|
||||
<div class="w-40">
|
||||
<label class="label">Type</label>
|
||||
<select name="type" class="input">
|
||||
<option value="">All Types</option>
|
||||
@foreach (var t in Enum.GetValues<ClientAssetType>())
|
||||
{
|
||||
<option value="@t" selected="@(Model.TypeFilter == t)">@t</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-secondary">Filter</button>
|
||||
<a href="/admin/assets?tab=tracked" class="btn btn-secondary">Clear</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Stats -->
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-white">@Model.TrackedCount</p>
|
||||
<p class="text-sm text-gray-400">Total Tracked</p>
|
||||
</div>
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-indigo-400">@Model.TextureCount</p>
|
||||
<p class="text-sm text-gray-400">Textures</p>
|
||||
</div>
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-green-400">@Model.SceneCount</p>
|
||||
<p class="text-sm text-gray-400">Scenes</p>
|
||||
</div>
|
||||
<div class="card p-4">
|
||||
<p class="text-2xl font-bold text-yellow-400">@Model.ScriptCount</p>
|
||||
<p class="text-sm text-gray-400">Scripts</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Assets Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
@foreach (var asset in Model.Assets)
|
||||
{
|
||||
<div class="card overflow-hidden group">
|
||||
<div class="h-32 bg-gray-900 flex items-center justify-center relative">
|
||||
@if (asset.AssetType == ClientAssetType.Texture)
|
||||
{
|
||||
<img src="@Html.Raw(Model.CdnBaseUrl)/downloads/@asset.DownloadPath"
|
||||
alt="@asset.FilePath"
|
||||
class="max-h-full max-w-full object-contain"
|
||||
onerror="this.parentElement.innerHTML='<div class=\'text-red-400 text-center\'><p class=\'text-xs\'>Failed to load</p></div>'" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-gray-600 text-center">
|
||||
@switch (asset.AssetType)
|
||||
{
|
||||
case ClientAssetType.Scene:
|
||||
<svg class="w-12 h-12 mx-auto text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
|
||||
</svg>
|
||||
break;
|
||||
case ClientAssetType.Script:
|
||||
<svg class="w-12 h-12 mx-auto text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/>
|
||||
</svg>
|
||||
break;
|
||||
default:
|
||||
<svg class="w-12 h-12 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
||||
</svg>
|
||||
break;
|
||||
}
|
||||
<p class="text-xs mt-1">@asset.AssetType</p>
|
||||
</div>
|
||||
}
|
||||
<div class="absolute top-2 right-2">
|
||||
<span class="badge badge-common text-xs">@asset.AssetType</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-3">
|
||||
<p class="text-sm text-white font-medium truncate">@System.IO.Path.GetFileName(asset.FilePath)</p>
|
||||
<p class="text-xs text-gray-500 truncate">@asset.FilePath</p>
|
||||
<div class="flex items-center justify-between mt-2 text-xs text-gray-400">
|
||||
<span>v@asset.Version</span>
|
||||
<span>@FormatFileSize(asset.FileSize)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t border-gray-700 p-2 flex justify-end gap-2">
|
||||
<button onclick="copyPath('@asset.FilePath')" class="p-1.5 hover:bg-gray-700 rounded text-gray-400" title="Copy Path">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<form method="post" asp-page-handler="DeleteAsset" class="inline">
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" name="assetId" value="@asset.Id" />
|
||||
<button type="submit" class="p-1.5 hover:bg-gray-700 rounded text-red-400" title="Untrack" onclick="return confirm('Remove tracking for this asset?')">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!Model.Assets.Any())
|
||||
{
|
||||
<div class="col-span-full card p-12 text-center">
|
||||
<p class="text-gray-400">No tracked assets found.</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
@if (Model.TotalPages > 1)
|
||||
{
|
||||
<div class="flex items-center justify-between">
|
||||
<p class="text-sm text-gray-400">
|
||||
Page @Model.CurrentPage of @Model.TotalPages
|
||||
</p>
|
||||
<div class="flex items-center gap-2">
|
||||
@if (Model.CurrentPage > 1)
|
||||
{
|
||||
<a href="@Model.GetPageUrl(Model.CurrentPage - 1)" class="btn btn-secondary">← Prev</a>
|
||||
}
|
||||
@if (Model.CurrentPage < Model.TotalPages)
|
||||
{
|
||||
<a href="@Model.GetPageUrl(Model.CurrentPage + 1)" class="btn btn-secondary">Next →</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.Message))
|
||||
{
|
||||
<div class="fixed bottom-4 right-4 p-4 rounded-lg @(Model.IsError ? "bg-red-900 border border-red-700" : "bg-green-900 border border-green-700") text-white shadow-lg">
|
||||
@Model.Message
|
||||
</div>
|
||||
}
|
||||
|
||||
@functions {
|
||||
string FormatFileSize(long bytes)
|
||||
{
|
||||
@@ -198,10 +304,14 @@
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
// Show a quick toast or just change cursor briefly
|
||||
console.log('Copied:', text);
|
||||
function copyPath(path) {
|
||||
navigator.clipboard.writeText(path).then(() => {
|
||||
// Quick visual feedback
|
||||
const toast = document.createElement('div');
|
||||
toast.className = 'fixed bottom-4 left-4 bg-gray-800 text-white px-4 py-2 rounded shadow-lg';
|
||||
toast.textContent = 'Copied: ' + path;
|
||||
document.body.appendChild(toast);
|
||||
setTimeout(() => toast.remove(), 2000);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user