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

Commit

Permalink
enh(UI): Add a “Parent alias“ column on the monitoring resources stat…
Browse files Browse the repository at this point in the history
…us page (#11190)

* 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
  • Loading branch information
Jordan91 authored and emabassi-ext committed Jul 26, 2022
1 parent 1afb472 commit bc04335
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 0 deletions.
5 changes: 5 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,8 @@ msgstr ""

# msgid "License expired"
# msgstr ""

# msgid "Parent alias
# msgstr ""


5 changes: 5 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,8 @@ msgstr "Date de fin de licence :"

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

# msgid "Parent alias
# msgstr "Alias parent"


5 changes: 5 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,8 @@ msgstr ""

# msgid "License expired"
# msgstr ""

# msgid "Parent alias
# msgstr ""


5 changes: 5 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,8 @@ 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';

0 comments on commit bc04335

Please sign in to comment.