@patternfly/quickstarts 6.3.0-prerelease.2 → 6.3.0-prerelease.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConsoleInternal/components/markdown-view.d.ts +2 -2
- package/dist/ConsoleInternal/components/utils/camel-case-wrap.d.ts +1 -1
- package/dist/ConsoleInternal/components/utils/status-box.d.ts +3 -3
- package/dist/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.d.ts +3 -3
- package/dist/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.d.ts +2 -2
- package/dist/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.d.ts +2 -2
- package/dist/ConsoleShared/src/components/modal/Modal.d.ts +3 -3
- package/dist/ConsoleShared/src/components/popper/Portal.d.ts +3 -3
- package/dist/ConsoleShared/src/components/popper/SimplePopper.d.ts +3 -3
- package/dist/ConsoleShared/src/components/spotlight/InteractiveSpotlight.d.ts +3 -2
- package/dist/ConsoleShared/src/components/spotlight/Spotlight.d.ts +2 -2
- package/dist/ConsoleShared/src/components/spotlight/StaticSpotlight.d.ts +3 -2
- package/dist/ConsoleShared/src/components/status/GenericStatus.d.ts +4 -4
- package/dist/ConsoleShared/src/components/status/NotStartedIcon.d.ts +1 -2
- package/dist/ConsoleShared/src/components/status/PopoverStatus.d.ts +4 -4
- package/dist/ConsoleShared/src/components/status/Status.d.ts +3 -3
- package/dist/ConsoleShared/src/components/status/StatusIconAndText.d.ts +3 -3
- package/dist/ConsoleShared/src/components/status/icons.d.ts +4 -4
- package/dist/ConsoleShared/src/components/status/statuses.d.ts +4 -4
- package/dist/ConsoleShared/src/components/utils/FallbackImg.d.ts +3 -3
- package/dist/ConsoleShared/src/utils/useCombineRefs.d.ts +2 -2
- package/dist/HelpTopicDrawer.d.ts +3 -3
- package/dist/HelpTopicPanelContent.d.ts +2 -2
- package/dist/QuickStartCatalogPage.d.ts +3 -3
- package/dist/QuickStartCloseModal.d.ts +2 -2
- package/dist/QuickStartContainer.d.ts +2 -2
- package/dist/QuickStartController.d.ts +2 -2
- package/dist/QuickStartDrawer.d.ts +2 -2
- package/dist/QuickStartDrawerContent.d.ts +2 -2
- package/dist/QuickStartMarkdownView.d.ts +2 -2
- package/dist/QuickStartPanelContent.d.ts +2 -2
- package/dist/catalog/Catalog/QuickStartCatalogHeader.d.ts +2 -2
- package/dist/catalog/Catalog/QuickStartCatalogSection.d.ts +2 -2
- package/dist/catalog/Catalog/QuickStartCatalogToolbar.d.ts +2 -2
- package/dist/catalog/QuickStartCatalog.d.ts +2 -2
- package/dist/catalog/QuickStartTile.d.ts +2 -2
- package/dist/catalog/QuickStartTileDescription.d.ts +2 -2
- package/dist/catalog/QuickStartTileFooter.d.ts +2 -2
- package/dist/catalog/QuickStartTileFooterExternal.d.ts +2 -2
- package/dist/catalog/QuickStartTileHeader.d.ts +2 -2
- package/dist/catalog/Toolbar/QuickStartCatalogFilter.d.ts +2 -2
- package/dist/catalog/Toolbar/QuickStartCatalogFilterItems.d.ts +7 -7
- package/dist/controller/QuickStartConclusion.d.ts +2 -2
- package/dist/controller/QuickStartContent.d.ts +2 -2
- package/dist/controller/QuickStartFooter.d.ts +2 -2
- package/dist/controller/QuickStartIntroduction.d.ts +2 -2
- package/dist/controller/QuickStartTaskHeader.d.ts +2 -2
- package/dist/controller/QuickStartTaskHeaderList.d.ts +2 -2
- package/dist/controller/QuickStartTaskReview.d.ts +2 -2
- package/dist/controller/QuickStartTasks.d.ts +2 -2
- package/dist/index.es.js +299 -459
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +310 -472
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-base.css +61 -0
- package/dist/quickstarts-full.es.js +1693 -511
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts.css +61 -0
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/help-topic-context.d.ts +2 -2
- package/dist/utils/quick-start-context.d.ts +3 -3
- package/package.json +3 -4
- package/src/ConsoleInternal/components/markdown-view.tsx +20 -18
- package/src/ConsoleInternal/components/utils/camel-case-wrap.tsx +3 -3
- package/src/ConsoleInternal/components/utils/status-box.tsx +4 -4
- package/src/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.tsx +8 -15
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/MarkdownCopyClipboard.spec.tsx +0 -1
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-extension.tsx +2 -2
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.tsx +4 -4
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +2 -2
- package/src/ConsoleShared/src/components/markdown-extensions/code-extension.tsx +2 -2
- package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +3 -3
- package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +3 -3
- package/src/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.tsx +5 -5
- package/src/ConsoleShared/src/components/modal/Modal.tsx +3 -3
- package/src/ConsoleShared/src/components/popper/Portal.tsx +5 -5
- package/src/ConsoleShared/src/components/popper/SimplePopper.tsx +15 -15
- package/src/ConsoleShared/src/components/spotlight/InteractiveSpotlight.tsx +6 -5
- package/src/ConsoleShared/src/components/spotlight/Spotlight.tsx +3 -3
- package/src/ConsoleShared/src/components/spotlight/StaticSpotlight.tsx +4 -3
- package/src/ConsoleShared/src/components/spotlight/spotlight.scss +63 -0
- package/src/ConsoleShared/src/components/status/GenericStatus.tsx +5 -5
- package/src/ConsoleShared/src/components/status/NotStartedIcon.tsx +0 -1
- package/src/ConsoleShared/src/components/status/PopoverStatus.tsx +4 -4
- package/src/ConsoleShared/src/components/status/Status.tsx +3 -11
- package/src/ConsoleShared/src/components/status/StatusIconAndText.tsx +6 -6
- package/src/ConsoleShared/src/components/status/icons.tsx +4 -8
- package/src/ConsoleShared/src/components/status/statuses.tsx +4 -5
- package/src/ConsoleShared/src/components/utils/FallbackImg.tsx +4 -4
- package/src/ConsoleShared/src/hooks/scroll.ts +4 -4
- package/src/ConsoleShared/src/hooks/useBoundingClientRect.ts +3 -3
- package/src/ConsoleShared/src/hooks/useForceRender.ts +2 -2
- package/src/ConsoleShared/src/hooks/useResizeObserver.ts +3 -6
- package/src/ConsoleShared/src/hooks/useScrollShadows.ts +4 -4
- package/src/ConsoleShared/src/utils/useCombineRefs.ts +4 -4
- package/src/HelpTopicDrawer.tsx +6 -6
- package/src/HelpTopicPanelContent.tsx +4 -4
- package/src/QuickStartCatalogPage.tsx +9 -9
- package/src/QuickStartCloseModal.tsx +3 -7
- package/src/QuickStartContainer.tsx +4 -4
- package/src/QuickStartController.tsx +11 -11
- package/src/QuickStartDrawer.tsx +6 -6
- package/src/QuickStartDrawerContent.tsx +3 -3
- package/src/QuickStartMarkdownView.tsx +3 -3
- package/src/QuickStartPanelContent.tsx +8 -8
- package/src/catalog/Catalog/QuickStartCatalogHeader.tsx +2 -2
- package/src/catalog/Catalog/QuickStartCatalogSection.tsx +2 -2
- package/src/catalog/Catalog/QuickStartCatalogToolbar.tsx +2 -2
- package/src/catalog/QuickStartCatalog.tsx +3 -3
- package/src/catalog/QuickStartTile.tsx +4 -4
- package/src/catalog/QuickStartTileDescription.tsx +4 -4
- package/src/catalog/QuickStartTileFooter.tsx +6 -6
- package/src/catalog/QuickStartTileFooterExternal.tsx +2 -5
- package/src/catalog/QuickStartTileHeader.tsx +2 -6
- package/src/catalog/Toolbar/QuickStartCatalogFilter.tsx +2 -2
- package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +16 -16
- package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +0 -1
- package/src/catalog/__tests__/QuickStartTile.spec.tsx +0 -1
- package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +1 -2
- package/src/controller/QuickStartConclusion.tsx +3 -3
- package/src/controller/QuickStartContent.tsx +2 -2
- package/src/controller/QuickStartFooter.tsx +10 -11
- package/src/controller/QuickStartIntroduction.tsx +4 -4
- package/src/controller/QuickStartTaskHeader.tsx +5 -5
- package/src/controller/QuickStartTaskHeaderList.tsx +2 -2
- package/src/controller/QuickStartTaskReview.tsx +4 -4
- package/src/controller/QuickStartTasks.tsx +5 -5
- package/src/controller/__tests__/QuickStartConclusion.spec.tsx +3 -3
- package/src/controller/__tests__/QuickStartContent.spec.tsx +2 -2
- package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +2 -2
- package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +2 -2
- package/src/utils/help-topic-context.tsx +7 -10
- package/src/utils/quick-start-context.tsx +11 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useCallback, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
Content,
|
|
@@ -28,11 +28,11 @@ export interface QuickStartCatalogPageProps {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const QuickStartCatalogEmptyState = ({ clearFilters }) => {
|
|
31
|
-
const { getResource } =
|
|
31
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
32
32
|
return (
|
|
33
33
|
<EmptyState
|
|
34
34
|
headingLevel="h4"
|
|
35
|
-
icon={SearchIcon}
|
|
35
|
+
icon={SearchIcon as any}
|
|
36
36
|
titleText={<>{getResource('No results found')}</>}
|
|
37
37
|
>
|
|
38
38
|
<EmptyStateBody>
|
|
@@ -52,7 +52,7 @@ export const QuickStartCatalogEmptyState = ({ clearFilters }) => {
|
|
|
52
52
|
);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export const QuickStartCatalogPage:
|
|
55
|
+
export const QuickStartCatalogPage: FC<QuickStartCatalogPageProps> = ({
|
|
56
56
|
quickStarts,
|
|
57
57
|
showFilter,
|
|
58
58
|
sortFnc = (q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName),
|
|
@@ -60,7 +60,7 @@ export const QuickStartCatalogPage: React.FC<QuickStartCatalogPageProps> = ({
|
|
|
60
60
|
hint,
|
|
61
61
|
showTitle = true,
|
|
62
62
|
}) => {
|
|
63
|
-
const sortFncCallback =
|
|
63
|
+
const sortFncCallback = useCallback(sortFnc, [sortFnc]);
|
|
64
64
|
const {
|
|
65
65
|
allQuickStarts = [],
|
|
66
66
|
setAllQuickStarts,
|
|
@@ -69,9 +69,9 @@ export const QuickStartCatalogPage: React.FC<QuickStartCatalogPageProps> = ({
|
|
|
69
69
|
filter,
|
|
70
70
|
setFilter,
|
|
71
71
|
loading,
|
|
72
|
-
} =
|
|
72
|
+
} = useContext<QuickStartContextValues>(QuickStartContext);
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
useEffect(() => {
|
|
75
75
|
// passed through prop, not context
|
|
76
76
|
if (quickStarts && JSON.stringify(quickStarts) !== JSON.stringify(allQuickStarts)) {
|
|
77
77
|
setAllQuickStarts(quickStarts);
|
|
@@ -87,8 +87,8 @@ export const QuickStartCatalogPage: React.FC<QuickStartCatalogPageProps> = ({
|
|
|
87
87
|
).sort(sortFncCallback)
|
|
88
88
|
: allQuickStarts;
|
|
89
89
|
|
|
90
|
-
const [filteredQuickStarts, setFilteredQuickStarts] =
|
|
91
|
-
|
|
90
|
+
const [filteredQuickStarts, setFilteredQuickStarts] = useState(initialFilteredQuickStarts);
|
|
91
|
+
useEffect(() => {
|
|
92
92
|
const filteredQs = showFilter
|
|
93
93
|
? filterQuickStarts(
|
|
94
94
|
allQuickStarts,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useContext } from 'react';
|
|
2
2
|
import { Button, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
3
|
import { ModalVariant } from '@patternfly/react-core/deprecated';
|
|
4
4
|
import { Modal } from '@console/shared';
|
|
@@ -10,12 +10,8 @@ interface QuickStartCloseModalProps {
|
|
|
10
10
|
onCancel: () => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const QuickStartCloseModal:
|
|
14
|
-
|
|
15
|
-
onConfirm,
|
|
16
|
-
onCancel,
|
|
17
|
-
}) => {
|
|
18
|
-
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
13
|
+
const QuickStartCloseModal: FC<QuickStartCloseModalProps> = ({ isOpen, onConfirm, onCancel }) => {
|
|
14
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
19
15
|
return (
|
|
20
16
|
<Modal
|
|
21
17
|
isOpen={isOpen}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
QuickStartContext,
|
|
4
4
|
QuickStartContextValues,
|
|
@@ -58,7 +58,7 @@ export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement
|
|
|
58
58
|
isManagedDrawer?: boolean;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export const QuickStartContainer:
|
|
61
|
+
export const QuickStartContainer: FC<QuickStartContainerProps> = ({
|
|
62
62
|
quickStarts,
|
|
63
63
|
children,
|
|
64
64
|
activeQuickStartID,
|
|
@@ -105,7 +105,7 @@ export const QuickStartContainer: React.FC<QuickStartContainerProps> = ({
|
|
|
105
105
|
...contextProps,
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
useEffect(() => {
|
|
109
109
|
if (
|
|
110
110
|
quickStarts &&
|
|
111
111
|
JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)
|
|
@@ -114,7 +114,7 @@ export const QuickStartContainer: React.FC<QuickStartContainerProps> = ({
|
|
|
114
114
|
}
|
|
115
115
|
}, [quickStarts, valuesForQuickstartContext]);
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
useEffect(() => {
|
|
118
118
|
if (loading !== valuesForQuickstartContext.loading) {
|
|
119
119
|
valuesForQuickstartContext.setLoading(loading);
|
|
120
120
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useCallback, useContext, useEffect } from 'react';
|
|
2
2
|
import QuickStartContent from './controller/QuickStartContent';
|
|
3
3
|
import QuickStartFooter from './controller/QuickStartFooter';
|
|
4
4
|
import {
|
|
@@ -19,7 +19,7 @@ interface QuickStartControllerProps {
|
|
|
19
19
|
contentRef?: React.Ref<HTMLDivElement>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const QuickStartController:
|
|
22
|
+
export const QuickStartController: FC<QuickStartControllerProps> = ({
|
|
23
23
|
quickStart,
|
|
24
24
|
nextQuickStarts,
|
|
25
25
|
contentRef,
|
|
@@ -40,8 +40,8 @@ export const QuickStartController: React.FC<QuickStartControllerProps> = ({
|
|
|
40
40
|
setQuickStartTaskStatus,
|
|
41
41
|
nextStep,
|
|
42
42
|
previousStep,
|
|
43
|
-
} =
|
|
44
|
-
|
|
43
|
+
} = useContext<QuickStartContextValues>(QuickStartContext);
|
|
44
|
+
useEffect(() => {
|
|
45
45
|
// If activeQuickStartID was changed through prop from QuickStartContainer, need to init the state if it does not exist yet
|
|
46
46
|
if (activeQuickStartID && !allQuickStartStates[activeQuickStartID]) {
|
|
47
47
|
setAllQuickStartStates({
|
|
@@ -57,17 +57,17 @@ export const QuickStartController: React.FC<QuickStartControllerProps> = ({
|
|
|
57
57
|
(task, index) => activeQuickStartState[`taskStatus${index}`],
|
|
58
58
|
) as QuickStartTaskStatus[];
|
|
59
59
|
|
|
60
|
-
const handleQuickStartChange =
|
|
60
|
+
const handleQuickStartChange = useCallback(
|
|
61
61
|
(quickStartId: string) => setActiveQuickStart(quickStartId),
|
|
62
62
|
[setActiveQuickStart],
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
const handleTaskStatusChange =
|
|
65
|
+
const handleTaskStatusChange = useCallback(
|
|
66
66
|
(newTaskStatus: QuickStartTaskStatus) => setQuickStartTaskStatus(newTaskStatus),
|
|
67
67
|
[setQuickStartTaskStatus],
|
|
68
68
|
);
|
|
69
69
|
|
|
70
|
-
const getQuickStartActiveTask =
|
|
70
|
+
const getQuickStartActiveTask = useCallback(() => {
|
|
71
71
|
let activeTaskNumber = 0;
|
|
72
72
|
while (
|
|
73
73
|
activeTaskNumber !== totalTasks &&
|
|
@@ -78,12 +78,12 @@ export const QuickStartController: React.FC<QuickStartControllerProps> = ({
|
|
|
78
78
|
return activeTaskNumber;
|
|
79
79
|
}, [totalTasks, activeQuickStartState]);
|
|
80
80
|
|
|
81
|
-
const handleQuickStartContinue =
|
|
81
|
+
const handleQuickStartContinue = useCallback(() => {
|
|
82
82
|
const activeTaskNumber = getQuickStartActiveTask();
|
|
83
83
|
setQuickStartTaskNumber(name, activeTaskNumber);
|
|
84
84
|
}, [getQuickStartActiveTask, setQuickStartTaskNumber, name]);
|
|
85
85
|
|
|
86
|
-
const handleNext =
|
|
86
|
+
const handleNext = useCallback(() => {
|
|
87
87
|
if (status === QuickStartStatus.COMPLETE && taskNumber === totalTasks) {
|
|
88
88
|
return handleQuickStartChange('');
|
|
89
89
|
}
|
|
@@ -95,9 +95,9 @@ export const QuickStartController: React.FC<QuickStartControllerProps> = ({
|
|
|
95
95
|
return nextStep(totalTasks);
|
|
96
96
|
}, [handleQuickStartChange, nextStep, status, taskNumber, totalTasks, handleQuickStartContinue]);
|
|
97
97
|
|
|
98
|
-
const handleBack =
|
|
98
|
+
const handleBack = useCallback(() => previousStep(), [previousStep]);
|
|
99
99
|
|
|
100
|
-
const handleTaskSelect =
|
|
100
|
+
const handleTaskSelect = useCallback(
|
|
101
101
|
(selectedTaskNumber: number) => {
|
|
102
102
|
setQuickStartTaskNumber(name, selectedTaskNumber);
|
|
103
103
|
},
|
package/src/QuickStartDrawer.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import { Drawer, DrawerContent, DrawerContentBody } from '@patternfly/react-core';
|
|
3
3
|
import QuickStartCloseModal from './QuickStartCloseModal';
|
|
4
4
|
import QuickStartDrawerContent from './QuickStartDrawerContent';
|
|
@@ -19,7 +19,7 @@ export interface QuickStartDrawerProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
19
19
|
onCloseNotInProgress?: any;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const QuickStartDrawer:
|
|
22
|
+
export const QuickStartDrawer: FC<QuickStartDrawerProps> = ({
|
|
23
23
|
quickStarts = [],
|
|
24
24
|
children,
|
|
25
25
|
appendTo,
|
|
@@ -34,9 +34,9 @@ export const QuickStartDrawer: React.FC<QuickStartDrawerProps> = ({
|
|
|
34
34
|
allQuickStarts = [],
|
|
35
35
|
allQuickStartStates,
|
|
36
36
|
setAllQuickStartStates,
|
|
37
|
-
} =
|
|
37
|
+
} = useContext<QuickStartContextValues>(QuickStartContext);
|
|
38
38
|
const combinedQuickStarts = allQuickStarts.concat(quickStarts);
|
|
39
|
-
|
|
39
|
+
useEffect(() => {
|
|
40
40
|
const params = new URLSearchParams(window.location.search);
|
|
41
41
|
// if there is a quick start param, but the quick start is not active, set it
|
|
42
42
|
// this can happen if a new browser session is opened or an incognito window for example
|
|
@@ -50,7 +50,7 @@ export const QuickStartDrawer: React.FC<QuickStartDrawerProps> = ({
|
|
|
50
50
|
}
|
|
51
51
|
}, [activeQuickStartID, combinedQuickStarts, setActiveQuickStart]);
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
useEffect(() => {
|
|
54
54
|
// If activeQuickStartID was changed through prop from QuickStartContainer, need to init the state if it does not exist yet
|
|
55
55
|
if (activeQuickStartID && !allQuickStartStates[activeQuickStartID]) {
|
|
56
56
|
setAllQuickStartStates({
|
|
@@ -60,7 +60,7 @@ export const QuickStartDrawer: React.FC<QuickStartDrawerProps> = ({
|
|
|
60
60
|
}
|
|
61
61
|
}, [activeQuickStartID, allQuickStartStates, setAllQuickStartStates]);
|
|
62
62
|
|
|
63
|
-
const [modalOpen, setModalOpen] =
|
|
63
|
+
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
|
64
64
|
const onClose = () => setActiveQuickStart('');
|
|
65
65
|
const handleClose = (activeQuickStartStatus: string | number) => {
|
|
66
66
|
if (activeQuickStartStatus === QuickStartStatus.IN_PROGRESS) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useContext } from 'react';
|
|
2
2
|
import QuickStartPanelContent from './QuickStartPanelContent';
|
|
3
3
|
import { QuickStartContext, QuickStartContextValues } from './utils/quick-start-context';
|
|
4
4
|
import { QuickStart } from './utils/quick-start-types';
|
|
@@ -12,7 +12,7 @@ export interface QuickStartDrawerContentProps extends React.HTMLProps<HTMLDivEle
|
|
|
12
12
|
handleDrawerClose?: (quickStartStatus: string | number) => void;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const QuickStartDrawerContent:
|
|
15
|
+
export const QuickStartDrawerContent: FC<QuickStartDrawerContentProps> = ({
|
|
16
16
|
quickStarts = [],
|
|
17
17
|
appendTo,
|
|
18
18
|
fullWidth,
|
|
@@ -23,7 +23,7 @@ export const QuickStartDrawerContent: React.FC<QuickStartDrawerContentProps> = (
|
|
|
23
23
|
activeQuickStartID,
|
|
24
24
|
allQuickStarts = [],
|
|
25
25
|
activeQuickStartState,
|
|
26
|
-
} =
|
|
26
|
+
} = useContext<QuickStartContextValues>(QuickStartContext);
|
|
27
27
|
const combinedQuickStarts = allQuickStarts.concat(quickStarts);
|
|
28
28
|
|
|
29
29
|
const handleClose = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useContext } from 'react';
|
|
2
2
|
import { SyncMarkdownView } from '@console/internal/components/markdown-view';
|
|
3
3
|
import {
|
|
4
4
|
AccordionRenderExtension,
|
|
@@ -21,12 +21,12 @@ interface QuickStartMarkdownViewProps {
|
|
|
21
21
|
className?: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const QuickStartMarkdownView:
|
|
24
|
+
const QuickStartMarkdownView: FC<QuickStartMarkdownViewProps> = ({
|
|
25
25
|
content,
|
|
26
26
|
exactHeight,
|
|
27
27
|
className,
|
|
28
28
|
}) => {
|
|
29
|
-
const { markdown } =
|
|
29
|
+
const { markdown } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
30
30
|
const inlineCopyClipboardShowdownExtension = useInlineCopyClipboardShowdownExtension();
|
|
31
31
|
const multilineCopyClipboardShowdownExtension = useMultilineCopyClipboardShowdownExtension();
|
|
32
32
|
const admonitionShowdownExtension = useAdmonitionShowdownExtension();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CSSProperties, FC, useContext, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
DrawerActions,
|
|
4
4
|
DrawerCloseButton,
|
|
@@ -35,14 +35,14 @@ const getElement = (appendTo: HTMLElement | (() => HTMLElement)) => {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const useScrollTopOnTaskNumberChange = (node: HTMLElement, taskNumber: number): void => {
|
|
38
|
-
|
|
38
|
+
useEffect(() => {
|
|
39
39
|
if (node) {
|
|
40
40
|
node.scrollTo({ top: 0, behavior: 'smooth' });
|
|
41
41
|
}
|
|
42
42
|
}, [taskNumber, node]);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const QuickStartPanelContent:
|
|
45
|
+
const QuickStartPanelContent: FC<QuickStartPanelContentProps> = ({
|
|
46
46
|
quickStarts = [],
|
|
47
47
|
handleClose,
|
|
48
48
|
activeQuickStartID,
|
|
@@ -52,10 +52,10 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
52
52
|
footerClass,
|
|
53
53
|
...props
|
|
54
54
|
}) => {
|
|
55
|
-
const titleRef =
|
|
55
|
+
const titleRef = useRef(null);
|
|
56
56
|
const { getResource, activeQuickStartState, focusOnQuickStart } =
|
|
57
|
-
|
|
58
|
-
const [contentRef, setContentRef] =
|
|
57
|
+
useContext<QuickStartContextValues>(QuickStartContext);
|
|
58
|
+
const [contentRef, setContentRef] = useState<HTMLDivElement>();
|
|
59
59
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
60
60
|
const taskNumber = activeQuickStartState?.taskNumber;
|
|
61
61
|
useScrollTopOnTaskNumberChange(contentRef, taskNumber as number);
|
|
@@ -74,7 +74,7 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
74
74
|
return Number.parseInt(taskNumber as string) + 1;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
useEffect(() => {
|
|
78
78
|
if (focusOnQuickStart && quickStart) {
|
|
79
79
|
titleRef.current.focus();
|
|
80
80
|
}
|
|
@@ -86,7 +86,7 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
86
86
|
data-testid={`qs-drawer-${camelize(quickStart.spec.displayName)}`}
|
|
87
87
|
data-qs={`qs-step-${getStep()}`}
|
|
88
88
|
data-test="quickstart drawer"
|
|
89
|
-
style={{ '--pf-v6-c-drawer__panel--PaddingBlockStart': '0' } as
|
|
89
|
+
style={{ '--pf-v6-c-drawer__panel--PaddingBlockStart': '0' } as CSSProperties}
|
|
90
90
|
{...props}
|
|
91
91
|
>
|
|
92
92
|
<div className="pfext-quick-start-panel-content">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
2
|
import { Title } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export interface QuickStartCatalogHeaderProps {
|
|
@@ -6,7 +6,7 @@ export interface QuickStartCatalogHeaderProps {
|
|
|
6
6
|
hint?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const QuickStartCatalogHeader:
|
|
9
|
+
export const QuickStartCatalogHeader: FunctionComponent<QuickStartCatalogHeaderProps> = ({
|
|
10
10
|
title,
|
|
11
11
|
hint,
|
|
12
12
|
}) => (
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
|
|
3
3
|
export interface QuickStartCatalogSectionProps {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export const QuickStartCatalogSection:
|
|
7
|
+
export const QuickStartCatalogSection: FC<QuickStartCatalogSectionProps> = ({ children }) => (
|
|
8
8
|
<div>{children}</div>
|
|
9
9
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { Toolbar } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export interface QuickStartCatalogToolbarProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const QuickStartCatalogToolbar:
|
|
8
|
+
export const QuickStartCatalogToolbar: FC<QuickStartCatalogToolbarProps> = ({ children }) => (
|
|
9
9
|
<Toolbar>{children}</Toolbar>
|
|
10
10
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FunctionComponent, useContext } from 'react';
|
|
2
2
|
import { Gallery } from '@patternfly/react-core';
|
|
3
3
|
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
4
4
|
import { QuickStart } from '../utils/quick-start-types';
|
|
@@ -9,9 +9,9 @@ interface QuickStartCatalogProps {
|
|
|
9
9
|
quickStarts: QuickStart[];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const QuickStartCatalog:
|
|
12
|
+
const QuickStartCatalog: FunctionComponent<QuickStartCatalogProps> = ({ quickStarts }) => {
|
|
13
13
|
const { activeQuickStartID, allQuickStartStates } =
|
|
14
|
-
|
|
14
|
+
useContext<QuickStartContextValues>(QuickStartContext);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useContext, useMemo } from 'react';
|
|
2
2
|
import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
|
|
3
3
|
import { FallbackImg } from '@console/shared';
|
|
4
4
|
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
@@ -50,7 +50,7 @@ export interface QuickStartTileProps {
|
|
|
50
50
|
action?: QuickstartAction;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const QuickStartTile:
|
|
53
|
+
const QuickStartTile: FC<QuickStartTileProps> = ({
|
|
54
54
|
quickStart,
|
|
55
55
|
status,
|
|
56
56
|
isActive,
|
|
@@ -63,7 +63,7 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
|
63
63
|
} = quickStart;
|
|
64
64
|
|
|
65
65
|
const { setActiveQuickStart, footer, getResource } =
|
|
66
|
-
|
|
66
|
+
useContext<QuickStartContextValues>(QuickStartContext);
|
|
67
67
|
|
|
68
68
|
const statusColorMap = {
|
|
69
69
|
[QuickStartStatus.COMPLETE]: 'green',
|
|
@@ -102,7 +102,7 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
|
102
102
|
onClick();
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
const footerComponent =
|
|
105
|
+
const footerComponent = useMemo(() => {
|
|
106
106
|
if (footer && footer.show === false) {
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useContext, useRef } from 'react';
|
|
2
2
|
import { Button, Flex, Popover } from '@patternfly/react-core';
|
|
3
3
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
4
4
|
import QuickStartMarkdownView from '../QuickStartMarkdownView';
|
|
@@ -8,13 +8,13 @@ interface QuickStartTileDescriptionProps {
|
|
|
8
8
|
description: string;
|
|
9
9
|
prerequisites?: string[];
|
|
10
10
|
}
|
|
11
|
-
const QuickStartTileDescription:
|
|
11
|
+
const QuickStartTileDescription: FC<QuickStartTileDescriptionProps> = ({
|
|
12
12
|
description,
|
|
13
13
|
prerequisites,
|
|
14
14
|
}) => {
|
|
15
|
-
const { getResource } =
|
|
15
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
16
16
|
const prereqs = prerequisites?.filter((p) => p);
|
|
17
|
-
const buttonRef =
|
|
17
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, useCallback, useContext } from 'react';
|
|
2
2
|
import { Button, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
3
|
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
4
4
|
import { QuickStartStatus } from '../utils/quick-start-types';
|
|
@@ -12,21 +12,21 @@ interface QuickStartTileFooterProps {
|
|
|
12
12
|
) => void;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const QuickStartTileFooter:
|
|
15
|
+
const QuickStartTileFooter: FC<QuickStartTileFooterProps> = ({
|
|
16
16
|
quickStartId,
|
|
17
17
|
status,
|
|
18
18
|
totalTasks,
|
|
19
19
|
onClickContinue,
|
|
20
20
|
}) => {
|
|
21
|
-
const { getResource } =
|
|
21
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
22
22
|
const { activeQuickStartID, startQuickStart, restartQuickStart } =
|
|
23
|
-
|
|
23
|
+
useContext<QuickStartContextValues>(QuickStartContext);
|
|
24
24
|
|
|
25
|
-
const start =
|
|
25
|
+
const start = useCallback(() => {
|
|
26
26
|
startQuickStart(quickStartId, totalTasks);
|
|
27
27
|
}, [quickStartId, startQuickStart, totalTasks]);
|
|
28
28
|
|
|
29
|
-
const restart =
|
|
29
|
+
const restart = useCallback(() => {
|
|
30
30
|
restartQuickStart(quickStartId, totalTasks);
|
|
31
31
|
}, [quickStartId, restartQuickStart, totalTasks]);
|
|
32
32
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { Button, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
3
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
4
4
|
import { QuickStartExternal } from '../utils/quick-start-types';
|
|
@@ -8,10 +8,7 @@ interface QuickStartTileFooterProps {
|
|
|
8
8
|
quickStartId?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const QuickStartTileFooterExternal:
|
|
12
|
-
link,
|
|
13
|
-
quickStartId,
|
|
14
|
-
}) => {
|
|
11
|
+
const QuickStartTileFooterExternal: FC<QuickStartTileFooterProps> = ({ link, quickStartId }) => {
|
|
15
12
|
const { href, text } = link;
|
|
16
13
|
|
|
17
14
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { Button, Flex } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
interface QuickStartTileHeaderProps {
|
|
@@ -7,11 +7,7 @@ interface QuickStartTileHeaderProps {
|
|
|
7
7
|
onSelect: (e: React.FormEvent<HTMLInputElement> | React.MouseEvent<Element, MouseEvent>) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const QuickStartTileHeader:
|
|
11
|
-
name,
|
|
12
|
-
quickStartId,
|
|
13
|
-
onSelect,
|
|
14
|
-
}) => (
|
|
10
|
+
const QuickStartTileHeader: FC<QuickStartTileHeaderProps> = ({ name, quickStartId, onSelect }) => (
|
|
15
11
|
<Flex flexWrap={{ default: 'nowrap' }}>
|
|
16
12
|
<Button data-test="title" id={quickStartId} variant="link" isInline onClick={onSelect}>
|
|
17
13
|
{name}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { Toolbar, ToolbarContent, ToolbarProps } from '@patternfly/react-core';
|
|
3
3
|
import {
|
|
4
4
|
QuickStartCatalogFilterCountWrapper,
|
|
@@ -12,7 +12,7 @@ interface QuickStartCatalogFilterProps extends Omit<ToolbarProps, 'ref'> {
|
|
|
12
12
|
onStatusChange: any;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const QuickStartCatalogFilter:
|
|
15
|
+
const QuickStartCatalogFilter: FC<QuickStartCatalogFilterProps> = ({
|
|
16
16
|
quickStartsCount,
|
|
17
17
|
onSearchInputChange = () => {},
|
|
18
18
|
onStatusChange = () => {},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, Ref, useCallback, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Badge,
|
|
4
4
|
MenuToggle,
|
|
@@ -15,7 +15,7 @@ import { QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY } from '../.
|
|
|
15
15
|
import { QuickStartContext, QuickStartContextValues } from '../../utils/quick-start-context';
|
|
16
16
|
|
|
17
17
|
export const QuickStartCatalogFilterSearch = ({ searchInputText, handleTextChange, ...props }) => {
|
|
18
|
-
const { getResource } =
|
|
18
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
19
19
|
return (
|
|
20
20
|
<ToolbarItem>
|
|
21
21
|
<SearchInput
|
|
@@ -37,9 +37,9 @@ export const QuickStartCatalogFilterSelect = ({
|
|
|
37
37
|
dropdownItems,
|
|
38
38
|
...props
|
|
39
39
|
}) => {
|
|
40
|
-
const { getResource } =
|
|
40
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
41
41
|
|
|
42
|
-
const toggle = (toggleRef:
|
|
42
|
+
const toggle = (toggleRef: Ref<MenuToggleElement>) => (
|
|
43
43
|
<MenuToggle
|
|
44
44
|
isFullWidth
|
|
45
45
|
ref={toggleRef}
|
|
@@ -69,7 +69,7 @@ export const QuickStartCatalogFilterSelect = ({
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export const QuickStartCatalogFilterCount = ({ quickStartsCount }) => {
|
|
72
|
-
const { getResource } =
|
|
72
|
+
const { getResource } = useContext<QuickStartContextValues>(QuickStartContext);
|
|
73
73
|
return (
|
|
74
74
|
<ToolbarItem align={{ default: 'alignEnd' }}>
|
|
75
75
|
{getResource('{{count, number}} item', quickStartsCount).replace(
|
|
@@ -83,12 +83,12 @@ export const QuickStartCatalogFilterCount = ({ quickStartsCount }) => {
|
|
|
83
83
|
interface QuickStartCatalogFilterSearchWrapperProps {
|
|
84
84
|
onSearchInputChange: any;
|
|
85
85
|
}
|
|
86
|
-
export const QuickStartCatalogFilterSearchWrapper:
|
|
86
|
+
export const QuickStartCatalogFilterSearchWrapper: FC<
|
|
87
87
|
QuickStartCatalogFilterSearchWrapperProps
|
|
88
88
|
> = ({ onSearchInputChange = () => {} }) => {
|
|
89
89
|
const { useQueryParams, filter, setFilter } =
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
useContext<QuickStartContextValues>(QuickStartContext);
|
|
91
|
+
useEffect(() => {
|
|
92
92
|
// use this effect to clear the search when a `clear all` action is performed higher up
|
|
93
93
|
const unlisten = history.listen(({ location }) => {
|
|
94
94
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -141,12 +141,12 @@ export const equalsIgnoreOrder = (a: any[], b: any[]) => {
|
|
|
141
141
|
interface QuickStartCatalogFilterStatusWrapperProps {
|
|
142
142
|
onStatusChange: any;
|
|
143
143
|
}
|
|
144
|
-
export const QuickStartCatalogFilterStatusWrapper:
|
|
144
|
+
export const QuickStartCatalogFilterStatusWrapper: FC<
|
|
145
145
|
QuickStartCatalogFilterStatusWrapperProps
|
|
146
146
|
> = ({ onStatusChange = () => {} }) => {
|
|
147
147
|
const { useQueryParams, filter, setFilter } =
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
useContext<QuickStartContextValues>(QuickStartContext);
|
|
149
|
+
useEffect(() => {
|
|
150
150
|
// use this effect to clear the status when a `clear all` action is performed higher up
|
|
151
151
|
const unlisten = history.listen(({ location }) => {
|
|
152
152
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -160,9 +160,9 @@ export const QuickStartCatalogFilterStatusWrapper: React.FC<
|
|
|
160
160
|
unlisten();
|
|
161
161
|
};
|
|
162
162
|
});
|
|
163
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
163
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
164
164
|
|
|
165
|
-
const onRowfilterSelect =
|
|
165
|
+
const onRowfilterSelect = useCallback(
|
|
166
166
|
(_e, selectedValue) => {
|
|
167
167
|
setIsDropdownOpen(false);
|
|
168
168
|
const selection = Object.entries(filter.status.statusTypes).find(
|
|
@@ -210,6 +210,6 @@ export const QuickStartCatalogFilterStatusWrapper: React.FC<
|
|
|
210
210
|
interface QuickStartCatalogFilterCountWrapperProps {
|
|
211
211
|
quickStartsCount: number;
|
|
212
212
|
}
|
|
213
|
-
export const QuickStartCatalogFilterCountWrapper:
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
export const QuickStartCatalogFilterCountWrapper: FC<QuickStartCatalogFilterCountWrapperProps> = ({
|
|
214
|
+
quickStartsCount,
|
|
215
|
+
}) => <QuickStartCatalogFilterCount quickStartsCount={quickStartsCount} />;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { Popover } from '@patternfly/react-core';
|
|
3
2
|
import { shallow } from 'enzyme';
|
|
4
3
|
import { getQuickStarts } from '../../data/test-utils';
|
|
@@ -12,7 +11,7 @@ jest.mock('react', () => {
|
|
|
12
11
|
};
|
|
13
12
|
});
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
xdescribe('QuickStartCatalog', () => {
|
|
16
15
|
beforeEach(() => {
|
|
17
16
|
spyOn(React, 'useContext').and.returnValue({
|
|
18
17
|
activeQuickStartID: '',
|