Fix: Use simple HTML output to test routing

- Changed AdminController to use simple echo/exit instead of TemplateResponse
  - Eliminates TemplateResponse complexity
  - Direct HTML output for debugging
- Simplified routes.php to single admin route
  - Removed test route (no longer needed)
  - Simple GET only route
- Simplified Application.php
  - Removed resource loading
  - Minimal bootstrap

If this shows 'Controller is working' page, routing is confirmed working.
If it still redirects to dashboard, it's a Nextcloud routing issue.

This is a minimal test version to confirm routing works before building full UI.
This commit is contained in:
WLTBAgent
2026-02-13 20:13:46 +00:00
parent b4a11fcc33
commit d4f96cc28b
3 changed files with 19 additions and 42 deletions

View File

@@ -4,9 +4,6 @@ declare(strict_types=1);
namespace OCA\AnalyticsHub\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
/**
@@ -15,40 +12,33 @@ use OCP\IRequest;
* @NoAdminRequired
* @NoCSRFRequired
*/
class AdminController extends Controller {
class AdminController {
private $appName;
public function __construct($appName, IRequest $request) {
parent::__construct($appName, $request);
public function __construct(string $appName, IRequest $request) {
$this->appName = $appName;
$this->request = $request;
}
/**
* Index page - render admin UI
* Index page - simple render without TemplateResponse
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index(): TemplateResponse {
return new TemplateResponse($this->appName, 'admin', [
'app_name' => $this->appName,
'version' => '1.0.0',
'status' => 'testing - admin accessible',
]);
}
/**
* Test route - simple JSON response
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function test(): JSONResponse {
return new JSONResponse([
'success' => true,
'message' => 'Analytics Hub controller is working!',
'app_name' => $this->appName,
]);
public function index(): void {
echo '<!DOCTYPE html>';
echo '<html>';
echo '<head><title>Mini-CMO Analytics Hub</title></head>';
echo '<body>';
echo '<h1>Mini-CMO Analytics Hub</h1>';
echo '<p>Controller is working! App name: ' . htmlspecialchars($this->appName) . '</p>';
echo '<p><strong>Status: Admin accessible!</strong></p>';
echo '<hr>';
echo '<p>Test successful - routing is working.</p>';
echo '</body>';
echo '</html>';
exit;
}
}