@patternfly/quickstarts 6.0.0-alpha.1 → 6.0.0-alpha.3
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 +0 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/accordion-extension.d.ts +0 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/admonition-extension.d.ts +0 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/code-extension.d.ts +0 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.d.ts +0 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.d.ts +0 -1
- package/dist/ConsoleShared/src/components/modal/Modal.d.ts +1 -2
- package/dist/ConsoleShared/src/components/spotlight/InteractiveSpotlight.d.ts +0 -1
- package/dist/ConsoleShared/src/components/spotlight/StaticSpotlight.d.ts +0 -1
- package/dist/HelpTopicDrawer.d.ts +0 -1
- package/dist/HelpTopicPanelContent.d.ts +0 -1
- package/dist/QuickStartDrawer.d.ts +0 -1
- package/dist/QuickStartPanelContent.d.ts +2 -2
- package/dist/catalog/QuickStartCatalog.d.ts +0 -1
- package/dist/catalog/QuickStartTile.d.ts +18 -1
- package/dist/catalog/QuickStartTileDescription.d.ts +0 -1
- package/dist/catalog/QuickStartTileFooter.d.ts +1 -0
- package/dist/catalog/QuickStartTileHeader.d.ts +1 -5
- package/dist/catalog/Toolbar/QuickStartCatalogFilter.d.ts +0 -1
- package/dist/controller/QuickStartContent.d.ts +1 -1
- package/dist/controller/QuickStartFooter.d.ts +1 -1
- package/dist/controller/QuickStartIntroduction.d.ts +0 -1
- package/dist/controller/QuickStartTaskHeaderList.d.ts +0 -1
- package/dist/controller/QuickStartTaskReview.d.ts +0 -1
- package/dist/controller/QuickStartTasks.d.ts +0 -1
- package/dist/index.es.js +196 -288
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +197 -288
- package/dist/index.js.map +1 -1
- package/dist/patternfly-docs/quick-starts/examples/HelpTopic.jsx +4 -4
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-help-topics.js +9 -18
- package/dist/patternfly-global.css +20 -66
- package/dist/patternfly-nested.css +2036 -2119
- package/dist/quickstarts-base.css +38 -415
- package/dist/quickstarts-full.es.js +1417 -847
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +41 -376
- package/dist/quickstarts-standalone.min.css +3 -3
- package/dist/quickstarts-vendor.css +6 -11
- package/dist/quickstarts.css +44 -426
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/quick-start-context.d.ts +2 -0
- package/dist/utils/quick-start-types.d.ts +1 -1
- package/package.json +13 -15
- package/src/ConsoleInternal/components/markdown-view.tsx +29 -9
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-extension.tsx +10 -17
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +5 -11
- package/src/ConsoleShared/src/components/markdown-extensions/code-extension.tsx +2 -2
- package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +0 -1
- package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +2 -6
- package/src/ConsoleShared/src/components/markdown-extensions/utils.ts +2 -1
- package/src/ConsoleShared/src/components/modal/Modal.tsx +1 -2
- package/src/ConsoleShared/src/components/popper/SimplePopper.tsx +5 -2
- package/src/ConsoleShared/src/components/spotlight/InteractiveSpotlight.tsx +0 -1
- package/src/ConsoleShared/src/components/spotlight/StaticSpotlight.tsx +0 -1
- package/src/ConsoleShared/src/components/status/icons.tsx +1 -5
- package/src/HelpTopicDrawer.tsx +1 -4
- package/src/HelpTopicPanelContent.tsx +4 -16
- package/src/QuickStartCatalogPage.tsx +34 -25
- package/src/QuickStartCloseModal.tsx +2 -2
- package/src/QuickStartController.tsx +2 -2
- package/src/QuickStartDrawer.tsx +2 -7
- package/src/QuickStartPanelContent.scss +7 -39
- package/src/QuickStartPanelContent.tsx +23 -47
- package/src/catalog/Catalog/QuickStartCatalogHeader.tsx +5 -4
- package/src/catalog/Catalog/QuickStartCatalogSection.tsx +1 -1
- package/src/catalog/Catalog/QuickStartCatalogToolbar.tsx +1 -3
- package/src/catalog/QuickStartCatalog.tsx +12 -16
- package/src/catalog/QuickStartTile.scss +11 -9
- package/src/catalog/QuickStartTile.tsx +135 -62
- package/src/catalog/QuickStartTileDescription.tsx +28 -42
- package/src/catalog/QuickStartTileFooter.tsx +13 -19
- package/src/catalog/QuickStartTileHeader.tsx +8 -58
- package/src/catalog/Toolbar/QuickStartCatalogFilter.tsx +8 -10
- package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +2 -5
- package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +3 -3
- package/src/catalog/__tests__/QuickStartTile.spec.tsx +5 -5
- package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +1 -1
- package/src/controller/QuickStartConclusion.tsx +4 -4
- package/src/controller/QuickStartContent.scss +3 -7
- package/src/controller/QuickStartContent.tsx +3 -5
- package/src/controller/QuickStartFooter.scss +1 -11
- package/src/controller/QuickStartFooter.tsx +27 -21
- package/src/controller/QuickStartIntroduction.tsx +11 -16
- package/src/controller/QuickStartTaskHeader.scss +20 -42
- package/src/controller/QuickStartTaskHeader.tsx +25 -62
- package/src/controller/QuickStartTaskHeaderList.tsx +4 -6
- package/src/controller/QuickStartTaskReview.tsx +6 -12
- package/src/controller/QuickStartTasks.tsx +6 -8
- package/src/controller/__tests__/QuickStartConclusion.spec.tsx +6 -19
- package/src/controller/__tests__/QuickStartFooter.spec.tsx +9 -54
- package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +1 -1
- package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +3 -6
- package/src/controller/__tests__/QuickStartTasks.spec.tsx +3 -6
- package/src/styles/_base.scss +3 -45
- package/src/styles/style.scss +1 -6
- package/src/utils/help-topic-context.tsx +2 -3
- package/src/utils/quick-start-context.tsx +12 -13
- package/src/utils/quick-start-types.ts +1 -1
- package/src/utils/quick-start-utils.ts +4 -2
- package/src/ConsoleInternal/components/_icon-and-text.scss +0 -14
- package/src/ConsoleInternal/components/_markdown-view.scss +0 -19
- package/src/ConsoleInternal/components/catalog/_catalog.scss +0 -392
- package/src/ConsoleInternal/components/utils/_status-box.scss +0 -58
- package/src/ConsoleShared/src/components/layout/PageLayout.scss +0 -29
- package/src/ConsoleShared/src/components/markdown-extensions/showdown-extension.scss +0 -52
- package/src/ConsoleShared/src/components/modal/Modal.scss +0 -3
- package/src/ConsoleShared/src/components/spotlight/spotlight.scss +0 -63
- package/src/QuickStartDrawer.scss +0 -11
- package/src/catalog/QuickStartCatalog.scss +0 -8
- package/src/catalog/QuickStartTileDescription.scss +0 -29
- package/src/catalog/QuickStartTileHeader.scss +0 -12
- package/src/catalog/Toolbar/QuickStartCatalogFilter.scss +0 -25
- package/src/controller/QuickStartIntroduction.scss +0 -35
- package/src/controller/QuickStartTaskHeaderList.scss +0 -17
- package/src/controller/QuickStartTaskReview.scss +0 -30
- package/src/controller/QuickStartTasks.scss +0 -90
- package/src/styles/_dark-custom-override.scss +0 -47
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import './QuickStartPanelContent.scss';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import {
|
|
4
3
|
DrawerActions,
|
|
@@ -8,15 +7,13 @@ import {
|
|
|
8
7
|
DrawerPanelContent,
|
|
9
8
|
Title,
|
|
10
9
|
} from '@patternfly/react-core';
|
|
11
|
-
import { css } from '@patternfly/react-styles';
|
|
12
10
|
import * as ReactDOM from 'react-dom';
|
|
13
|
-
import { Shadows, useScrollShadows } from '@console/shared';
|
|
14
11
|
import QuickStartController from './QuickStartController';
|
|
15
12
|
import { QuickStartContext, QuickStartContextValues } from './utils/quick-start-context';
|
|
16
13
|
import { QuickStart } from './utils/quick-start-types';
|
|
17
14
|
import { camelize } from './utils/quick-start-utils';
|
|
18
|
-
|
|
19
|
-
import
|
|
15
|
+
|
|
16
|
+
import './QuickStartPanelContent.scss';
|
|
20
17
|
|
|
21
18
|
type HandleClose = () => void;
|
|
22
19
|
|
|
@@ -27,7 +24,7 @@ interface QuickStartPanelContentProps {
|
|
|
27
24
|
appendTo?: HTMLElement | (() => HTMLElement);
|
|
28
25
|
isResizable?: boolean;
|
|
29
26
|
showClose?: boolean;
|
|
30
|
-
|
|
27
|
+
footerClass?: string;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
const getElement = (appendTo: HTMLElement | (() => HTMLElement)) => {
|
|
@@ -52,14 +49,13 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
52
49
|
appendTo,
|
|
53
50
|
isResizable = true,
|
|
54
51
|
showClose = true,
|
|
55
|
-
|
|
52
|
+
footerClass,
|
|
56
53
|
...props
|
|
57
54
|
}) => {
|
|
58
55
|
const titleRef = React.useRef(null);
|
|
59
|
-
const { getResource, activeQuickStartState } =
|
|
56
|
+
const { getResource, activeQuickStartState, focusOnQuickStart } =
|
|
60
57
|
React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
61
58
|
const [contentRef, setContentRef] = React.useState<HTMLDivElement>();
|
|
62
|
-
const shadows = useScrollShadows(contentRef);
|
|
63
59
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
64
60
|
const taskNumber = activeQuickStartState?.taskNumber;
|
|
65
61
|
useScrollTopOnTaskNumberChange(contentRef, taskNumber as number);
|
|
@@ -67,19 +63,8 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
67
63
|
quickStart?.spec.nextQuickStart?.includes(qs.metadata.name),
|
|
68
64
|
);
|
|
69
65
|
|
|
70
|
-
const headerClasses = css('pfext-quick-start-panel-content__header', {
|
|
71
|
-
'pfext-quick-start-panel-content__header__shadow':
|
|
72
|
-
shadows === Shadows.top || shadows === Shadows.both,
|
|
73
|
-
'pfext-quick-start-panel-content__header--blue-white': headerVariant === 'blue-white',
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const footerClass = css({
|
|
77
|
-
'pfext-quick-start-panel-content__footer__shadow':
|
|
78
|
-
shadows === Shadows.bottom || shadows === Shadows.both,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
66
|
const getStep = () => {
|
|
82
|
-
const tasks = quickStart.spec.tasks
|
|
67
|
+
const tasks = quickStart.spec.tasks?.length || 0;
|
|
83
68
|
if (Number.parseInt(taskNumber as string) === -1) {
|
|
84
69
|
return 'intro';
|
|
85
70
|
}
|
|
@@ -90,45 +75,40 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
90
75
|
};
|
|
91
76
|
|
|
92
77
|
React.useEffect(() => {
|
|
93
|
-
if (quickStart) {
|
|
78
|
+
if (focusOnQuickStart && quickStart) {
|
|
94
79
|
titleRef.current.focus();
|
|
95
80
|
}
|
|
96
|
-
}, [quickStart]);
|
|
81
|
+
}, [focusOnQuickStart, quickStart]);
|
|
97
82
|
|
|
98
83
|
const content = quickStart ? (
|
|
99
84
|
<DrawerPanelContent
|
|
100
85
|
isResizable={isResizable}
|
|
101
|
-
className="pfext-quick-start__base"
|
|
102
86
|
data-testid={`qs-drawer-${camelize(quickStart.spec.displayName)}`}
|
|
103
87
|
data-qs={`qs-step-${getStep()}`}
|
|
104
88
|
data-test="quickstart drawer"
|
|
89
|
+
style={{ '--pf-v6-c-drawer__panel--PaddingBlockStart': '0' } as React.CSSProperties}
|
|
105
90
|
{...props}
|
|
106
91
|
>
|
|
107
|
-
<div className=
|
|
92
|
+
<div className="pfext-quick-start-panel-content">
|
|
108
93
|
<DrawerHead>
|
|
109
|
-
<div
|
|
94
|
+
<div tabIndex={-1} ref={titleRef}>
|
|
110
95
|
<Title
|
|
111
96
|
headingLevel="h2"
|
|
112
97
|
size="xl"
|
|
113
|
-
className="pfext-quick-start-panel-content__name"
|
|
114
98
|
style={{ marginRight: 'var(--pf-t--global--spacer--md)' }}
|
|
115
99
|
>
|
|
116
|
-
<span
|
|
117
|
-
dangerouslySetInnerHTML={{
|
|
118
|
-
__html: removeParagraphWrap(markdownConvert(quickStart?.spec.displayName)),
|
|
119
|
-
}}
|
|
120
|
-
/>{' '}
|
|
121
|
-
<small className="pfext-quick-start-panel-content__duration">
|
|
122
|
-
{quickStart?.spec.durationMinutes
|
|
123
|
-
? getResource(
|
|
124
|
-
'{{type}} • {{duration, number}} minutes',
|
|
125
|
-
quickStart?.spec.durationMinutes,
|
|
126
|
-
)
|
|
127
|
-
.replace('{{duration, number}}', quickStart?.spec.durationMinutes)
|
|
128
|
-
.replace('{{type}}', getResource('Type'))
|
|
129
|
-
: getResource('Type')}
|
|
130
|
-
</small>
|
|
100
|
+
<span>{quickStart?.spec.displayName}</span>{' '}
|
|
131
101
|
</Title>
|
|
102
|
+
<span>
|
|
103
|
+
{quickStart?.spec.durationMinutes
|
|
104
|
+
? getResource(
|
|
105
|
+
'{{type}} • {{duration, number}} minutes',
|
|
106
|
+
quickStart?.spec.durationMinutes,
|
|
107
|
+
)
|
|
108
|
+
.replace('{{duration, number}}', quickStart?.spec.durationMinutes)
|
|
109
|
+
.replace('{{type}}', getResource('Type'))
|
|
110
|
+
: getResource('Type')}
|
|
111
|
+
</span>
|
|
132
112
|
</div>
|
|
133
113
|
{showClose && (
|
|
134
114
|
<DrawerActions>
|
|
@@ -141,11 +121,7 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
141
121
|
)}
|
|
142
122
|
</DrawerHead>
|
|
143
123
|
</div>
|
|
144
|
-
<DrawerPanelBody
|
|
145
|
-
hasNoPadding
|
|
146
|
-
className="pfext-quick-start-panel-content__body"
|
|
147
|
-
data-test="content"
|
|
148
|
-
>
|
|
124
|
+
<DrawerPanelBody className="pfext-quick-start-panel-content__body" data-test="content">
|
|
149
125
|
<QuickStartController
|
|
150
126
|
quickStart={quickStart}
|
|
151
127
|
nextQuickStarts={nextQuickStarts}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Title } from '@patternfly/react-core';
|
|
2
3
|
|
|
3
4
|
export interface QuickStartCatalogHeaderProps {
|
|
4
5
|
title: string;
|
|
@@ -9,10 +10,10 @@ export const QuickStartCatalogHeader: React.FC<QuickStartCatalogHeaderProps> = (
|
|
|
9
10
|
title,
|
|
10
11
|
hint,
|
|
11
12
|
}) => (
|
|
12
|
-
<div
|
|
13
|
-
<h1 data-pf-content="true"
|
|
13
|
+
<div>
|
|
14
|
+
<Title headingLevel="h1" data-pf-content="true">
|
|
14
15
|
{title}
|
|
15
|
-
</
|
|
16
|
-
{hint && <div
|
|
16
|
+
</Title>
|
|
17
|
+
{hint && <div>{hint}</div>}
|
|
17
18
|
</div>
|
|
18
19
|
);
|
|
@@ -6,7 +6,5 @@ export interface QuickStartCatalogToolbarProps {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export const QuickStartCatalogToolbar: React.FC<QuickStartCatalogToolbarProps> = ({ children }) => (
|
|
9
|
-
<Toolbar
|
|
10
|
-
{children}
|
|
11
|
-
</Toolbar>
|
|
9
|
+
<Toolbar>{children}</Toolbar>
|
|
12
10
|
);
|
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Gallery
|
|
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';
|
|
5
5
|
import { getQuickStartStatus } from '../utils/quick-start-utils';
|
|
6
6
|
import QuickStartTile from './QuickStartTile';
|
|
7
7
|
|
|
8
|
-
import './QuickStartCatalog.scss';
|
|
9
|
-
|
|
10
8
|
interface QuickStartCatalogProps {
|
|
11
9
|
quickStarts: QuickStart[];
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
const QuickStartCatalog: React.FC<QuickStartCatalogProps> = ({ quickStarts }) => {
|
|
15
|
-
const { activeQuickStartID, allQuickStartStates } =
|
|
16
|
-
QuickStartContext
|
|
17
|
-
);
|
|
13
|
+
const { activeQuickStartID, allQuickStartStates } =
|
|
14
|
+
React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
18
15
|
|
|
19
16
|
return (
|
|
20
|
-
<div
|
|
21
|
-
<Gallery
|
|
22
|
-
{quickStarts.map((quickStart) => {
|
|
17
|
+
<div>
|
|
18
|
+
<Gallery hasGutter>
|
|
19
|
+
{quickStarts.map((quickStart, index) => {
|
|
23
20
|
const {
|
|
24
21
|
metadata: { name: id },
|
|
25
22
|
} = quickStart;
|
|
26
23
|
|
|
27
24
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</GalleryItem>
|
|
25
|
+
<QuickStartTile
|
|
26
|
+
key={index}
|
|
27
|
+
quickStart={quickStart}
|
|
28
|
+
isActive={id === activeQuickStartID}
|
|
29
|
+
status={getQuickStartStatus(allQuickStartStates, id)}
|
|
30
|
+
/>
|
|
35
31
|
);
|
|
36
32
|
})}
|
|
37
33
|
</Gallery>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
.pfext-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
.pf-v6-theme-dark .pfext-catalog-item-icon__img {
|
|
2
|
+
filter: brightness(1.5) invert(1) hue-rotate(180deg) saturate(4);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
// some icons provided to catalog tiles might have no defined height/width. Without this style, in those cases
|
|
6
|
+
// the icons would have a height and width of 0.
|
|
7
|
+
.pf-v6-c-card__header-main .pf-v6-c-icon__content, {
|
|
8
|
+
display: contents;
|
|
9
|
+
}
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
+
.pf-v6-c-card.pf-m-selectable::before, .pf-v6-c-card.pf-m-clickable::before {
|
|
12
|
+
border: var(--pf-v6-c-card--BorderColor) var(--pf-v6-c-card--BorderStyle) var(--pf-v6-c-card--BorderWidth) !important;
|
|
11
13
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CatalogTile } from '@patternfly/react-catalog-view-extension';
|
|
3
2
|
import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
|
|
4
3
|
import { FallbackImg } from '@console/shared';
|
|
5
4
|
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
@@ -9,15 +8,46 @@ import QuickStartTileDescription from './QuickStartTileDescription';
|
|
|
9
8
|
import QuickStartTileFooter from './QuickStartTileFooter';
|
|
10
9
|
import QuickStartTileFooterExternal from './QuickStartTileFooterExternal';
|
|
11
10
|
import QuickStartTileHeader from './QuickStartTileHeader';
|
|
12
|
-
import
|
|
13
|
-
|
|
11
|
+
import OutlinedBookmarkIcon from '@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon';
|
|
12
|
+
import {
|
|
13
|
+
Card,
|
|
14
|
+
CardBody,
|
|
15
|
+
CardHeader,
|
|
16
|
+
CardFooter,
|
|
17
|
+
CardTitle,
|
|
18
|
+
Icon,
|
|
19
|
+
Button,
|
|
20
|
+
ButtonProps,
|
|
21
|
+
Flex,
|
|
22
|
+
Stack,
|
|
23
|
+
Label
|
|
24
|
+
} from '@patternfly/react-core';
|
|
25
|
+
import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
|
|
26
|
+
import { StatusIcon } from '@console/shared';
|
|
14
27
|
import './QuickStartTile.scss';
|
|
15
28
|
|
|
16
|
-
interface
|
|
29
|
+
export interface QuickstartAction {
|
|
30
|
+
/** Screen reader aria label. */
|
|
31
|
+
'aria-label': string;
|
|
32
|
+
/** Icon to be rendered as a plain button, by default Bookmark outlined will be used. */
|
|
33
|
+
icon?: React.ComponentType<unknown>;
|
|
34
|
+
/** Callback with synthetic event parameter. */
|
|
35
|
+
onClick?: (e: React.SyntheticEvent) => void;
|
|
36
|
+
/** Additional button props to be rendered as extra props. */
|
|
37
|
+
buttonProps?: ButtonProps;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface QuickStartTileProps {
|
|
41
|
+
/** The quickstart object triggered by this tile */
|
|
17
42
|
quickStart: QuickStart;
|
|
43
|
+
/** Current status of the quickstart */
|
|
18
44
|
status: QuickStartStatus;
|
|
45
|
+
/** Flag indicating whether the quickstart is active (drawer is open) */
|
|
19
46
|
isActive: boolean;
|
|
47
|
+
/** Event handler attached to the tile */
|
|
20
48
|
onClick?: () => void;
|
|
49
|
+
/** Action config for button rendered next to title */
|
|
50
|
+
action?: QuickstartAction;
|
|
21
51
|
}
|
|
22
52
|
|
|
23
53
|
const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
@@ -25,33 +55,54 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
|
25
55
|
status,
|
|
26
56
|
isActive,
|
|
27
57
|
onClick = () => {},
|
|
58
|
+
action,
|
|
28
59
|
}) => {
|
|
29
60
|
const {
|
|
30
61
|
metadata: { name: id },
|
|
31
62
|
spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type },
|
|
32
63
|
} = quickStart;
|
|
33
64
|
|
|
34
|
-
const { setActiveQuickStart, footer } =
|
|
65
|
+
const { setActiveQuickStart, footer, getResource } =
|
|
35
66
|
React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
36
67
|
|
|
37
|
-
|
|
68
|
+
|
|
69
|
+
const statusColorMap = {
|
|
70
|
+
[QuickStartStatus.COMPLETE]: 'green',
|
|
71
|
+
[QuickStartStatus.IN_PROGRESS]: 'purple',
|
|
72
|
+
[QuickStartStatus.NOT_STARTED]: 'grey',
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const statusLocaleMap = {
|
|
76
|
+
[QuickStartStatus.COMPLETE]: getResource('Complete'),
|
|
77
|
+
[QuickStartStatus.IN_PROGRESS]: getResource('In progress'),
|
|
78
|
+
[QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
79
|
+
};
|
|
38
80
|
|
|
39
81
|
let quickStartIcon: React.ReactNode;
|
|
40
82
|
if (typeof icon === 'object') {
|
|
41
|
-
quickStartIcon = <Icon size="
|
|
83
|
+
quickStartIcon = <Icon size="2xl">{icon}</Icon>;
|
|
42
84
|
} else {
|
|
43
85
|
quickStartIcon = (
|
|
44
|
-
<Icon size="
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
86
|
+
<Icon size="2xl">
|
|
87
|
+
<FallbackImg
|
|
88
|
+
src={icon as string}
|
|
89
|
+
alt=""
|
|
90
|
+
className="pfext-catalog-item-icon__img"
|
|
91
|
+
fallback={<RocketIcon />}
|
|
92
|
+
/>
|
|
51
93
|
</Icon>
|
|
52
94
|
);
|
|
53
95
|
}
|
|
54
96
|
|
|
97
|
+
const onSelect = () => {
|
|
98
|
+
if (!link) {
|
|
99
|
+
setActiveQuickStart(id, tasks?.length);
|
|
100
|
+
} else {
|
|
101
|
+
window.open(link.href, '_blank', 'noopener,noreferrer');
|
|
102
|
+
}
|
|
103
|
+
onClick();
|
|
104
|
+
};
|
|
105
|
+
|
|
55
106
|
const footerComponent = React.useMemo(() => {
|
|
56
107
|
if (footer && footer.show === false) {
|
|
57
108
|
return null;
|
|
@@ -61,59 +112,81 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
|
61
112
|
return <QuickStartTileFooterExternal link={link} quickStartId={id} />;
|
|
62
113
|
}
|
|
63
114
|
|
|
64
|
-
return
|
|
115
|
+
return (
|
|
116
|
+
<QuickStartTileFooter
|
|
117
|
+
quickStartId={id}
|
|
118
|
+
status={status}
|
|
119
|
+
totalTasks={tasks?.length}
|
|
120
|
+
onClickContinue={onSelect}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
65
123
|
}, [footer, id, link, status, tasks?.length]);
|
|
66
124
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
};
|
|
125
|
+
const ActionIcon = action?.icon || OutlinedBookmarkIcon;
|
|
126
|
+
const additionalAction = action ? (
|
|
127
|
+
<Button
|
|
128
|
+
aria-label={action['aria-label']}
|
|
129
|
+
icon={<ActionIcon />}
|
|
130
|
+
variant="plain"
|
|
131
|
+
onClick={action.onClick}
|
|
132
|
+
{...action.buttonProps}
|
|
133
|
+
/>
|
|
134
|
+
) : undefined;
|
|
79
135
|
|
|
80
136
|
return (
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
137
|
+
<Card
|
|
138
|
+
id={`${id}-catalog-tile`}
|
|
139
|
+
style={{ height: '100%' }}
|
|
140
|
+
data-testid={`qs-card-${camelize(displayName)}`}
|
|
141
|
+
{...(isActive && {
|
|
142
|
+
isClickable: true,
|
|
143
|
+
isSelectable: true,
|
|
144
|
+
isSelected: true,
|
|
145
|
+
isClicked: true,
|
|
146
|
+
})}
|
|
147
|
+
>
|
|
148
|
+
<CardHeader
|
|
149
|
+
{...(action && {
|
|
150
|
+
actions: { actions: additionalAction },
|
|
151
|
+
})}
|
|
152
|
+
>
|
|
153
|
+
{quickStartIcon}
|
|
154
|
+
</CardHeader>
|
|
155
|
+
<CardTitle>
|
|
156
|
+
<QuickStartTileHeader
|
|
157
|
+
name={displayName}
|
|
158
|
+
onSelect={onSelect}
|
|
159
|
+
quickStartId={id}
|
|
160
|
+
/>
|
|
161
|
+
</CardTitle>
|
|
162
|
+
<CardBody>
|
|
163
|
+
<Stack hasGutter>
|
|
164
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
165
|
+
{type && <Label color={type.color}>{type.text}</Label>}
|
|
166
|
+
{durationMinutes && (
|
|
167
|
+
<Label variant="outline" data-test="duration" icon={<OutlinedClockIcon />}>
|
|
168
|
+
{getResource('{{duration, number}} minutes', durationMinutes).replace(
|
|
169
|
+
'{{duration, number}}',
|
|
170
|
+
durationMinutes,
|
|
171
|
+
)}
|
|
172
|
+
</Label>
|
|
173
|
+
)}
|
|
174
|
+
{status !== QuickStartStatus.NOT_STARTED && (
|
|
175
|
+
<Label
|
|
176
|
+
variant="outline"
|
|
177
|
+
color={statusColorMap[status] as "green" | "purple" | "grey"}
|
|
178
|
+
icon={<StatusIcon status={status} />}
|
|
179
|
+
data-test="status"
|
|
180
|
+
>
|
|
181
|
+
{statusLocaleMap[status]}
|
|
182
|
+
</Label>
|
|
183
|
+
)}
|
|
184
|
+
</Flex>
|
|
111
185
|
<QuickStartTileDescription description={description} prerequisites={prerequisites} />
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</div>
|
|
186
|
+
</Stack>
|
|
187
|
+
</CardBody>
|
|
188
|
+
<CardFooter>{footerComponent}</CardFooter>
|
|
189
|
+
</Card>
|
|
117
190
|
);
|
|
118
191
|
};
|
|
119
192
|
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Button,
|
|
4
|
-
Popover,
|
|
5
|
-
Text,
|
|
6
|
-
TextList,
|
|
7
|
-
TextListItem,
|
|
8
|
-
TextVariants,
|
|
9
|
-
} from '@patternfly/react-core';
|
|
2
|
+
import { Button, Flex, Popover } from '@patternfly/react-core';
|
|
10
3
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
11
4
|
import QuickStartMarkdownView from '../QuickStartMarkdownView';
|
|
12
5
|
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
13
6
|
|
|
14
|
-
import './QuickStartTileDescription.scss';
|
|
15
|
-
|
|
16
7
|
interface QuickStartTileDescriptionProps {
|
|
17
8
|
description: string;
|
|
18
9
|
prerequisites?: string[];
|
|
@@ -23,55 +14,50 @@ const QuickStartTileDescription: React.FC<QuickStartTileDescriptionProps> = ({
|
|
|
23
14
|
}) => {
|
|
24
15
|
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
25
16
|
const prereqs = prerequisites?.filter((p) => p);
|
|
17
|
+
const buttonRef = React.useRef<HTMLButtonElement>(null);
|
|
18
|
+
|
|
26
19
|
return (
|
|
27
20
|
<>
|
|
28
|
-
<QuickStartMarkdownView
|
|
29
|
-
content={description}
|
|
30
|
-
className="pfext-quick-start-tile-description"
|
|
31
|
-
/>
|
|
21
|
+
<QuickStartMarkdownView content={description} />
|
|
32
22
|
{prereqs?.length > 0 && (
|
|
33
|
-
<
|
|
34
|
-
<
|
|
23
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
24
|
+
<h5>
|
|
35
25
|
{getResource('Prerequisites ({{totalPrereqs}})').replace(
|
|
36
26
|
'{{totalPrereqs}}',
|
|
37
27
|
prereqs.length,
|
|
38
28
|
)}{' '}
|
|
39
|
-
</
|
|
29
|
+
</h5>
|
|
30
|
+
<Button
|
|
31
|
+
variant="link"
|
|
32
|
+
isInline
|
|
33
|
+
data-testid="qs-card-prereqs"
|
|
34
|
+
ref={buttonRef}
|
|
35
|
+
onClick={(e) => {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
}}
|
|
39
|
+
aria-label={getResource('Show prerequisites')}
|
|
40
|
+
>
|
|
41
|
+
<InfoCircleIcon />
|
|
42
|
+
</Button>
|
|
40
43
|
<Popover
|
|
41
44
|
aria-label={getResource('Prerequisites')}
|
|
42
45
|
headerContent={getResource('Prerequisites')}
|
|
43
|
-
|
|
46
|
+
triggerRef={buttonRef}
|
|
44
47
|
bodyContent={
|
|
45
|
-
<div
|
|
46
|
-
<
|
|
47
|
-
aria-label={getResource('Prerequisites')}
|
|
48
|
-
className="pfext-quick-start-tile-prerequisites-list"
|
|
49
|
-
>
|
|
48
|
+
<div>
|
|
49
|
+
<ul aria-label={getResource('Prerequisites')}>
|
|
50
50
|
{prereqs.map((prerequisite, index) => (
|
|
51
51
|
// eslint-disable-next-line react/no-array-index-key
|
|
52
|
-
<
|
|
52
|
+
<li key={index}>
|
|
53
53
|
<QuickStartMarkdownView content={prerequisite} />
|
|
54
|
-
</
|
|
54
|
+
</li>
|
|
55
55
|
))}
|
|
56
|
-
</
|
|
56
|
+
</ul>
|
|
57
57
|
</div>
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
variant="link"
|
|
62
|
-
isInline
|
|
63
|
-
className="pfext-quick-start-tile-prerequisites__icon"
|
|
64
|
-
data-testid="qs-card-prereqs"
|
|
65
|
-
onClick={(e) => {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
e.stopPropagation();
|
|
68
|
-
}}
|
|
69
|
-
aria-label={getResource('Show prerequisites')}
|
|
70
|
-
>
|
|
71
|
-
<InfoCircleIcon />
|
|
72
|
-
</Button>
|
|
73
|
-
</Popover>
|
|
74
|
-
</div>
|
|
59
|
+
/>
|
|
60
|
+
</Flex>
|
|
75
61
|
)}
|
|
76
62
|
</>
|
|
77
63
|
);
|
|
@@ -7,35 +7,28 @@ interface QuickStartTileFooterProps {
|
|
|
7
7
|
quickStartId: string;
|
|
8
8
|
status: string;
|
|
9
9
|
totalTasks?: number;
|
|
10
|
+
onClickContinue: (
|
|
11
|
+
e: React.FormEvent<HTMLInputElement> | React.MouseEvent<Element, MouseEvent>,
|
|
12
|
+
) => void;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
const QuickStartTileFooter: React.FC<QuickStartTileFooterProps> = ({
|
|
13
16
|
quickStartId,
|
|
14
17
|
status,
|
|
15
18
|
totalTasks,
|
|
19
|
+
onClickContinue,
|
|
16
20
|
}) => {
|
|
17
21
|
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
18
|
-
const { activeQuickStartID, startQuickStart, restartQuickStart } =
|
|
19
|
-
QuickStartContextValues
|
|
20
|
-
>(QuickStartContext);
|
|
22
|
+
const { activeQuickStartID, startQuickStart, restartQuickStart } =
|
|
23
|
+
React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
21
24
|
|
|
22
|
-
const start = React.useCallback(
|
|
23
|
-
(
|
|
24
|
-
|
|
25
|
-
e.stopPropagation();
|
|
26
|
-
startQuickStart(quickStartId, totalTasks);
|
|
27
|
-
},
|
|
28
|
-
[quickStartId, startQuickStart, totalTasks],
|
|
29
|
-
);
|
|
25
|
+
const start = React.useCallback(() => {
|
|
26
|
+
startQuickStart(quickStartId, totalTasks);
|
|
27
|
+
}, [quickStartId, startQuickStart, totalTasks]);
|
|
30
28
|
|
|
31
|
-
const restart = React.useCallback(
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
e.stopPropagation();
|
|
35
|
-
restartQuickStart(quickStartId, totalTasks);
|
|
36
|
-
},
|
|
37
|
-
[quickStartId, restartQuickStart, totalTasks],
|
|
38
|
-
);
|
|
29
|
+
const restart = React.useCallback(() => {
|
|
30
|
+
restartQuickStart(quickStartId, totalTasks);
|
|
31
|
+
}, [quickStartId, restartQuickStart, totalTasks]);
|
|
39
32
|
|
|
40
33
|
return (
|
|
41
34
|
<Flex justifyContent={{ default: 'justifyContentSpaceBetween' }}>
|
|
@@ -57,6 +50,7 @@ const QuickStartTileFooter: React.FC<QuickStartTileFooterProps> = ({
|
|
|
57
50
|
<FlexItem>
|
|
58
51
|
<Button
|
|
59
52
|
variant="link"
|
|
53
|
+
onClick={onClickContinue}
|
|
60
54
|
isInline
|
|
61
55
|
data-testid="qs-card-inProgress-resume"
|
|
62
56
|
id={`${quickStartId}-continue`}
|