mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(dashboard): UGC list shows a model's given name, and Took/CPU/RAM columns
The models list's Took, CPU and RAM (est.) are separate columns, each sortable (sort=slowest|cpu|memory). The File column shows the name a player gave the model where it is placed, with the upload's extension (the upload's file name is its tooltip), and the name sort uses it (case-insensitive, so SQLite and MySQL agree). The config layer test no longer assumes the build's sharedconfig.ini has no mysql_host; it checks that the database-supplied value isn't used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,7 @@ public:
|
||||
uint32_t processMs{}; // how long the last successful make took (0: not made, or made before it was timed)
|
||||
uint32_t processCpuMs{}; // the worker thread's CPU time for it
|
||||
uint32_t processMemoryKb{}; // the memory the UGC server estimated for it (not measured)
|
||||
std::string modelName; // models: the name a player gave it where it is placed (empty: none)
|
||||
};
|
||||
|
||||
// What SearchUgc matches. A number (when set) is matched against ids; text against names
|
||||
@@ -65,6 +66,8 @@ public:
|
||||
TRIANGLES, // models: the most triangles first
|
||||
SLOWEST, // the longest last make first (process_ms)
|
||||
MADE, // the most recently made (or attempted) first (processed_at)
|
||||
CPU, // the most CPU time in the last make first (process_cpu_ms)
|
||||
MEMORY, // the most estimated memory in the last make first (process_memory_kb)
|
||||
};
|
||||
|
||||
// A page of one kind: all of them or those matching the search (the same matching as SearchUgc), in a state or any
|
||||
|
||||
@@ -31,10 +31,12 @@ namespace UgcLookupSql {
|
||||
return (modular
|
||||
? "SELECT b.ugc_id AS id, b.character_id, c.name AS character_name, COALESCE(c.account_id, 0) AS account_id, a.name AS account_name, "
|
||||
"b.is_optimized, b.process_error, b.ldf_config AS detail, b.process_attempts, b.processed_at, 0 AS process_after, 0 AS bake_ao, "
|
||||
"0 AS brick_count, 0 AS triangle_count, b.process_ms, b.process_cpu_ms, b.process_memory_kb "
|
||||
"0 AS brick_count, 0 AS triangle_count, b.process_ms, b.process_cpu_ms, b.process_memory_kb, '' AS model_name "
|
||||
: "SELECT u.id, u.character_id, c.name AS character_name, u.account_id, a.name AS account_name, "
|
||||
"u.is_optimized, u.process_error, u.filename AS detail, u.process_attempts, u.processed_at, u.process_after, u.bake_ao, "
|
||||
"u.brick_count, u.triangle_count, u.process_ms, u.process_cpu_ms, u.process_memory_kb ") + From(modular);
|
||||
"u.brick_count, u.triangle_count, u.process_ms, u.process_cpu_ms, u.process_memory_kb, "
|
||||
// The name a player gave the model where it is placed (empty: none)
|
||||
"COALESCE((SELECT pc.model_name FROM properties_contents AS pc WHERE pc.ugc_id = u.id AND pc.model_name <> '' LIMIT 1), '') AS model_name ") + From(modular);
|
||||
}
|
||||
|
||||
// Whether a search has anything to match (else a list is of everything)
|
||||
@@ -55,9 +57,12 @@ namespace UgcLookupSql {
|
||||
switch (query.sort) {
|
||||
case eSort::OLDEST: return "ORDER BY " + id + dir(false) + " ";
|
||||
case eSort::OWNER: return "ORDER BY c.name" + std::string(dir(false)) + ", " + id + " DESC ";
|
||||
case eSort::NAME: return std::string("ORDER BY ") + (modular ? "b.ldf_config" : "u.filename") + dir(false) + ", " + id + " DESC ";
|
||||
// Models: the name the player gave it, else the upload's file name
|
||||
case eSort::NAME: return std::string("ORDER BY ") + (modular ? "b.ldf_config" : "LOWER(COALESCE(NULLIF(model_name, ''), u.filename))") + dir(false) + ", " + id + " DESC ";
|
||||
case eSort::BRICKS: return modular ? "ORDER BY " + id + dir(true) + " " : "ORDER BY u.brick_count" + std::string(dir(true)) + ", u.id DESC ";
|
||||
case eSort::TRIANGLES: return modular ? "ORDER BY " + id + dir(true) + " " : "ORDER BY u.triangle_count" + std::string(dir(true)) + ", u.id DESC ";
|
||||
case eSort::CPU: return "ORDER BY " + std::string(modular ? "b" : "u") + ".process_cpu_ms" + dir(true) + ", " + id + " DESC ";
|
||||
case eSort::MEMORY: return "ORDER BY " + std::string(modular ? "b" : "u") + ".process_memory_kb" + dir(true) + ", " + id + " DESC ";
|
||||
case eSort::MADE: return "ORDER BY " + std::string(modular ? "b" : "u") + ".processed_at" + dir(true) + ", " + id + " DESC ";
|
||||
case eSort::SLOWEST: return "ORDER BY " + std::string(modular ? "b" : "u") + ".process_ms" + dir(true) + ", " + id + " DESC ";
|
||||
default: return "ORDER BY " + id + dir(true) + " ";
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace {
|
||||
entry.processMs = static_cast<uint32_t>(result->getInt64("process_ms"));
|
||||
entry.processCpuMs = static_cast<uint32_t>(result->getInt64("process_cpu_ms"));
|
||||
entry.processMemoryKb = static_cast<uint32_t>(result->getInt64("process_memory_kb"));
|
||||
entry.modelName = result->getString("model_name").c_str();
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace {
|
||||
entry.processMs = static_cast<uint32_t>(result.getInt64Field("process_ms"));
|
||||
entry.processCpuMs = static_cast<uint32_t>(result.getInt64Field("process_cpu_ms"));
|
||||
entry.processMemoryKb = static_cast<uint32_t>(result.getInt64Field("process_memory_kb"));
|
||||
entry.modelName = result.getStringField("model_name", "");
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user