Skip to content

Commit

Permalink
CNV-37814: Upgrade to PFv5
Browse files Browse the repository at this point in the history
Signed-off-by: Aviv Turgeman <aturgema@redhat.com>
  • Loading branch information
avivtur committed Feb 22, 2024
1 parent 97188be commit ac229c3
Show file tree
Hide file tree
Showing 440 changed files with 5,449 additions and 7,464 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -4,6 +4,7 @@ RUN command -v yarn || npm i -g yarn

COPY . /opt/app-root/src
WORKDIR /opt/app-root/src
ENV NODE_OPTIONS=--max-old-space-size=8192
RUN yarn install --frozen-lockfile --ignore-engines && yarn build

FROM registry.access.redhat.com/ubi8/nginx-120
Expand Down
32 changes: 16 additions & 16 deletions cypress/tests/catalog/filter.spec.ts
Expand Up @@ -10,51 +10,51 @@ describe('Test VM catalog filter', () => {

it('ID(CNV-8464) Filter VM catalog by OS name', () => {
cy.get(catalogView.RHEL).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL9.metadataName);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL8.metadataName);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL7.metadataName);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.RHEL9.metadataName);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.RHEL8.metadataName);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.RHEL7.metadataName);
cy.get(catalogView.RHEL).find(catalogView.checkbox).uncheck();

cy.get(catalogView.WINDOWS).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN10.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN2K12R2.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN2K16.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN2K19.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN10.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN2K12R2.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN2K16.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN2K19.name);
cy.get(catalogView.WINDOWS).find(catalogView.checkbox).uncheck();

cy.get(catalogView.FEDORA).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.FEDORA.metadataName);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.FEDORA.metadataName);
cy.get(catalogView.FEDORA).find(catalogView.checkbox).uncheck();
});

it('ID(CNV-8465) Filter VM catalog by Workload', () => {
cy.get(catalogView.DESKTOP).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN10.name);
cy.get(catalogView.GRID).find('a').should('not.contain', TEMPLATE.WIN2K19.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN10.name);
cy.get(catalogView.GRID).find('div').should('not.contain', TEMPLATE.WIN2K19.name);
cy.get(catalogView.DESKTOP).find(catalogView.checkbox).uncheck();
});

