Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

enh(UI): Add a “Parent alias“ column on the monitoring resources status page #11190

4 changes: 4 additions & 0 deletions lang/es_ES.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -15127,3 +15127,7 @@ msgstr ""

# msgid "License expired"
# msgstr ""

msgid "Parent alias
msgstr ""

4 changes: 4 additions & 0 deletions lang/fr_FR.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16863,3 +16863,7 @@ msgstr "Date de fin de licence :"

msgid "License expired"
msgstr "Licence expirée"

msgid "Parent alias
msgstr "Alias parent"

4 changes: 4 additions & 0 deletions lang/pt_BR.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -15578,3 +15578,7 @@ msgstr ""

# msgid "License expired"
# msgstr ""

msgid "Parent alias
msgstr ""

4 changes: 4 additions & 0 deletions lang/pt_PT.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -15566,3 +15566,7 @@ msgstr ""

# msgid "License expired"
# msgstr ""

msgid "Parent alias
msgstr ""

Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ const getDetailCardLines = ({
shouldBeDisplayed: !isNil(details.calculation_type),
title: labelCalculationType,
},
{
line: <DetailsLine line={details.parent.uuid} />,
shouldBeDisplayed: !isNil(details.calculation_type),
title: labelCalculationType,
},
{
isCustomCard: true,
line: <Groups details={details} />,
Expand Down
25 changes: 25 additions & 0 deletions www/front_src/src/Resources/Listing/columns/ParentAlias.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className={classes.resourceDetailsCell}>
<div className={classes.resourceNameItem}>
<Typography variant="body2">{row.parent.alias}</Typography>
</div>
</div>
);
};

export default ParentAliasColumn;
12 changes: 12 additions & 0 deletions www/front_src/src/Resources/Listing/columns/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
labelNotification,
labelCheck,
labelSeverity,
labelParentAlias,
} from '../../translatedLabels';
import truncate from '../../truncate';

Expand All @@ -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: {
Expand Down Expand Up @@ -194,6 +196,16 @@ export const getColumns = ({ actions, t }: ColumnProps): Array<Column> => [
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',
Expand Down
1 change: 1 addition & 0 deletions www/front_src/src/Resources/translatedLabels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';