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:
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace OCA\AnalyticsHub\AppInfo;
|
namespace OCA\AnalyticsHub\AppInfo;
|
||||||
|
|
||||||
use OCP\AppFramework\App;
|
use OCP\AppFramework\App;
|
||||||
use OCP\Util;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application class for Mini-CMO Analytics Hub
|
* Application class for Mini-CMO Analytics Hub
|
||||||
@@ -18,8 +17,6 @@ class Application extends App {
|
|||||||
public function __construct(array $urlParams = []) {
|
public function __construct(array $urlParams = []) {
|
||||||
parent::__construct(self::APP_ID, $urlParams);
|
parent::__construct(self::APP_ID, $urlParams);
|
||||||
|
|
||||||
// Load scripts and styles for admin page
|
// No resources to load for simple test
|
||||||
Util::addStyle(self::APP_ID, 'admin');
|
|
||||||
Util::addScript(self::APP_ID, 'admin');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\AnalyticsHub;
|
namespace OCA\AnalyticsHub;
|
||||||
|
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
|
||||||
use OCP\AppFramework\Http\JSONResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routes for Mini-CMO Analytics Hub
|
* Routes for Mini-CMO Analytics Hub
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'routes' => [
|
'routes' => [
|
||||||
// Test route
|
// Admin route - simple GET only
|
||||||
[
|
|
||||||
'name' => 'admin#test',
|
|
||||||
'url' => '/test',
|
|
||||||
'verb' => 'GET',
|
|
||||||
'requirements' => [],
|
|
||||||
],
|
|
||||||
// Admin routes
|
|
||||||
[
|
[
|
||||||
'name' => 'admin#index',
|
'name' => 'admin#index',
|
||||||
'url' => '/admin',
|
'url' => '/admin',
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\AnalyticsHub\Controller;
|
namespace OCA\AnalyticsHub\Controller;
|
||||||
|
|
||||||
use OCP\AppFramework\Controller;
|
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
|
||||||
use OCP\AppFramework\Http\JSONResponse;
|
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,40 +12,33 @@ use OCP\IRequest;
|
|||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
class AdminController extends Controller {
|
class AdminController {
|
||||||
|
|
||||||
private $appName;
|
private $appName;
|
||||||
|
|
||||||
public function __construct($appName, IRequest $request) {
|
public function __construct(string $appName, IRequest $request) {
|
||||||
parent::__construct($appName, $request);
|
|
||||||
$this->appName = $appName;
|
$this->appName = $appName;
|
||||||
|
$this->request = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index page - render admin UI
|
* Index page - simple render without TemplateResponse
|
||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
public function index(): TemplateResponse {
|
public function index(): void {
|
||||||
return new TemplateResponse($this->appName, 'admin', [
|
echo '<!DOCTYPE html>';
|
||||||
'app_name' => $this->appName,
|
echo '<html>';
|
||||||
'version' => '1.0.0',
|
echo '<head><title>Mini-CMO Analytics Hub</title></head>';
|
||||||
'status' => 'testing - admin accessible',
|
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>';
|
||||||
* Test route - simple JSON response
|
echo '<p>Test successful - routing is working.</p>';
|
||||||
*
|
echo '</body>';
|
||||||
* @NoAdminRequired
|
echo '</html>';
|
||||||
* @NoCSRFRequired
|
exit;
|
||||||
*/
|
|
||||||
public function test(): JSONResponse {
|
|
||||||
return new JSONResponse([
|
|
||||||
'success' => true,
|
|
||||||
'message' => 'Analytics Hub controller is working!',
|
|
||||||
'app_name' => $this->appName,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user