From 4e95ca3c7bade2ab40f171cb40a2dc7cf1739f17 Mon Sep 17 00:00:00 2001 From: Anne-Catherine <57360138+accognet@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:23:20 +0200 Subject: [PATCH 1/4] =?UTF-8?q?N=C2=B0541=20-=20Dashlets:=20Improve=20read?= =?UTF-8?q?ability=20when=20to=20much=20labels=20(pie=20chart)=20or=20too?= =?UTF-8?q?=20long=20labels=20(bar=20chart)=20(#452)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * N°541 - Dashlets: Improve readability when to much labels (pie chart) or too long labels (bar chart) --- application/displayblock.class.inc.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index f89172feb..1fff40f1f 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -1009,6 +1009,8 @@ EOF $iTotalCount = 0; $aValues = array(); $aURLs = array(); + $iMaxNbCharsInLabel = 0; + foreach ($aRes as $iRow => $aRow) { $sValue = $aRow['grouped_by_1']; @@ -1016,7 +1018,11 @@ EOF $aGroupBy[(int)$iRow] = (int) $aRow[$sFctVar]; $iTotalCount += $aRow['_itop_count_']; $aValues[] = array('label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'), 'label_html' => $sHtmlValue, 'value' => (int) $aRow[$sFctVar]); - + + if ($iMaxNbCharsInLabel < mb_strlen($sValue)) { + $iMaxNbCharsInLabel = mb_strlen($sValue); + } + // Build the search for this subset $oSubsetSearch = $this->m_oFilter->DeepClone(); $oCondition = new BinaryExpression($oGroupByExp, '=', new ScalarExpression($sValue)); @@ -1039,7 +1045,10 @@ EOF $sJson = json_encode($aValues); $oPage->add_ready_script( << 50) { + // Calculation of the number of legends line add to the height of the graph to have a maximum of 5 legend columns + $iNbLinesIncludedInChartHeight = 10; + $iNbLinesToAddForName = ceil(count($aNames) / 5) - $iNbLinesIncludedInChartHeight; + } $oPage->add_ready_script( << Date: Thu, 20 Apr 2023 11:03:43 +0200 Subject: [PATCH 2/4] =?UTF-8?q?N=C2=B06217=20-=20Add=20accessiblity=20meta?= =?UTF-8?q?=20data=20for=20title=20on=20"Power=20menu"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/itopwebpage.class.inc.php | 2 +- dictionaries/en.dictionary.itop.ui.php | 1 + dictionaries/fr.dictionary.itop.ui.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 1fdd9e647..02024b345 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -1219,7 +1219,7 @@ EOF; { $sLogonMessage = Dict::Format('UI:LoggedAsMessage', $sUserName); } - $sLogOffMenu = "
    • "; + $sLogOffMenu = "
        • "; $sLogOffMenu .= "
        • $sLogonMessage
        • \n"; $aActions = array(); diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php index e870ca93c..4c4917b4f 100644 --- a/dictionaries/en.dictionary.itop.ui.php +++ b/dictionaries/en.dictionary.itop.ui.php @@ -560,6 +560,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Login:NewPasswordPrompt' => 'New password', 'UI:Login:RetypeNewPasswordPrompt' => 'Retype new password', 'UI:Login:IncorrectOldPassword' => 'Error: the old password is incorrect', + 'UI:PowerMenu' => 'Open user menu', 'UI:LogOffMenu' => 'Log off', 'UI:LogOff:ThankYou' => 'Thank you for using '.ITOP_APPLICATION, 'UI:LogOff:ClickHereToLoginAgain' => 'Click here to login again...', diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index 71d6e5939..f4e5abfcb 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -543,6 +543,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Login:NewPasswordPrompt' => 'Nouveau mot de passe', 'UI:Login:RetypeNewPasswordPrompt' => 'Resaisir le nouveau mot de passe', 'UI:Login:IncorrectOldPassword' => 'Erreur: l\'ancien mot de passe est incorrect', + 'UI:PowerMenu' => 'Ouvre le menu utilisateur', 'UI:LogOffMenu' => 'Déconnexion', 'UI:LogOff:ThankYou' => 'Merci d\'avoir utilisé iTop', 'UI:LogOff:ClickHereToLoginAgain' => 'Cliquez ici pour vous reconnecter...', From 46e869d1f4186ec9f5f5a5e6a7e2f72ecd70574c Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 20 Apr 2023 12:22:12 +0200 Subject: [PATCH 3/4] =?UTF-8?q?N=C2=B06124=20-=20Workaround=20performance?= =?UTF-8?q?=20problem=20on=20the=20modification=20of=20an=20object=20with?= =?UTF-8?q?=20an=20n:n=20relation=20having=20a=20large=20volume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/ui.linkswidget.class.inc.php | 71 +++++++++++++++++------- core/config.class.inc.php | 8 +++ 2 files changed, 59 insertions(+), 20 deletions(-) diff --git a/application/ui.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index 1f4e63da5..e2bf70609 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/application/ui.linkswidget.class.inc.php @@ -100,15 +100,18 @@ class UILinksWidget * @param array $aArgs Extra context arguments * @param DBObject $oCurrentObj The object to which all the elements of the linked set refer to * @param int $iUniqueId A unique identifier of new links - * @param boolean $bReadOnly Display link as editable or read-only. Default is false (editable) + * @param bool $bReadOnly Display link as editable or read-only. Default is false (editable) + * @param bool $bAllowRemoteExtKeyEdit If true, the ext. key to the remote object can be edited, otherwise it will be read-only * * @return array The HTML fragment of the one-row form * @throws \ArchivedObjectException * @throws \CoreException * @throws \CoreUnexpectedValue * @throws \Exception + * + * @since 3.1.0 3.0.4 3.0.3-1 N°6124 - Workaround performance problem on the modification of an object with an n:n relation having a large volume */ - protected function GetFormRow(WebPage $oP, DBObject $oLinkedObj, $linkObjOrId, $aArgs, $oCurrentObj, $iUniqueId, $bReadOnly = false) + protected function GetFormRow(WebPage $oP, DBObject $oLinkedObj, $linkObjOrId, $aArgs, $oCurrentObj, $iUniqueId, $bReadOnly = false, $bAllowRemoteExtKeyEdit = true) { $sPrefix = "$this->m_sAttCode{$this->m_sNameSuffix}"; $aRow = array(); @@ -139,8 +142,11 @@ class UILinksWidget $aRow['form::checkbox'] = "m_iInputId.".OnSelectChange();\" value=\"$iKey\">"; foreach ($this->m_aEditableFields as $sFieldCode) { + // N°6124 - Force remote ext. key as read-only if too many items in the linkset + $bReadOnlyField = ($sFieldCode === $this->m_sExtKeyToRemote) && (false === $bAllowRemoteExtKeyEdit); + $sSafeFieldId = $this->GetFieldId($linkObjOrId->GetKey(), $sFieldCode); - $this->AddRowForFieldCode($aRow, $sFieldCode, $aArgs, $linkObjOrId, $oP, $sNameSuffix, $sSafeFieldId); + $this->AddRowForFieldCode($aRow, $sFieldCode, $aArgs, $linkObjOrId, $oP, $sNameSuffix, $sSafeFieldId, $bReadOnlyField); $aFieldsMap[$sFieldCode] = $sSafeFieldId; } } @@ -255,11 +261,24 @@ JS return $aRow; } - private function AddRowForFieldCode(&$aRow, $sFieldCode, &$aArgs, $oLnk, $oP, $sNameSuffix, $sSafeFieldId): void + /** + * @param $aRow + * @param $sFieldCode + * @param $aArgs + * @param $oLnk + * @param $oP + * @param $sNameSuffix + * @param $sSafeFieldId + * @param bool $bReadOnlyField If true, the field will be read-only, otherwise it can be edited + * + * @return void + * @since 3.1.0 3.0.4 3.0.3-1 N°6124 - Workaround performance problem on the modification of an object with an n:n relation having a large volume + */ + private function AddRowForFieldCode(&$aRow, $sFieldCode, &$aArgs, $oLnk, $oP, $sNameSuffix, $sSafeFieldId, $bReadOnlyField = false): void { if (($sFieldCode === $this->m_sExtKeyToRemote)) { - // current field is the lnk extkey to the remote class + // Current field is the lnk extkey to the remote class $aArgs['replaceDependenciesByRemoteClassFields'] = true; $sRowFieldCode = 'static::key'; $aArgs['wizHelperRemote'] = $aArgs['wizHelper'].'_remote'; @@ -281,20 +300,31 @@ JS $sDisplayValue = $oLnk->GetEditValue($sFieldCode); $oAttDef = MetaModel::GetAttributeDef($this->m_sLinkedClass, $sFieldCode); - $aRow[$sRowFieldCode] = '
          ' - .cmdbAbstractObject::GetFormElementForField( - $oP, - $this->m_sLinkedClass, - $sFieldCode, - $oAttDef, - $sValue, - $sDisplayValue, - $sSafeFieldId, - $sNameSuffix, - 0, - $aArgs - ) - .'
          '; + if ($bReadOnlyField) { + $sFieldForHtml = $sDisplayValue; + } else { + $sFieldForHtml = cmdbAbstractObject::GetFormElementForField( + $oP, + $this->m_sLinkedClass, + $sFieldCode, + $oAttDef, + $sValue, + $sDisplayValue, + $sSafeFieldId, + $sNameSuffix, + 0, + $aArgs + ); + } + + $aRow[$sRowFieldCode] = << +
          +
          $sFieldForHtml
          +
          + +HTML + ; } private function GetFieldId($iLnkId, $sFieldCode, $bSafe = true) @@ -374,6 +404,7 @@ JS $oBlock->sRemoteClass = $this->m_sRemoteClass; $oValue->Rewind(); + $bAllowRemoteExtKeyEdit = $oValue->Count() <= utils::GetConfig()->Get('link_set_max_edit_ext_key'); $aForm = array(); $iMaxAddedId = 0; $iAddedId = -1; // Unique id for new links @@ -398,7 +429,7 @@ JS } $iMaxAddedId = max($iMaxAddedId, $key); - $aForm[$key] = $this->GetFormRow($oPage, $oLinkedObj, $oCurrentLink, $aArgs, $oCurrentObj, $key, $bReadOnly); + $aForm[$key] = $this->GetFormRow($oPage, $oLinkedObj, $oCurrentLink, $aArgs, $oCurrentObj, $key, $bReadOnly, $bAllowRemoteExtKeyEdit); } $oBlock->iMaxAddedId = (int) $iMaxAddedId; diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 2894cf4a6..13e1c33d8 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -480,6 +480,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ], + 'link_set_max_edit_ext_key' => [ + 'type' => 'integer', + 'description' => 'Maximum number of items in the link that allow editing the remote external key. Above that limit, remote external key cannot be edited. Mind that setting this limit too high can have a negative impact on performances.', + 'default' => 50, + 'value' => 50, + 'source_of_value' => '', + 'show_in_conf_sample' => true, + ], 'tag_set_item_separator' => [ 'type' => 'string', 'description' => 'Tag set from string: tag label separator', From cfe227e0c7f98a695fb1156844d88d415a4f6952 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 20 Apr 2023 15:28:20 +0200 Subject: [PATCH 4/4] =?UTF-8?q?N=C2=B06216=20-=20Fix=20line-height=20being?= =?UTF-8?q?=20too=20big=20in=20the=20attachments=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/backoffice/pages/_attachments.scss | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/css/backoffice/pages/_attachments.scss b/css/backoffice/pages/_attachments.scss index 3188f2950..6427e0b97 100644 --- a/css/backoffice/pages/_attachments.scss +++ b/css/backoffice/pages/_attachments.scss @@ -6,10 +6,6 @@ $ibo-attachment--datatable--icon-preview--max-height: 44px !default; $ibo-attachment--datatable--icon-preview--max-width: $ibo-attachment--datatable--icon-preview--max-height !default; -$ibo-attachment--datatable--line-height: $ibo-attachment--datatable--icon-preview--max-height !default; - -$ibo-attachment--datatable--first-column--line-height: 0px !default; - $ibo-attachment--drag-in--border: 2px $ibo-color-grey-400 dashed !default; $ibo-attachment--upload-file--drop-zone-hint--max-height: 200px !default; $ibo-attachment--upload-file--drop-zone-hint--margin: 22px $ibo-spacing-0 !default; @@ -33,10 +29,7 @@ $ibo-attachment--tab-header--drop-in--icon--color: $ibo-color-blue-600 !default; max-width: $ibo-attachment--datatable--icon-preview--max-width; } .ibo-attachment--datatable tbody tr td { - line-height: $ibo-attachment--datatable--line-height; -} -.ibo-attachment--datatable tbody tr td:nth-child(1){ - line-height: $ibo-attachment--datatable--first-column--line-height; + vertical-align: middle; } .ibo-attachment--upload-file--drop-zone-hint{