appName = $appName; $this->config = $config; } /** * Index page - render admin UI * * @AdminRequired * @NoCSRFRequired */ public function index(): TemplateResponse { // Get configuration values directly from config service $clientId = $this->config->getAppValue('analyticshub', 'google_client_id', ''); $clientSecret = $this->config->getAppValue('analyticshub', 'google_client_secret', ''); $refreshToken = $this->config->getAppValue('analyticshub', 'google_refresh_token', ''); $apiKey = $this->config->getAppValue('analyticshub', 'anthropic_api_key', ''); $llmEndpoint = $this->config->getAppValue('analyticshub', 'llm_api_endpoint', ''); $llmModel = $this->config->getAppValue('analyticshub', 'llm_model', ''); // Check if configured $isConfigured = !empty($clientId) && !empty($clientSecret) && !empty($refreshToken) && !empty($apiKey); $isGAConfigured = !empty($clientId) && !empty($clientSecret) && !empty($refreshToken); $isLLMConfigured = !empty($apiKey); // Mask secrets for display $maskedClientSecret = ''; if (!empty($clientSecret)) { $maskedClientSecret = '••••••••••••••••'; } $maskedRefreshToken = ''; if (!empty($refreshToken)) { $maskedRefreshToken = substr($refreshToken, 0, 8) . '...' . substr($refreshToken, -4); } $maskedApiKey = ''; if (!empty($apiKey)) { $maskedApiKey = substr($apiKey, 0, 8) . '...' . substr($apiKey, -4); } return new TemplateResponse('analyticshub', 'admin', [ 'app_name' => 'Mini-CMO Analytics Hub', 'version' => '1.0.0', 'status' => $isConfigured ? 'Ready' : 'Configuration Required', 'is_configured' => $isConfigured, 'is_ga_configured' => $isGAConfigured, 'is_llm_configured' => $isLLMConfigured, 'google_client_id' => $clientId, 'google_client_secret_masked' => $maskedClientSecret, 'google_refresh_token_masked' => $maskedRefreshToken, 'llm_api_endpoint' => $llmEndpoint, 'llm_model' => $llmModel, 'anthropic_api_key_masked' => $maskedApiKey, ], 'blank'); // Use 'blank' rendering mode for admin pages } }