Skip to content

Commit

Permalink
Revert "Remove Check-related action buttons from Host Details view (#…
Browse files Browse the repository at this point in the history
…1973)"

This reverts commit 232c808.
  • Loading branch information
dottorblaster committed Nov 16, 2023
1 parent ce252a0 commit 19cde4e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
48 changes: 48 additions & 0 deletions assets/js/components/HostDetails/HostDetails.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React, { useState } from 'react';
import { get } from 'lodash';
import { EOS_CLEAR_ALL, EOS_PLAY_CIRCLE, EOS_SETTINGS } from 'eos-icons-react';

import { agentVersionWarning } from '@lib/agent';

import Button from '@components/Button';
import Table from '@components/Table';
import PageHeader from '@components/PageHeader';
import BackButton from '@components/BackButton';
import WarningBanner from '@components/Banners/WarningBanner';
import CleanUpButton from '@components/CleanUpButton';
import DeregistrationModal from '@components/DeregistrationModal';
import { canStartExecution } from '@components/ChecksSelection';
import Tooltip from '@components/Tooltip';

import SuseLogo from '@static/suse_logo.svg';
import CheckResultsOverview from '@components/CheckResultsOverview';
Expand Down Expand Up @@ -37,11 +41,14 @@ function HostDetails({
provider,
providerData,
sapInstances,
savingChecks,
saptuneStatus = {},
selectedChecks = [],
slesSubscriptions,
catalog,
lastExecution,
cleanUpHost,
requestHostChecksExecution,
navigate,
}) {
const [cleanUpModalOpen, setCleanUpModalOpen] = useState(false);
Expand Down Expand Up @@ -103,6 +110,47 @@ function HostDetails({
}}
/>
)}
<Button
type="primary-white"
className="inline-block mx-0.5 border-green-500 border"
size="small"
onClick={() => navigate(`/hosts/${hostID}/settings`)}
>
<EOS_SETTINGS className="inline-block fill-jungle-green-500" />{' '}
Check Selection
</Button>

<Button
type="primary-white"
className="mx-0.5 border-green-500 border"
size="small"
onClick={() => navigate(`/hosts/${hostID}/executions/last`)}
>
<EOS_CLEAR_ALL className="inline-block fill-jungle-green-500" />
Show Results
</Button>

<Tooltip
isEnabled={!canStartExecution(selectedChecks, savingChecks)}
content="Select some Checks first!"
place="bottom"
>
<Button
type="primary"
className="mx-1"
onClick={requestHostChecksExecution}
disabled={!canStartExecution(selectedChecks, savingChecks)}
>
<EOS_PLAY_CIRCLE
className={`${
canStartExecution(selectedChecks, savingChecks)
? 'fill-white'
: 'fill-gray-200'
} inline-block align-sub`}
/>{' '}
Start Execution
</Button>
</Tooltip>
</div>
</div>
<div className="pb-3">
Expand Down
6 changes: 3 additions & 3 deletions assets/js/components/HostDetails/HostDetails.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import HostDetails from './HostDetails';

describe('HostDetails component', () => {
describe('Checks execution', () => {
it.skip('should show the Checks related action buttons', () => {
it('should show the Checks related action buttons', () => {
renderWithRouter(<HostDetails agentVersion="1.0.0" />);

expect(
Expand All @@ -27,7 +27,7 @@ describe('HostDetails component', () => {
).toBeVisible();
});

it.skip('should disable start execution button when checks are not selected', async () => {
it('should disable start execution button when checks are not selected', async () => {
const user = userEvent.setup();

renderWithRouter(
Expand All @@ -41,7 +41,7 @@ describe('HostDetails component', () => {
expect(screen.getByText('Select some Checks first!')).toBeInTheDocument();
});

it.skip('should enable start execution button when checks are selected', async () => {
it('should enable start execution button when checks are selected', async () => {
const user = userEvent.setup();
const selectedChecks = [faker.animal.bear(), faker.animal.bear()];

Expand Down

0 comments on commit 19cde4e

Please sign in to comment.