@patternfly/quickstarts 2.0.1-rc.2 → 2.2.0
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/README.md +318 -34
- package/dist/ConsoleInternal/module/k8s/types.d.ts +5 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/admonition-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/index.d.ts +1 -0
- package/dist/HelpTopicDrawer.d.ts +26 -0
- package/dist/HelpTopicPanelContent.d.ts +10 -0
- package/dist/QuickStartCatalogPage.d.ts +1 -2
- package/dist/controller/QuickStartTaskHeader.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +214 -38
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +221 -36
- package/dist/index.js.map +1 -1
- package/dist/patternfly-nested.css +222 -2
- package/dist/quickstarts-base.css +59 -36
- package/dist/quickstarts-full.es.js +947 -305
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +14 -4
- package/dist/quickstarts-standalone.min.css +1 -1
- package/dist/quickstarts.css +59 -36
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/const.d.ts +1 -0
- package/dist/utils/help-topic-context.d.ts +21 -0
- package/dist/utils/help-topic-types.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem,
|
|
3
|
+
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Alert, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, OptionsMenuItem, OptionsMenu, OptionsMenuToggle, Stack, StackItem } from '@patternfly/react-core';
|
|
4
4
|
import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
|
|
@@ -8,6 +8,8 @@ import { __rest } from 'tslib';
|
|
|
8
8
|
import * as ReactDOM from 'react-dom';
|
|
9
9
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
10
10
|
import CopyIcon from '@patternfly/react-icons/dist/js/icons/copy-icon';
|
|
11
|
+
import LightbulbIcon from '@patternfly/react-icons/dist/js/icons/lightbulb-icon';
|
|
12
|
+
import FireIcon from '@patternfly/react-icons/dist/js/icons/fire-icon';
|
|
11
13
|
import SyncAltIcon from '@patternfly/react-icons/dist/js/icons/sync-alt-icon';
|
|
12
14
|
import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
|
|
13
15
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
@@ -19,6 +21,7 @@ import { Converter } from 'showdown';
|
|
|
19
21
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
20
22
|
import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
|
|
21
23
|
import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-icon';
|
|
24
|
+
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
22
25
|
|
|
23
26
|
function _extends() {
|
|
24
27
|
_extends = Object.assign || function (target) {
|
|
@@ -70,7 +73,8 @@ const QUICKSTART_ID_FILTER_KEY = 'quickstart';
|
|
|
70
73
|
const QUICKSTART_TASKS_INITIAL_STATES = [
|
|
71
74
|
QuickStartTaskStatus.INIT,
|
|
72
75
|
QuickStartTaskStatus.VISITED,
|
|
73
|
-
];
|
|
76
|
+
];
|
|
77
|
+
const HELP_TOPIC_NAME_KEY = 'topic';
|
|
74
78
|
|
|
75
79
|
let createHistory;
|
|
76
80
|
try {
|
|
@@ -125,6 +129,7 @@ var Yes = "Yes";
|
|
|
125
129
|
var No = "No";
|
|
126
130
|
var Cancel = "Cancel";
|
|
127
131
|
var Leave = "Leave";
|
|
132
|
+
var Type = "Quick start";
|
|
128
133
|
var en = {
|
|
129
134
|
"No results found": "No results found",
|
|
130
135
|
"No results match the filter criteria. Remove filters or clear all filters to show results.": "No results match the filter criteria. Remove filters or clear all filters to show results.",
|
|
@@ -168,7 +173,8 @@ var en = {
|
|
|
168
173
|
"Not available": "Not available",
|
|
169
174
|
"Copy to clipboard": "Copy to clipboard",
|
|
170
175
|
"Successfully copied to clipboard!": "Successfully copied to clipboard!",
|
|
171
|
-
|
|
176
|
+
Type: Type,
|
|
177
|
+
"{{type}} • {{duration, number}} minutes": "{{type}} • {{duration, number}} minutes"
|
|
172
178
|
};
|
|
173
179
|
|
|
174
180
|
/* eslint-disable */
|
|
@@ -581,7 +587,7 @@ const QuickStartContextDefaults = {
|
|
|
581
587
|
useLegacyHeaderColors: false,
|
|
582
588
|
markdown: null,
|
|
583
589
|
loading: false,
|
|
584
|
-
alwaysShowTaskReview:
|
|
590
|
+
alwaysShowTaskReview: true,
|
|
585
591
|
};
|
|
586
592
|
const QuickStartContext = createContext(QuickStartContextDefaults);
|
|
587
593
|
const getResource = (resource, options, resourceBundle, lng) => {
|
|
@@ -678,7 +684,7 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
678
684
|
useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, id);
|
|
679
685
|
return id;
|
|
680
686
|
});
|
|
681
|
-
setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.
|
|
687
|
+
setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.NOT_STARTED) })));
|
|
682
688
|
}, [setActiveQuickStartID, setAllQuickStartStates, useQueryParams]);
|
|
683
689
|
// When alwaysShowTaskReview preference is enabled, skip visited step and go directly to review
|
|
684
690
|
const stepAfterInitial = alwaysShowTaskReview
|
|
@@ -1276,6 +1282,39 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1276
1282
|
}), [getResource]);
|
|
1277
1283
|
};
|
|
1278
1284
|
|
|
1285
|
+
var AdmonitionType;
|
|
1286
|
+
(function (AdmonitionType) {
|
|
1287
|
+
AdmonitionType["TIP"] = "TIP";
|
|
1288
|
+
AdmonitionType["NOTE"] = "NOTE";
|
|
1289
|
+
AdmonitionType["IMPORTANT"] = "IMPORTANT";
|
|
1290
|
+
AdmonitionType["WARNING"] = "WARNING";
|
|
1291
|
+
AdmonitionType["CAUTION"] = "CAUTION";
|
|
1292
|
+
})(AdmonitionType || (AdmonitionType = {}));
|
|
1293
|
+
const admonitionToAlertVariantMap = {
|
|
1294
|
+
[AdmonitionType.NOTE]: { variant: 'info' },
|
|
1295
|
+
[AdmonitionType.TIP]: { variant: 'default', customIcon: React.createElement(LightbulbIcon, null) },
|
|
1296
|
+
[AdmonitionType.IMPORTANT]: { variant: 'danger' },
|
|
1297
|
+
[AdmonitionType.CAUTION]: { variant: 'warning', customIcon: React.createElement(FireIcon, null) },
|
|
1298
|
+
[AdmonitionType.WARNING]: { variant: 'warning' },
|
|
1299
|
+
};
|
|
1300
|
+
const useAdmonitionShowdownExtension = () => {
|
|
1301
|
+
// const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
1302
|
+
return React.useMemo(() => ({
|
|
1303
|
+
type: 'lang',
|
|
1304
|
+
regex: /\[([\d\w\s-()$!]+)]{{(admonition) ([\w-]+)}}/g,
|
|
1305
|
+
replace: (text, content, admonitionLabel, admonitionType, groupId) => {
|
|
1306
|
+
if (!content || !admonitionLabel || !admonitionType || !groupId) {
|
|
1307
|
+
return text;
|
|
1308
|
+
}
|
|
1309
|
+
admonitionType = admonitionType.toUpperCase();
|
|
1310
|
+
const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
|
|
1311
|
+
const style = admonitionType === AdmonitionType.CAUTION ? { backgroundColor: '#ec7a0915' } : {};
|
|
1312
|
+
const pfAlert = (React.createElement(Alert, { variant: variant, customIcon: customIcon && customIcon, isInline: true, title: admonitionType, className: "pfext-markdown-admonition", style: style }, content));
|
|
1313
|
+
return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
|
|
1314
|
+
},
|
|
1315
|
+
}), []);
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1279
1318
|
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1280
1319
|
const [isSrcValid, setIsSrcValid] = React.useState(true);
|
|
1281
1320
|
if (src && isSrcValid) {
|
|
@@ -1353,13 +1392,31 @@ const markdownConvert = (markdown, extensions) => {
|
|
|
1353
1392
|
if (extensions) {
|
|
1354
1393
|
converter.addExtension(extensions);
|
|
1355
1394
|
}
|
|
1356
|
-
// add hook to transform anchor tags
|
|
1357
1395
|
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1358
1396
|
// nodeType 1 = element type
|
|
1397
|
+
// transform anchor tags
|
|
1359
1398
|
if (node.nodeType === 1 && node.nodeName.toLowerCase() === 'a') {
|
|
1360
1399
|
node.setAttribute('rel', 'noopener noreferrer');
|
|
1361
1400
|
return node;
|
|
1362
1401
|
}
|
|
1402
|
+
// add PF class to ul and ol lists
|
|
1403
|
+
if (node.nodeType === 1 &&
|
|
1404
|
+
(node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol')) {
|
|
1405
|
+
node.setAttribute('class', 'pf-c-list');
|
|
1406
|
+
return node;
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
// Add a hook to make all links open a new window
|
|
1410
|
+
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
|
1411
|
+
// set all elements owning target to target=_blank
|
|
1412
|
+
if ('target' in node) {
|
|
1413
|
+
node.setAttribute('target', '_blank');
|
|
1414
|
+
}
|
|
1415
|
+
// set non-HTML/MathML links to xlink:show=new
|
|
1416
|
+
if (!node.hasAttribute('target') &&
|
|
1417
|
+
(node.hasAttribute('xlink:href') || node.hasAttribute('href'))) {
|
|
1418
|
+
node.setAttribute('xlink:show', 'new');
|
|
1419
|
+
}
|
|
1363
1420
|
});
|
|
1364
1421
|
return DOMPurify.sanitize(converter.makeHtml(markdown), {
|
|
1365
1422
|
USE_PROFILES: {
|
|
@@ -1497,6 +1554,7 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1497
1554
|
const { markdown } = React.useContext(QuickStartContext);
|
|
1498
1555
|
const inlineCopyClipboardShowdownExtension = useInlineCopyClipboardShowdownExtension();
|
|
1499
1556
|
const multilineCopyClipboardShowdownExtension = useMultilineCopyClipboardShowdownExtension();
|
|
1557
|
+
const admonitionShowdownExtension = useAdmonitionShowdownExtension();
|
|
1500
1558
|
return (React.createElement(SyncMarkdownView, { inline: true, content: content, exactHeight: exactHeight, extensions: [
|
|
1501
1559
|
{
|
|
1502
1560
|
type: 'lang',
|
|
@@ -1518,11 +1576,14 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1518
1576
|
},
|
|
1519
1577
|
inlineCopyClipboardShowdownExtension,
|
|
1520
1578
|
multilineCopyClipboardShowdownExtension,
|
|
1579
|
+
admonitionShowdownExtension,
|
|
1521
1580
|
...(markdown ? markdown.extensions : []),
|
|
1522
1581
|
], renderExtension: (docContext, rootSelector) => (React.createElement(React.Fragment, null,
|
|
1523
1582
|
React.createElement(MarkdownHighlightExtension, { docContext: docContext, rootSelector: rootSelector }),
|
|
1524
1583
|
React.createElement(MarkdownCopyClipboard, { docContext: docContext, rootSelector: rootSelector }),
|
|
1525
|
-
markdown &&
|
|
1584
|
+
markdown &&
|
|
1585
|
+
markdown.renderExtension &&
|
|
1586
|
+
markdown.renderExtension(docContext, rootSelector))), className: className }));
|
|
1526
1587
|
};
|
|
1527
1588
|
|
|
1528
1589
|
const QuickStartTileDescription = ({ description, prerequisites, }) => {
|
|
@@ -1628,7 +1689,9 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1628
1689
|
// @ts-ignore
|
|
1629
1690
|
component: "div", style: {
|
|
1630
1691
|
cursor: 'pointer',
|
|
1631
|
-
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick,
|
|
1692
|
+
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick,
|
|
1693
|
+
// https://github.com/patternfly/patternfly-react/issues/7039
|
|
1694
|
+
href: "#", "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent })));
|
|
1632
1695
|
};
|
|
1633
1696
|
|
|
1634
1697
|
const QuickStartCatalog = ({ quickStarts }) => {
|
|
@@ -1779,7 +1842,9 @@ const QuickStartCatalogPage = ({ quickStarts, showFilter, sortFnc = (q1, q2) =>
|
|
|
1779
1842
|
const filteredQs = showFilter
|
|
1780
1843
|
? filterQuickStarts(allQuickStarts, filter.keyword, filter.status.statusFilters, allQuickStartStates).sort(sortFncCallback)
|
|
1781
1844
|
: allQuickStarts;
|
|
1782
|
-
|
|
1845
|
+
// also needs a check whether the content of the QS changed
|
|
1846
|
+
if (filteredQs.length !== filteredQuickStarts.length ||
|
|
1847
|
+
JSON.stringify(filteredQs) !== JSON.stringify(filteredQuickStarts)) {
|
|
1783
1848
|
setFilteredQuickStarts(filteredQs);
|
|
1784
1849
|
}
|
|
1785
1850
|
}, [
|
|
@@ -1868,14 +1933,17 @@ const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
|
1868
1933
|
}
|
|
1869
1934
|
return React.createElement("span", { className: classNames }, content);
|
|
1870
1935
|
};
|
|
1871
|
-
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, }) => {
|
|
1936
|
+
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
1872
1937
|
const classNames = css('pfext-quick-start-task-header__title', {
|
|
1873
1938
|
'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
|
|
1874
1939
|
'pfext-quick-start-task-header__title-failed': taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
|
|
1875
1940
|
});
|
|
1876
|
-
const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
|
|
1877
|
-
const
|
|
1878
|
-
const
|
|
1941
|
+
// const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
|
|
1942
|
+
// const skippedReview = taskStatus === QuickStartTaskStatus.REVIEW;
|
|
1943
|
+
const failedReview = taskStatus === QuickStartTaskStatus.FAILED;
|
|
1944
|
+
// TODO: toned down when this is shown, investigate further when we should display it
|
|
1945
|
+
// related: https://github.com/patternfly/patternfly-quickstarts/issues/104
|
|
1946
|
+
const tryAgain = failedReview && (React.createElement(React.Fragment, null,
|
|
1879
1947
|
React.createElement("div", null),
|
|
1880
1948
|
React.createElement("div", { className: "pfext-quick-start-task-header__tryagain" }, "Try the steps again.")));
|
|
1881
1949
|
const content = (React.createElement("div", { className: "pfext-quick-start-task-header" },
|
|
@@ -1886,7 +1954,7 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
|
|
|
1886
1954
|
' ',
|
|
1887
1955
|
subtitle))),
|
|
1888
1956
|
tryAgain));
|
|
1889
|
-
return (React.createElement(WizardNavItem, { content: content, step: taskIndex, onNavItemClick: () => onTaskSelect(taskIndex - 1), navItemComponent: "button", isCurrent: isActiveTask }));
|
|
1957
|
+
return (React.createElement(WizardNavItem, { content: content, step: taskIndex, onNavItemClick: () => onTaskSelect(taskIndex - 1), navItemComponent: "button", isCurrent: isActiveTask }, children));
|
|
1890
1958
|
};
|
|
1891
1959
|
|
|
1892
1960
|
const QuickStartTaskHeaderList = ({ tasks, allTaskStatuses, onTaskSelect, }) => {
|
|
@@ -1920,7 +1988,8 @@ const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, prerequi
|
|
|
1920
1988
|
const prereqList = (prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (React.createElement(ExpandableSection, { toggleText: getResource('View Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length), onToggle: () => setIsPrereqsExpanded(!isPrereqsExpanded), className: "pfext-quick-start-intro__prereq" },
|
|
1921
1989
|
React.createElement(List, { className: "pfext-quick-start-intro__prereq-list" }, prereqs.map((pr) => {
|
|
1922
1990
|
return (React.createElement(ListItem, { key: pr, className: "pfext-quick-start-intro__prereq-list__item" },
|
|
1923
|
-
React.createElement("span", { className: "pfext-quick-start-intro__prereq-list__item-content" },
|
|
1991
|
+
React.createElement("span", { className: "pfext-quick-start-intro__prereq-list__item-content" },
|
|
1992
|
+
React.createElement(QuickStartMarkdownView, { content: pr }))));
|
|
1924
1993
|
}))));
|
|
1925
1994
|
return (React.createElement(React.Fragment, null,
|
|
1926
1995
|
React.createElement(QuickStartMarkdownView, { content: introduction }),
|
|
@@ -1949,7 +2018,7 @@ const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
|
|
|
1949
2018
|
'pfext-quick-start-task-review--failed': taskStatus === QuickStartTaskStatus.FAILED,
|
|
1950
2019
|
});
|
|
1951
2020
|
const title = React.createElement("span", { className: alertClassNames }, getResource('Check your work'));
|
|
1952
|
-
return (React.createElement(Alert, { className: "pfext-quick-start-task-review-alert", variant: getAlertVariant(taskStatus), title: title, isInline: true },
|
|
2021
|
+
return (React.createElement(Alert, { className: "pfext-quick-start-task-review-alert", variant: getAlertVariant(taskStatus), title: title, isInline: true, role: "alert" },
|
|
1953
2022
|
React.createElement(QuickStartMarkdownView, { content: instructions }),
|
|
1954
2023
|
React.createElement("span", { className: "pfext-quick-start-task-review__actions" },
|
|
1955
2024
|
React.createElement(Radio, { id: "review-success", name: "review-success", "data-testid": "qs-drawer-check-yes", label: getResource('Yes'), className: "pfext-quick-start-task-review__radio", isChecked: taskStatus === QuickStartTaskStatus.SUCCESS, onChange: () => onTaskReview(QuickStartTaskStatus.SUCCESS) }),
|
|
@@ -1959,22 +2028,22 @@ const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
|
|
|
1959
2028
|
|
|
1960
2029
|
const QuickStartTasks = ({ tasks, taskNumber, allTaskStatuses, onTaskReview, onTaskSelect, }) => {
|
|
1961
2030
|
const { getResource, alwaysShowTaskReview } = React.useContext(QuickStartContext);
|
|
1962
|
-
return (React.createElement("div", { className: "pfext-quick-start-tasks__list" },
|
|
1963
|
-
.
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
React.createElement(
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2031
|
+
return (React.createElement("div", { className: "pfext-quick-start-tasks__list" },
|
|
2032
|
+
React.createElement("ul", null, tasks
|
|
2033
|
+
.filter((_, index) => allTaskStatuses[index] !== QuickStartTaskStatus.INIT)
|
|
2034
|
+
.map((task, index) => {
|
|
2035
|
+
const { title, description, review } = task;
|
|
2036
|
+
const isActiveTask = index === taskNumber;
|
|
2037
|
+
const taskStatus = allTaskStatuses[index];
|
|
2038
|
+
const shouldShowTaskReview = (!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) || alwaysShowTaskReview) &&
|
|
2039
|
+
review;
|
|
2040
|
+
return (React.createElement(React.Fragment, { key: title },
|
|
2041
|
+
React.createElement(QuickStartTaskHeader, { taskIndex: index + 1, title: title, size: "md", subtitle: getResource('{{index, number}} of {{tasks, number}}')
|
|
2042
|
+
.replace('{{index, number}}', index + 1)
|
|
2043
|
+
.replace('{{tasks, number}}', tasks.length), taskStatus: taskStatus, isActiveTask: isActiveTask, onTaskSelect: onTaskSelect }, isActiveTask && (React.createElement("div", { className: "pfext-quick-start-task__content" },
|
|
2044
|
+
React.createElement(QuickStartMarkdownView, { content: description }),
|
|
2045
|
+
shouldShowTaskReview && (React.createElement(QuickStartTaskReview, { review: review, taskStatus: taskStatus, onTaskReview: onTaskReview })))))));
|
|
2046
|
+
}))));
|
|
1978
2047
|
};
|
|
1979
2048
|
|
|
1980
2049
|
const QuickStartContent = React.forwardRef(({ quickStart, nextQuickStarts = [], taskNumber, allTaskStatuses, onTaskSelect, onTaskReview, onQuickStartChange, }, ref) => {
|
|
@@ -2084,11 +2153,10 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
|
|
|
2084
2153
|
};
|
|
2085
2154
|
const QuickStartPanelContent = (_a) => {
|
|
2086
2155
|
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
|
|
2087
|
-
const { getResource } = React.useContext(QuickStartContext);
|
|
2156
|
+
const { getResource, activeQuickStartState } = React.useContext(QuickStartContext);
|
|
2088
2157
|
const [contentRef, setContentRef] = React.useState();
|
|
2089
2158
|
const shadows = useScrollShadows(contentRef);
|
|
2090
2159
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
2091
|
-
const { activeQuickStartState } = React.useContext(QuickStartContext);
|
|
2092
2160
|
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
2093
2161
|
useScrollTopOnTaskNumberChange(contentRef, taskNumber);
|
|
2094
2162
|
const nextQuickStarts = quickStarts.filter((qs) => { var _a; return (_a = quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.nextQuickStart) === null || _a === void 0 ? void 0 : _a.includes(qs.metadata.name); });
|
|
@@ -2116,7 +2184,10 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2116
2184
|
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, quickStart === null || quickStart === void 0 ? void 0 :
|
|
2117
2185
|
quickStart.spec.displayName,
|
|
2118
2186
|
' ',
|
|
2119
|
-
React.createElement("small", { className: "pfext-quick-start-panel-content__duration" },
|
|
2187
|
+
React.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, (quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes) ? getResource('{{type}} • {{duration, number}} minutes', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|
|
2188
|
+
.replace('{{duration, number}}', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|
|
2189
|
+
.replace('{{type}}', getResource('Type'))
|
|
2190
|
+
: getResource('Type')))),
|
|
2120
2191
|
showClose && (React.createElement(DrawerActions, null,
|
|
2121
2192
|
React.createElement(DrawerCloseButton, { onClick: handleClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))))),
|
|
2122
2193
|
React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
|
|
@@ -2128,7 +2199,7 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2128
2199
|
};
|
|
2129
2200
|
|
|
2130
2201
|
const QuickStartContainer = (_a) => {
|
|
2131
|
-
var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview =
|
|
2202
|
+
var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview = true } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
|
|
2132
2203
|
const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
|
|
2133
2204
|
setActiveQuickStartID,
|
|
2134
2205
|
allQuickStartStates,
|
|
@@ -2166,7 +2237,7 @@ const QuickStartDrawer = (_a) => {
|
|
|
2166
2237
|
// if there is a quick start param, but the quick start is not active, set it
|
|
2167
2238
|
// this can happen if a new browser session is opened or an incognito window for example
|
|
2168
2239
|
const quickStartIdFromParam = params.get(QUICKSTART_ID_FILTER_KEY) || '';
|
|
2169
|
-
if (quickStartIdFromParam &&
|
|
2240
|
+
if (quickStartIdFromParam && activeQuickStartID !== quickStartIdFromParam) {
|
|
2170
2241
|
const activeQuickStart = getQuickStartByName(quickStartIdFromParam, combinedQuickStarts);
|
|
2171
2242
|
// don't try to load a quick start that is actually just an external resource (spec.link)
|
|
2172
2243
|
if (combinedQuickStarts.length > 0 && activeQuickStart && !activeQuickStart.spec.link) {
|
|
@@ -2225,6 +2296,111 @@ const QuickStartDrawer = (_a) => {
|
|
|
2225
2296
|
React.createElement(QuickStartCloseModal, { isOpen: modalOpen, onConfirm: onModalConfirm, onCancel: onModalCancel })));
|
|
2226
2297
|
};
|
|
2227
2298
|
|
|
2299
|
+
const HelpTopicContextDefaults = {
|
|
2300
|
+
helpTopics: [],
|
|
2301
|
+
activeHelpTopic: null,
|
|
2302
|
+
setActiveHelpTopicByName: () => { },
|
|
2303
|
+
filteredHelpTopics: [],
|
|
2304
|
+
setFilteredHelpTopics: () => { },
|
|
2305
|
+
loading: false,
|
|
2306
|
+
};
|
|
2307
|
+
const HelpTopicContext = React__default.createContext(HelpTopicContextDefaults);
|
|
2308
|
+
const useValuesForHelpTopicContext = (value = {}) => {
|
|
2309
|
+
const combinedValue = Object.assign(Object.assign({}, HelpTopicContextDefaults), value);
|
|
2310
|
+
const [loading, setLoading] = React__default.useState(combinedValue.loading);
|
|
2311
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
2312
|
+
const [helpTopics, setHelpTopics] = React__default.useState(combinedValue.helpTopics || []);
|
|
2313
|
+
const [activeHelpTopic, setActiveHelpTopic] = React__default.useState(combinedValue.activeHelpTopic || null);
|
|
2314
|
+
const setActiveHelpTopicByName = React__default.useCallback((helpTopicName) => {
|
|
2315
|
+
const topic = helpTopics.find((t) => {
|
|
2316
|
+
return t.name === helpTopicName;
|
|
2317
|
+
});
|
|
2318
|
+
if (!helpTopicName) {
|
|
2319
|
+
setActiveHelpTopic(null);
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
setActiveHelpTopic(topic);
|
|
2323
|
+
}, [helpTopics]);
|
|
2324
|
+
const [filteredHelpTopics, setFilteredHelpTopics] = React__default.useState(combinedValue.filteredHelpTopics || []);
|
|
2325
|
+
return {
|
|
2326
|
+
helpTopics,
|
|
2327
|
+
activeHelpTopic,
|
|
2328
|
+
setActiveHelpTopicByName,
|
|
2329
|
+
filteredHelpTopics,
|
|
2330
|
+
setFilteredHelpTopics,
|
|
2331
|
+
loading,
|
|
2332
|
+
setLoading,
|
|
2333
|
+
};
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2336
|
+
const HelpTopicPanelContent = (_a) => {
|
|
2337
|
+
var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true } = _a, props = __rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable"]);
|
|
2338
|
+
const { setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
|
|
2339
|
+
const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React.useState(false);
|
|
2340
|
+
const toggleHelpTopicMenu = () => {
|
|
2341
|
+
setIsHelpTopicMenuOpen(!isHelpTopicMenuOpen);
|
|
2342
|
+
};
|
|
2343
|
+
const onSelectHelpTopic = (event) => {
|
|
2344
|
+
const topicName = event.currentTarget.id;
|
|
2345
|
+
setActiveHelpTopicByName(topicName);
|
|
2346
|
+
toggleHelpTopicMenu();
|
|
2347
|
+
};
|
|
2348
|
+
const menuItems = filteredHelpTopics.map((topic) => {
|
|
2349
|
+
return (React.createElement(OptionsMenuItem, { key: topic.name, onSelect: onSelectHelpTopic, id: topic.name }, topic.title));
|
|
2350
|
+
});
|
|
2351
|
+
const content = (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
|
|
2352
|
+
React.createElement("div", null,
|
|
2353
|
+
React.createElement(DrawerHead, null,
|
|
2354
|
+
React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
|
|
2355
|
+
React.createElement(OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React.createElement(OptionsMenuToggle, { onToggle: toggleHelpTopicMenu, toggleTemplate: React.createElement(BarsIcon, null) }), menuItems: menuItems }),
|
|
2356
|
+
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.title))),
|
|
2357
|
+
React.createElement(Divider, null),
|
|
2358
|
+
React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
|
|
2359
|
+
React.createElement(Stack, { hasGutter: true },
|
|
2360
|
+
React.createElement(StackItem, { style: { padding: '20px' } },
|
|
2361
|
+
React.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
|
|
2362
|
+
React.createElement(Divider, null),
|
|
2363
|
+
React.createElement(StackItem, { style: { padding: '20px' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
|
|
2364
|
+
return React.createElement(QuickStartMarkdownView, { key: link, content: link });
|
|
2365
|
+
})))))));
|
|
2366
|
+
return content;
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
const HelpTopicContainer = (_a) => {
|
|
2370
|
+
var { helpTopics, children, resourceBundle, language, loading = false, markdown, contextProps } = _a, props = __rest(_a, ["helpTopics", "children", "resourceBundle", "language", "loading", "markdown", "contextProps"]);
|
|
2371
|
+
const valuesForHelpTopicContext = useValuesForHelpTopicContext(Object.assign({ helpTopics,
|
|
2372
|
+
language, resourceBundle: Object.assign({}, resourceBundle), loading,
|
|
2373
|
+
markdown }, contextProps));
|
|
2374
|
+
React.useEffect(() => {
|
|
2375
|
+
if (loading !== valuesForHelpTopicContext.loading) {
|
|
2376
|
+
valuesForHelpTopicContext.setLoading(loading);
|
|
2377
|
+
}
|
|
2378
|
+
}, [loading, valuesForHelpTopicContext]);
|
|
2379
|
+
const drawerProps = Object.assign({}, props);
|
|
2380
|
+
return (React.createElement(HelpTopicContext.Provider, { value: valuesForHelpTopicContext },
|
|
2381
|
+
React.createElement(HelpTopicDrawer, Object.assign({}, drawerProps), children)));
|
|
2382
|
+
};
|
|
2383
|
+
const HelpTopicDrawer = (_a) => {
|
|
2384
|
+
var {
|
|
2385
|
+
// helpTopics,
|
|
2386
|
+
children } = _a, props = __rest(_a, ["children"]);
|
|
2387
|
+
const { activeHelpTopic, filteredHelpTopics } = React.useContext(HelpTopicContext);
|
|
2388
|
+
// Leave here if query param is desired for help topics later
|
|
2389
|
+
// React.useEffect(() => {
|
|
2390
|
+
// const params = new URLSearchParams(window.location.search);
|
|
2391
|
+
// // if there is a quick start param, but the quick start is not active, set it
|
|
2392
|
+
// // this can happen if a new browser session is opened or an incognito window for example
|
|
2393
|
+
// const helpTopicNameFromParam = params.get(HELP_TOPIC_NAME_KEY) || '';
|
|
2394
|
+
// if (helpTopicNameFromParam) {
|
|
2395
|
+
// setActiveHelpTopicByName(helpTopicNameFromParam);
|
|
2396
|
+
// }
|
|
2397
|
+
// }, [inContextHelpTopics, setActiveHelpTopicByName]);
|
|
2398
|
+
const panelContent = (React.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics }));
|
|
2399
|
+
return (React.createElement(React.Fragment, null,
|
|
2400
|
+
React.createElement(Drawer, Object.assign({ isExpanded: !!activeHelpTopic, isInline: true }, props), children ? (React.createElement(DrawerContent, { panelContent: panelContent },
|
|
2401
|
+
React.createElement(DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React.createElement("div", { className: "pf-c-drawer__main" }, panelContent)))));
|
|
2402
|
+
};
|
|
2403
|
+
|
|
2228
2404
|
const useLocalStorage = (key, initialValue) => {
|
|
2229
2405
|
// State to store our value
|
|
2230
2406
|
// Pass initial state function to useState so logic is only executed once
|
|
@@ -2262,5 +2438,5 @@ const useLocalStorage = (key, initialValue) => {
|
|
|
2262
2438
|
return [storedValue, setValue];
|
|
2263
2439
|
};
|
|
2264
2440
|
|
|
2265
|
-
export { Box, CamelCaseWrap, EmptyBox, Loading, LoadingBox, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForQuickStartContext };
|
|
2441
|
+
export { Box, CamelCaseWrap, EmptyBox, HELP_TOPIC_NAME_KEY, HelpTopicContainer, HelpTopicContext, HelpTopicContextDefaults, HelpTopicDrawer, Loading, LoadingBox, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForHelpTopicContext, useValuesForQuickStartContext };
|
|
2266
2442
|
//# sourceMappingURL=index.es.js.map
|