Browse Source

Customer portal : Added highlight classes to items in the manage brick

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4158 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 9 năm trước cách đây
mục cha
commit
5a75f501fd

+ 3 - 2
datamodels/2.x/itop-portal-base/portal/src/controllers/managebrickcontroller.class.inc.php

@@ -375,12 +375,13 @@ class ManageBrickController extends BrickController
 						'actions' => $aActions
 					);
 				}
-
+				
 				// ... And item's properties
 				$aItems[] = array(
 					'id' => $oCurrentRow->GetKey(),
 					'class' => $sCurrentClass,
-					'attributes' => $aItemAttrs
+					'attributes' => $aItemAttrs,
+					'highlight_class' => $oCurrentRow->GetHilightClass()
 				);
 			}
 

+ 24 - 0
datamodels/2.x/itop-portal-base/portal/src/views/bricks/manage/layout.html.twig

@@ -165,6 +165,30 @@
 					"dom": '<"row"<"col-sm-6"l><"col-sm-6"<f><"visible-xs"p>>>t<"row"<"col-sm-6"ri><"col-sm-6"p>>',
 					"columns": getColumnsDefinition('{{ sAreaId }}'),
 					"order": [[0, "desc"]],
+					"rowCallback": function(oRow, oData){
+						if(oData.highlight_class !== undefined)
+						{
+							var sHighlightClass = oData.highlight_class;
+							var sBSHiglightClass = '';
+							
+							// Adding classic iTop class
+							$(oRow).addClass(sHighlightClass);
+							// Adding mapped BS class
+							if(sHighlightClass === '{{ constant('HILIGHT_CLASS_CRITICAL') }}')
+							{
+								sBSHiglightClass = 'danger';
+							}
+							else if(sHighlightClass === '{{ constant('HILIGHT_CLASS_WARNING') }}')
+							{
+								sBSHiglightClass = 'warning';
+							}
+							else if(sHighlightClass === '{{ constant('HILIGHT_CLASS_OK') }}')
+							{
+								sBSHiglightClass = 'success';
+							}
+							$(oRow).addClass(sBSHiglightClass);
+						}
+					},
 					"drawCallback": function(settings){
 						// Hiding pagination if only one page
 						if($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2)

+ 0 - 1
sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php

@@ -209,7 +209,6 @@ EOF
 						"columns": getColumnsDefinition_{$this->oField->GetGlobalId()}(),
 						"select": {$sSelectionOptionHtml},
 						"rowId": "id",
-						"rowTest": "id",
 						"data": oRawDatas_{$this->oField->GetGlobalId()},
 					});