Skip to content

Commit

Permalink
Include cluster field in the host details view
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Apr 29, 2022
1 parent 3ea6603 commit 8d301b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions assets/js/components/HostDetails/HostDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import Table from '@components/Table';

import HeartbeatPill from './HeartbeatPill';

import ClusterLink from '@components/ClusterLink';

import {
subscriptionsTableConfiguration,
sapInstancesTableConfiguration,
} from './tableConfigs';

import SuseLogo from '../../../static/suse_logo.svg';
import { getInstancesOnHost, getHost } from '@state/selectors';
import { getInstancesOnHost, getClusterOnHost, getHost } from '@state/selectors';

const HostDetails = () => {
const { hostID } = useParams();
const host = useSelector(getHost(hostID));
const cluster = useSelector(getClusterOnHost(hostID));
const sapSystems = useSelector(getInstancesOnHost(hostID));

// eslint-disable-next-line no-undef
Expand All @@ -41,7 +44,7 @@ const HostDetails = () => {
orientation="vertical"
data={[
{ title: 'Name', content: host.hostname },
{ title: 'Cluster', content: host.cluster && host.cluster.name },
{ title: 'Cluster', content: <ClusterLink cluster={cluster}>{cluster?.name}</ClusterLink> },
{ title: 'Agent version', content: host.agent_version },
]}
/>
Expand Down
5 changes: 5 additions & 0 deletions assets/js/state/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ const enrichInstances = (instances, sapSystemId, state) =>
};
});

export const getClusterOnHost = (hostId) => (state) => {
const host = state.hostsList.hosts.find((host) => host.id === hostId);
return state.clustersList.clusters.find(isIdByKey('id', host?.cluster_id))
};

export const getInstancesOnHost = (hostId) => (state) => {
const { databaseInstances, applicationInstances } = state.sapSystemsList;

Expand Down

0 comments on commit 8d301b0

Please sign in to comment.