it('ID(CNV-8466) Filter VM catalog by OS and Workload', () => {
cy.get(catalogView.WINDOWS).find(catalogView.checkbox).check();
cy.get(catalogView.SERVER).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN2K12R2.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN2K16.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN2K19.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN2K12R2.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN2K16.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN2K19.name);
cy.get(catalogView.SERVER).find(catalogView.checkbox).uncheck();

cy.get(catalogView.DESKTOP).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.WIN10.name);
cy.get(catalogView.GRID).find('div').should('contain', TEMPLATE.WIN10.name);
cy.get(catalogView.DESKTOP).find(catalogView.checkbox).uncheck();
cy.get(catalogView.WINDOWS).find(catalogView.checkbox).uncheck();
});
// TODO: Fix by Guohua
it.skip('ID(CNV-8467) Filter VM catalog by text', () => {
cy.get(catalogView.filterText).type(TEMPLATE.RHEL8.name);
cy.contains(TEMPLATE.RHEL8.name).should('exist');
cy.get(catalogView.GRID).find('a').should('have.length', 1);
cy.get(catalogView.GRID).find('div').should('have.length', 1);

cy.get(catalogView.filterText).clear().type(TEMPLATE.WIN10.metadataName);
cy.contains(TEMPLATE.WIN10.name).should('exist');
cy.get(catalogView.GRID).find('a').should('have.length', 1);
cy.get(catalogView.GRID).find('div').should('have.length', 1);
});
});
69 changes: 24 additions & 45 deletions locales/en/plugin__kubevirt-plugin.json

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions package.json
Expand Up @@ -55,15 +55,16 @@
"version": "0.0.0"
},
"dependencies": {
"@kubevirt-ui/components": "^0.0.10",
"@novnc/novnc": "1.3.0",
"@patternfly/quickstarts": "2.4.0",
"@patternfly/react-catalog-view-extension": "^4.82.8",
"@patternfly/react-charts": "^6.84.8",
"@patternfly/react-core": "4.276.8",
"@patternfly/react-icons": "^4.82.8",
"@patternfly/react-log-viewer": "^5.0.0",
"@patternfly/react-table": "4.113.0",
"@patternfly/quickstarts": "5.1.0",
"@patternfly/react-catalog-view-extension": "5.0.0",
"@patternfly/react-charts": "7.1.1",
"@patternfly/react-core": "^5.1.1",
"@patternfly/react-icons": "^5.1.1",
"@patternfly/react-log-viewer": "5.1.0",
"@patternfly/react-styles": "^5.1.1",
"@patternfly/react-table": "^5.1.1",
"@patternfly/react-tokens": "^5.1.1",
"@types/byte-size": "^8.1.0",
"axios": "^0.27.2",
"buffer": "^6.0.3",
Expand Down Expand Up @@ -91,9 +92,11 @@
"react-router-dom-v5-compat": "^6.22.0",
"react-tagsinput": "^3.19.0",
"react-use-websocket": "^4.3.1",
"showdown": ">=2.1.0",
"unique-names-generator": "^4.6.0",
"use-immer": "^0.6.0",
"validator": "^13.7.0",
"victory-core": "~36.8.1",
"xbytes": "^1.7.0",
"xterm": "^4.18.0",
"xterm-addon-fit": "^0.5.0",
Expand All @@ -102,9 +105,9 @@
"devDependencies": {
"@cypress/webpack-preprocessor": "^5.11.0",
"@kubevirt-ui/kubevirt-api": "^1.2.2",
"@openshift-console/dynamic-plugin-sdk": "0.0.21",
"@openshift-console/dynamic-plugin-sdk-internal": "0.0.11",
"@openshift-console/dynamic-plugin-sdk-webpack": "0.0.11",
"@openshift-console/dynamic-plugin-sdk": "1.0.0",
"@openshift-console/dynamic-plugin-sdk-internal": "1.0.0",
"@openshift-console/dynamic-plugin-sdk-webpack": "1.0.0",
"@openshift-console/plugin-shared": "^0.0.1",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
Expand Down Expand Up @@ -156,7 +159,7 @@
"ts-node": "10.x",
"tsconfig-paths-webpack-plugin": "^3.5.1",
"typescript": "^4.5.5",
"webpack": "^5.68.0",
"webpack": "5.75.0",
"webpack-cli": "4.10.x",
"webpack-dev-server": "^4.7.4",
"yarn": "^1.22.18"
Expand All @@ -171,13 +174,11 @@
"name": "kubevirt-plugin",
"private": true,
"resolutions": {
"@patternfly/react-icons": "^4.82.8",
"@types/react": "^17.0.40",
"@types/react-dom": "^17.0.0",
"webpack": "^5.68.0"
"@types/react-dom": "^17.0.0"
},
"scripts": {
"build": "NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 rm -rf dist && yarn ts-node node_modules/.bin/webpack",
"build": "NODE_ENV=production rm -rf dist && yarn ts-node node_modules/.bin/webpack",
"check-types": "tsc",
"clean": "rm -rf dist",
"cypress-generate": "cd cypress && marge -o ./gui-test-screenshots/ -f cypress-report -t 'Kubevirt Cypress Test Results' -p 'Kubevirt Test Results' --showPassed false --assetsDir ./gui-test-screenshots/cypress/assets ./gui-test-screenshots/cypress.json",
Expand Down
Expand Up @@ -32,8 +32,10 @@ const ActionDropdownItem: FC<ActionDropdownItemProps> = ({ action, setIsOpen })
key={action?.id}
onClick={handleClick}
{...(isCloneDisabled && {
tooltip: t(`You don't have permission to perform this action`),
tooltipProps: { position: TooltipPosition.left },
tooltipProps: {
content: t(`You don't have permission to perform this action`),
position: TooltipPosition.left,
},
})}
className={classNames({ ActionDropdownItem__disabled: isCloneDisabled })}
>
Expand Down
62 changes: 62 additions & 0 deletions src/utils/components/ActionsDropdown/ActionsDropdown.tsx
@@ -0,0 +1,62 @@
import React, { FC, memo, useState } from 'react';

import ActionDropdownItem from '@kubevirt-utils/components/ActionDropdownItem/ActionDropdownItem';
import DropdownToggle from '@kubevirt-utils/components/toggles/DropdownToggle';
import KebabToggle from '@kubevirt-utils/components/toggles/KebabToggle';
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation';
import { Action } from '@openshift-console/dynamic-plugin-sdk';
import { Dropdown, DropdownList } from '@patternfly/react-core';

type ActionsDropdownProps = {
actions: Action[];
className?: string;
id?: string;
isKebabToggle?: boolean;
onLazyClick?: () => void;
};

const ActionsDropdown: FC<ActionsDropdownProps> = ({
actions = [],
className,
id,
isKebabToggle,
onLazyClick,
}) => {
const { t } = useKubevirtTranslation();
const [isOpen, setIsOpen] = useState(false);

const onToggle = () => {
setIsOpen((prevIsOpen) => {
if (onLazyClick && !prevIsOpen) onLazyClick();

return !prevIsOpen;
});
};

const Toggle = isKebabToggle
? KebabToggle({ isExpanded: isOpen, onClick: onToggle })
: DropdownToggle({
children: t('Actions'),
isExpanded: isOpen,
onClick: onToggle,
});

return (
<Dropdown
className={className}
data-test-id={id}
isOpen={isOpen}
onOpenChange={(open: boolean) => setIsOpen(open)}
popperProps={{ enableFlip: true, position: 'right' }}
toggle={Toggle}
>
<DropdownList>
{actions?.map((action) => (
<ActionDropdownItem action={action} key={action?.id} setIsOpen={setIsOpen} />
))}
</DropdownList>
</Dropdown>
);
};

export default memo(ActionsDropdown);

This file was deleted.

This file was deleted.

@@ -1,6 +1,7 @@
import React, { FC } from 'react';

import ExternalLink from '@kubevirt-utils/components/ExternalLink/ExternalLink';
import FormGroupHelperText from '@kubevirt-utils/components/FormGroupHelperText/FormGroupHelperText';
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation';
import { FormGroup, NumberInput, Text, TextInput, Title } from '@patternfly/react-core';

Expand All @@ -22,9 +23,6 @@ const SchedulingSettings: FC<SchedulingSettingsProps> = ({
return (
<>
<FormGroup
helperText={t(
'Specify the number of revisions that should be retained. A value of X means that the X latest versions will be kept.',
)}
fieldId="volume-registry-retain-revisions"
isRequired
label={t('Retain revisions')}
Expand All @@ -41,8 +39,12 @@ const SchedulingSettings: FC<SchedulingSettingsProps> = ({
plusBtnAriaLabel={t('Increment')}
value={retainRevisions}
/>
<FormGroupHelperText>
{t(
'Specify the number of revisions that should be retained. A value of X means that the X latest versions will be kept.',
)}
</FormGroupHelperText>
</FormGroup>

<div>
<Title headingLevel="h2" size="md">
{t('Scheduling settings')}
Expand All @@ -57,17 +59,17 @@ const SchedulingSettings: FC<SchedulingSettingsProps> = ({
</div>
<FormGroup
fieldId="volume-registry-retain-cron-expression"
helperText={t('Example (At 00:00 on Tuesday): 0 0 * * 2.')}
isRequired
label={t('Cron expression')}
>
<TextInput
data-test-id="volume-registry-retain-cron-expression"
id="volume-registry-retain-cron-expression"
onChange={setBootableVolumeField('cronExpression')}
onChange={(_, value: string) => setBootableVolumeField('cronExpression')(value)}
type="text"
value={cronExpression}
/>
<FormGroupHelperText>{t('Example (At 00:00 on Tuesday): 0 0 * * 2.')}</FormGroupHelperText>
</FormGroup>
</>
);
Expand Down

0 comments on commit ac229c3

Please sign in to comment.