Merge remote-tracking branch 'origin/support/3.0' into develop

# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/templates/bricks/browse/mode_mosaic.html.twig
#	datamodels/2.x/itop-portal-base/portal/templates/bricks/browse/mode_tree.html.twig
This commit is contained in:
Pierre Goiffon
2022-02-22 09:40:37 +01:00
51 changed files with 768 additions and 999 deletions

View File

@@ -899,6 +899,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
$('#label_'+me.id).val(txt);
$('#label_'+me.id).removeClass('ac_dlg_loading');
$('#label_'+me.id).data('selected_value',txt);
var prevValue = $('#'+me.id).val();
$('#'+me.id).val(iObjectId);

View File

@@ -132,6 +132,7 @@ $(function()
this._InitializeLockWatcher();
}
this._InitializeCurrentTab();
this._ApplyEntriesFilters();
this._UpdateMessagesCounters();
this._UpdateFiltersCheckboxesFromOptions();
@@ -279,6 +280,8 @@ $(function()
_onTabTitleClick: function (oEvent, oTabTitleElem) {
// Avoid anchor glitch
oEvent.preventDefault();
let oState = {};
const sId = this.element.attr('id');
const oTabTogglerElem = oTabTitleElem.closest(this.js_selectors.tab_toggler);
const sTabType = oTabTogglerElem.attr('data-tab-type');
@@ -293,12 +296,17 @@ $(function()
{
const sCaselogAttCode = oTabTogglerElem.attr('data-caselog-attribute-code');
this._ShowCaseLogTab(sCaselogAttCode);
oState[sId] = "caselog-"+sCaselogAttCode;
}
else
{
this.element.find(this.js_selectors.tab_toolbar + '[data-tab-type="activity"]').addClass(this.css_classes.is_active);
this._ShowActivityTab();
oState[sId] = "activity";
}
// Add current activity tab to url hash
$.bbq.pushState(oState);
},
/**
* @param oInputElem {Object} jQuery object representing the filter's input
@@ -590,6 +598,22 @@ $(function()
return oTabData;
},
/**
* Set a tab active if it's specified in the url
* @returns {void}
* @private
*/
_InitializeCurrentTab : function(){
const sTabId = $.bbq.getState(this.element.attr('id'), true);
if(sTabId !== undefined){
if(sTabId.startsWith("caselog-")){
this._GetTabTogglerFromCaseLogAttCode(sTabId.replace("caselog-", "")).find(this.js_selectors.tab_title).trigger('click')
}
else if(sTabId === "activity"){
this.element.find(this.js_selectors.tab_toggler + '[data-tab-type="activity"]').find(this.js_selectors.tab_title).trigger('click')
}
}
},
/**
* @returns {Object} Active tab toolbar jQuery element
* @private
@@ -922,9 +946,10 @@ $(function()
return false;
}
// Update the feed
// Update the feed and tab toggler message counter
for (let sCaseLogAttCode in oData.data.entries) {
me._AddEntry(oData.data.entries[sCaseLogAttCode], 'start');
me._IncreaseTabTogglerMessagesCounter(sCaseLogAttCode);
}
me._ApplyEntriesFilters();
@@ -946,7 +971,30 @@ $(function()
me._UnfreezeCaseLogsEntryForms();
});
},
/**
* Increase a tab toggler number of messages indicator given a caselog attribute code
*
* @param sCaseLogAttCode {string} A caselog attribute code
* @return {void}
* @private
*/
_IncreaseTabTogglerMessagesCounter: function(sCaseLogAttCode){
let oTabTogglerCounter = this._GetTabTogglerFromCaseLogAttCode(sCaseLogAttCode).find('[data-role="ibo-activity-panel--tab-title-messages-count"]');
let iNewCounterValue = parseInt(oTabTogglerCounter.attr('data-messages-count')) + 1;
oTabTogglerCounter.attr('data-messages-count', iNewCounterValue).text(iNewCounterValue);
},
/**
* Return tab toggler given a caselog attribute code
*
* @param sCaseLogAttCode {string} A caselog attribute code
* @return {Object}
* @private
*/
_GetTabTogglerFromCaseLogAttCode: function(sCaseLogAttCode)
{
return this.element.find(this.js_selectors.tab_toggler+'[data-tab-type="caselog"][data-caselog-attribute-code="'+sCaseLogAttCode+'"]')
},
// - Helpers on object lock
/**
* Initialize the lock watcher on a regular basis

View File

@@ -157,7 +157,7 @@ $(function()
me._updateExtraTabsList();
}, {
root: $('.ibo-tab-container--tabs-list')[0],
threshold: [1] // Must be completely visible
threshold: [0.9] // N°4783 Should be completely visible, but lowering the threshold prevents a bug in the JS Observer API when the window is zoomed in/out, in which case all items respond as being hidden even when they are not.
});
this.element.find(this.js_selectors.tab_header).each(function(){
oTabsListIntersectObs.observe(this);