From 8bcd4457592789a675ce08e90e9a309af4e10fc3 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Fri, 14 Aug 2026 02:13:02 +0200 Subject: [PATCH] ysdsad --- custom/apps/mining-checker/assets/js/app.js | 25 ++++++++++++++++--- .../src/Infrastructure/SchemaManager.php | 21 ++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/custom/apps/mining-checker/assets/js/app.js b/custom/apps/mining-checker/assets/js/app.js index 8480c408..d54b1ab3 100644 --- a/custom/apps/mining-checker/assets/js/app.js +++ b/custom/apps/mining-checker/assets/js/app.js @@ -821,7 +821,18 @@ : null, ]), hoveredPoint - ? h('div', { key: 'hover', className: 'mc-mini-card' }, [ + ? h('div', { + key: 'hover', + className: 'mc-mini-card', + style: { + position: 'absolute', + top: 28, + right: 0, + zIndex: 3, + pointerEvents: 'none', + maxWidth: '220px', + }, + }, [ h('div', { key: 'label', className: 'mc-kicker', style: { color: hoveredPoint.color } }, hoveredPoint.label), h('div', { key: 'value' }, `${hoveredPoint.x}: ${hoveredPoint.value}`), ]) @@ -1678,15 +1689,19 @@ async function loadSchemaStatus(key) { try { const schema = await request(`${apiBase}/projects/${encodeURIComponent(key)}/schema-status`, { timeoutMs: 4000 }); - setSchemaStatus(normalizeSchemaStatus(schema)); + const normalized = normalizeSchemaStatus(schema); + setSchemaStatus(normalized); + return normalized; } catch (err) { setSchemaStatus(normalizeSchemaStatus(null)); setError((previous) => previous || `Schema-Status konnte nicht geladen werden: ${err.message}`); + return null; } } async function loadBootstrap(key, options) { const suppressError = !!(options && options.suppressError); + const schemaStatusOverride = options && options.schemaStatusOverride ? options.schemaStatusOverride : null; const cacheKey = `${key}:${activeTab || 'overview'}`; const cachedPayload = bootstrapCacheRef.current.get(cacheKey) || null; @@ -1708,7 +1723,8 @@ }, 30000); try { - if (schemaStatus.missing_count > 0 || schemaStatus.pending_upgrade_count > 0) { + const effectiveSchemaStatus = schemaStatusOverride || schemaStatus; + if (effectiveSchemaStatus.missing_count > 0 || effectiveSchemaStatus.pending_upgrade_count > 0) { setPayload(normalizeBootstrap(null, key)); setError('Mining-Checker Schema ist noch nicht initialisiert. Bitte im Tab Settings die Datenbank initialisieren.'); return false; @@ -2646,7 +2662,8 @@ ? `Angewendete Upgrades: ${result.upgraded.join(', ')}.` : 'Keine Upgrades erforderlich.') ); - await loadBootstrap(projectKey); + const refreshedStatus = await loadSchemaStatus(projectKey); + await loadBootstrap(projectKey, { schemaStatusOverride: refreshedStatus || nextStatus }); } catch (err) { setError(err.message); } finally { diff --git a/custom/apps/mining-checker/src/Infrastructure/SchemaManager.php b/custom/apps/mining-checker/src/Infrastructure/SchemaManager.php index 6961e40d..debf05de 100644 --- a/custom/apps/mining-checker/src/Infrastructure/SchemaManager.php +++ b/custom/apps/mining-checker/src/Infrastructure/SchemaManager.php @@ -279,6 +279,7 @@ final class SchemaManager public function upgradeSchemaDirect(): array { + $before = $this->schemaStatus(); $coreTables = [ $this->prefix . 'projects', $this->prefix . 'settings', @@ -291,8 +292,11 @@ final class SchemaManager $presentCoreTables = $this->existingTables($coreTables); if ($presentCoreTables === []) { $this->importSchema(); + $after = $this->schemaStatus(); return [ 'upgraded' => ['schema_initialized'], + 'before' => $before, + 'after' => $after, 'message' => 'Mining-Checker Schema wurde neu angelegt.', ]; } @@ -312,6 +316,19 @@ final class SchemaManager $this->upgradeCostPlanColumns(); $applied[] = 'cost_plan_columns'; } + if ( + ($this->tableExists($this->prefix . 'cost_plans') && ( + !$this->columnExists($this->prefix . 'cost_plans', 'daily_cost_amount') || + !$this->columnExists($this->prefix . 'cost_plans', 'daily_cost_currency') + )) || + ($this->tableExists($this->prefix . 'purchased_miners') && ( + !$this->columnExists($this->prefix . 'purchased_miners', 'daily_cost_amount') || + !$this->columnExists($this->prefix . 'purchased_miners', 'daily_cost_currency') + )) + ) { + $this->upgradeServerDailyCostColumns(); + $applied[] = 'server_daily_cost_columns'; + } $settingsColumns = $this->existingColumns($this->prefix . 'settings', ['preferred_currencies', 'report_currency', 'crypto_currency', 'display_timezone', 'fx_max_age_hours', 'module_theme_mode', 'module_theme_accent']); if (!in_array('preferred_currencies', $settingsColumns, true) || !in_array('report_currency', $settingsColumns, true) || !in_array('crypto_currency', $settingsColumns, true) || !in_array('display_timezone', $settingsColumns, true) || !in_array('fx_max_age_hours', $settingsColumns, true) || !in_array('module_theme_mode', $settingsColumns, true) || !in_array('module_theme_accent', $settingsColumns, true)) { @@ -389,8 +406,12 @@ final class SchemaManager $applied[] = 'target_offer_foreign_key'; } + $after = $this->schemaStatus(); + return [ 'upgraded' => $applied, + 'before' => $before, + 'after' => $after, 'message' => $applied === [] ? 'Schema ist bereits auf dem neuesten Stand.' : 'Direktes Schema-Upgrade erfolgreich ausgefuehrt.',