Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track changes made in dashlet views #4755

Draft
wants to merge 106 commits into
base: enhanced-dashboards-development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
b8d0f1c
JS: Introduce dashboards behavior
yhabteab Mar 11, 2022
f21a7d2
CSS: Introduce some styling for the enhanced dashboards
yhabteab Mar 11, 2022
937f063
MYSQL: Introduce mysql schema for the enhanced dashboards
yhabteab Mar 11, 2022
f19369e
Introduce some database model for the new dashboards
yhabteab Mar 11, 2022
3c55422
`loader.js`: Allow to override the actual form action using `formacti…
yhabteab Mar 11, 2022
26f2f73
Introduce common `DataExtractor` trait
yhabteab Mar 11, 2022
cd54881
ViewScript: Remove index.phtml of the search dashboard controller
yhabteab Mar 11, 2022
335a077
Dashbaord: Introduce some common traits used to manage the new dashbo…
yhabteab Mar 11, 2022
644a75d
Introduce a new `Dashlet` widget
yhabteab Mar 11, 2022
f9da975
Introduce new `Pane` widget
yhabteab Mar 11, 2022
8a225f6
Navigation: Introduce `DashboardHome` navigation item class
yhabteab Mar 11, 2022
dab899e
Introduce a new dashboard manager
yhabteab Mar 11, 2022
b42fcd9
Module: Use the new dashbaord widget for providing dashbaords and das…
yhabteab Mar 11, 2022
42581e8
Dashboard: Introduce `OverridingWidget` interface
yhabteab Mar 11, 2022
4548122
Introduce `DashletListItem` class
yhabteab Mar 11, 2022
c01d44d
Introduce `DashletlistMultiSelect` class
yhabteab Mar 11, 2022
1120bc0
SearchDashboard: Provide support for the enhanced dashboards
yhabteab Mar 11, 2022
4addf52
Menu: Provide own class for dashboard homes navigation items
yhabteab Mar 11, 2022
06d9e9a
Controllers: Introduce own dashboards controller
yhabteab Mar 11, 2022
ef528a0
Make use of the new controller by default
yhabteab Mar 11, 2022
faebd29
LayoutController: Use dashboard home menu class to loadd the navigati…
yhabteab Mar 11, 2022
ff90450
DashboardSettings: Don't add `Add Dashlet` as a dropdown menu anymore
yhabteab Mar 11, 2022
22450ab
DashletForm: Add support for the new dashboards and make use of ipl form
yhabteab Mar 11, 2022
dcaf625
Forms: Introduce `RemoveDashletForm` class
yhabteab Mar 11, 2022
f55f496
Forms: Introduce `HomePaneForm` class
yhabteab Mar 11, 2022
c47a847
Forms: Introduce `RemoveHomePaneForm` class
yhabteab Mar 11, 2022
b28cc41
Forms: Introduce `WelcomeForm` class
yhabteab Mar 11, 2022
a121c95
Dashboard: Introduce `DashbaordList` widget
yhabteab Mar 11, 2022
3dcf9fa
Dashboard: Introduce `DashboardHomeList` widget
yhabteab Mar 11, 2022
9e4d09f
Dashboard: Introduce `Settings` class to manage to the new dashbaords
yhabteab Mar 11, 2022
731cd2a
Dashboard: Provide mini welcome wizard for new users
yhabteab Mar 11, 2022
a2623ef
Forms: Introduce NewHomePaneForm class
yhabteab Mar 28, 2022
532ed02
modal.js: Register onModalClose event also on `.modal-cancel` selector
yhabteab Mar 28, 2022
d6a2f1e
Do some code refactoring
yhabteab Mar 28, 2022
96c3b31
Delay sorting events for 100ms
yhabteab Apr 1, 2022
d903b90
JS: Replace jquery.find() with pure js
yhabteab Apr 1, 2022
ac3f3a6
Module: Restore removed imports
yhabteab Apr 4, 2022
654d925
Pane: Utilize query with dashboard when selecting dashlets
yhabteab Apr 4, 2022
2913a4f
Fix some logical inconsistencies
yhabteab Apr 4, 2022
0a94adc
Adjust param description & extract home properties from a homeitem pr…
yhabteab Apr 4, 2022
85a5376
Remove some unused interfaces/attrs
yhabteab Apr 6, 2022
e5f501d
Remove some unnecessary classes
yhabteab Apr 6, 2022
5280931
dashboard.js: Use js class syntax
yhabteab Apr 6, 2022
100e852
modal.js: Change modal cancel selector
yhabteab Apr 6, 2022
41f1ac4
Use Menu class instead of HomeMenu
yhabteab Apr 6, 2022
876c109
Module: Revert changed and removed legacy codes
yhabteab Apr 6, 2022
adf2013
Fix some code styles and comments
yhabteab Apr 6, 2022
b1c07d8
Remove empty line
yhabteab Apr 6, 2022
023ea09
dashboard.js: Fix drag&drop doesn't work for dashboards if there is n…
yhabteab Apr 7, 2022
231b4ce
Schema: Merge dashboards.sql to the icingaweb2 schema
yhabteab Apr 7, 2022
652d432
Schema: Introduce 2.11.sql upgrade schema
yhabteab Apr 7, 2022
629636a
events.js: Adjust dashlets loading to the new dashlet layout
yhabteab Apr 7, 2022
f6d2664
DeshletForm: Don't re-populate dashboard pane element
yhabteab Apr 7, 2022
96fbd28
DashletForm: Ensure to pre-select a dashboard when clicking add-dashlet
yhabteab Apr 7, 2022
1f9d054
Adjust dashbaord conent layouts & don't redirect when sorting only da…
yhabteab Apr 7, 2022
2162392
BaseDashboardForm: Make cancel-button of type button
yhabteab Apr 7, 2022
595b4be
Introduce new-home action
yhabteab Apr 7, 2022
01280e6
Fix typo
yhabteab Apr 7, 2022
69fe8f7
Menu: Swallow silently any DB issue in the main menu
yhabteab Apr 8, 2022
4fb6002
dashboard.js: Fix moving a dashlet to another home/pane throws an error
yhabteab Apr 8, 2022
d979d41
Use sendMultipartUpdate() for drag&drop actions & adjust some css styles
yhabteab Apr 8, 2022
da4edb2
Module: undo removed import
yhabteab Apr 8, 2022
a1ed493
Clean up codes
yhabteab Apr 8, 2022
217faab
Wrap getConn() into a try catch to prevent the menu from being broken
yhabteab Apr 8, 2022
a34dc9a
Adjust how module dashlets are handled
yhabteab Apr 11, 2022
fb54ed9
form.less: Adjust remove & cancel button style sheets
yhabteab Apr 12, 2022
a79e83c
Remove obsolete button styles & add a proper button class names
yhabteab Apr 12, 2022
f3dc630
Use setTitle() instead of setting resp headrs directly
yhabteab Apr 12, 2022
9d2e90f
Use own activate() method to activate dashboards
yhabteab Apr 12, 2022
a9b59d4
Simulate removal of dashboard home `Default Home`
yhabteab Apr 13, 2022
167d6c7
forms.less: Undo changed button styles
yhabteab Apr 13, 2022
89b0b4d
Fix accessing method on null
yhabteab Apr 13, 2022
09b87ea
Update mysql upgrade script
yhabteab Apr 13, 2022
037adcb
Regroup dashboard input elements
yhabteab Apr 13, 2022
40092ef
Fix return type mismatch
yhabteab Apr 13, 2022
372ffa1
Allow browsing predefined dashlets when creating a new dashlet
yhabteab Apr 13, 2022
1429d4a
Fix code styling issue
yhabteab Apr 13, 2022
49b37ea
Merge some related classes
yhabteab Apr 14, 2022
737f1d4
DashletForm: Ensure to dump unselected dashlets before updating the DB
yhabteab Apr 14, 2022
b39f6ad
Don't render the initial modal view over again when autosubmitting th…
yhabteab Apr 14, 2022
d95c754
DashboardsController: Perform a full reload when the drop action coul…
yhabteab Apr 14, 2022
7b22be2
Use handle icon to initiate the drag&drop events
yhabteab Apr 14, 2022
c71f738
Use spaceship operator for sorting assoc arrays
yhabteab Apr 14, 2022
d8de5d7
Make the bars icon a bit bigger
yhabteab Apr 14, 2022
61213b2
dashboards.js: Don't delay drag&drop events anymore
yhabteab Apr 14, 2022
8ed9af5
dashboards.js: Don't use a variable for handle
yhabteab Apr 14, 2022
757a28b
dashboard.js: Only handle `rendered` events we're interested in
nilmerg Apr 19, 2022
8df2c9e
layout.less: Fully remove letter-spacing from .dashboard
nilmerg Apr 19, 2022
63802df
Decouple menu and dashboard code
nilmerg Apr 20, 2022
7aa34bb
DashboardControls: Ensure to use sorted entries in rewindEntries()
nilmerg Apr 20, 2022
33eaccf
Menu: Don't translate home titles
nilmerg Apr 20, 2022
7b90d09
dashboards/settings: Don't change refresh url due to re-order
nilmerg Apr 20, 2022
e588596
DashboardsController: Use `$this->getServerRequest()` where applicable
nilmerg Apr 20, 2022
a3ee130
Change handling of the params `showCompact` and `limit`
nilmerg Apr 21, 2022
310335e
Rename DashboardControls -> DashboardEntries & add an internal flag f…
yhabteab Apr 22, 2022
9729b0e
Remove trait DataExtractor
yhabteab Apr 22, 2022
90c0633
Use some renamed tratis & move from/to array methods to BaseDashboard
yhabteab Apr 22, 2022
0f562ab
Remove ModuleDashlet trait
yhabteab Apr 22, 2022
b358e1b
Move module related methods from to trait to Dashlet class
yhabteab Apr 22, 2022
2732d7d
SetupNewDashboardForm: Ensure to rerender dashlet parts with custom_u…
yhabteab Apr 22, 2022
fdc9b36
Follow-up for 63802dfc4
nilmerg Apr 22, 2022
fae7531
DROP ME – I'm part of #4752
nilmerg Apr 21, 2022
efcd14c
[WIP] Allow modules to register *framework* params
nilmerg Apr 25, 2022
84373cd
Support `_dashlet` parameter
nilmerg Apr 25, 2022
6a593fa
[WIP] Track changes made by users in dashlet views
nilmerg Apr 25, 2022
c736c71
loader.js: Mark extra updates as scripted and refreshes
nilmerg Apr 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
520 changes: 520 additions & 0 deletions application/controllers/DashboardsController.php

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions application/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@

namespace Icinga\Controllers;

use Icinga\Web\Controller\ActionController;
use Icinga\Web\Widget;
use Icinga\Web\Widget\SearchDashboard;
use ipl\Web\Compat\CompatController;

/**
* Search controller
*/
class SearchController extends ActionController
class SearchController extends CompatController
{
public function indexAction()
{
$searchDashboard = new SearchDashboard();
$searchDashboard->setUser($this->Auth()->getUser());
$this->view->dashboard = $searchDashboard->search($this->params->get('q'));

// NOTE: This renders the dashboard twice. Remove this once we can catch exceptions thrown in view scripts.
$this->view->dashboard->render();
$this->controls->setTabs($searchDashboard->getTabs());
$this->addContent($searchDashboard->search($this->getParam('q')));
}

public function hintAction()
Expand Down
3 changes: 2 additions & 1 deletion application/forms/Authentication/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Icinga\Authentication\User\ExternalBackend;
use Icinga\Common\Database;
use Icinga\User;
use Icinga\Web\Dashboard\Dashboard;
use Icinga\Web\Form;
use Icinga\Web\RememberMe;
use Icinga\Web\Url;
Expand All @@ -27,7 +28,7 @@ class LoginForm extends Form
/**
* Redirect URL
*/
const REDIRECT_URL = 'dashboard';
const REDIRECT_URL = Dashboard::BASE_ROUTE;

public static $defaultElementDecorators = [
['ViewHelper', ['separator' => '']],
Expand Down
128 changes: 128 additions & 0 deletions application/forms/Dashboard/BaseDashboardForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?php

/* Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */

namespace Icinga\Forms\Dashboard;

use Icinga\Web\Dashboard\Common\BaseDashboard;
use Icinga\Web\Dashboard\Dashboard;
use ipl\Html\Contract\FormElement;
use ipl\Html\HtmlElement;
use ipl\Html\ValidHtml;
use ipl\Web\Compat\CompatForm;
use ipl\Web\Url;
use ipl\Web\Widget\Icon;

/**
* Base Form for all kinds of dashboard types
*/
abstract class BaseDashboardForm extends CompatForm
{
const CREATE_NEW_HOME = 'Create new Home';

const CREATE_NEW_PANE = 'Create new Dashboard';

/**
* Dashboard instance for which this form is being rendered
*
* @var Dashboard
*/
protected $dashboard;

/**
* Create a new Dashboard Form
*
* @param Dashboard $dashboard
*/
public function __construct(Dashboard $dashboard)
{
$this->dashboard = $dashboard;

$this->init();
}

/**
* Initialize this form
*
* @return void
*/
protected function init()
{
// This is needed for the modal views
$this->setAction((string) Url::fromRequest());
}

public function hasBeenSubmitted()
{
// We don't use addElement() for the form controls, so the form has no way of knowing
// that we do have a submit button and will always be submitted with autosubmit elements
return $this->hasBeenSent() && $this->getPopulatedValue('submit');
}

/**
* Populate form data from config
*
* @param BaseDashboard $dashboard
*
* @return void
*/
public function load(BaseDashboard $dashboard)
{
}

/**
* Create custom form controls
*
* @return HtmlElement
*/
protected function createFormControls(): ValidHtml
{
return HtmlElement::create('div', ['class' => ['control-group', 'form-controls']]);
}

/**
* Create a cancel button
*
* @return HtmlElement
*/
protected function createCancelButton(): ValidHtml
{
return HtmlElement::create('button', [
'type' => 'button',
'class' => 'btn-cancel',
'data-icinga-modal-cancel' => true
])->setContent(t('Cancel'));
}

/**
* Create a remove button
*
* @param Url $action
* @param string $label
*
* @return FormElement
*/
protected function createRemoveButton(Url $action, string $label): ValidHtml
{
return $this->createElement('submitButton', 'btn_remove', [
'class' => 'btn-remove',
'label' => [new Icon('trash'), $label],
'formaction' => (string) $action
]);
}

/**
* Create and register a submit button
*
* @param string $label
*
* @return FormElement
*/
protected function registerSubmitButton(string $label): ValidHtml
{
$submitElement = $this->createElement('submit', 'submit', ['class' => 'btn-primary', 'label' => $label]);
$this->registerElement($submitElement);

return $submitElement;
}
}
Loading