fix: [dashboard] grid scope fix

pull/5705/head
iglocska 2020-03-10 11:34:30 +01:00
parent e0ad3ec9a4
commit f1faa7845f
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 26 additions and 25 deletions

View File

@ -46,7 +46,7 @@ class AppController extends Controller
public $helpers = array('Utility', 'OrgImg', 'FontAwesome', 'UserName'); public $helpers = array('Utility', 'OrgImg', 'FontAwesome', 'UserName');
private $__queryVersion = '100'; private $__queryVersion = '101';
public $pyMispVersion = '2.4.122'; public $pyMispVersion = '2.4.122';
public $phpmin = '7.2'; public $phpmin = '7.2';
public $phprec = '7.4'; public $phprec = '7.4';

View File

@ -15,32 +15,12 @@
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function resetDashboardGrid(grid) { var grid = false;
$('.grid-stack-item').each(function() {
updateDashboardWidget(this);
});
saveDashboardState();
$('.edit-widget').click(function() {
el = $(this).closest('.grid-stack-item');
data = {
id: el.attr('id'),
config: JSON.parse(el.attr('config')),
widget: el.attr('widget'),
alias: el.attr('alias')
}
openGenericModalPost(baseurl + '/dashboards/getForm/edit', data);
});
$('.remove-widget').click(function() {
el = $(this).closest('.grid-stack-item');
grid.removeWidget(el);
saveDashboardState();
});
}
$(document).ready(function () { $(document).ready(function () {
var grid = GridStack.init({verticalMargin: 2}); grid = GridStack.init({verticalMargin: 2});
resetDashboardGrid(grid); resetDashboardGrid(grid);
grid.on('change', function(event, items) { grid.on('change', function(event, items) {
alert(1);
saveDashboardState(); saveDashboardState();
}); });
grid.on('added', function(event, items) { grid.on('added', function(event, items) {

View File

@ -4905,7 +4905,6 @@ function submitDashboardAddWidget() {
type: 'GET', type: 'GET',
success: function(data) { success: function(data) {
el = data; el = data;
var grid = GridStack.init();
grid.addWidget( grid.addWidget(
el, el,
{ {
@ -4989,6 +4988,28 @@ function updateDashboardWidget(element) {
} }
} }
function resetDashboardGrid(grid) {
$('.grid-stack-item').each(function() {
updateDashboardWidget(this);
});
saveDashboardState();
$('.edit-widget').click(function() {
el = $(this).closest('.grid-stack-item');
data = {
id: el.attr('id'),
config: JSON.parse(el.attr('config')),
widget: el.attr('widget'),
alias: el.attr('alias')
}
openGenericModalPost(baseurl + '/dashboards/getForm/edit', data);
});
$('.remove-widget').click(function() {
el = $(this).closest('.grid-stack-item');
grid.removeWidget(el);
saveDashboardState();
});
}
function setHomePage() { function setHomePage() {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',