Skip to content

Commit

Permalink
[BUG]: dashboard problems when saving and displaying in the sidebar f…
Browse files Browse the repository at this point in the history
…orbidden portlets not stored (#77)

* Fix: Added the name and fixed rename functionality for dashboards
Selection forbiddenPortlets is working now

* Apply php-cs-fixer changes

* Fix: Removed initial text for new item

Co-authored-by: mcop1 <[email protected]>
  • Loading branch information
mcop1 and mcop1 authored Jul 6, 2022
1 parent 13cb1a8 commit 2188644
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/Controller/PerspectiveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,21 @@ protected function buildDashboardTree(TreeHelper $treeHelper, $config)
$disabledClass = $config['writeable'] ? '' : $this->disabledCssClass;

$tree = [];
foreach ($config['dashboards']['predefined'] as $dashboardName => $dashboardConfig) {
$tree[] = [
'id' => $treeHelper->createUuid(),
'text' => $dashboardName,
'type' => 'dashboardDefinition',
'leaf' => true,
'allowDrag' => false,
'allowDrop' => false,
'iconCls' => 'pimcore_icon_welcome',
'cls' => $disabledClass,
'writeable' => $config['writeable'],
'config' => array_merge($dashboardConfig, ['name' => $dashboardName])
];
if (isset($config['dashboards']['predefined'])) {
foreach ($config['dashboards']['predefined'] as $dashboardName => $dashboardConfig) {
$tree[] = [
'id' => $treeHelper->createUuid(),
'text' => $dashboardName,
'type' => 'dashboardDefinition',
'leaf' => true,
'allowDrag' => false,
'allowDrop' => false,
'iconCls' => 'pimcore_icon_welcome',
'cls' => $disabledClass,
'writeable' => $config['writeable'],
'config' => array_merge($dashboardConfig, ['name' => $dashboardName])
];
}
}

return $tree;
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/public/js/pimcore/perspective/perspective.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ pimcore.bundle.perspectiveeditor.PerspectiveEditor = class {

record.data.text = value;
record.data.name = value;

if(record.data.type === 'dashboardDefinition') {
let config = record.data.config;
config['name'] = value;
}

pimcore.bundle.perspectiveeditor.PerspectiveViewHelper.reloadTreeNode(record);
this.setDirty(true);
}
Expand Down Expand Up @@ -611,6 +617,7 @@ pimcore.bundle.perspectiveeditor.PerspectiveEditor = class {
}

createDashboardFormPanel (record){
record.data.config = Object.assign({}, record.data.config);
var config = record.data.config;
var data = this.availablePortlets;
var items = [];
Expand Down

0 comments on commit 2188644

Please sign in to comment.