KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Dashboard application actions do not update current window #3280

Closed Igor Matjasic opened this topic on on Apr 11, 2024 - 3 comments

I
Igor Matjasic commented on Apr 11, 2024

Hi, I'm running Koolreport Dashboard on my Yii 1.1 PHP application. I have managed to set up everything correctly, I basically set up the same dashboard as on the dashobard demo Product page.

The problum is whenever I clcik on anything on the dasboard that shoudl navigate or perform an action, a new window appears with the response html instead of the resposne being loaded in the current window(as pictured below).

Even when I have an empty dashboard, this problem still persists, when I click on the "Dashboard" icon in the top left corner. Below is my code for the application(CoriApp.php).

<?php

use \koolreport\dashboard\Application;
use koolreport\amazing\dashboard\Amazing;
use \koolreport\dashboard\security\CSRF;
use koolreport\appstack\dashboard\AppStack;

class App extends Application
{
    use \koolreport\dashboard\inside\Yii1;
    /*protected function assets()
    {
        return [
            "url"=> Yii::app()->getUrlManager()->getBaseUrl() . "/assets/koolreport_dashboard_assets",
            "path"=> Yii::getPathOfAlias("webroot") . "/assets/koolreport_dashboard_assets"
        ];
    }*/

    protected function onCreated()
    {
        $this->theme(Amazing::create());
        /*$this->theme(
            AppStack::create()
                ->colorScheme("dark")
        );*/
        //uncomment this below for debugging koolreport errors 
        $this->debugMode(true);
    }

    protected function csrf()
    {
        return CSRF::create()
                ->name(Yii::app()->request->csrfTokenName)
                ->token(Yii::app()->request->csrfToken);
    }

    protected function sidebar()
    {
        return [
            "Nonconformity Board"=>CoriBoard::create(),
        ];
    }
}

Yii1 is an edited version of the Yii2 trait file that I changed myself to be compatible with Yii 1.1

namespace koolreport\dashboard\inside;
use Yii;

trait Yii1 //#tomasChange a lot of this file has been changed to be compatible with Yii 1.1
{
    protected function assets()
    {
        $webUrl = Yii::app()->getUrlManager()->getBaseUrl();//pointing to web
        $webPath = Yii::getPathOfAlias("webroot");//path to webroot

        //assets folder
        $webPath = str_replace("\\", "/", $webPath);
        if (!is_dir($webPath . "/assets/koolreport_dashboard_assets")) {
            mkdir($webPath . "/assets/koolreport_dashboard_assets", 0755);
        }
        return array(
            "url" => $webUrl . "/assets/koolreport_dashboard_assets",
            "path" => $webPath . "/assets/koolreport_dashboard_assets",
        );
    }
}

Below is my dashbaord code, I have omited some of the other code since the problem is there ven without it

<?php

use \koolreport\dashboard\Dashboard;

use \koolreport\dashboard\containers\Row;
use \koolreport\dashboard\containers\Panel;
use \koolreport\dashboard\widgets\Text;
use \koolreport\dashboard\widgets\StateHolder;

use \koolreport\dashboard\menu\MenuItem;
use \koolreport\dashboard\Client;
use \koolreport\dashboard\containers\Html;

class CoriBoard extends Dashboard
{
    protected function content()
    {
        return [

        ];
    }
}

Below is my code for the view file.

<?php
//require_once  "vendor/autoload.php"; //Load library
require_once __DIR__ . "/../../models/dashboards/CoriApp.php";

App::create()->run();
?>

The library is loaded in my module file of my MVC structure The view file above is loaded through my controller in the code below( I have tried adding the require_once in m controller file but it doesn't help), I also disabled my standard layout in case that was making any problems but it makes no difference

    public function actionCoriDashboard(){
        $this->layout = false;//"//layouts/koolreportDashBoard";
        $this->render('coriDashboard', array());
    }

Any help would be appreciated, I can't find anything wrong with my code or setup. Again I will specify the responses I receive are correct, checking with developer tools, but they appear in that strange window istead of updating the current one. My php version is 7.2 if that helps.

K
KoolReport commented on Apr 12, 2024

Let not initiate the dashboard app inside Yii view but inside the action like below.

    public function actionCoriDashboard(){
        App::create()->run();
        exit;
    }

Let me know if the issue is resolved.

I
Igor Matjasic commented on Apr 15, 2024

Yes, this works, thank you.

K
KoolReport commented on Apr 15, 2024

Awesome :D

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Dashboard