Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add header to upgradable packages view #2685

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assets/js/pages/UpgradablePackagesPage/UpgradablePackagesPage.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React, { useEffect } from 'react';
import { useParams } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
import { get } from 'lodash';

import { getHost } from '@state/selectors/host';
import { getUpgradablePackages } from '@state/selectors/softwareUpdates';
import { fetchSoftwareUpdatesSettings } from '@state/softwareUpdatesSettings';
import {
fetchSoftwareUpdates,
fetchUpgradablePackagesPatches,
} from '@state/softwareUpdates';

import PageHeader from '@common/PageHeader';
import BackButton from '@common/BackButton';
import UpgradablePackagesList from '@common/UpgradablePackagesList';

Expand All @@ -21,6 +24,10 @@ function UpgradablePackagesPage() {
dispatch(fetchSoftwareUpdatesSettings());
}, []);

const host = useSelector(getHost(hostID));

const hostname = get(host, 'hostname', '');

const upgradablePackages = useSelector((state) =>
getUpgradablePackages(state, hostID)
);
Expand All @@ -36,6 +43,9 @@ function UpgradablePackagesPage() {
return (
<>
<BackButton url={`/hosts/${hostID}`}>Back to Host Details</BackButton>
<PageHeader>
Upgradable packages: <span className="font-bold">{hostname}</span>
</PageHeader>
<UpgradablePackagesList upgradablePackages={upgradablePackages} />
</>
);
Expand Down