From 20f5f22ed8c11e59a460a5df4ea512f831dc48d0 Mon Sep 17 00:00:00 2001 From: jcaro Date: Fri, 17 Jun 2022 16:14:32 +0200 Subject: [PATCH 1/8] =?UTF-8?q?enh(UI):=20Add=20a=20=E2=80=9CParent=20alia?= =?UTF-8?q?s=E2=80=9C=20column=20=20on=20the=20monitoring=20resources=20st?= =?UTF-8?q?atus=20page=20(#11190)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add column ParentAlias * Add new label ParentAlias * Add column ParentAlias and new column component * Add new card to display Parent Alias * Remove tile in Details Panel, enhancement not expected * FIx eslint issue * Fix naming on label parent alias * Add translation * Add line at the end of files * Add line at the end of file * fix issues --- lang/es_ES.UTF-8/LC_MESSAGES/messages.po | 4 +++ lang/fr_FR.UTF-8/LC_MESSAGES/messages.po | 4 +++ lang/pt_BR.UTF-8/LC_MESSAGES/messages.po | 4 +++ lang/pt_PT.UTF-8/LC_MESSAGES/messages.po | 2 ++ .../tabs/Details/DetailsCard/cards.tsx | 5 ++++ .../Resources/Listing/columns/ParentAlias.tsx | 25 +++++++++++++++++++ .../src/Resources/Listing/columns/index.tsx | 12 +++++++++ .../src/Resources/translatedLabels.ts | 1 + 8 files changed, 57 insertions(+) create mode 100644 www/front_src/src/Resources/Listing/columns/ParentAlias.tsx diff --git a/lang/es_ES.UTF-8/LC_MESSAGES/messages.po b/lang/es_ES.UTF-8/LC_MESSAGES/messages.po index c2938b35436..9ca6e8c6d8f 100644 --- a/lang/es_ES.UTF-8/LC_MESSAGES/messages.po +++ b/lang/es_ES.UTF-8/LC_MESSAGES/messages.po @@ -15162,3 +15162,7 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" +# msgid "Parent alias +# msgstr "" + + diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po index ae774523348..0d7202e9723 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -16976,3 +16976,7 @@ msgstr "Veuillez utiliser l'interface Web pour installer Centreon." msgid "Please use Web UI to update Centreon." msgstr "Veuillez utiliser l'interface Web pour mettre à jour Centreon." +# msgid "Parent alias +# msgstr "Alias parent" + + diff --git a/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po b/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po index 9e76be908f9..f4571a2ba90 100644 --- a/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po @@ -15613,3 +15613,7 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" +# msgid "Parent alias +# msgstr "" + + diff --git a/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po b/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po index 664500c9dc4..5428cd8a4a3 100644 --- a/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po +++ b/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po @@ -15601,3 +15601,5 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" +# msgid "Parent alias +# msgstr "" diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx index c00a5b0b179..3ccce444db9 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx @@ -183,6 +183,11 @@ const getDetailCardLines = ({ shouldBeDisplayed: !isNil(details.calculation_type), title: labelCalculationType, }, + { + line: , + shouldBeDisplayed: !isNil(details.calculation_type), + title: labelCalculationType, + }, { isCustomCard: true, line: , diff --git a/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx b/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx new file mode 100644 index 00000000000..c0c34e2c461 --- /dev/null +++ b/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx @@ -0,0 +1,25 @@ +import { Typography } from '@mui/material'; + +import { ComponentColumnProps } from '@centreon/ui'; + +import { useColumnStyles } from '.'; + +const ParentAliasColumn = ({ + row, +}: ComponentColumnProps): JSX.Element | null => { + const classes = useColumnStyles(); + + if (!row.parent) { + return null; + } + + return ( +
+
+ {row.parent.alias} +
+
+ ); +}; + +export default ParentAliasColumn; diff --git a/www/front_src/src/Resources/Listing/columns/index.tsx b/www/front_src/src/Resources/Listing/columns/index.tsx index 48d75a9b400..b415e2918ab 100644 --- a/www/front_src/src/Resources/Listing/columns/index.tsx +++ b/www/front_src/src/Resources/Listing/columns/index.tsx @@ -22,6 +22,7 @@ import { labelNotification, labelCheck, labelSeverity, + labelParentAlias, } from '../../translatedLabels'; import truncate from '../../truncate'; @@ -35,6 +36,7 @@ import ResourceColumn from './Resource'; import ParentResourceColumn from './Parent'; import NotificationColumn from './Notification'; import ChecksColumn from './Checks'; +import ParentAliasColumn from './ParentAlias'; const useStyles = makeStyles((theme) => ({ resourceDetailsCell: { @@ -194,6 +196,16 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ sortable: true, type: ColumnType.string, }, + { + Component: ParentAliasColumn, + getRenderComponentOnRowUpdateCondition: T, + id: 'parent_alias', + label: t(labelParentAlias), + rowMemoProps: ['parent'], + sortField: 'parent_alias', + sortable: true, + type: ColumnType.component, + }, { getFormattedString: ({ fqdn }): string => fqdn, id: 'fqdn', diff --git a/www/front_src/src/Resources/translatedLabels.ts b/www/front_src/src/Resources/translatedLabels.ts index 2013eab5575..75fbdd3ed02 100644 --- a/www/front_src/src/Resources/translatedLabels.ts +++ b/www/front_src/src/Resources/translatedLabels.ts @@ -249,3 +249,4 @@ export const labelNoContactIsConfiguredForThisResource = 'No contacts are configured for this resource'; export const labelNoContactGroupsIsConfiguredForThisResource = 'No contact groups are configured for this resource'; +export const labelParentAlias = 'Parent alias'; From 5f5593757f92bf0a31db539347a28e47bc618c45 Mon Sep 17 00:00:00 2001 From: jcaro Date: Fri, 12 Aug 2022 14:13:22 +0200 Subject: [PATCH 2/8] Update lang/fr_FR.UTF-8/LC_MESSAGES/messages.po Co-authored-by: Tom Darneix --- lang/fr_FR.UTF-8/LC_MESSAGES/messages.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po index 0d7202e9723..f288cbf0892 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -16976,7 +16976,7 @@ msgstr "Veuillez utiliser l'interface Web pour installer Centreon." msgid "Please use Web UI to update Centreon." msgstr "Veuillez utiliser l'interface Web pour mettre à jour Centreon." -# msgid "Parent alias -# msgstr "Alias parent" +msgid "Parent alias +msgstr "Alias parent" From 261f8b8daedba726c0bd192a667f25528a517d49 Mon Sep 17 00:00:00 2001 From: jcaro Date: Fri, 12 Aug 2022 14:13:27 +0200 Subject: [PATCH 3/8] Update lang/es_ES.UTF-8/LC_MESSAGES/messages.po Co-authored-by: Tom Darneix --- lang/es_ES.UTF-8/LC_MESSAGES/messages.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/es_ES.UTF-8/LC_MESSAGES/messages.po b/lang/es_ES.UTF-8/LC_MESSAGES/messages.po index 9ca6e8c6d8f..7f8250dcbf8 100644 --- a/lang/es_ES.UTF-8/LC_MESSAGES/messages.po +++ b/lang/es_ES.UTF-8/LC_MESSAGES/messages.po @@ -15162,7 +15162,7 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" + # msgid "Parent alias # msgstr "" - From 0252717c6cfcee4932163a41385510558ab0fc96 Mon Sep 17 00:00:00 2001 From: jcaro Date: Fri, 12 Aug 2022 14:13:32 +0200 Subject: [PATCH 4/8] Update lang/pt_PT.UTF-8/LC_MESSAGES/messages.po Co-authored-by: Tom Darneix --- lang/pt_PT.UTF-8/LC_MESSAGES/messages.po | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po b/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po index 5428cd8a4a3..85a43777b29 100644 --- a/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po +++ b/lang/pt_PT.UTF-8/LC_MESSAGES/messages.po @@ -15601,5 +15601,7 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" + # msgid "Parent alias # msgstr "" + From 2edcd26dc63c1dc5de8b4e9f5343c25b8ca33d0c Mon Sep 17 00:00:00 2001 From: jcaro Date: Fri, 12 Aug 2022 14:13:40 +0200 Subject: [PATCH 5/8] Update lang/es_ES.UTF-8/LC_MESSAGES/messages.po MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jérémy Delpierre --- lang/es_ES.UTF-8/LC_MESSAGES/messages.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/es_ES.UTF-8/LC_MESSAGES/messages.po b/lang/es_ES.UTF-8/LC_MESSAGES/messages.po index 7f8250dcbf8..76c880fb312 100644 --- a/lang/es_ES.UTF-8/LC_MESSAGES/messages.po +++ b/lang/es_ES.UTF-8/LC_MESSAGES/messages.po @@ -15163,6 +15163,6 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" -# msgid "Parent alias +# msgid "Parent alias" # msgstr "" From 4821db29d32b3cec4b1ac942a966428e4b6dac71 Mon Sep 17 00:00:00 2001 From: jcaro Date: Fri, 12 Aug 2022 14:13:49 +0200 Subject: [PATCH 6/8] Update lang/pt_BR.UTF-8/LC_MESSAGES/messages.po MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jérémy Delpierre --- lang/pt_BR.UTF-8/LC_MESSAGES/messages.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po b/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po index f4571a2ba90..4f20b41a31a 100644 --- a/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/pt_BR.UTF-8/LC_MESSAGES/messages.po @@ -15613,7 +15613,7 @@ msgstr "" # msgid "Warning, maximum size exceeded for input '%s' (max: %d), it will be truncated upon saving" # msgstr "" -# msgid "Parent alias +# msgid "Parent alias" # msgstr "" From 7bbcf9725238b9e7610aa490aec8c460dc773ca1 Mon Sep 17 00:00:00 2001 From: jcaro Date: Tue, 16 Aug 2022 09:00:18 +0200 Subject: [PATCH 7/8] Update lang/fr_FR.UTF-8/LC_MESSAGES/messages.po Co-authored-by: Bruno d'Auria --- lang/fr_FR.UTF-8/LC_MESSAGES/messages.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po index f288cbf0892..4833ca84c1a 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -16978,5 +16978,5 @@ msgid "Please use Web UI to update Centreon." msgstr "Veuillez utiliser l'interface Web pour mettre à jour Centreon." msgid "Parent alias -msgstr "Alias parent" +msgstr "Alias du parent" From a0b365dc21fee55ff9e182614c44cfe986e12092 Mon Sep 17 00:00:00 2001 From: Jordan CARO Date: Fri, 19 Aug 2022 10:11:51 +0200 Subject: [PATCH 8/8] Fix issue on messages.po file --- lang/fr_FR.UTF-8/LC_MESSAGES/messages.po | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po index 4833ca84c1a..ae774523348 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -16976,7 +16976,3 @@ msgstr "Veuillez utiliser l'interface Web pour installer Centreon." msgid "Please use Web UI to update Centreon." msgstr "Veuillez utiliser l'interface Web pour mettre à jour Centreon." - -msgid "Parent alias -msgstr "Alias du parent" -