Upgrade Notes
From 3.5 to 4.x #
Overall, there will be seamless upgrading experience from 3.5 to 4.x. We have made all changes in 4.x be backward compatible with 3.5 version. However, there are some changes that may need you to touch your code:
Language #
In previous 3.5 version, if you want to use a language, you will add the trait to Application like this:
class App extends Application
{
use koolreport\dashboard\languages\ES;
}
In new version 4.x, language is made dynamic and be set via language()
method of application:
use koolreport\dashboard\languages\ES;
class App extends Application
{
protected function onCreated()
{
$this->language(ES::create());
}
}
Also, you can add extra translation text to your application, not only stick with our own translation text:
ES::create()
->extra([
"Anything"=>"Cualquier cosa",
...
])
Lastly, we understand your dashboard may be used by multinational users and they may wish to select their preferred language. So we have kick off the multi-language capability. You just need to provide into Application list of selectable languages, Dashboard Framework will show language selector to let your user choose language.
use koolreport\dashboard\languages\EN;
use koolreport\dashboard\languages\ES;
use koolreport\dashboard\languages\FR;
use koolreport\dashboard\languages\DE;
class App extends Application
{
protected function languages()
{
return [
EN::create(),
ES::create(),
FR::create(),
DE::create(),
];
}
}
Learn more about dynamic language in Dashboard
Theme #
Previously in order to set theme in Dashboard, you add the theme trait like this
class App extends Application
{
use \koolreport\dashboard\amazing\Theme;
}
Now we have made theme be set dynamically via theme()
method of Application. The theme is also a dynamic object that you are able to set property:
use koolreport\appstack\dashboard\AppStack;
class App extends Application
{
protected function onCreated()
{
$this->theme(
AppStack::create()
->dark(true)
->colorScheme("dark")
->sidebarPosition("right")
->sidebarBahavior("fixed")
->layout("boxed")
);
}
}
By the way, AppStack is our new theme added to Dashboard Framework so now we have 2 options: Amazing Theme and AppStack Theme. We promise to add more theme for you in the future.
Learn more about theme in Dashboard
Multiple pages #
Prior to Dashboard Framework 4.x, there is only one main page called Main
containing list of dashboards. Now you can create as many pages as you want. You can create a public page for public access and member page for login users only. In each page, you can customize list of dashboards on sidebar, menuitems on top menu and account menu.
class App extends Application
{
protected function pages()
{
return [
PublicPage::create()->loginRequired(false)->default(true),
MemberPage::create()->loginRequired(true)
];
}
}
RawSQL parameters #
One of our complaints we received in version 3.5 is the inability to set parameters for rawSQL()
, we have to fill parameter by ourselves:
protected function dataSource()
{
return AutoMaker::rawSQL("
SELECT * from customers
WHERE
customerNumber = ".$this->params("customerNumber")."
");
}
Now in version 4.x, we can do this
protected function dataSource()
{
return AutoMaker::rawSQL("
SELECT * from customers
WHERE
customerNumber = :customerNumber
")->params([
":customerNumber"=>$this->params("customerNumber")
]);
}
Rename dashboards() method to sidebar() #
Previous 3.5 version, we provide list of dashboards and their structure to Application in dashboards()
method like this:
class App extends Application
{
protected function dashboards()
{
return[
"SaleBoard"=>SaleBoard::create(),
"MarketingBoard"=>MarketingBoard::create(),
];
}
}
Now we do:
class App extends Application
{
protected function sidebar()
{
return[
"SaleBoard"=>SaleBoard::create(),
"MarketingBoard"=>MarketingBoard::create(),
];
}
}
Although your old applications are still working with dashboards()
methods but it is deprecated and you should use sidebar()
for your new application. The reason of this change is to make the name of method reflects the real functionality (to make the sidebar).
Rename widgets() method to content() #
You may have been familiar with widgets()
methods of Dashboard in which we provide list of widgets. However, in real case usage, the widgets()
does not only contain list of widgets but also containers and structure of dashboard's content. That is the reason we changed the name of methods from widgets()
to content()
to reflect the its real functionality.
Previous 3.5 code:
class MyDashboard extends Dashboard
{
protected function widgets()
{
return[
Html::h1("My Table"),
MyTable::create(),
];
}
}
Now we do:
class MyDashboard extends Dashboard
{
protected function content()
{
return[
Html::h1("My Table"),
MyTable::create(),
];
}
}
For yours old applications that use widgets()
, they still work however the widgets()
method will be deprecated and you should use content()
in your new application.
New FlexView widget #
In version 4.x, we have provided a new widget called FlexView
. As the name suggested, FlexView is able to hold multiple views within it and be able to switch between those views. It is equipped with state persistence and abitilty to go back in history.
onClientLoading and onClientLoaded #
Now Dashboard and all widgets have the client-event called onClientLoading
and onClientLoaded
. We can run any specific javascript code when this event happens with the purpose of customizing those widgets display or behaviors.
Inline Editing #
In version 4.x, we have added InlineEditAction
that let a resource in Admin Panel be able to do inline editing.
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.