Skip to content

Commit 9c61834

Browse files
committed
Move common package into forklift
Signed-off-by: Aviv Turgeman <[email protected]>
1 parent c16eb10 commit 9c61834

File tree

168 files changed

+261
-2148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+261
-2148
lines changed

package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@
77
"repository": "https://github.com/kubev2v/forklift-console-plugin.git",
88
"workspaces": [
99
"packages/eslint-plugin",
10-
"packages/common",
1110
"packages/forklift-console-plugin"
1211
],
1312
"scripts": {
14-
"clean": "rm -rf ./dist ./coverage && yarn workspace @kubev2v/common run clean && yarn workspace @kubev2v/forklift-console-plugin run clean",
13+
"clean": "rm -rf ./dist ./coverage && yarn workspace @kubev2v/forklift-console-plugin run clean",
1514
"clean:all": "yarn run clean && rm -rf ./node_modules ./tmp",
16-
"build": "NODE_ENV=production yarn workspace @kubev2v/common run build && NODE_ENV=production yarn workspace @kubev2v/forklift-console-plugin run build",
17-
"start": "concurrently \"NODE_ENV=development yarn workspace @kubev2v/common run start\" \"NODE_ENV=development yarn workspace @kubev2v/forklift-console-plugin run start\"",
15+
"build": "NODE_ENV=production yarn workspace @kubev2v/forklift-console-plugin run build",
16+
"start": "NODE_ENV=development yarn workspace @kubev2v/forklift-console-plugin run start",
1817
"i18n": "yarn workspace @kubev2v/forklift-console-plugin run i18n",
1918
"lint": "yarn workspaces run lint",
2019
"lint:fix": "yarn workspaces run lint:fix",
2120
"test:i18n": "bash ./ci/test-i18n.sh",
22-
"test": "yarn workspace @kubev2v/common run build && yarn workspaces run test",
23-
"test:coverage": "yarn workspace @kubev2v/common run build && yarn workspaces run test:coverage",
24-
"test:updateSnapshot": "yarn workspace @kubev2v/common run build && yarn workspaces run test:updateSnapshot",
21+
"test": "yarn workspaces run test",
22+
"test:coverage": "yarn workspaces run test:coverage",
23+
"test:updateSnapshot": "yarn workspaces run test:updateSnapshot",
2524
"test:e2e": "cd testing && cypress run --browser chrome --headed",
2625
"console": "bash ./ci/start-console.sh",
2726
"console:stop": "bash ./ci/stop-console.sh",

packages/common/rollup.config.js

-37
This file was deleted.

packages/common/src/components/Icons/RedHatProgressionIcon.tsx

-19
This file was deleted.

packages/common/src/components/Icons/index.ts

-3
This file was deleted.

packages/common/src/components/QueryClientHoc/QueryClientHoc.tsx

-32
This file was deleted.

packages/common/src/components/QueryClientHoc/index.ts

-3
This file was deleted.

packages/common/src/index.ts

-5
This file was deleted.

packages/forklift-console-plugin/jest.config.ts

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ const moduleNameMapper = {
1515
...pathsToModuleNameMapper(compilerOptions.paths, {
1616
prefix: '<rootDir>/',
1717
}),
18-
19-
// Mappings for monorepo packages
20-
'@kubev2v/common/(.*)$': '<rootDir>/../common/dist/$1',
2118
};
2219

2320
// Sync object

packages/forklift-console-plugin/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"test:updateSnapshot": "TZ=UTC jest --updateSnapshot"
2929
},
3030
"dependencies": {
31-
"@kubev2v/common": "*",
3231
"@kubev2v/types": "0.0.20",
3332
"@openshift-console/dynamic-plugin-sdk": "1.8.0",
3433
"@patternfly/react-charts": "7.4.1",

packages/forklift-console-plugin/src/components/TableSortContext.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { createContext, FC, PropsWithChildren, useContext } from 'react';
22

3-
import { ResourceField, SortType, useSort } from '@kubev2v/common';
3+
import { useSort } from './common/components/TableView/sort';
4+
import { SortType } from './common/components/TableView/types';
5+
import { ResourceField } from './common/utils/types';
46

57
export type TableSortContextProps = {
68
activeSort: SortType;

packages/forklift-console-plugin/src/components/common/ProjectNameSelect.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { FC, ReactNode } from 'react';
22
import { useForkliftTranslation } from 'src/utils';
33

4-
import { FormGroupWithHelpText, TypeaheadSelect, TypeaheadSelectOption } from '@kubev2v/common';
54
import {
65
K8sResourceKind,
76
useFlag,
@@ -10,6 +9,12 @@ import {
109
import { Popover } from '@patternfly/react-core';
1110
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
1211

12+
import { FormGroupWithHelpText } from './components/FormGroupWithHelpText/FormGroupWithHelpText';
13+
import {
14+
TypeaheadSelect,
15+
TypeaheadSelectOption,
16+
} from './components/TypeaheadSelect/TypeaheadSelect';
17+
1318
interface ProjectNameSelectProps {
1419
value: string | undefined;
1520
options: TypeaheadSelectOption[];

packages/common/src/components/index.ts packages/forklift-console-plugin/src/components/common/components/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ export * from './Filter';
44
export * from './FilterGroup';
55
export * from './FormGroupWithHelpText';
66
export * from './HelpIconPopover';
7-
export * from './Icons';
87
export * from './LoadingDots';
98
export * from './Page';
10-
export * from './QueryClientHoc';
119
export * from './TableView';
1210
export * from './TypeaheadSelect';
1311
// @endindex

packages/forklift-console-plugin/src/components/page/ManageColumnsToolbar.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { useState } from 'react';
22
import { useForkliftTranslation } from 'src/utils/i18n';
33

4-
import { ManageColumnsModal, ManageColumnsToolbarItem } from '@kubev2v/common';
5-
import { ResourceField } from '@kubev2v/common';
4+
import { ManageColumnsModal } from '../common/components/TableView/ManageColumnsModal';
5+
import { ManageColumnsToolbarItem } from '../common/components/TableView/ManageColumnsToolbarItem';
6+
import { ResourceField } from '../common/utils/types';
67

78
export interface ManageColumnsToolbarProps {
89
/** Read only. State maintained by parent component. */

packages/forklift-console-plugin/src/components/page/StandardPage.tsx

+25-27
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,6 @@
11
import React, { FC, ReactNode, useEffect, useMemo, useState } from 'react';
22
import { useForkliftTranslation } from 'src/utils/i18n';
33

4-
import {
5-
AttributeValueFilter,
6-
createMetaMatcher,
7-
DEFAULT_PER_PAGE,
8-
DefaultHeader,
9-
DefaultRow,
10-
defaultSupportedFilters,
11-
defaultValueMatchers,
12-
ErrorState,
13-
FilterGroup,
14-
FilterRenderer,
15-
GlobalActionToolbarProps,
16-
Loading,
17-
NoResultsFound,
18-
NoResultsMatchFilter,
19-
ResourceField,
20-
RowProps,
21-
TableView,
22-
TableViewHeaderProps,
23-
toFieldFilter,
24-
useFields,
25-
usePagination,
26-
UserSettings,
27-
useUrlFilters,
28-
ValueMatcher,
29-
withTr,
30-
} from '@kubev2v/common';
314
import {
325
Level,
336
LevelItem,
@@ -41,6 +14,31 @@ import {
4114
} from '@patternfly/react-core';
4215
import { FilterIcon } from '@patternfly/react-icons';
4316

17+
import { AttributeValueFilter } from '../common/components/FilterGroup/AttributeValueFilter';
18+
import { FilterGroup } from '../common/components/FilterGroup/FilterGroup';
19+
import { toFieldFilter } from '../common/components/FilterGroup/helpers';
20+
import {
21+
createMetaMatcher,
22+
defaultSupportedFilters,
23+
defaultValueMatchers,
24+
} from '../common/components/FilterGroup/matchers';
25+
import { FilterRenderer, ValueMatcher } from '../common/components/FilterGroup/types';
26+
import { useUrlFilters } from '../common/components/FilterGroup/useUrlFilters';
27+
import {
28+
ErrorState,
29+
Loading,
30+
NoResultsFound,
31+
NoResultsMatchFilter,
32+
} from '../common/components/Page/PageStates';
33+
import { UserSettings } from '../common/components/Page/types';
34+
import { useFields } from '../common/components/Page/useFields';
35+
import { DEFAULT_PER_PAGE, usePagination } from '../common/components/Page/usePagination';
36+
import { DefaultHeader } from '../common/components/TableView/DefaultHeader';
37+
import { DefaultRow } from '../common/components/TableView/DefaultRow';
38+
import { TableView } from '../common/components/TableView/TableView';
39+
import { RowProps, TableViewHeaderProps } from '../common/components/TableView/types';
40+
import { withTr } from '../common/components/TableView/withTr';
41+
import { GlobalActionToolbarProps, ResourceField } from '../common/utils/types';
4442
import {
4543
TableSortContext,
4644
TableSortContextProps,

packages/forklift-console-plugin/src/components/page/StandardPageWithSelection.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import React, { FC, useState } from 'react';
22

3-
import {
4-
DefaultHeader,
5-
GlobalActionToolbarProps,
6-
RowProps,
7-
TableViewHeaderProps,
8-
withTr,
9-
} from '@kubev2v/common';
103
import { Td, Th } from '@patternfly/react-table';
114

5+
import { DefaultHeader } from '../common/components/TableView/DefaultHeader';
6+
import { RowProps, TableViewHeaderProps } from '../common/components/TableView/types';
7+
import { withTr } from '../common/components/TableView/withTr';
8+
import { GlobalActionToolbarProps } from '../common/utils/types';
9+
1210
import StandardPage, { StandardPageProps } from './StandardPage';
1311

1412
export function withRowSelection<T>({

packages/forklift-console-plugin/src/modules/NetworkMaps/components/NetworkMapsEmptyState.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getResourceUrl } from 'src/modules/Providers/utils';
66
import { useHasSufficientProviders } from 'src/utils/fetch';
77
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';
88

9-
import { ExternalLink } from '@kubev2v/common';
9+
import { ExternalLink } from '@forklift/common/components/ExternalLink/ExternalLink';
1010
import { ProviderModelRef } from '@kubev2v/types';
1111
import { Button, Flex, FlexItem } from '@patternfly/react-core';
1212

packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/MapsSection/components/MapsEdit.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ReactNode, useState } from 'react';
22
import { DetailsItem } from 'src/modules/Providers/utils';
33

4-
import { FormGroupWithHelpText } from '@kubev2v/common';
4+
import { FormGroupWithHelpText } from '@forklift/common/components/FormGroupWithHelpText/FormGroupWithHelpText';
55
import { ProviderModelGroupVersionKind, V1beta1Provider } from '@kubev2v/types';
66
import { ResourceLink } from '@openshift-console/dynamic-plugin-sdk';
77
import { Form, FormSelect, FormSelectOption } from '@patternfly/react-core';

packages/forklift-console-plugin/src/modules/NetworkMaps/views/details/components/ProvidersSection/components/ProvidersEdit.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ReactNode } from 'react';
22
import { DetailsItem } from 'src/modules/Providers/utils';
33

4-
import { FormGroupWithHelpText } from '@kubev2v/common';
4+
import { FormGroupWithHelpText } from '@forklift/common/components/FormGroupWithHelpText/FormGroupWithHelpText';
55
import { ProviderModelGroupVersionKind, V1beta1Provider } from '@kubev2v/types';
66
import { ResourceLink } from '@openshift-console/dynamic-plugin-sdk';
77
import { Form, FormSelect, FormSelectOption } from '@patternfly/react-core';

packages/forklift-console-plugin/src/modules/NetworkMaps/views/list/NetworkMapRow.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22

3-
import { ResourceField, RowProps } from '@kubev2v/common';
3+
import { RowProps } from '@forklift/common/components/TableView/types';
4+
import { ResourceField } from '@forklift/common/utils/types';
45
import { Td, Tr } from '@patternfly/react-table';
56

67
import { NetworkMapActionsDropdown } from '../../actions';

packages/forklift-console-plugin/src/modules/NetworkMaps/views/list/NetworkMapsListPage.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import StandardPage from 'src/components/page/StandardPage';
33
import { useGetDeleteAndEditAccessReview } from 'src/modules/Providers/hooks';
44
import { useForkliftTranslation } from 'src/utils/i18n';
55

6-
import { EnumToTuple, loadUserSettings, ResourceFieldFactory } from '@kubev2v/common';
6+
import { EnumToTuple } from '@forklift/common/components/FilterGroup/helpers';
7+
import { loadUserSettings } from '@forklift/common/components/Page/userSettings';
8+
import { ResourceFieldFactory } from '@forklift/common/utils/types';
79
import {
810
NetworkMapModel,
911
NetworkMapModelGroupVersionKind,

packages/forklift-console-plugin/src/modules/NetworkMaps/views/list/components/CellProps.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NetworkMapData } from 'src/modules/NetworkMaps/utils';
22

3-
import { ResourceField } from '@kubev2v/common';
3+
import { ResourceField } from '@forklift/common/utils/types';
44

55
export type CellProps = {
66
data: NetworkMapData;

packages/forklift-console-plugin/src/modules/NetworkMaps/views/list/components/StatusCell.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
44
import { getResourceUrl, TableIconCell } from 'src/modules/Providers/utils';
55
import { useForkliftTranslation } from 'src/utils/i18n';
66

7-
import { getResourceFieldValue } from '@kubev2v/common';
7+
import { getResourceFieldValue } from '@forklift/common/components/FilterGroup/matchers';
88
import { NetworkMapModelRef } from '@kubev2v/types';
99
import { Button, Popover, Spinner, Text, TextContent, TextVariants } from '@patternfly/react-core';
1010
import { CheckCircleIcon, ExclamationCircleIcon } from '@patternfly/react-icons';

packages/forklift-console-plugin/src/modules/Overview/utils/helpers/OverviewUserSettings.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { loadFromLocalStorage, removeFromLocalStorage, saveToLocalStorage } from '@kubev2v/common';
1+
import {
2+
loadFromLocalStorage,
3+
removeFromLocalStorage,
4+
saveToLocalStorage,
5+
} from '@forklift/common/utils/localStorage';
26

37
export interface OverviewUserSettings {
48
welcome?: WelcomeSettings;

packages/forklift-console-plugin/src/modules/Plans/components/PlansEmptyState.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getResourceUrl } from 'src/modules/Providers/utils';
55
import { useHasSufficientProviders } from 'src/utils/fetch';
66
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';
77

8-
import { ExternalLink } from '@kubev2v/common';
8+
import { ExternalLink } from '@forklift/common/components/ExternalLink/ExternalLink';
99
import { ProviderModelRef } from '@kubev2v/types';
1010
import { Button, Flex, FlexItem } from '@patternfly/react-core';
1111

packages/forklift-console-plugin/src/modules/Plans/modals/DuplicateModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Validation } from 'src/modules/Providers/utils/types';
66
import { validateK8sName } from 'src/modules/Providers/utils/validators';
77
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';
88

9-
import { FormGroupWithHelpText } from '@kubev2v/common';
9+
import { FormGroupWithHelpText } from '@forklift/common/components/FormGroupWithHelpText/FormGroupWithHelpText';
1010
import {
1111
K8sResourceCommon,
1212
NetworkMapModel,

packages/forklift-console-plugin/src/modules/Plans/views/create/components/PlanCreateForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { CreateVmMigrationPageState } from 'src/modules/Providers/views/migrate/types';
1313
import { ForkliftTrans, useForkliftTranslation } from 'src/utils';
1414

15-
import { FormGroupWithHelpText } from '@kubev2v/common';
15+
import { FormGroupWithHelpText } from '@forklift/common/components/FormGroupWithHelpText/FormGroupWithHelpText';
1616
import { V1beta1Provider } from '@kubev2v/types';
1717
import {
1818
Flex,

0 commit comments

Comments
 (0)