diff --git a/frontend/src/__tests__/cypress/cypress/pages/hardwareProfile.ts b/frontend/src/__tests__/cypress/cypress/pages/hardwareProfile.ts index f0e9d6dfef..03d07b8aa5 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/hardwareProfile.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/hardwareProfile.ts @@ -1,5 +1,4 @@ import { Contextual } from '~/__tests__/cypress/cypress/pages/components/Contextual'; -import { Modal } from './components/Modal'; import { TableRow } from './components/table'; class HardwareProfileTableToolbar extends Contextual { @@ -105,19 +104,4 @@ class HardwareProfile { } } -class DisableHardwareProfileModal extends Modal { - constructor() { - super('Disable hardware profile'); - } - - findDisableButton() { - return this.findFooter().findByRole('button', { name: 'Disable' }); - } - - findCancelButton() { - return this.findFooter().findByRole('button', { name: 'Cancel' }); - } -} - export const hardwareProfile = new HardwareProfile(); -export const disableHardwareProfileModal = new DisableHardwareProfileModal(); diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/hardwareProfiles/hardwareProfiles.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/hardwareProfiles/hardwareProfiles.cy.ts index 7b0c56a5cd..b4d439c632 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/hardwareProfiles/hardwareProfiles.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/hardwareProfiles/hardwareProfiles.cy.ts @@ -1,7 +1,4 @@ -import { - hardwareProfile, - disableHardwareProfileModal, -} from '~/__tests__/cypress/cypress/pages/hardwareProfile'; +import { hardwareProfile } from '~/__tests__/cypress/cypress/pages/hardwareProfile'; import { mockHardwareProfile } from '~/__mocks__/mockHardwareProfile'; import { deleteModal } from '~/__tests__/cypress/cypress/pages/components/DeleteModal'; import { HardwareProfileModel } from '~/__tests__/cypress/cypress/utils/models'; @@ -90,7 +87,9 @@ describe('Hardware Profile', () => { hardwareProfileTableToolbar.findFilterInput('name').clear(); hardwareProfile.findRows().should('have.length', 2); - hardwareProfileTableToolbar.findFilterMenuOption('filter-toolbar-dropdown', 'Enable').click(); + hardwareProfileTableToolbar + .findFilterMenuOption('filter-toolbar-dropdown', 'Enabled') + .click(); hardwareProfileTableToolbar.selectEnableFilter('Enabled'); hardwareProfile.findRows().should('have.length', 1); hardwareProfile.getRow('Test Hardware Profile').find().should('exist'); @@ -133,7 +132,6 @@ describe('Hardware Profile', () => { hardwareProfile.getRow('Test Hardware Profile Delete').findEnabled().should('not.be.checked'); hardwareProfile.getRow('Test Hardware Profile').findEnabled().should('be.checked'); hardwareProfile.getRow('Test Hardware Profile').findEnableSwitch().click(); - disableHardwareProfileModal.findDisableButton().click(); cy.wait('@toggleHardwareProfile').then((interception) => { expect(interception.request.body).to.eql([ diff --git a/frontend/src/pages/hardwareProfiles/DisableHardwareProfileModal.tsx b/frontend/src/pages/hardwareProfiles/DisableHardwareProfileModal.tsx deleted file mode 100644 index 694dad4edc..0000000000 --- a/frontend/src/pages/hardwareProfiles/DisableHardwareProfileModal.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react'; -import { Button } from '@patternfly/react-core'; -import { Modal } from '@patternfly/react-core/deprecated'; - -type DisableHardwareProfileModalProps = { - onClose: (confirmStatus: boolean) => void; -}; - -const DisableHardwareProfileModal: React.FC = ({ onClose }) => ( - onClose(false)} - actions={[ - , - , - ]} - > - This will disable the hardware profile and it will no longer be available for use with new - workbenches and runtimes. Existing resources using this profile will retain it unless a new - profile is selected. - -); - -export default DisableHardwareProfileModal; diff --git a/frontend/src/pages/hardwareProfiles/HardwareProfileEnableToggle.tsx b/frontend/src/pages/hardwareProfiles/HardwareProfileEnableToggle.tsx index b4d0233a6b..6f6c0ed190 100644 --- a/frontend/src/pages/hardwareProfiles/HardwareProfileEnableToggle.tsx +++ b/frontend/src/pages/hardwareProfiles/HardwareProfileEnableToggle.tsx @@ -4,8 +4,6 @@ import useNotification from '~/utilities/useNotification'; import { toggleHardwareProfileEnablement } from '~/api'; import { HardwareProfileKind } from '~/k8sTypes'; -import DisableHardwareProfileModal from '~/pages/hardwareProfiles/DisableHardwareProfileModal'; - type HardwareProfileEnableToggleProps = { hardwareProfile: HardwareProfileKind; refreshHardwareProfiles: () => void; @@ -16,8 +14,6 @@ const HardwareProfileEnableToggle: React.FC = refreshHardwareProfiles, }) => { const { enabled } = hardwareProfile.spec; - const label = enabled ? 'enabled' : 'stopped'; - const [isModalOpen, setIsModalOpen] = React.useState(false); const [isEnabled, setEnabled] = React.useState(enabled); const [isLoading, setLoading] = React.useState(false); const notification = useNotification(); @@ -46,33 +42,14 @@ const HardwareProfileEnableToggle: React.FC = }; return ( - <> - { - if (isEnabled) { - setIsModalOpen(true); - } else { - handleChange(true); - } - }} - /> - {isModalOpen ? ( - { - if (confirmStatus) { - handleChange(false); - } - setIsModalOpen(false); - }} - /> - ) : null} - + handleChange(checked)} + /> ); }; diff --git a/frontend/src/pages/hardwareProfiles/HardwareProfilesTable.tsx b/frontend/src/pages/hardwareProfiles/HardwareProfilesTable.tsx index a57e6fd70c..464a18d5ca 100644 --- a/frontend/src/pages/hardwareProfiles/HardwareProfilesTable.tsx +++ b/frontend/src/pages/hardwareProfiles/HardwareProfilesTable.tsx @@ -33,7 +33,7 @@ const HardwareProfilesTable: React.FC = ({ () => hardwareProfiles.filter((cr) => { const nameFilter = filterData.Name?.toLowerCase(); - const enableFilter = filterData.Enable; + const enableFilter = filterData.Enabled; if (nameFilter && !cr.spec.displayName.toLowerCase().includes(nameFilter)) { return false; diff --git a/frontend/src/pages/hardwareProfiles/HardwareProfilesTableRow.tsx b/frontend/src/pages/hardwareProfiles/HardwareProfilesTableRow.tsx index 44d379518e..cdd0a2c55a 100644 --- a/frontend/src/pages/hardwareProfiles/HardwareProfilesTableRow.tsx +++ b/frontend/src/pages/hardwareProfiles/HardwareProfilesTableRow.tsx @@ -5,7 +5,6 @@ import { StackItem, Timestamp, TimestampTooltipVariant, - Title, } from '@patternfly/react-core'; import { ActionsColumn, ExpandableRowContent, Tbody, Td, Tr } from '@patternfly/react-table'; import { relativeTime } from '~/utilities/time'; @@ -51,7 +50,7 @@ const HardwareProfilesTableRow: React.FC = ({ truncateDescriptionLines={2} /> - + = ({ {hardwareProfile.spec.identifiers && hardwareProfile.spec.identifiers.length !== 0 && ( - - Node resources - +

Node resources

@@ -115,9 +112,7 @@ const HardwareProfilesTableRow: React.FC = ({ {hardwareProfile.spec.nodeSelectors && hardwareProfile.spec.nodeSelectors.length !== 0 && ( - - Node selectors - +

Node selectors

@@ -125,9 +120,7 @@ const HardwareProfilesTableRow: React.FC = ({ {hardwareProfile.spec.tolerations && hardwareProfile.spec.tolerations.length !== 0 && ( - - Tolerations - +

Tolerations

diff --git a/frontend/src/pages/hardwareProfiles/HardwareProfilesToolbar.tsx b/frontend/src/pages/hardwareProfiles/HardwareProfilesToolbar.tsx index 55a49fc42b..ffb1c17323 100644 --- a/frontend/src/pages/hardwareProfiles/HardwareProfilesToolbar.tsx +++ b/frontend/src/pages/hardwareProfiles/HardwareProfilesToolbar.tsx @@ -30,7 +30,7 @@ const HardwareProfilesToolbar: React.FC = ({ onChange={(_event, value) => onChange(value)} /> ), - [HardwareProfileFilterOptions.enable]: ({ value, onChange, ...props }) => ( + [HardwareProfileFilterOptions.enabled]: ({ value, onChange, ...props }) => ( [] = [ }, { field: 'enablement', - label: 'Enable', + label: 'Enabled', sortable: false, info: { popover: 'Indicates whether the hardware profile is available for new resources.', @@ -131,12 +131,12 @@ export enum HardwareProfileEnableType { export enum HardwareProfileFilterOptions { name = 'Name', - enable = 'Enable', + enabled = 'Enabled', } export const hardwareProfileFilterOptions = { [HardwareProfileFilterOptions.name]: 'Name', - [HardwareProfileFilterOptions.enable]: 'Enable', + [HardwareProfileFilterOptions.enabled]: 'Enabled', }; export type HardwareProfileFilterDataType = Record< @@ -146,5 +146,5 @@ export type HardwareProfileFilterDataType = Record< export const initialHardwareProfileFilterData: HardwareProfileFilterDataType = { [HardwareProfileFilterOptions.name]: '', - [HardwareProfileFilterOptions.enable]: undefined, + [HardwareProfileFilterOptions.enabled]: undefined, };