Skip to content

Commit

Permalink
Initial PF5 update
Browse files Browse the repository at this point in the history
Signed-off-by: yaacov <[email protected]>
  • Loading branch information
yaacov committed Sep 25, 2024
1 parent d695b4a commit 3ac4fd3
Show file tree
Hide file tree
Showing 164 changed files with 2,763 additions and 6,924 deletions.
2 changes: 1 addition & 1 deletion build/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-18 AS build
# -t quay.io/kubev2v/forklift-console-plugin \
# -f ./build/Containerfile \
# --build-arg VERSION=1.2.3 .
ARG VERSION=2.6.4
ARG VERSION=2.7.0
ENV VERSION=${VERSION}

# Copy app source
Expand Down
8,124 changes: 2,244 additions & 5,880 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 9 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@
"packages/common",
"packages/forklift-console-plugin"
],
"config": {
"libs": "-w @kubev2v/webpack -w @kubev2v/common"
},
"scripts": {
"clean": "rm -rf ./dist ./coverage && npm run clean -ws --if-present",
"clean:all": "npm run clean && npm run clean:all -ws --if-present && rm -rf ./node_modules ./tmp ",
"build": "NODE_ENV=production npm run build $npm_package_config_libs && NODE_ENV=production npm run build -w @kubev2v/forklift-console-plugin",
"build:dev": "npm run build $npm_package_config_libs && npm run build:dev -w @kubev2v/forklift-console-plugin",
"build": "NODE_ENV=production npm run build -w @kubev2v/common && NODE_ENV=production npm run build -w @kubev2v/forklift-console-plugin",
"build:dev": "npm run build -w @kubev2v/common && npm run build:dev -w @kubev2v/forklift-console-plugin",
"start": "npm run start -w @kubev2v/forklift-console-plugin",
"start:overlay-proxy": "npm run build $npm_package_config_libs && npm run start -w @kubev2v/forklift-console-plugin -- -c webpack.proxy.config.ts",
"start:overlay-proxy": "npm run build -w @kubev2v/common && npm run start -w @kubev2v/forklift-console-plugin -- -c webpack.proxy.config.ts",
"i18n": "npm run i18n -w @kubev2v/forklift-console-plugin",
"lint": "npm run lint -ws --if-present",
"lint:fix": "npm run lint:fix -ws --if-present",
"test:i18n": "bash ./ci/test-i18n.sh",
"test": "npm run build $npm_package_config_libs && npm run test -ws --if-present",
"test:coverage": "npm run build $npm_package_config_libs && npm run test:coverage -ws --if-present",
"test:updateSnapshot": "npm run build $npm_package_config_libs && npm run test:updateSnapshot -ws --if-present",
"test": "npm run build -w @kubev2v/common && npm run test -ws --if-present",
"test:coverage": "npm run build -w @kubev2v/common && npm run test:coverage -ws --if-present",
"test:updateSnapshot": "npm run build -w @kubev2v/common && npm run test:updateSnapshot -ws --if-present",
"test:e2e": "cypress run --config-file cypress/cypress.config.cjs --browser chrome --headed",
"console": "bash ./ci/start-console.sh",
"console:oauth": "bash ./ci/start-console.sh --auth",
Expand All @@ -51,15 +48,12 @@
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-url": "^8.0.2",
"@rollup/pluginutils": "^5.0.2",
"@testing-library/cypress": "^9.0.0",
"@testing-library/cypress": "^10.0.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.4.3",
"@types/node": "^20.1.0",
"@types/node": "^20.16.6",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"cypress": "^12.8.1",
"cypress": "^13.14.2",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.1.0",
Expand Down
51 changes: 26 additions & 25 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,38 @@
"storybook:build": "storybook build"
},
"peerDependencies": {
"@openshift-console/dynamic-plugin-sdk": "0.0.21",
"@patternfly/react-core": "4.276.6",
"@patternfly/react-table": "4.112.39",
"@patternfly/react-icons": "5.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-i18next": "^11.7.3",
"react-query": "^3.39.2",
"react-router": "5.3.x",
"react-router-dom": "5.3.x",
"@openshift-console/dynamic-plugin-sdk": "1.6.0",
"@patternfly/react-core": "^5.4.0",
"@patternfly/react-icons": "^5.4.0",
"@patternfly/react-table": "^5.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.0.2",
"react-query": "^3.39.3",
"react-router": "^6.26.2",
"react-router-dom": "^6.26.2",
"jsonpath": "^1.1.1",
"jsrsasign": "11.1.0",
"luxon": "^3.3.0"
"luxon": "^3.5.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.5.0",
"@storybook/addon-essentials": "^8.1.5",
"@storybook/addon-interactions": "^8.1.5",
"@storybook/addon-links": "^8.1.5",
"@storybook/addon-storysource": "^8.1.5",
"@storybook/addon-webpack5-compiler-swc": "^1.0.3",
"@storybook/blocks": "^8.1.5",
"@chromatic-com/storybook": "^2.0.2",
"@storybook/addon-essentials": "^8.3.2",
"@storybook/addon-interactions": "^8.3.2",
"@storybook/addon-links": "^8.3.2",
"@storybook/addon-storysource": "^8.3.2",
"@storybook/addon-webpack5-compiler-swc": "^1.0.5",
"@storybook/blocks": "^8.3.2",
"@storybook/preset-scss": "^1.0.3",
"@storybook/react": "^8.1.5",
"@storybook/react-webpack5": "^8.1.5",
"@storybook/test": "^8.1.5",
"@types/react": "^17.0.1",
"@types/react-dom": "^17.0.1",
"@storybook/react": "^8.3.2",
"@storybook/react-webpack5": "^8.3.2",
"@storybook/test": "^8.3.2",
"@testing-library/react": "^16.0.1",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"eslint-plugin-storybook": "^0.8.0",
"prop-types": "^15.8.1",
"sass": "^1.63.3",
"storybook": "^8.1.5"
"sass": "^1.79.3",
"storybook": "^8.3.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import React, { useMemo, useState } from 'react';
import { useHistory } from 'react-router';
import { useNavigate } from 'react-router';

import { ActionService, ActionServiceProvider } from '@openshift-console/dynamic-plugin-sdk';
import { Dropdown, DropdownItem, DropdownToggle, KebabToggle } from '@patternfly/react-core';
import {
Dropdown,
DropdownItem,
DropdownToggle,
KebabToggle,
} from '@patternfly/react-core/deprecated';

import { ToggleEventType } from '../../utils';

Expand Down Expand Up @@ -66,7 +71,7 @@ const ActionsAsDropdown = ({
ignoreList = [],
}: ActionService &
Pick<ActionServiceDropdownProps<object>, 'variant' | 'dropdownToggleText' | 'ignoreList'>) => {
const history = useHistory();
const history = useNavigate();
const [isActionMenuOpen, setIsActionMenuOpen] = useState(false);
const isPlain = variant === 'kebab';

Expand All @@ -76,9 +81,9 @@ const ActionsAsDropdown = ({

const toggle =
variant === 'kebab' ? (
<KebabToggle onToggle={onToggle} />
<KebabToggle onToggle={(e, v) => onToggle(v, e)} />
) : (
<DropdownToggle onToggle={onToggle}>{dropdownToggleText}</DropdownToggle>
<DropdownToggle onToggle={(e, v) => onToggle(v, e)}>{dropdownToggleText}</DropdownToggle>
);

return (
Expand All @@ -93,7 +98,7 @@ const ActionsAsDropdown = ({
.map(({ id, label, cta, disabled, disabledTooltip, tooltip }) => (
<DropdownItem
key={id}
onClick={typeof cta === 'function' ? cta : () => cta.href && history.push(cta.href)}
onClick={typeof cta === 'function' ? cta : () => cta.href && history(cta.href)}
isAriaDisabled={disabled}
tooltip={disabled ? disabledTooltip : tooltip}
>
Expand Down
7 changes: 3 additions & 4 deletions packages/common/src/components/Filter/AutocompleteFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useState } from 'react';

import { ToolbarChip, ToolbarFilter } from '@patternfly/react-core';
import {
Select,
SelectOption,
SelectOptionObject,
SelectVariant,
ToolbarChip,
ToolbarFilter,
} from '@patternfly/react-core';
} from '@patternfly/react-core/deprecated';

import { SelectEventType, SelectValueType, ToggleEventType } from '../../utils';

Expand Down Expand Up @@ -108,7 +107,7 @@ export const AutocompleteFilter = ({
selections={[]}
placeholderText={placeholderLabel}
isOpen={isExpanded}
onToggle={onToggle}
onToggle={(e, v) => onToggle(v, e)}
onFilter={onFilter}
shouldResetOnSelect={true}
>
Expand Down
7 changes: 3 additions & 4 deletions packages/common/src/components/Filter/EnumFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useMemo, useState } from 'react';

import { ToolbarChip, ToolbarFilter } from '@patternfly/react-core';
import {
Select,
SelectOption,
SelectOptionObject,
SelectVariant,
ToolbarChip,
ToolbarFilter,
} from '@patternfly/react-core';
} from '@patternfly/react-core/deprecated';

import { localeCompare, SelectEventType, SelectValueType, ToggleEventType } from '../../utils';

Expand Down Expand Up @@ -185,7 +184,7 @@ export const EnumFilter = ({
selections={selectedUniqueEnumLabels}
placeholderText={placeholderLabel}
isOpen={isExpanded}
onToggle={onToggle}
onToggle={(e, v) => onToggle(v, e)}
hasInlineFilter={hasInlineFilter}
onFilter={onFilter}
>
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/components/Filter/GroupedEnumFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useState } from 'react';

import { ToolbarFilter } from '@patternfly/react-core';
import {
Select,
SelectGroup,
SelectOption,
SelectOptionObject,
SelectVariant,
ToolbarFilter,
} from '@patternfly/react-core';
} from '@patternfly/react-core/deprecated';

import { EnumValue, SelectEventType, SelectValueType, ToggleEventType } from '../../utils';

Expand Down Expand Up @@ -166,7 +166,7 @@ export const GroupedEnumFilter = ({
.map(toSelectOption)}
placeholderText={placeholderLabel}
isOpen={isExpanded}
onToggle={onToggle}
onToggle={(e, v) => onToggle(v, e)}
hasInlineFilter={hasInlineFilter}
onFilter={onFilter}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/components/Filter/SwitchFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const SwitchFilter = ({
<Switch
label={placeholderLabel}
isChecked={selectedFilters.length === 1 && selectedFilters[0] === 'true'}
onChange={onChange}
onChange={(e, v) => onChange(v, e)}
/>
</ToolbarItem>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cleanup, renderHook } from '@testing-library/react-hooks';
import { cleanup, renderHook } from '@testing-library/react';

import { useUnique } from '../EnumFilter';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useState } from 'react';

import { ToolbarGroup, ToolbarItem } from '@patternfly/react-core';
import {
Select,
SelectOption,
SelectOptionObject,
SelectVariant,
ToolbarGroup,
ToolbarItem,
} from '@patternfly/react-core';
} from '@patternfly/react-core/deprecated';

import { SelectEventType, SelectValueType, ToggleEventType } from '../../utils';

Expand Down Expand Up @@ -66,7 +65,7 @@ export const AttributeValueFilter = ({
<ToolbarItem>
<Select
onSelect={onFilterTypeSelect}
onToggle={onToggle}
onToggle={(e, v) => onToggle(v, e)}
isOpen={expanded}
variant={SelectVariant.single}
aria-label={'Select Filter'}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { act, cleanup, renderHook } from '@testing-library/react-hooks';
import { act } from 'react';

import { cleanup, renderHook } from '@testing-library/react';

import { NAME } from '../../../utils';
import { useUrlFilters } from '../useUrlFilters';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const FormGroupWithHelpText: React.FC<FormGroupWithHelpTextProps> = ({
role={role}
>
{children}
<FormHelperText isHidden={false}>
<FormHelperText hidden={false}>
<HelperText>
<HelperTextItem variant={variant}>{helperTextMsg}</HelperTextItem>
</HelperText>
Expand Down
33 changes: 18 additions & 15 deletions packages/common/src/components/Page/PageStates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import React, { ComponentType } from 'react';
import {
Button,
EmptyState,
EmptyStateActions,
EmptyStateBody,
EmptyStateFooter,
EmptyStateHeader,
EmptyStateIcon,
EmptyStatePrimary,
Spinner,
Title,
} from '@patternfly/react-core';
Expand All @@ -20,8 +22,8 @@ import { ExclamationCircleIcon, SearchIcon } from '@patternfly/react-icons';
export const BaseState = ({
title,
Icon,
color,
Component,
color,
}: {
title?: string;
Icon?: ComponentType;
Expand All @@ -30,15 +32,14 @@ export const BaseState = ({
}) => {
return (
<EmptyState>
<EmptyStateIcon
component={Component}
icon={Icon}
color={color}
variant={Component ? 'container' : 'icon'}
<EmptyStateHeader
titleText={title}
headingLevel="h4"
icon={<EmptyStateIcon icon={Icon} color={color} />}
/>
<Title headingLevel="h4" size="lg">
{title}
</Title>
<EmptyStateBody>
<Component />
</EmptyStateBody>
</EmptyState>
);
};
Expand Down Expand Up @@ -79,11 +80,13 @@ export const NoResultsMatchFilter = ({
{title}
</Title>
<EmptyStateBody>{description}</EmptyStateBody>
<EmptyStatePrimary>
<Button variant="link" onClick={clearAllFilters}>
{clearAllLabel}
</Button>
</EmptyStatePrimary>
<EmptyStateFooter>
<EmptyStateActions>
<Button variant="link" onClick={clearAllFilters}>
{clearAllLabel}
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
);
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { act, cleanup, renderHook } from '@testing-library/react-hooks';
import { act } from 'react';

import { cleanup, renderHook } from '@testing-library/react';

import { NAME, NAMESPACE } from '../../../utils';
import { useFields } from '../useFields';
Expand Down
2 changes: 0 additions & 2 deletions packages/common/src/components/TableView/DefaultHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export function DefaultHeader<T>({
setActiveSort,
})
}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}
>
{label}
</Th>
Expand Down
9 changes: 2 additions & 7 deletions packages/common/src/components/TableView/DefaultRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ import { RowProps } from './types';
*/
export function DefaultRow<T>({ resourceFields, resourceData }: RowProps<T>) {
return (
<Tr onPointerEnterCapture={undefined} onPointerLeaveCapture={undefined}>
<Tr>
{resourceFields?.map(({ resourceFieldId, label }) => (
<Td
key={resourceFieldId}
dataLabel={label}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}
>
<Td key={resourceFieldId} dataLabel={label}>
{String(getResourceFieldValue(resourceData, resourceFieldId, resourceFields) ?? '')}
</Td>
))}
Expand Down
Loading

0 comments on commit 3ac4fd3

Please sign in to comment.