N°3685 - Front-end performances: Include graph libs. (Raphael, simple_graph, ...) only when necessary

This commit is contained in:
Molkobain
2021-09-10 17:11:52 +02:00
parent e4d7bf7dbb
commit bac584a6b4
4 changed files with 14 additions and 8 deletions

View File

@@ -1499,10 +1499,12 @@ EOF
$sDirection = utils::ReadParam('d', 'horizontal');
$iGroupingThreshold = utils::ReadParam('g', 5);
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/raphael-min.js');
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/fraphael.js');
$oP->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/jquery.contextMenu.css');
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.contextMenu.js');
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.mousewheel.js');
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/simple_graph.js');
try
{

View File

@@ -281,14 +281,9 @@ class _Ticket extends cmdbAbstractObject
// Display the impact analysis for tickets not in 'closed' or 'resolved' status... and not in edition
if ((!$bEditMode) && (!in_array($this->Get('status'), array('resolved', 'closed'))))
{
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/fraphael.js');
$oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/jquery.contextMenu.css');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.contextMenu.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/simple_graph.js');
$oPage->AddAjaxTab('Ticket:ImpactAnalysis',
utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=ticket_impact&class='.get_class($this).'&id='.$this->GetKey(),
true, null, AjaxTab::ENUM_TAB_PLACEHOLDER_MISC);
}
}
}
?>

View File

@@ -2207,6 +2207,7 @@ EOF
require_once(APPROOT.'core/simplegraph.class.inc.php');
require_once(APPROOT.'core/relationgraph.class.inc.php');
require_once(APPROOT.'core/displayablegraph.class.inc.php');
$sRelation = utils::ReadParam('relation', 'impacts');
$sDirection = utils::ReadParam('direction', 'down');
$iGroupingThreshold = utils::ReadParam('g', 5);
@@ -2216,6 +2217,13 @@ EOF
$sImpactAttCodeValue = utils::ReadParam('impact_attcode_value', 'manual');
$iId = (int)utils::ReadParam('id', 0, false, 'integer');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/raphael-min.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/fraphael.js');
$oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/jquery.contextMenu.css');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.contextMenu.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.mousewheel.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/simple_graph.js');
// Get the list of source objects
$oTicket = MetaModel::GetObject($sClass, $iId);
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);

View File

@@ -43,6 +43,9 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
// - DashletGroupBy & other specific places
'js/d3.js',
'js/c3.js',
// - DisplayableGraph, impact analysis
'js/raphael-min.js',
'js/jquery.mousewheel.js',
// Deprecated files
'js/date.js',
@@ -189,8 +192,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/property_field.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/icon_select.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/ajaxfileupload.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/raphael-min.js');
}
/**