appName = $appName; $this->config = $config; $this->gaService = $gaService; $this->llmService = $llmService; } /** * Index page - render admin UI * * @NoAdminRequired * @NoCSRFRequired */ public function index(): TemplateResponse { // Check configuration status gracefully $isConfigured = false; $isGAConfigured = false; $isLLMConfigured = false; try { $isGAConfigured = $this->gaService->isConfigured(); $isLLMConfigured = $this->llmService->isConfigured(); $isConfigured = $isGAConfigured && $isLLMConfigured; } catch (\Exception $e) { // If service initialization fails, app is not configured $isConfigured = false; } // Get configuration values (masked for secrets) $clientId = $this->config->getAppValue('google_client_id', 'analyticshub', ''); $apiKey = $this->config->getAppValue('anthropic_api_key', 'analyticshub', ''); // Mask API key for display $maskedApiKey = ''; if (!empty($apiKey)) { $maskedApiKey = substr($apiKey, 0, 8) . '...' . substr($apiKey, -4); } return new TemplateResponse($this->appName, 'admin', [ 'app_name' => $this->appName, 'version' => '1.0.0', 'status' => 'Ready for development', 'is_configured' => $isConfigured, 'is_ga_configured' => $isGAConfigured, 'is_llm_configured' => $isLLMConfigured, 'google_client_id' => $clientId, 'anthropic_api_key_masked' => $maskedApiKey, 'request' => $this->request, ]); } }