@patternfly/quickstarts 0.0.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 +546 -0
- package/dist/ConsoleInternal/components/markdown-view.d.ts +19 -0
- package/dist/ConsoleInternal/components/utils/camel-case-wrap.d.ts +6 -0
- package/dist/ConsoleInternal/components/utils/index.d.ts +3 -0
- package/dist/ConsoleInternal/components/utils/router.d.ts +9 -0
- package/dist/ConsoleInternal/components/utils/status-box.d.ts +20 -0
- package/dist/ConsoleInternal/module/k8s/types.d.ts +42 -0
- package/dist/ConsoleShared/index.d.ts +1 -0
- package/dist/ConsoleShared/src/components/index.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.d.ts +13 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/accordion-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.d.ts +6 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/admonition-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/code-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/const.d.ts +5 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/index.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/utils.d.ts +1 -0
- package/dist/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-highlight-extension/highlight-consts.d.ts +4 -0
- package/dist/ConsoleShared/src/components/markdown-highlight-extension/index.d.ts +1 -0
- package/dist/ConsoleShared/src/components/modal/Modal.d.ts +9 -0
- package/dist/ConsoleShared/src/components/modal/index.d.ts +1 -0
- package/dist/ConsoleShared/src/components/popper/Portal.d.ts +8 -0
- package/dist/ConsoleShared/src/components/popper/SimplePopper.d.ts +6 -0
- package/dist/ConsoleShared/src/components/popper/index.d.ts +2 -0
- package/dist/ConsoleShared/src/components/spotlight/InteractiveSpotlight.d.ts +7 -0
- package/dist/ConsoleShared/src/components/spotlight/Spotlight.d.ts +7 -0
- package/dist/ConsoleShared/src/components/spotlight/StaticSpotlight.d.ts +7 -0
- package/dist/ConsoleShared/src/components/spotlight/index.d.ts +1 -0
- package/dist/ConsoleShared/src/components/status/GenericStatus.d.ts +12 -0
- package/dist/ConsoleShared/src/components/status/NotStartedIcon.d.ts +3 -0
- package/dist/ConsoleShared/src/components/status/PopoverStatus.d.ts +13 -0
- package/dist/ConsoleShared/src/components/status/Status.d.ts +11 -0
- package/dist/ConsoleShared/src/components/status/StatusIconAndText.d.ts +8 -0
- package/dist/ConsoleShared/src/components/status/icons.d.ts +9 -0
- package/dist/ConsoleShared/src/components/status/index.d.ts +1 -0
- package/dist/ConsoleShared/src/components/status/statuses.d.ts +5 -0
- package/dist/ConsoleShared/src/components/status/types.d.ts +9 -0
- package/dist/ConsoleShared/src/components/utils/FallbackImg.d.ts +9 -0
- package/dist/ConsoleShared/src/components/utils/index.d.ts +1 -0
- package/dist/ConsoleShared/src/constants/index.d.ts +1 -0
- package/dist/ConsoleShared/src/constants/ui.d.ts +1 -0
- package/dist/ConsoleShared/src/hooks/index.d.ts +6 -0
- package/dist/ConsoleShared/src/hooks/scroll.d.ts +8 -0
- package/dist/ConsoleShared/src/hooks/useBoundingClientRect.d.ts +3 -0
- package/dist/ConsoleShared/src/hooks/useEventListener.d.ts +1 -0
- package/dist/ConsoleShared/src/hooks/useForceRender.d.ts +4 -0
- package/dist/ConsoleShared/src/hooks/useResizeObserver.d.ts +1 -0
- package/dist/ConsoleShared/src/hooks/useScrollShadows.d.ts +7 -0
- package/dist/ConsoleShared/src/index.d.ts +4 -0
- package/dist/ConsoleShared/src/utils/index.d.ts +1 -0
- package/dist/ConsoleShared/src/utils/useCombineRefs.d.ts +2 -0
- package/dist/HelpTopicDrawer.d.ts +33 -0
- package/dist/HelpTopicPanelContent.d.ts +11 -0
- package/dist/QuickStartCatalogPage.d.ts +14 -0
- package/dist/QuickStartCloseModal.d.ts +8 -0
- package/dist/QuickStartController.d.ts +10 -0
- package/dist/QuickStartDrawer.d.ts +62 -0
- package/dist/QuickStartMarkdownView.d.ts +9 -0
- package/dist/QuickStartPanelContent.d.ts +15 -0
- package/dist/catalog/Catalog/QuickStartCatalogHeader.d.ts +6 -0
- package/dist/catalog/Catalog/QuickStartCatalogSection.d.ts +5 -0
- package/dist/catalog/Catalog/QuickStartCatalogToolbar.d.ts +5 -0
- package/dist/catalog/Catalog/index.d.ts +3 -0
- package/dist/catalog/QuickStartCatalog.d.ts +8 -0
- package/dist/catalog/QuickStartTile.d.ts +14 -0
- package/dist/catalog/QuickStartTileDescription.d.ts +8 -0
- package/dist/catalog/QuickStartTileFooter.d.ts +8 -0
- package/dist/catalog/QuickStartTileFooterExternal.d.ts +8 -0
- package/dist/catalog/QuickStartTileHeader.d.ts +24 -0
- package/dist/catalog/Toolbar/QuickStartCatalogFilter.d.ts +10 -0
- package/dist/catalog/Toolbar/QuickStartCatalogFilterItems.d.ts +31 -0
- package/dist/catalog/index.d.ts +9 -0
- package/dist/controller/QuickStartConclusion.d.ts +12 -0
- package/dist/controller/QuickStartContent.d.ts +14 -0
- package/dist/controller/QuickStartFooter.d.ts +14 -0
- package/dist/controller/QuickStartIntroduction.d.ts +12 -0
- package/dist/controller/QuickStartTaskHeader.d.ts +15 -0
- package/dist/controller/QuickStartTaskHeaderList.d.ts +10 -0
- package/dist/controller/QuickStartTaskReview.d.ts +10 -0
- package/dist/controller/QuickStartTasks.d.ts +12 -0
- package/dist/data/mocks/json/explore-pipeline-quickstart.d.ts +2 -0
- package/dist/data/mocks/json/explore-serverless-quickstart.d.ts +2 -0
- package/dist/data/mocks/json/monitor-sampleapp-quickstart.d.ts +2 -0
- package/dist/data/mocks/json/tour-icons.d.ts +2 -0
- package/dist/data/quick-start-test-data.d.ts +2 -0
- package/dist/data/test-utils.d.ts +8 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.es.js +2593 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +2695 -0
- package/dist/index.js.map +1 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/design-guidelines.md +105 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements copy.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/catalog-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/check-your-work.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/introduction-screen.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/mixed-catalog.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/prerequisites.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/qs-context.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-resized.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-no.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-yes.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/Basic.jsx +73 -0
- package/dist/patternfly-docs/quick-starts/examples/HelpTopic.jsx +51 -0
- package/dist/patternfly-docs/quick-starts/examples/about.md +84 -0
- package/dist/patternfly-docs/quick-starts/examples/basic.md +29 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-help-topics.js +173 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-quickstarts.js +215 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/index.js +15 -0
- package/dist/patternfly-docs/quick-starts/examples/help-topics.md +28 -0
- package/dist/patternfly-docs/quick-starts/examples/img/catalog.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/img/help-topic.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/img/side-panel.png +0 -0
- package/dist/patternfly-global.css +1302 -0
- package/dist/patternfly-nested.css +11812 -0
- package/dist/quickstarts-base.css +1219 -0
- package/dist/quickstarts-full.es.js +31861 -0
- package/dist/quickstarts-full.es.js.map +1 -0
- package/dist/quickstarts-standalone.css +868 -0
- package/dist/quickstarts-standalone.min.css +4 -0
- package/dist/quickstarts-vendor.css +165 -0
- package/dist/quickstarts.css +1383 -0
- package/dist/quickstarts.min.css +1 -0
- package/dist/styles/patternfly-global-entry.d.ts +1 -0
- package/dist/styles/patternfly-nested-entry.d.ts +1 -0
- package/dist/styles/quickstarts-standalone-entry.d.ts +1 -0
- package/dist/styles/vendor-entry.d.ts +1 -0
- package/dist/utils/PluralResolver.d.ts +16 -0
- package/dist/utils/asciidoc-procedure-parser.d.ts +12 -0
- package/dist/utils/const.d.ts +6 -0
- package/dist/utils/help-topic-context.d.ts +23 -0
- package/dist/utils/help-topic-types.d.ts +13 -0
- package/dist/utils/quick-start-context.d.ts +81 -0
- package/dist/utils/quick-start-types.d.ts +60 -0
- package/dist/utils/quick-start-utils.d.ts +10 -0
- package/dist/utils/useLocalStorage.d.ts +1 -0
- package/dist/vendor.js +2 -0
- package/dist/vendor.js.map +1 -0
- package/package.json +105 -0
- package/src/ConsoleInternal/components/_icon-and-text.scss +14 -0
- package/src/ConsoleInternal/components/_markdown-view.scss +19 -0
- package/src/ConsoleInternal/components/catalog/_catalog.scss +392 -0
- package/src/ConsoleInternal/components/markdown-view.tsx +276 -0
- package/src/ConsoleInternal/components/utils/_status-box.scss +58 -0
- package/src/ConsoleInternal/components/utils/camel-case-wrap.tsx +33 -0
- package/src/ConsoleInternal/components/utils/index.tsx +3 -0
- package/src/ConsoleInternal/components/utils/router.ts +45 -0
- package/src/ConsoleInternal/components/utils/status-box.tsx +56 -0
- package/src/ConsoleInternal/module/k8s/types.ts +53 -0
- package/src/ConsoleShared/index.ts +1 -0
- package/src/ConsoleShared/src/components/index.ts +7 -0
- package/src/ConsoleShared/src/components/layout/PageLayout.scss +29 -0
- package/src/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.tsx +95 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/MarkdownCopyClipboard.spec.tsx +25 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/test-data.ts +5 -0
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-extension.tsx +51 -0
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.tsx +60 -0
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +67 -0
- package/src/ConsoleShared/src/components/markdown-extensions/code-extension.tsx +23 -0
- package/src/ConsoleShared/src/components/markdown-extensions/const.ts +5 -0
- package/src/ConsoleShared/src/components/markdown-extensions/index.ts +7 -0
- package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +39 -0
- package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +44 -0
- package/src/ConsoleShared/src/components/markdown-extensions/showdown-extension.scss +52 -0
- package/src/ConsoleShared/src/components/markdown-extensions/utils.ts +1 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.tsx +65 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/highlight-consts.ts +9 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/index.ts +1 -0
- package/src/ConsoleShared/src/components/modal/Modal.scss +3 -0
- package/src/ConsoleShared/src/components/modal/Modal.tsx +19 -0
- package/src/ConsoleShared/src/components/modal/index.ts +1 -0
- package/src/ConsoleShared/src/components/popper/Portal.tsx +25 -0
- package/src/ConsoleShared/src/components/popper/SimplePopper.tsx +92 -0
- package/src/ConsoleShared/src/components/popper/index.ts +2 -0
- package/src/ConsoleShared/src/components/spotlight/InteractiveSpotlight.tsx +58 -0
- package/src/ConsoleShared/src/components/spotlight/Spotlight.tsx +35 -0
- package/src/ConsoleShared/src/components/spotlight/StaticSpotlight.tsx +32 -0
- package/src/ConsoleShared/src/components/spotlight/index.ts +1 -0
- package/src/ConsoleShared/src/components/spotlight/spotlight.scss +63 -0
- package/src/ConsoleShared/src/components/status/GenericStatus.tsx +34 -0
- package/src/ConsoleShared/src/components/status/NotStartedIcon.tsx +27 -0
- package/src/ConsoleShared/src/components/status/PopoverStatus.tsx +39 -0
- package/src/ConsoleShared/src/components/status/Status.tsx +38 -0
- package/src/ConsoleShared/src/components/status/StatusIconAndText.tsx +42 -0
- package/src/ConsoleShared/src/components/status/icons.tsx +39 -0
- package/src/ConsoleShared/src/components/status/index.tsx +1 -0
- package/src/ConsoleShared/src/components/status/statuses.tsx +20 -0
- package/src/ConsoleShared/src/components/status/types.ts +8 -0
- package/src/ConsoleShared/src/components/utils/FallbackImg.tsx +20 -0
- package/src/ConsoleShared/src/components/utils/index.ts +1 -0
- package/src/ConsoleShared/src/constants/index.ts +1 -0
- package/src/ConsoleShared/src/constants/ui.ts +1 -0
- package/src/ConsoleShared/src/hooks/index.ts +6 -0
- package/src/ConsoleShared/src/hooks/scroll.ts +52 -0
- package/src/ConsoleShared/src/hooks/useBoundingClientRect.ts +18 -0
- package/src/ConsoleShared/src/hooks/useEventListener.ts +14 -0
- package/src/ConsoleShared/src/hooks/useForceRender.ts +6 -0
- package/src/ConsoleShared/src/hooks/useResizeObserver.ts +19 -0
- package/src/ConsoleShared/src/hooks/useScrollShadows.ts +45 -0
- package/src/ConsoleShared/src/index.ts +4 -0
- package/src/ConsoleShared/src/utils/index.ts +1 -0
- package/src/ConsoleShared/src/utils/useCombineRefs.ts +16 -0
- package/src/HelpTopicDrawer.tsx +116 -0
- package/src/HelpTopicPanelContent.tsx +160 -0
- package/src/QuickStartCatalogPage.tsx +195 -0
- package/src/QuickStartCloseModal.tsx +47 -0
- package/src/QuickStartController.tsx +111 -0
- package/src/QuickStartDrawer.scss +11 -0
- package/src/QuickStartDrawer.tsx +265 -0
- package/src/QuickStartMarkdownView.tsx +80 -0
- package/src/QuickStartPanelContent.scss +46 -0
- package/src/QuickStartPanelContent.tsx +165 -0
- package/src/__tests__/quick-start-utils.spec.tsx +16 -0
- package/src/catalog/Catalog/QuickStartCatalogHeader.tsx +18 -0
- package/src/catalog/Catalog/QuickStartCatalogSection.tsx +9 -0
- package/src/catalog/Catalog/QuickStartCatalogToolbar.tsx +12 -0
- package/src/catalog/Catalog/index.ts +3 -0
- package/src/catalog/QuickStartCatalog.scss +8 -0
- package/src/catalog/QuickStartCatalog.tsx +42 -0
- package/src/catalog/QuickStartTile.scss +11 -0
- package/src/catalog/QuickStartTile.tsx +129 -0
- package/src/catalog/QuickStartTileDescription.scss +29 -0
- package/src/catalog/QuickStartTileDescription.tsx +79 -0
- package/src/catalog/QuickStartTileFooter.tsx +101 -0
- package/src/catalog/QuickStartTileFooterExternal.tsx +40 -0
- package/src/catalog/QuickStartTileHeader.scss +16 -0
- package/src/catalog/QuickStartTileHeader.tsx +105 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilter.scss +25 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilter.tsx +32 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +218 -0
- package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +35 -0
- package/src/catalog/__tests__/QuickStartTile.spec.tsx +38 -0
- package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +44 -0
- package/src/catalog/index.ts +9 -0
- package/src/controller/QuickStartConclusion.tsx +63 -0
- package/src/controller/QuickStartContent.scss +12 -0
- package/src/controller/QuickStartContent.tsx +72 -0
- package/src/controller/QuickStartFooter.scss +13 -0
- package/src/controller/QuickStartFooter.tsx +124 -0
- package/src/controller/QuickStartIntroduction.scss +35 -0
- package/src/controller/QuickStartIntroduction.tsx +64 -0
- package/src/controller/QuickStartTaskHeader.scss +58 -0
- package/src/controller/QuickStartTaskHeader.tsx +125 -0
- package/src/controller/QuickStartTaskHeaderList.scss +17 -0
- package/src/controller/QuickStartTaskHeaderList.tsx +33 -0
- package/src/controller/QuickStartTaskReview.scss +30 -0
- package/src/controller/QuickStartTaskReview.tsx +81 -0
- package/src/controller/QuickStartTasks.scss +89 -0
- package/src/controller/QuickStartTasks.tsx +75 -0
- package/src/controller/__tests__/QuickStartConclusion.spec.tsx +95 -0
- package/src/controller/__tests__/QuickStartContent.spec.tsx +52 -0
- package/src/controller/__tests__/QuickStartFooter.spec.tsx +148 -0
- package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +43 -0
- package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +45 -0
- package/src/controller/__tests__/QuickStartTasks.spec.tsx +81 -0
- package/src/data/mocks/json/explore-pipeline-quickstart.ts +66 -0
- package/src/data/mocks/json/explore-serverless-quickstart.ts +90 -0
- package/src/data/mocks/json/monitor-sampleapp-quickstart.ts +77 -0
- package/src/data/mocks/json/tour-icons.ts +3 -0
- package/src/data/mocks/yamls/add-healthchecks-quickstart.yaml +67 -0
- package/src/data/mocks/yamls/explore-pipeline-quickstart.yaml +57 -0
- package/src/data/mocks/yamls/explore-serverless-quickstart.yaml +83 -0
- package/src/data/mocks/yamls/install-associate-pipeline-quickstart.yaml +74 -0
- package/src/data/mocks/yamls/monitor-sampleapp-quickstart.yaml +66 -0
- package/src/data/mocks/yamls/sample-application-quickstart.yaml +97 -0
- package/src/data/mocks/yamls/serverless-application-quickstart.yaml +141 -0
- package/src/data/quick-start-test-data.ts +10 -0
- package/src/data/test-utils.ts +11 -0
- package/src/declaration.d.ts +2 -0
- package/src/index.ts +17 -0
- package/src/locales/en/quickstart.json +46 -0
- package/src/styles/_base.scss +54 -0
- package/src/styles/_dark-custom-override.scss +62 -0
- package/src/styles/legacy-bootstrap/README.md +21 -0
- package/src/styles/legacy-bootstrap/_code.scss +46 -0
- package/src/styles/legacy-bootstrap/_tables.scss +38 -0
- package/src/styles/legacy-bootstrap/_type.scss +92 -0
- package/src/styles/legacy-bootstrap/_variables.scss +48 -0
- package/src/styles/legacy-bootstrap.scss +5 -0
- package/src/styles/patternfly-global-entry.ts +1 -0
- package/src/styles/patternfly-global.scss +28 -0
- package/src/styles/patternfly-nested-entry.ts +1 -0
- package/src/styles/patternfly-nested.scss +18 -0
- package/src/styles/quickstarts-standalone-entry.ts +1 -0
- package/src/styles/quickstarts-standalone.scss +7 -0
- package/src/styles/style.scss +12 -0
- package/src/styles/vendor-entry.ts +1 -0
- package/src/styles/vendor.scss +7 -0
- package/src/utils/PluralResolver.ts +362 -0
- package/src/utils/asciidoc-procedure-parser.ts +130 -0
- package/src/utils/const.ts +10 -0
- package/src/utils/help-topic-context.tsx +72 -0
- package/src/utils/help-topic-types.ts +16 -0
- package/src/utils/quick-start-context.tsx +473 -0
- package/src/utils/quick-start-types.ts +73 -0
- package/src/utils/quick-start-utils.ts +88 -0
- package/src/utils/useLocalStorage.ts +38 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2695 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var reactCore = require('@patternfly/react-core');
|
|
7
|
+
var SearchIcon = require('@patternfly/react-icons/dist/js/icons/search-icon');
|
|
8
|
+
var reactStyles = require('@patternfly/react-styles');
|
|
9
|
+
var tslib = require('tslib');
|
|
10
|
+
require('@patternfly/react-styles/css/components/Form/form');
|
|
11
|
+
var RocketIcon = require('@patternfly/react-icons/dist/js/icons/rocket-icon');
|
|
12
|
+
var ReactDOM = require('react-dom');
|
|
13
|
+
var server = require('react-dom/server');
|
|
14
|
+
var CopyIcon = require('@patternfly/react-icons/dist/js/icons/copy-icon');
|
|
15
|
+
var LightbulbIcon = require('@patternfly/react-icons/dist/js/icons/lightbulb-icon');
|
|
16
|
+
var FireIcon = require('@patternfly/react-icons/dist/js/icons/fire-icon');
|
|
17
|
+
var showdown = require('showdown');
|
|
18
|
+
var SyncAltIcon = require('@patternfly/react-icons/dist/js/icons/sync-alt-icon');
|
|
19
|
+
var CheckCircleIcon = require('@patternfly/react-icons/dist/js/icons/check-circle-icon');
|
|
20
|
+
var ExclamationCircleIcon = require('@patternfly/react-icons/dist/js/icons/exclamation-circle-icon');
|
|
21
|
+
var InfoCircleIcon = require('@patternfly/react-icons/dist/js/icons/info-circle-icon');
|
|
22
|
+
require('@patternfly/react-tokens/dist/esm/global_danger_color_100');
|
|
23
|
+
require('@patternfly/react-tokens/dist/esm/global_palette_blue_300');
|
|
24
|
+
var okColor = require('@patternfly/react-tokens/dist/esm/global_palette_green_500');
|
|
25
|
+
var ExternalLinkAltIcon = require('@patternfly/react-icons/dist/js/icons/external-link-alt-icon');
|
|
26
|
+
var OutlinedClockIcon = require('@patternfly/react-icons/dist/js/icons/outlined-clock-icon');
|
|
27
|
+
var OutlinedBookmarkIcon = require('@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon');
|
|
28
|
+
var ArrowRightIcon = require('@patternfly/react-icons/dist/js/icons/arrow-right-icon');
|
|
29
|
+
var BarsIcon = require('@patternfly/react-icons/dist/js/icons/bars-icon');
|
|
30
|
+
|
|
31
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
32
|
+
|
|
33
|
+
function _interopNamespace(e) {
|
|
34
|
+
if (e && e.__esModule) return e;
|
|
35
|
+
var n = Object.create(null);
|
|
36
|
+
if (e) {
|
|
37
|
+
Object.keys(e).forEach(function (k) {
|
|
38
|
+
if (k !== 'default') {
|
|
39
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
40
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return e[k];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
n['default'] = e;
|
|
50
|
+
return Object.freeze(n);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
54
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
55
|
+
var SearchIcon__default = /*#__PURE__*/_interopDefaultLegacy(SearchIcon);
|
|
56
|
+
var RocketIcon__default = /*#__PURE__*/_interopDefaultLegacy(RocketIcon);
|
|
57
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
58
|
+
var CopyIcon__default = /*#__PURE__*/_interopDefaultLegacy(CopyIcon);
|
|
59
|
+
var LightbulbIcon__default = /*#__PURE__*/_interopDefaultLegacy(LightbulbIcon);
|
|
60
|
+
var FireIcon__default = /*#__PURE__*/_interopDefaultLegacy(FireIcon);
|
|
61
|
+
var SyncAltIcon__default = /*#__PURE__*/_interopDefaultLegacy(SyncAltIcon);
|
|
62
|
+
var CheckCircleIcon__default = /*#__PURE__*/_interopDefaultLegacy(CheckCircleIcon);
|
|
63
|
+
var ExclamationCircleIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExclamationCircleIcon);
|
|
64
|
+
var InfoCircleIcon__default = /*#__PURE__*/_interopDefaultLegacy(InfoCircleIcon);
|
|
65
|
+
var okColor__default = /*#__PURE__*/_interopDefaultLegacy(okColor);
|
|
66
|
+
var ExternalLinkAltIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExternalLinkAltIcon);
|
|
67
|
+
var OutlinedClockIcon__default = /*#__PURE__*/_interopDefaultLegacy(OutlinedClockIcon);
|
|
68
|
+
var OutlinedBookmarkIcon__default = /*#__PURE__*/_interopDefaultLegacy(OutlinedBookmarkIcon);
|
|
69
|
+
var ArrowRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowRightIcon);
|
|
70
|
+
var BarsIcon__default = /*#__PURE__*/_interopDefaultLegacy(BarsIcon);
|
|
71
|
+
|
|
72
|
+
function _extends() {
|
|
73
|
+
_extends = Object.assign || function (target) {
|
|
74
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
75
|
+
var source = arguments[i];
|
|
76
|
+
|
|
77
|
+
for (var key in source) {
|
|
78
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
79
|
+
target[key] = source[key];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return target;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return _extends.apply(this, arguments);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var m,x=m||(m={});x.Pop="POP";x.Push="PUSH";x.Replace="REPLACE";var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function z(a,b){if(!a){"undefined"!==typeof console&&console.warn(b);try{throw Error(b);}catch(g){}}}function A(a){a.preventDefault();a.returnValue="";}
|
|
91
|
+
function B(){var a=[];return {get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b});}},call:function(b){a.forEach(function(a){return a&&a(b)});}}}function D(){return Math.random().toString(36).substr(2,8)}function E(a){var b=a.pathname,g=a.search;a=a.hash;return (void 0===b?"/":b)+(void 0===g?"":g)+(void 0===a?"":a)}
|
|
92
|
+
function F(a){var b={};if(a){var g=a.indexOf("#");0<=g&&(b.hash=a.substr(g),a=a.substr(0,g));g=a.indexOf("?");0<=g&&(b.search=a.substr(g),a=a.substr(0,g));a&&(b.pathname=a);}return b}
|
|
93
|
+
function createBrowserHistory(a){function b(){var a=h.location,d=f.state||{};return [d.idx,y({pathname:a.pathname,search:a.search,hash:a.hash,state:d.usr||null,key:d.key||"default"})]}function g(a){return "string"===typeof a?a:E(a)}function t(a,d){void 0===d&&(d=null);return y(_extends({},l,{},"string"===typeof a?F(a):a,{state:d,key:D()}))}function v(a){n=a;a=b();q=a[0];l=a[1];c.call({action:n,location:l});}function w(a,d){function c(){w(a,d);}var k=m.Push,C=t(a,d);if(!e.length||(e.call({action:k,
|
|
94
|
+
location:C,retry:c}),!1)){var b=[{usr:C.state,key:C.key,idx:q+1},g(C)];C=b[0];b=b[1];try{f.pushState(C,"",b);}catch(G){h.location.assign(b);}v(k);}}function u(a,d){function c(){u(a,d);}var b=m.Replace,k=t(a,d);e.length&&(e.call({action:b,location:k,retry:c}),1)||(k=[{usr:k.state,key:k.key,idx:q},g(k)],f.replaceState(k[0],"",k[1]),v(b));}function r(a){f.go(a);}void 0===a&&(a={});a=a.window;var h=void 0===a?document.defaultView:a,f=h.history,p=null;h.addEventListener("popstate",function(){if(p)e.call(p),
|
|
95
|
+
p=null;else {var a=m.Pop,d=b(),c=d[0];d=d[1];if(e.length)if(null!=c){var f=q-c;f&&(p={action:a,location:d,retry:function(){r(-1*f);}},r(f));}else "production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):void 0;else v(a);}});var n=
|
|
96
|
+
m.Pop;a=b();var q=a[0],l=a[1],c=B(),e=B();null==q&&(q=0,f.replaceState(_extends({},f.state,{idx:q}),""));return {get action(){return n},get location(){return l},createHref:g,push:w,replace:u,go:r,back:function(){r(-1);},forward:function(){r(1);},listen:function(a){return c.push(a)},block:function(a){var d=e.push(a);1===e.length&&h.addEventListener("beforeunload",A);return function(){d();e.length||h.removeEventListener("beforeunload",A);}}}}function createMemoryHistory(a){function b(a,b){void 0===b&&(b=null);return y(_extends({},n,{},"string"===typeof a?F(a):a,{state:b,key:D()}))}function g(a,b,f){return !l.length||(l.call({action:a,location:b,retry:f}),!1)}function t(a,b){p=a;n=b;q.call({action:p,location:n});}function v(a,e){var c=m.Push,d=b(a,e);"production"!==process.env.NODE_ENV?z("/"===n.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(a)+")"):void 0;g(c,d,function(){v(a,e);})&&
|
|
97
|
+
(f+=1,h.splice(f,h.length,d),t(c,d));}function w(a,e){var c=m.Replace,d=b(a,e);"production"!==process.env.NODE_ENV?z("/"===n.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(a)+")"):void 0;g(c,d,function(){w(a,e);})&&(h[f]=d,t(c,d));}function u(a){var b=Math.min(Math.max(f+a,0),h.length-1),c=m.Pop,d=h[b];g(c,d,function(){u(a);})&&(f=b,t(c,d));}void 0===a&&(a={});var r=a;a=r.initialEntries;r=r.initialIndex;var h=(void 0===a?["/"]:a).map(function(a){var b=
|
|
98
|
+
y(_extends({pathname:"/",search:"",hash:"",state:null,key:D()},"string"===typeof a?F(a):a));"production"!==process.env.NODE_ENV?z("/"===b.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(a)+")"):void 0;return b}),f=Math.min(Math.max(null==r?h.length-1:r,0),h.length-1),p=m.Pop,n=h[f],q=B(),l=B();return {get index(){return f},get action(){return p},get location(){return n},createHref:function(a){return "string"===typeof a?
|
|
99
|
+
a:E(a)},push:v,replace:w,go:u,back:function(){u(-1);},forward:function(){u(1);},listen:function(a){return q.push(a)},block:function(a){return l.push(a)}}}
|
|
100
|
+
|
|
101
|
+
exports.QuickStartStatus = void 0;
|
|
102
|
+
(function (QuickStartStatus) {
|
|
103
|
+
QuickStartStatus["COMPLETE"] = "Complete";
|
|
104
|
+
QuickStartStatus["IN_PROGRESS"] = "In Progress";
|
|
105
|
+
QuickStartStatus["NOT_STARTED"] = "Not started";
|
|
106
|
+
})(exports.QuickStartStatus || (exports.QuickStartStatus = {}));
|
|
107
|
+
exports.QuickStartTaskStatus = void 0;
|
|
108
|
+
(function (QuickStartTaskStatus) {
|
|
109
|
+
QuickStartTaskStatus["INIT"] = "Initial";
|
|
110
|
+
QuickStartTaskStatus["VISITED"] = "Visited";
|
|
111
|
+
QuickStartTaskStatus["REVIEW"] = "Review";
|
|
112
|
+
QuickStartTaskStatus["SUCCESS"] = "Success";
|
|
113
|
+
QuickStartTaskStatus["FAILED"] = "Failed";
|
|
114
|
+
})(exports.QuickStartTaskStatus || (exports.QuickStartTaskStatus = {}));
|
|
115
|
+
|
|
116
|
+
const QUICKSTART_SEARCH_FILTER_KEY = 'keyword';
|
|
117
|
+
const QUICKSTART_STATUS_FILTER_KEY = 'status';
|
|
118
|
+
const QUICKSTART_ID_FILTER_KEY = 'quickstart';
|
|
119
|
+
const QUICKSTART_TASKS_INITIAL_STATES = [
|
|
120
|
+
exports.QuickStartTaskStatus.INIT,
|
|
121
|
+
exports.QuickStartTaskStatus.VISITED,
|
|
122
|
+
];
|
|
123
|
+
const HELP_TOPIC_NAME_KEY = 'topic';
|
|
124
|
+
|
|
125
|
+
let createHistory;
|
|
126
|
+
try {
|
|
127
|
+
if (process.env.NODE_ENV === 'test') {
|
|
128
|
+
// Running in node. Can't use browser history
|
|
129
|
+
createHistory = createMemoryHistory;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
createHistory = createBrowserHistory;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (unused) {
|
|
136
|
+
createHistory = createBrowserHistory;
|
|
137
|
+
}
|
|
138
|
+
const history = createHistory();
|
|
139
|
+
const removeQueryArgument = (k) => {
|
|
140
|
+
const params = new URLSearchParams(window.location.search);
|
|
141
|
+
if (params.has(k)) {
|
|
142
|
+
params.delete(k);
|
|
143
|
+
const url = new URL(window.location.href);
|
|
144
|
+
history.replace(`${url.pathname}?${params.toString()}${url.hash}`);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const setQueryArgument = (k, v) => {
|
|
148
|
+
if (!v) {
|
|
149
|
+
return removeQueryArgument(k);
|
|
150
|
+
}
|
|
151
|
+
const params = new URLSearchParams(window.location.search);
|
|
152
|
+
if (params.get(k) !== v) {
|
|
153
|
+
params.set(k, v);
|
|
154
|
+
const url = new URL(window.location.href);
|
|
155
|
+
history.replace(`${url.pathname}?${params.toString()}${url.hash}`);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const clearFilterParams = () => {
|
|
159
|
+
removeQueryArgument(QUICKSTART_SEARCH_FILTER_KEY);
|
|
160
|
+
removeQueryArgument(QUICKSTART_STATUS_FILTER_KEY);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var Status$1 = "Status";
|
|
164
|
+
var Prerequisites = "Prerequisites";
|
|
165
|
+
var Complete = "Complete";
|
|
166
|
+
var Start = "Start";
|
|
167
|
+
var Continue = "Continue";
|
|
168
|
+
var Next = "Next";
|
|
169
|
+
var Close = "Close";
|
|
170
|
+
var Back = "Back";
|
|
171
|
+
var Restart = "Restart";
|
|
172
|
+
var Yes = "Yes";
|
|
173
|
+
var No = "No";
|
|
174
|
+
var Cancel = "Cancel";
|
|
175
|
+
var Leave = "Leave";
|
|
176
|
+
var Type = "Quick start";
|
|
177
|
+
var en = {
|
|
178
|
+
"No results found": "No results found",
|
|
179
|
+
"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.",
|
|
180
|
+
"Clear all filters": "Clear all filters",
|
|
181
|
+
"Quick Starts": "Quick Starts",
|
|
182
|
+
"Complete ({{statusCount, number}})": "Complete ({{statusCount, number}})",
|
|
183
|
+
"In progress ({{statusCount, number}})": "In progress ({{statusCount, number}})",
|
|
184
|
+
"Not started ({{statusCount, number}})": "Not started ({{statusCount, number}})",
|
|
185
|
+
"Filter by keyword...": "Filter by keyword...",
|
|
186
|
+
"Select filter": "Select filter",
|
|
187
|
+
Status: Status$1,
|
|
188
|
+
"{{count, number}} item": "{{count, number}} item",
|
|
189
|
+
"{{count, number}} item_plural": "{{count, number}} items",
|
|
190
|
+
"Prerequisites ({{totalPrereqs}})": "Prerequisites ({{totalPrereqs}})",
|
|
191
|
+
"View Prerequisites ({{totalPrereqs}})": "View Prerequisites ({{totalPrereqs}})",
|
|
192
|
+
Prerequisites: Prerequisites,
|
|
193
|
+
"Show prerequisites": "Show prerequisites",
|
|
194
|
+
Complete: Complete,
|
|
195
|
+
"In progress": "In progress",
|
|
196
|
+
"Not started": "Not started",
|
|
197
|
+
"{{duration, number}} minutes": "{{duration, number}} minutes",
|
|
198
|
+
"One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.": "One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.",
|
|
199
|
+
"Start {{nextQSDisplayName}} quick start": "Start {{nextQSDisplayName}} quick start",
|
|
200
|
+
Start: Start,
|
|
201
|
+
Continue: Continue,
|
|
202
|
+
Next: Next,
|
|
203
|
+
Close: Close,
|
|
204
|
+
Back: Back,
|
|
205
|
+
Restart: Restart,
|
|
206
|
+
"In this quick start, you will complete {{count, number}} task": "In this quick start, you will complete {{count, number}} task",
|
|
207
|
+
"In this quick start, you will complete {{count, number}} task_plural": "In this quick start, you will complete {{count, number}} tasks",
|
|
208
|
+
"{{taskIndex, number}}": "{{taskIndex, number}}",
|
|
209
|
+
"Check your work": "Check your work",
|
|
210
|
+
Yes: Yes,
|
|
211
|
+
No: No,
|
|
212
|
+
"{{index, number}} of {{tasks, number}}": "{{index, number}} of {{tasks, number}}",
|
|
213
|
+
"Leave quick start?": "Leave quick start?",
|
|
214
|
+
Cancel: Cancel,
|
|
215
|
+
Leave: Leave,
|
|
216
|
+
"Your progress will be saved.": "Your progress will be saved.",
|
|
217
|
+
"Not available": "Not available",
|
|
218
|
+
"Copy to clipboard": "Copy to clipboard",
|
|
219
|
+
"Successfully copied to clipboard!": "Successfully copied to clipboard!",
|
|
220
|
+
Type: Type,
|
|
221
|
+
"{{type}} • {{duration, number}} minutes": "{{type}} • {{duration, number}} minutes"
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/* eslint-disable */
|
|
225
|
+
// https://github.com/i18next/i18next/blob/master/src/PluralResolver.js
|
|
226
|
+
const sets = [
|
|
227
|
+
{
|
|
228
|
+
lngs: [
|
|
229
|
+
'ach',
|
|
230
|
+
'ak',
|
|
231
|
+
'am',
|
|
232
|
+
'arn',
|
|
233
|
+
'br',
|
|
234
|
+
'fil',
|
|
235
|
+
'gun',
|
|
236
|
+
'ln',
|
|
237
|
+
'mfe',
|
|
238
|
+
'mg',
|
|
239
|
+
'mi',
|
|
240
|
+
'oc',
|
|
241
|
+
'pt',
|
|
242
|
+
'pt-BR',
|
|
243
|
+
'tg',
|
|
244
|
+
'tl',
|
|
245
|
+
'ti',
|
|
246
|
+
'tr',
|
|
247
|
+
'uz',
|
|
248
|
+
'wa',
|
|
249
|
+
],
|
|
250
|
+
nr: [1, 2],
|
|
251
|
+
fc: 1,
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
lngs: [
|
|
255
|
+
'af',
|
|
256
|
+
'an',
|
|
257
|
+
'ast',
|
|
258
|
+
'az',
|
|
259
|
+
'bg',
|
|
260
|
+
'bn',
|
|
261
|
+
'ca',
|
|
262
|
+
'da',
|
|
263
|
+
'de',
|
|
264
|
+
'dev',
|
|
265
|
+
'el',
|
|
266
|
+
'en',
|
|
267
|
+
'eo',
|
|
268
|
+
'es',
|
|
269
|
+
'et',
|
|
270
|
+
'eu',
|
|
271
|
+
'fi',
|
|
272
|
+
'fo',
|
|
273
|
+
'fur',
|
|
274
|
+
'fy',
|
|
275
|
+
'gl',
|
|
276
|
+
'gu',
|
|
277
|
+
'ha',
|
|
278
|
+
'hi',
|
|
279
|
+
'hu',
|
|
280
|
+
'hy',
|
|
281
|
+
'ia',
|
|
282
|
+
'it',
|
|
283
|
+
'kk',
|
|
284
|
+
'kn',
|
|
285
|
+
'ku',
|
|
286
|
+
'lb',
|
|
287
|
+
'mai',
|
|
288
|
+
'ml',
|
|
289
|
+
'mn',
|
|
290
|
+
'mr',
|
|
291
|
+
'nah',
|
|
292
|
+
'nap',
|
|
293
|
+
'nb',
|
|
294
|
+
'ne',
|
|
295
|
+
'nl',
|
|
296
|
+
'nn',
|
|
297
|
+
'no',
|
|
298
|
+
'nso',
|
|
299
|
+
'pa',
|
|
300
|
+
'pap',
|
|
301
|
+
'pms',
|
|
302
|
+
'ps',
|
|
303
|
+
'pt-PT',
|
|
304
|
+
'rm',
|
|
305
|
+
'sco',
|
|
306
|
+
'se',
|
|
307
|
+
'si',
|
|
308
|
+
'so',
|
|
309
|
+
'son',
|
|
310
|
+
'sq',
|
|
311
|
+
'sv',
|
|
312
|
+
'sw',
|
|
313
|
+
'ta',
|
|
314
|
+
'te',
|
|
315
|
+
'tk',
|
|
316
|
+
'ur',
|
|
317
|
+
'yo',
|
|
318
|
+
],
|
|
319
|
+
nr: [1, 2],
|
|
320
|
+
fc: 2,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
lngs: [
|
|
324
|
+
'ay',
|
|
325
|
+
'bo',
|
|
326
|
+
'cgg',
|
|
327
|
+
'fa',
|
|
328
|
+
'ht',
|
|
329
|
+
'id',
|
|
330
|
+
'ja',
|
|
331
|
+
'jbo',
|
|
332
|
+
'ka',
|
|
333
|
+
'km',
|
|
334
|
+
'ko',
|
|
335
|
+
'ky',
|
|
336
|
+
'lo',
|
|
337
|
+
'ms',
|
|
338
|
+
'sah',
|
|
339
|
+
'su',
|
|
340
|
+
'th',
|
|
341
|
+
'tt',
|
|
342
|
+
'ug',
|
|
343
|
+
'vi',
|
|
344
|
+
'wo',
|
|
345
|
+
'zh',
|
|
346
|
+
],
|
|
347
|
+
nr: [1],
|
|
348
|
+
fc: 3,
|
|
349
|
+
},
|
|
350
|
+
{ lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'], nr: [1, 2, 5], fc: 4 },
|
|
351
|
+
{ lngs: ['ar'], nr: [0, 1, 2, 3, 11, 100], fc: 5 },
|
|
352
|
+
{ lngs: ['cs', 'sk'], nr: [1, 2, 5], fc: 6 },
|
|
353
|
+
{ lngs: ['csb', 'pl'], nr: [1, 2, 5], fc: 7 },
|
|
354
|
+
{ lngs: ['cy'], nr: [1, 2, 3, 8], fc: 8 },
|
|
355
|
+
{ lngs: ['fr'], nr: [1, 2], fc: 9 },
|
|
356
|
+
{ lngs: ['ga'], nr: [1, 2, 3, 7, 11], fc: 10 },
|
|
357
|
+
{ lngs: ['gd'], nr: [1, 2, 3, 20], fc: 11 },
|
|
358
|
+
{ lngs: ['is'], nr: [1, 2], fc: 12 },
|
|
359
|
+
{ lngs: ['jv'], nr: [0, 1], fc: 13 },
|
|
360
|
+
{ lngs: ['kw'], nr: [1, 2, 3, 4], fc: 14 },
|
|
361
|
+
{ lngs: ['lt'], nr: [1, 2, 10], fc: 15 },
|
|
362
|
+
{ lngs: ['lv'], nr: [1, 2, 0], fc: 16 },
|
|
363
|
+
{ lngs: ['mk'], nr: [1, 2], fc: 17 },
|
|
364
|
+
{ lngs: ['mnk'], nr: [0, 1, 2], fc: 18 },
|
|
365
|
+
{ lngs: ['mt'], nr: [1, 2, 11, 20], fc: 19 },
|
|
366
|
+
{ lngs: ['or'], nr: [2, 1], fc: 2 },
|
|
367
|
+
{ lngs: ['ro'], nr: [1, 2, 20], fc: 20 },
|
|
368
|
+
{ lngs: ['sl'], nr: [5, 1, 2, 3], fc: 21 },
|
|
369
|
+
{ lngs: ['he', 'iw'], nr: [1, 2, 20, 21], fc: 22 },
|
|
370
|
+
];
|
|
371
|
+
const _rulesPluralsTypes = {
|
|
372
|
+
1: function (n) {
|
|
373
|
+
return Number(n > 1);
|
|
374
|
+
},
|
|
375
|
+
2: function (n) {
|
|
376
|
+
return Number(n != 1);
|
|
377
|
+
},
|
|
378
|
+
3: function (n) {
|
|
379
|
+
return 0;
|
|
380
|
+
},
|
|
381
|
+
4: function (n) {
|
|
382
|
+
return Number(n % 10 == 1 && n % 100 != 11
|
|
383
|
+
? 0
|
|
384
|
+
: n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)
|
|
385
|
+
? 1
|
|
386
|
+
: 2);
|
|
387
|
+
},
|
|
388
|
+
5: function (n) {
|
|
389
|
+
return Number(n == 0
|
|
390
|
+
? 0
|
|
391
|
+
: n == 1
|
|
392
|
+
? 1
|
|
393
|
+
: n == 2
|
|
394
|
+
? 2
|
|
395
|
+
: n % 100 >= 3 && n % 100 <= 10
|
|
396
|
+
? 3
|
|
397
|
+
: n % 100 >= 11
|
|
398
|
+
? 4
|
|
399
|
+
: 5);
|
|
400
|
+
},
|
|
401
|
+
6: function (n) {
|
|
402
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
403
|
+
},
|
|
404
|
+
7: function (n) {
|
|
405
|
+
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
406
|
+
},
|
|
407
|
+
8: function (n) {
|
|
408
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
409
|
+
},
|
|
410
|
+
9: function (n) {
|
|
411
|
+
return Number(n >= 2);
|
|
412
|
+
},
|
|
413
|
+
10: function (n) {
|
|
414
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
415
|
+
},
|
|
416
|
+
11: function (n) {
|
|
417
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
418
|
+
},
|
|
419
|
+
12: function (n) {
|
|
420
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
421
|
+
},
|
|
422
|
+
13: function (n) {
|
|
423
|
+
return Number(n !== 0);
|
|
424
|
+
},
|
|
425
|
+
14: function (n) {
|
|
426
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
427
|
+
},
|
|
428
|
+
15: function (n) {
|
|
429
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
430
|
+
},
|
|
431
|
+
16: function (n) {
|
|
432
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
433
|
+
},
|
|
434
|
+
17: function (n) {
|
|
435
|
+
return Number(n == 1 || (n % 10 == 1 && n % 100 != 11) ? 0 : 1);
|
|
436
|
+
},
|
|
437
|
+
18: function (n) {
|
|
438
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
439
|
+
},
|
|
440
|
+
19: function (n) {
|
|
441
|
+
return Number(n == 1
|
|
442
|
+
? 0
|
|
443
|
+
: n == 0 || (n % 100 > 1 && n % 100 < 11)
|
|
444
|
+
? 1
|
|
445
|
+
: n % 100 > 10 && n % 100 < 20
|
|
446
|
+
? 2
|
|
447
|
+
: 3);
|
|
448
|
+
},
|
|
449
|
+
20: function (n) {
|
|
450
|
+
return Number(n == 1 ? 0 : n == 0 || (n % 100 > 0 && n % 100 < 20) ? 1 : 2);
|
|
451
|
+
},
|
|
452
|
+
21: function (n) {
|
|
453
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
454
|
+
},
|
|
455
|
+
22: function (n) {
|
|
456
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
function createRules() {
|
|
460
|
+
const rules = {};
|
|
461
|
+
sets.forEach((set) => {
|
|
462
|
+
set.lngs.forEach((l) => {
|
|
463
|
+
rules[l] = {
|
|
464
|
+
numbers: set.nr,
|
|
465
|
+
plurals: _rulesPluralsTypes[set.fc],
|
|
466
|
+
};
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
return rules;
|
|
470
|
+
}
|
|
471
|
+
class PluralResolver {
|
|
472
|
+
constructor(options = {}) {
|
|
473
|
+
this.options = options;
|
|
474
|
+
this.rules = createRules();
|
|
475
|
+
}
|
|
476
|
+
addRule(lng, obj) {
|
|
477
|
+
this.rules[lng] = obj;
|
|
478
|
+
}
|
|
479
|
+
getRule(code) {
|
|
480
|
+
return this.rules[code];
|
|
481
|
+
}
|
|
482
|
+
needsPlural(code) {
|
|
483
|
+
const rule = this.getRule(code);
|
|
484
|
+
return rule && rule.numbers.length > 1;
|
|
485
|
+
}
|
|
486
|
+
getPluralFormsOfKey(code, key) {
|
|
487
|
+
return this.getSuffixes(code).map((suffix) => key + suffix);
|
|
488
|
+
}
|
|
489
|
+
getSuffixes(code) {
|
|
490
|
+
const rule = this.getRule(code);
|
|
491
|
+
if (!rule) {
|
|
492
|
+
return [];
|
|
493
|
+
}
|
|
494
|
+
return rule.numbers.map((number) => this.getSuffix(code, number));
|
|
495
|
+
}
|
|
496
|
+
getSuffix(code, count) {
|
|
497
|
+
const rule = this.getRule(code);
|
|
498
|
+
if (rule) {
|
|
499
|
+
// if (rule.numbers.length === 1) return ''; // only singular
|
|
500
|
+
const idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
501
|
+
let suffix = rule.numbers[idx];
|
|
502
|
+
// special treatment for lngs only having singular and plural
|
|
503
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
504
|
+
if (suffix === 2) {
|
|
505
|
+
suffix = 'plural';
|
|
506
|
+
}
|
|
507
|
+
else if (suffix === 1) {
|
|
508
|
+
suffix = '';
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const returnSuffix = () => this.options.prepend && suffix.toString()
|
|
512
|
+
? this.options.prepend + suffix.toString()
|
|
513
|
+
: suffix.toString();
|
|
514
|
+
// COMPATIBILITY JSON
|
|
515
|
+
// v1
|
|
516
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
517
|
+
if (suffix === 1) {
|
|
518
|
+
return '';
|
|
519
|
+
}
|
|
520
|
+
if (typeof suffix === 'number') {
|
|
521
|
+
return `_plural_${suffix.toString()}`;
|
|
522
|
+
}
|
|
523
|
+
return returnSuffix();
|
|
524
|
+
}
|
|
525
|
+
if ( /* v2 */this.options.compatibilityJSON === 'v2') {
|
|
526
|
+
return returnSuffix();
|
|
527
|
+
}
|
|
528
|
+
if (
|
|
529
|
+
/* v3 - gettext index */ this.options.simplifyPluralSuffix &&
|
|
530
|
+
rule.numbers.length === 2 &&
|
|
531
|
+
rule.numbers[0] === 1) {
|
|
532
|
+
return returnSuffix();
|
|
533
|
+
}
|
|
534
|
+
return this.options.prepend && idx.toString()
|
|
535
|
+
? this.options.prepend + idx.toString()
|
|
536
|
+
: idx.toString();
|
|
537
|
+
}
|
|
538
|
+
// this.logger.warn(`no plural rule found for: ${code}`);
|
|
539
|
+
return '';
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
const QUICK_START_NAME = 'console.openshift.io/name';
|
|
544
|
+
const getQuickStartByName = (name, quickStarts) => quickStarts.find((quickStart) => quickStart.metadata.name === name);
|
|
545
|
+
const getQuickStartStatus = (allQuickStartStates, quickStartID) => { var _a, _b; return (_b = (_a = allQuickStartStates === null || allQuickStartStates === void 0 ? void 0 : allQuickStartStates[quickStartID]) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : exports.QuickStartStatus.NOT_STARTED; };
|
|
546
|
+
const getTaskStatusKey = (taskNumber) => `taskStatus${taskNumber}`;
|
|
547
|
+
const getQuickStartStatusCount = (allQuickStartStates, quickStarts) => quickStarts.reduce((totals, item) => {
|
|
548
|
+
totals[getQuickStartStatus(allQuickStartStates, item.metadata.name)]++;
|
|
549
|
+
return totals;
|
|
550
|
+
}, {
|
|
551
|
+
[exports.QuickStartStatus.IN_PROGRESS]: 0,
|
|
552
|
+
[exports.QuickStartStatus.COMPLETE]: 0,
|
|
553
|
+
[exports.QuickStartStatus.NOT_STARTED]: 0,
|
|
554
|
+
});
|
|
555
|
+
const getDisabledQuickStarts = () => {
|
|
556
|
+
var _a, _b;
|
|
557
|
+
let disabledQuickStarts = [];
|
|
558
|
+
const quickStartServerData = (_a = window.SERVER_FLAGS) === null || _a === void 0 ? void 0 : _a.quickStarts;
|
|
559
|
+
try {
|
|
560
|
+
if (quickStartServerData) {
|
|
561
|
+
disabledQuickStarts = (_b = JSON.parse(quickStartServerData).disabled) !== null && _b !== void 0 ? _b : [];
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
catch (e) {
|
|
565
|
+
// eslint-disable-next-line no-console
|
|
566
|
+
console.error('error while parsing SERVER_FLAG.quickStarts', e);
|
|
567
|
+
}
|
|
568
|
+
return disabledQuickStarts;
|
|
569
|
+
};
|
|
570
|
+
const isDisabledQuickStart = (quickstart, disabledQuickStarts) => {
|
|
571
|
+
var _a, _b;
|
|
572
|
+
const quickStartName = (_b = (_a = quickstart.metadata.annotations) === null || _a === void 0 ? void 0 : _a[QUICK_START_NAME]) !== null && _b !== void 0 ? _b : quickstart.metadata.name;
|
|
573
|
+
return disabledQuickStarts.includes(quickStartName);
|
|
574
|
+
};
|
|
575
|
+
const filterQuickStarts = (quickStarts, filterText, statusFilters, allQuickStartStates) => {
|
|
576
|
+
const searchText = filterText.toLowerCase();
|
|
577
|
+
return quickStarts.filter(({ metadata: { name }, spec: { displayName, prerequisites = [], description } }) => {
|
|
578
|
+
const matchesFilter = statusFilters.length > 0
|
|
579
|
+
? statusFilters.includes(getQuickStartStatus(allQuickStartStates, name))
|
|
580
|
+
: true;
|
|
581
|
+
const matchesText = displayName.toLowerCase().includes(searchText) ||
|
|
582
|
+
description.toLowerCase().includes(searchText) ||
|
|
583
|
+
prerequisites.some((text) => text.toLowerCase().includes(searchText));
|
|
584
|
+
return matchesFilter && matchesText;
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
const camelize = (str) => str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
|
|
588
|
+
if (+match === 0) {
|
|
589
|
+
return '';
|
|
590
|
+
} // or if (/\s+/.test(match)) for white spaces
|
|
591
|
+
return index === 0 ? match.toLowerCase() : match.toUpperCase();
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
const pluralResolver = new PluralResolver({ simplifyPluralSuffix: true });
|
|
595
|
+
const getDefaultQuickStartState = (totalTasks, initialStatus) => {
|
|
596
|
+
const defaultQuickStartState = {
|
|
597
|
+
status: initialStatus || exports.QuickStartStatus.NOT_STARTED,
|
|
598
|
+
taskNumber: -1,
|
|
599
|
+
};
|
|
600
|
+
if (totalTasks) {
|
|
601
|
+
for (let i = 0; i < totalTasks; i++) {
|
|
602
|
+
defaultQuickStartState[getTaskStatusKey(i)] = exports.QuickStartTaskStatus.INIT;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return defaultQuickStartState;
|
|
606
|
+
};
|
|
607
|
+
const QuickStartContextDefaults = {
|
|
608
|
+
allQuickStarts: [],
|
|
609
|
+
activeQuickStartID: '',
|
|
610
|
+
allQuickStartStates: {},
|
|
611
|
+
activeQuickStartState: {},
|
|
612
|
+
setAllQuickStarts: () => { },
|
|
613
|
+
resourceBundle: en,
|
|
614
|
+
getResource: (resource) => resource,
|
|
615
|
+
language: 'en',
|
|
616
|
+
useQueryParams: true,
|
|
617
|
+
filter: {
|
|
618
|
+
keyword: '',
|
|
619
|
+
status: {
|
|
620
|
+
statusTypes: {},
|
|
621
|
+
statusFilters: [],
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
setFilter: () => { },
|
|
625
|
+
footer: null,
|
|
626
|
+
useLegacyHeaderColors: false,
|
|
627
|
+
markdown: null,
|
|
628
|
+
loading: false,
|
|
629
|
+
alwaysShowTaskReview: true,
|
|
630
|
+
};
|
|
631
|
+
const QuickStartContext = React.createContext(QuickStartContextDefaults);
|
|
632
|
+
const getResource = (resource, options, resourceBundle, lng) => {
|
|
633
|
+
if (options && !isNaN(options.count)) {
|
|
634
|
+
const suffix = pluralResolver.getSuffix(lng, options.count);
|
|
635
|
+
if (suffix && resourceBundle[`${resource}_${suffix}`]) {
|
|
636
|
+
// needs plural
|
|
637
|
+
return resourceBundle[`${resource}_${suffix}`];
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return (resourceBundle && resourceBundle[resource]) || resource;
|
|
641
|
+
};
|
|
642
|
+
const useValuesForQuickStartContext = (value = {}) => {
|
|
643
|
+
var _a, _b;
|
|
644
|
+
const combinedValue = Object.assign(Object.assign({}, QuickStartContextDefaults), value);
|
|
645
|
+
const { activeQuickStartID, setActiveQuickStartID, setAllQuickStartStates, useQueryParams, allQuickStartStates, allQuickStarts = [], footer, useLegacyHeaderColors, markdown, } = combinedValue;
|
|
646
|
+
const [quickStarts, setQuickStarts] = React__default['default'].useState(combinedValue.allQuickStarts || []);
|
|
647
|
+
const [resourceBundle, setResourceBundle] = React__default['default'].useState(Object.assign(Object.assign({}, en), combinedValue.resourceBundle));
|
|
648
|
+
const [language, setLanguage] = React__default['default'].useState(combinedValue.language);
|
|
649
|
+
const changeResourceBundle = (bundle, lng) => {
|
|
650
|
+
lng && setLanguage(lng);
|
|
651
|
+
setResourceBundle(Object.assign(Object.assign({}, en), bundle));
|
|
652
|
+
};
|
|
653
|
+
const findResource = React.useCallback((resource, count) => getResource(resource, count !== undefined ? { count } : null, resourceBundle, language), [resourceBundle, language]);
|
|
654
|
+
const [loading, setLoading] = React__default['default'].useState(combinedValue.loading);
|
|
655
|
+
const [alwaysShowTaskReview, setAlwaysShowTaskReview] = React__default['default'].useState(combinedValue.alwaysShowTaskReview);
|
|
656
|
+
const initialSearchParams = new URLSearchParams(window.location.search);
|
|
657
|
+
const initialSearchQuery = initialSearchParams.get(QUICKSTART_SEARCH_FILTER_KEY) || '';
|
|
658
|
+
const initialStatusFilters = ((_a = initialSearchParams.get(QUICKSTART_STATUS_FILTER_KEY)) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
659
|
+
const quickStartStatusCount = getQuickStartStatusCount(allQuickStartStates, allQuickStarts);
|
|
660
|
+
const [statusTypes, setStatusTypes] = React__default['default'].useState({
|
|
661
|
+
[exports.QuickStartStatus.COMPLETE]: findResource('Complete ({{statusCount, number}})').replace('{{statusCount, number}}', quickStartStatusCount[exports.QuickStartStatus.COMPLETE]),
|
|
662
|
+
[exports.QuickStartStatus.IN_PROGRESS]: findResource('In progress ({{statusCount, number}})').replace('{{statusCount, number}}', quickStartStatusCount[exports.QuickStartStatus.IN_PROGRESS]),
|
|
663
|
+
[exports.QuickStartStatus.NOT_STARTED]: findResource('Not started ({{statusCount, number}})').replace('{{statusCount, number}}', quickStartStatusCount[exports.QuickStartStatus.NOT_STARTED]),
|
|
664
|
+
});
|
|
665
|
+
const [statusFilters, setStatusFilters] = React__default['default'].useState(initialStatusFilters);
|
|
666
|
+
const [filterKeyword, setFilterKeyword] = React__default['default'].useState(initialSearchQuery);
|
|
667
|
+
const setFilter = (type, val) => {
|
|
668
|
+
if (type === 'keyword') {
|
|
669
|
+
setFilterKeyword(val);
|
|
670
|
+
}
|
|
671
|
+
else if (type === 'status') {
|
|
672
|
+
setStatusFilters(val);
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
React__default['default'].useEffect(() => {
|
|
676
|
+
const updatedQuickStartStatusCount = getQuickStartStatusCount(allQuickStartStates, quickStarts);
|
|
677
|
+
setStatusTypes({
|
|
678
|
+
[exports.QuickStartStatus.COMPLETE]: findResource('Complete ({{statusCount, number}})').replace('{{statusCount, number}}', updatedQuickStartStatusCount[exports.QuickStartStatus.COMPLETE]),
|
|
679
|
+
[exports.QuickStartStatus.IN_PROGRESS]: findResource('In progress ({{statusCount, number}})').replace('{{statusCount, number}}', updatedQuickStartStatusCount[exports.QuickStartStatus.IN_PROGRESS]),
|
|
680
|
+
[exports.QuickStartStatus.NOT_STARTED]: findResource('Not started ({{statusCount, number}})').replace('{{statusCount, number}}', updatedQuickStartStatusCount[exports.QuickStartStatus.NOT_STARTED]),
|
|
681
|
+
});
|
|
682
|
+
}, [allQuickStartStates, findResource, quickStarts]);
|
|
683
|
+
const updateAllQuickStarts = (qs) => {
|
|
684
|
+
setQuickStarts(qs);
|
|
685
|
+
};
|
|
686
|
+
const setActiveQuickStart = React.useCallback((quickStartId, totalTasks) => {
|
|
687
|
+
setActiveQuickStartID((id) => {
|
|
688
|
+
if (!quickStartId || id === quickStartId) {
|
|
689
|
+
useQueryParams && removeQueryArgument(QUICKSTART_ID_FILTER_KEY);
|
|
690
|
+
return '';
|
|
691
|
+
}
|
|
692
|
+
useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, quickStartId);
|
|
693
|
+
return quickStartId;
|
|
694
|
+
});
|
|
695
|
+
setAllQuickStartStates((qs) => !quickStartId || qs[quickStartId]
|
|
696
|
+
? qs
|
|
697
|
+
: Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks) }));
|
|
698
|
+
}, [setActiveQuickStartID, setAllQuickStartStates, useQueryParams]);
|
|
699
|
+
const startQuickStart = React.useCallback((quickStartId, totalTasks) => {
|
|
700
|
+
setActiveQuickStartID((id) => {
|
|
701
|
+
if (!id || id !== quickStartId) {
|
|
702
|
+
useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, quickStartId);
|
|
703
|
+
return quickStartId;
|
|
704
|
+
}
|
|
705
|
+
useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, id);
|
|
706
|
+
return id;
|
|
707
|
+
});
|
|
708
|
+
setAllQuickStartStates((qs) => {
|
|
709
|
+
if (qs.hasOwnProperty(quickStartId)) {
|
|
710
|
+
return Object.assign(Object.assign({}, qs), { [quickStartId]: Object.assign(Object.assign({}, qs[quickStartId]), { status: exports.QuickStartStatus.IN_PROGRESS }) });
|
|
711
|
+
}
|
|
712
|
+
return Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, exports.QuickStartStatus.IN_PROGRESS) });
|
|
713
|
+
});
|
|
714
|
+
}, [setActiveQuickStartID, setAllQuickStartStates, useQueryParams]);
|
|
715
|
+
const restartQuickStart = React.useCallback((quickStartId, totalTasks) => {
|
|
716
|
+
setActiveQuickStartID((id) => {
|
|
717
|
+
if (!id || id !== quickStartId) {
|
|
718
|
+
useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, quickStartId);
|
|
719
|
+
return quickStartId;
|
|
720
|
+
}
|
|
721
|
+
useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, id);
|
|
722
|
+
return id;
|
|
723
|
+
});
|
|
724
|
+
setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, exports.QuickStartStatus.NOT_STARTED) })));
|
|
725
|
+
}, [setActiveQuickStartID, setAllQuickStartStates, useQueryParams]);
|
|
726
|
+
// When alwaysShowTaskReview preference is enabled, skip visited step and go directly to review
|
|
727
|
+
const stepAfterInitial = alwaysShowTaskReview
|
|
728
|
+
? exports.QuickStartTaskStatus.REVIEW
|
|
729
|
+
: exports.QuickStartTaskStatus.VISITED;
|
|
730
|
+
const nextStep = React.useCallback((totalTasks) => {
|
|
731
|
+
if (!activeQuickStartID) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
setAllQuickStartStates((qs) => {
|
|
735
|
+
const quickStart = qs[activeQuickStartID];
|
|
736
|
+
const status = quickStart === null || quickStart === void 0 ? void 0 : quickStart.status;
|
|
737
|
+
const taskNumber = quickStart === null || quickStart === void 0 ? void 0 : quickStart.taskNumber;
|
|
738
|
+
const taskStatus = quickStart[getTaskStatusKey(taskNumber)];
|
|
739
|
+
let updatedStatus;
|
|
740
|
+
let updatedTaskNumber;
|
|
741
|
+
let updatedTaskStatus;
|
|
742
|
+
if (status === exports.QuickStartStatus.NOT_STARTED) {
|
|
743
|
+
updatedStatus = exports.QuickStartStatus.IN_PROGRESS;
|
|
744
|
+
}
|
|
745
|
+
else if (status === exports.QuickStartStatus.IN_PROGRESS &&
|
|
746
|
+
!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) &&
|
|
747
|
+
taskNumber === totalTasks - 1) {
|
|
748
|
+
updatedStatus = exports.QuickStartStatus.COMPLETE;
|
|
749
|
+
}
|
|
750
|
+
if (taskStatus === exports.QuickStartTaskStatus.VISITED) {
|
|
751
|
+
updatedTaskStatus = exports.QuickStartTaskStatus.REVIEW;
|
|
752
|
+
}
|
|
753
|
+
if (taskNumber < totalTasks && !updatedTaskStatus) {
|
|
754
|
+
updatedTaskNumber = taskNumber + 1;
|
|
755
|
+
}
|
|
756
|
+
const markInitialStepVisitedOrReview = updatedTaskNumber > -1 &&
|
|
757
|
+
quickStart[getTaskStatusKey(updatedTaskNumber)] === exports.QuickStartTaskStatus.INIT
|
|
758
|
+
? stepAfterInitial
|
|
759
|
+
: quickStart[getTaskStatusKey(updatedTaskNumber)];
|
|
760
|
+
const newState = Object.assign(Object.assign({}, qs), { [activeQuickStartID]: Object.assign(Object.assign(Object.assign(Object.assign({}, quickStart), (updatedStatus ? { status: updatedStatus } : {})), (updatedTaskNumber > -1
|
|
761
|
+
? {
|
|
762
|
+
taskNumber: updatedTaskNumber,
|
|
763
|
+
[getTaskStatusKey(updatedTaskNumber)]: markInitialStepVisitedOrReview,
|
|
764
|
+
}
|
|
765
|
+
: {})), (updatedTaskStatus ? { [getTaskStatusKey(taskNumber)]: updatedTaskStatus } : {})) });
|
|
766
|
+
return newState;
|
|
767
|
+
});
|
|
768
|
+
}, [activeQuickStartID, setAllQuickStartStates, stepAfterInitial]);
|
|
769
|
+
const previousStep = React.useCallback(() => {
|
|
770
|
+
setAllQuickStartStates((qs) => {
|
|
771
|
+
const quickStart = qs[activeQuickStartID];
|
|
772
|
+
const taskNumber = quickStart === null || quickStart === void 0 ? void 0 : quickStart.taskNumber;
|
|
773
|
+
if (taskNumber < 0) {
|
|
774
|
+
return qs;
|
|
775
|
+
}
|
|
776
|
+
return Object.assign(Object.assign({}, qs), { [activeQuickStartID]: Object.assign(Object.assign({}, quickStart), { taskNumber: taskNumber - 1 }) });
|
|
777
|
+
});
|
|
778
|
+
}, [activeQuickStartID, setAllQuickStartStates]);
|
|
779
|
+
const setQuickStartTaskNumber = React.useCallback((quickStartId, taskNumber) => {
|
|
780
|
+
setAllQuickStartStates((qs) => {
|
|
781
|
+
const quickStart = qs[quickStartId];
|
|
782
|
+
const status = quickStart === null || quickStart === void 0 ? void 0 : quickStart.status;
|
|
783
|
+
let updatedStatus;
|
|
784
|
+
if (taskNumber > -1 && status === exports.QuickStartStatus.NOT_STARTED) {
|
|
785
|
+
updatedStatus = exports.QuickStartStatus.IN_PROGRESS;
|
|
786
|
+
}
|
|
787
|
+
let updatedTaskStatus = {};
|
|
788
|
+
for (let taskIndex = 0; taskIndex <= taskNumber; taskIndex++) {
|
|
789
|
+
const taskStatus = quickStart[getTaskStatusKey(taskIndex)];
|
|
790
|
+
const newTaskStatus = taskStatus === exports.QuickStartTaskStatus.INIT ? stepAfterInitial : undefined;
|
|
791
|
+
if (newTaskStatus) {
|
|
792
|
+
updatedTaskStatus = Object.assign(Object.assign({}, updatedTaskStatus), { [getTaskStatusKey(taskIndex)]: newTaskStatus });
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
const updatedQuickStart = Object.assign(Object.assign(Object.assign(Object.assign({}, quickStart), (updatedStatus ? { status: updatedStatus } : {})), { taskNumber }), updatedTaskStatus);
|
|
796
|
+
return Object.assign(Object.assign({}, qs), { [quickStartId]: updatedQuickStart });
|
|
797
|
+
});
|
|
798
|
+
}, [setAllQuickStartStates, stepAfterInitial]);
|
|
799
|
+
const setQuickStartTaskStatus = React.useCallback((taskStatus) => {
|
|
800
|
+
const quickStart = allQuickStartStates[activeQuickStartID];
|
|
801
|
+
const { taskNumber } = quickStart;
|
|
802
|
+
const updatedQuickStart = Object.assign(Object.assign({}, quickStart), { [getTaskStatusKey(taskNumber)]: taskStatus });
|
|
803
|
+
setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [activeQuickStartID]: updatedQuickStart })));
|
|
804
|
+
}, [allQuickStartStates, activeQuickStartID, setAllQuickStartStates]);
|
|
805
|
+
const activeQuickStartState = (_b = allQuickStartStates === null || allQuickStartStates === void 0 ? void 0 : allQuickStartStates[activeQuickStartID]) !== null && _b !== void 0 ? _b : {};
|
|
806
|
+
const getQuickStartForId = React.useCallback((id) => allQuickStartStates[id], [
|
|
807
|
+
allQuickStartStates,
|
|
808
|
+
]);
|
|
809
|
+
return {
|
|
810
|
+
allQuickStarts: quickStarts,
|
|
811
|
+
setAllQuickStarts: updateAllQuickStarts,
|
|
812
|
+
activeQuickStartID,
|
|
813
|
+
setActiveQuickStartID,
|
|
814
|
+
allQuickStartStates,
|
|
815
|
+
setAllQuickStartStates,
|
|
816
|
+
activeQuickStartState,
|
|
817
|
+
setActiveQuickStart: value.setActiveQuickStart || setActiveQuickStart,
|
|
818
|
+
startQuickStart: value.startQuickStart || startQuickStart,
|
|
819
|
+
restartQuickStart: value.restartQuickStart || restartQuickStart,
|
|
820
|
+
nextStep: value.nextStep || nextStep,
|
|
821
|
+
previousStep: value.previousStep || previousStep,
|
|
822
|
+
setQuickStartTaskNumber,
|
|
823
|
+
setQuickStartTaskStatus,
|
|
824
|
+
getQuickStartForId,
|
|
825
|
+
footer,
|
|
826
|
+
useLegacyHeaderColors,
|
|
827
|
+
useQueryParams,
|
|
828
|
+
markdown,
|
|
829
|
+
resourceBundle,
|
|
830
|
+
getResource: findResource,
|
|
831
|
+
setResourceBundle: changeResourceBundle,
|
|
832
|
+
language,
|
|
833
|
+
setLanguage,
|
|
834
|
+
// revisit if this should be in public context API
|
|
835
|
+
filter: {
|
|
836
|
+
keyword: filterKeyword,
|
|
837
|
+
status: {
|
|
838
|
+
statusTypes,
|
|
839
|
+
statusFilters,
|
|
840
|
+
},
|
|
841
|
+
},
|
|
842
|
+
setFilter,
|
|
843
|
+
loading,
|
|
844
|
+
setLoading,
|
|
845
|
+
alwaysShowTaskReview,
|
|
846
|
+
setAlwaysShowTaskReview,
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
const QuickStartContextProvider = ({ children, value }) => (React__default['default'].createElement(QuickStartContext.Provider, { value: useValuesForQuickStartContext(value) }, children));
|
|
850
|
+
|
|
851
|
+
const Box = ({ children, className }) => (React__namespace.createElement("div", { className: reactStyles.css('pfext-status-box', className) }, children));
|
|
852
|
+
const Loading = ({ className }) => (React__namespace.createElement("div", { className: reactStyles.css('pfext-m-loader', className) },
|
|
853
|
+
React__namespace.createElement("div", { className: "pfext-m-loader-dot__one" }),
|
|
854
|
+
React__namespace.createElement("div", { className: "pfext-m-loader-dot__two" }),
|
|
855
|
+
React__namespace.createElement("div", { className: "pfext-m-loader-dot__three" })));
|
|
856
|
+
Loading.displayName = 'Loading';
|
|
857
|
+
const LoadingBox = ({ className, message }) => (React__namespace.createElement(Box, { className: reactStyles.css('pfext-status-box--loading', className) },
|
|
858
|
+
React__namespace.createElement(Loading, null),
|
|
859
|
+
message && React__namespace.createElement("div", { className: "pfext-status-box__loading-message" }, message)));
|
|
860
|
+
LoadingBox.displayName = 'LoadingBox';
|
|
861
|
+
const EmptyBox = ({ label }) => {
|
|
862
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
863
|
+
return (React__namespace.createElement(Box, null,
|
|
864
|
+
React__namespace.createElement("div", { "data-test": "empty-message", className: "text-center" }, label
|
|
865
|
+
? getResource('No {{label}} found').replace('{{label}}', label)
|
|
866
|
+
: getResource('Not found'))));
|
|
867
|
+
};
|
|
868
|
+
EmptyBox.displayName = 'EmptyBox';
|
|
869
|
+
|
|
870
|
+
const MEMO = {};
|
|
871
|
+
const CamelCaseWrap = ({ value, dataTest }) => {
|
|
872
|
+
if (!value) {
|
|
873
|
+
return '-';
|
|
874
|
+
}
|
|
875
|
+
if (MEMO[value]) {
|
|
876
|
+
return MEMO[value];
|
|
877
|
+
}
|
|
878
|
+
// Add word break points before capital letters (but keep consecutive capital letters together).
|
|
879
|
+
const words = value.match(/[A-Z]+[^A-Z]*|[^A-Z]+/g);
|
|
880
|
+
const rendered = (React__namespace.createElement("span", { "data-test": dataTest }, words.map((word, i) => (React__namespace.createElement(React__namespace.Fragment, { key: i },
|
|
881
|
+
word,
|
|
882
|
+
i !== words.length - 1 && React__namespace.createElement("wbr", null))))));
|
|
883
|
+
MEMO[value] = rendered;
|
|
884
|
+
return rendered;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
class CatalogTile extends React__namespace.Component {
|
|
888
|
+
constructor(props) {
|
|
889
|
+
super(props);
|
|
890
|
+
this.handleClick = (e) => {
|
|
891
|
+
const { onClick, href } = this.props;
|
|
892
|
+
if (!href) {
|
|
893
|
+
e.preventDefault();
|
|
894
|
+
}
|
|
895
|
+
if (onClick) {
|
|
896
|
+
onClick(e);
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
this.renderBadges = (badges) => {
|
|
900
|
+
if (!badges || !badges.length) {
|
|
901
|
+
return null;
|
|
902
|
+
}
|
|
903
|
+
return (React__namespace.createElement("div", { className: "catalog-tile-pf-badge-container" }, badges.map((badge, index) => (React__namespace.createElement("span", { key: `badge-${index}` }, badge)))));
|
|
904
|
+
};
|
|
905
|
+
this.generatedId = reactCore.getUniqueId('pf-catalog-tile');
|
|
906
|
+
}
|
|
907
|
+
render() {
|
|
908
|
+
const _a = this.props, { id, className, featured, onClick, href, icon, iconImg, iconAlt, iconClass, badges, title, vendor, description, footer,
|
|
909
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
910
|
+
ref, children } = _a, props = tslib.__rest(_a, ["id", "className", "featured", "onClick", "href", "icon", "iconImg", "iconAlt", "iconClass", "badges", "title", "vendor", "description", "footer", "ref", "children"]);
|
|
911
|
+
return (React__namespace.createElement(reactCore.Card, Object.assign({ component: href ? 'a' : 'div', id: id || this.generatedId, href: href || '#', className: reactStyles.css('catalog-tile-pf', { featured }, className), isClickable: !!onClick }, props),
|
|
912
|
+
(badges.length > 0 || iconImg || iconClass || icon || onClick) && (React__namespace.createElement(reactCore.CardHeader, { actions: { actions: badges.length > 0 && this.renderBadges(badges) }, selectableActions: onClick && {
|
|
913
|
+
selectableActionId: id + '-input',
|
|
914
|
+
onClickAction: (e) => this.handleClick(e),
|
|
915
|
+
selectableActionAriaLabelledby: id
|
|
916
|
+
} },
|
|
917
|
+
iconImg && React__namespace.createElement("img", { className: "catalog-tile-pf-icon", src: iconImg, alt: iconAlt }),
|
|
918
|
+
!iconImg && (iconClass || icon) && React__namespace.createElement("span", { className: `catalog-tile-pf-icon ${iconClass}` }, icon))),
|
|
919
|
+
React__namespace.createElement(reactCore.CardTitle, { className: "catalog-tile-pf-header" },
|
|
920
|
+
React__namespace.createElement("div", { className: "catalog-tile-pf-title" }, title),
|
|
921
|
+
vendor && React__namespace.createElement("div", { className: "catalog-tile-pf-subtitle" }, vendor)),
|
|
922
|
+
(description || children) && (React__namespace.createElement(reactCore.CardBody, { className: "catalog-tile-pf-body" },
|
|
923
|
+
description && (React__namespace.createElement("div", { className: "catalog-tile-pf-description" },
|
|
924
|
+
React__namespace.createElement("span", { className: reactStyles.css({ 'has-footer': footer }) }, description))),
|
|
925
|
+
children)),
|
|
926
|
+
footer && React__namespace.createElement(reactCore.CardFooter, { className: "catalog-tile-pf-footer" }, footer)));
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
CatalogTile.displayName = 'CatalogTile';
|
|
930
|
+
CatalogTile.defaultProps = {
|
|
931
|
+
id: null,
|
|
932
|
+
className: '',
|
|
933
|
+
featured: false,
|
|
934
|
+
onClick: null,
|
|
935
|
+
href: null,
|
|
936
|
+
iconImg: null,
|
|
937
|
+
iconAlt: '',
|
|
938
|
+
iconClass: '',
|
|
939
|
+
icon: null,
|
|
940
|
+
badges: [],
|
|
941
|
+
vendor: null,
|
|
942
|
+
description: null,
|
|
943
|
+
footer: null,
|
|
944
|
+
children: null
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
const Modal = (_a) => {
|
|
948
|
+
var { isFullScreen = false, className } = _a, props = tslib.__rest(_a, ["isFullScreen", "className"]);
|
|
949
|
+
return (React__namespace.createElement(reactCore.Modal, Object.assign({}, props, { className: reactStyles.css('pfext-modal', className), appendTo: () => (isFullScreen ? document.body : document.querySelector('#modal-container')) })));
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
const getContainer = (container) => typeof container === 'function' ? container() : container;
|
|
953
|
+
const Portal = ({ children, container }) => {
|
|
954
|
+
const [containerNode, setContainerNode] = React__namespace.useState();
|
|
955
|
+
reactCore.useIsomorphicLayoutEffect(() => {
|
|
956
|
+
setContainerNode(getContainer(container) || document.body);
|
|
957
|
+
}, [container]);
|
|
958
|
+
return containerNode ? ReactDOM__namespace.createPortal(children, containerNode) : null;
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
const SimplePopper = ({ children }) => {
|
|
962
|
+
const openProp = true;
|
|
963
|
+
const nodeRef = React__namespace.useRef();
|
|
964
|
+
const popperRef = React__namespace.useRef(null);
|
|
965
|
+
const [isOpen, setOpenState] = React__namespace.useState(openProp);
|
|
966
|
+
const setOpen = React__namespace.useCallback((newOpen) => {
|
|
967
|
+
setOpenState(newOpen);
|
|
968
|
+
}, []);
|
|
969
|
+
React__namespace.useEffect(() => {
|
|
970
|
+
setOpen(openProp);
|
|
971
|
+
}, [openProp, setOpen]);
|
|
972
|
+
const onKeyDown = React__namespace.useCallback((e) => {
|
|
973
|
+
if (e.keyCode === 27) {
|
|
974
|
+
setOpen(false);
|
|
975
|
+
}
|
|
976
|
+
}, [setOpen]);
|
|
977
|
+
const onClickOutside = React__namespace.useCallback((e) => {
|
|
978
|
+
if (!nodeRef.current || (e.target instanceof Node && !nodeRef.current.contains(e.target))) {
|
|
979
|
+
setOpen(false);
|
|
980
|
+
}
|
|
981
|
+
}, [setOpen]);
|
|
982
|
+
const destroy = React__namespace.useCallback(() => {
|
|
983
|
+
if (popperRef.current) {
|
|
984
|
+
popperRef.current.destroy();
|
|
985
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
986
|
+
document.removeEventListener('mousedown', onClickOutside, true);
|
|
987
|
+
document.removeEventListener('touchstart', onClickOutside, true);
|
|
988
|
+
}
|
|
989
|
+
}, [onClickOutside, onKeyDown]);
|
|
990
|
+
const initialize = React__namespace.useCallback(() => {
|
|
991
|
+
if (!nodeRef.current || !isOpen) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
destroy();
|
|
995
|
+
}, [isOpen, destroy]);
|
|
996
|
+
const nodeRefCallback = React__namespace.useCallback((node) => {
|
|
997
|
+
nodeRef.current = node;
|
|
998
|
+
initialize();
|
|
999
|
+
}, [initialize]);
|
|
1000
|
+
React__namespace.useEffect(() => {
|
|
1001
|
+
initialize();
|
|
1002
|
+
}, [initialize]);
|
|
1003
|
+
React__namespace.useEffect(() => () => {
|
|
1004
|
+
destroy();
|
|
1005
|
+
}, [destroy]);
|
|
1006
|
+
React__namespace.useEffect(() => {
|
|
1007
|
+
if (!isOpen) {
|
|
1008
|
+
destroy();
|
|
1009
|
+
}
|
|
1010
|
+
}, [destroy, isOpen]);
|
|
1011
|
+
return isOpen ? (React__namespace.createElement(Portal, null,
|
|
1012
|
+
React__namespace.createElement("div", { ref: nodeRefCallback, style: { zIndex: 9999, position: 'absolute', top: 0, left: 0 }, className: "pfext-quick-start__base" }, children))) : null;
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
const isInViewport = (elementToCheck) => {
|
|
1016
|
+
const rect = elementToCheck.getBoundingClientRect();
|
|
1017
|
+
return (rect.top >= 0 &&
|
|
1018
|
+
rect.left >= 0 &&
|
|
1019
|
+
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
1020
|
+
rect.right <= (window.innerWidth || document.documentElement.clientWidth));
|
|
1021
|
+
};
|
|
1022
|
+
const InteractiveSpotlight = ({ element }) => {
|
|
1023
|
+
const { top, bottom, left, right, height, width } = element.getBoundingClientRect();
|
|
1024
|
+
const style = {
|
|
1025
|
+
height,
|
|
1026
|
+
width,
|
|
1027
|
+
top,
|
|
1028
|
+
left,
|
|
1029
|
+
bottom,
|
|
1030
|
+
right,
|
|
1031
|
+
};
|
|
1032
|
+
const [clicked, setClicked] = React__namespace.useState(false);
|
|
1033
|
+
React__namespace.useEffect(() => {
|
|
1034
|
+
if (!clicked) {
|
|
1035
|
+
if (!isInViewport(element)) {
|
|
1036
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
|
|
1037
|
+
}
|
|
1038
|
+
const handleClick = () => setClicked(true);
|
|
1039
|
+
document.addEventListener('click', handleClick);
|
|
1040
|
+
return () => {
|
|
1041
|
+
document.removeEventListener('click', handleClick);
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
return () => { };
|
|
1045
|
+
}, [element, clicked]);
|
|
1046
|
+
if (clicked) {
|
|
1047
|
+
return null;
|
|
1048
|
+
}
|
|
1049
|
+
return (React__namespace.createElement(Portal, null,
|
|
1050
|
+
React__namespace.createElement(SimplePopper, null,
|
|
1051
|
+
React__namespace.createElement("div", { className: "pfext-spotlight pfext-spotlight__element-highlight-animate", style: style }))));
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
var ScrollDirection;
|
|
1055
|
+
(function (ScrollDirection) {
|
|
1056
|
+
ScrollDirection["scrollingUp"] = "scrolling-up";
|
|
1057
|
+
ScrollDirection["scrollingDown"] = "scrolling-down";
|
|
1058
|
+
ScrollDirection["scrolledToBottom"] = "scrolled-to-bottom";
|
|
1059
|
+
ScrollDirection["scrolledToTop"] = "scrolled-to-top";
|
|
1060
|
+
})(ScrollDirection || (ScrollDirection = {}));
|
|
1061
|
+
|
|
1062
|
+
const useResizeObserver = (callback, targetElement, observerOptions = undefined) => {
|
|
1063
|
+
const element = React__namespace.useMemo(() => targetElement !== null && targetElement !== void 0 ? targetElement : document.querySelector('body'), [targetElement]);
|
|
1064
|
+
React__namespace.useEffect(() => {
|
|
1065
|
+
const observer = new ResizeObserver(callback);
|
|
1066
|
+
observer.observe(element, observerOptions);
|
|
1067
|
+
return () => {
|
|
1068
|
+
observer.disconnect();
|
|
1069
|
+
};
|
|
1070
|
+
}, [callback, observerOptions, element]);
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
var Shadows;
|
|
1074
|
+
(function (Shadows) {
|
|
1075
|
+
Shadows["none"] = "none";
|
|
1076
|
+
Shadows["both"] = "both";
|
|
1077
|
+
Shadows["top"] = "top";
|
|
1078
|
+
Shadows["bottom"] = "bottom";
|
|
1079
|
+
})(Shadows || (Shadows = {}));
|
|
1080
|
+
const useScrollShadows = (node) => {
|
|
1081
|
+
const [shadows, setShadows] = React__namespace.useState(Shadows.none);
|
|
1082
|
+
const computeShadows = React__namespace.useCallback(() => {
|
|
1083
|
+
if (node) {
|
|
1084
|
+
const { scrollTop, clientHeight, scrollHeight } = node;
|
|
1085
|
+
const top = scrollTop !== 0;
|
|
1086
|
+
const bottom = scrollTop + clientHeight < scrollHeight;
|
|
1087
|
+
if (top && bottom) {
|
|
1088
|
+
setShadows(Shadows.both);
|
|
1089
|
+
}
|
|
1090
|
+
else if (top) {
|
|
1091
|
+
setShadows(Shadows.top);
|
|
1092
|
+
}
|
|
1093
|
+
else if (bottom) {
|
|
1094
|
+
setShadows(Shadows.bottom);
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
setShadows(Shadows.none);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}, [node]);
|
|
1101
|
+
// recompute when the scroll container changes in size
|
|
1102
|
+
useResizeObserver(computeShadows, node);
|
|
1103
|
+
React__namespace.useEffect(() => {
|
|
1104
|
+
if (node) {
|
|
1105
|
+
// compute initial shadows
|
|
1106
|
+
computeShadows();
|
|
1107
|
+
// listen for scroll events
|
|
1108
|
+
node.addEventListener('scroll', computeShadows);
|
|
1109
|
+
}
|
|
1110
|
+
return () => {
|
|
1111
|
+
if (node) {
|
|
1112
|
+
node.removeEventListener('scroll', computeShadows);
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
}, [node, computeShadows]);
|
|
1116
|
+
return shadows;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
const useBoundingClientRect = (targetElement) => {
|
|
1120
|
+
const [clientRect, setClientRect] = React__namespace.useState(() => targetElement ? targetElement.getBoundingClientRect() : null);
|
|
1121
|
+
const observerCallback = React__namespace.useCallback(() => {
|
|
1122
|
+
setClientRect(targetElement ? targetElement.getBoundingClientRect() : null);
|
|
1123
|
+
}, [targetElement]);
|
|
1124
|
+
useResizeObserver(observerCallback);
|
|
1125
|
+
return clientRect;
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* React hook that forces component render.
|
|
1130
|
+
*/
|
|
1131
|
+
const useForceRender = () => React__namespace.useReducer((s) => !s, false)[1];
|
|
1132
|
+
|
|
1133
|
+
const useEventListener = (target, event, callback) => {
|
|
1134
|
+
React.useEffect(() => {
|
|
1135
|
+
target.addEventListener(event, callback);
|
|
1136
|
+
return () => {
|
|
1137
|
+
target.removeEventListener(event, callback);
|
|
1138
|
+
};
|
|
1139
|
+
}, [target, event, callback]);
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
const StaticSpotlight = ({ element }) => {
|
|
1143
|
+
const clientRect = useBoundingClientRect(element);
|
|
1144
|
+
const style = clientRect
|
|
1145
|
+
? {
|
|
1146
|
+
top: clientRect.top,
|
|
1147
|
+
left: clientRect.left,
|
|
1148
|
+
height: clientRect.height,
|
|
1149
|
+
width: clientRect.width,
|
|
1150
|
+
}
|
|
1151
|
+
: {};
|
|
1152
|
+
return clientRect ? (React__namespace.createElement(Portal, null,
|
|
1153
|
+
React__namespace.createElement("div", { className: "pf-v5-c-backdrop pfext-spotlight__with-backdrop" },
|
|
1154
|
+
React__namespace.createElement("div", { className: "pfext-spotlight pfext-spotlight__element-highlight-noanimate", style: style })))) : null;
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
const Spotlight = ({ selector, interactive }) => {
|
|
1158
|
+
// if target element is a hidden one return null
|
|
1159
|
+
const element = React__namespace.useMemo(() => {
|
|
1160
|
+
const highlightElement = document.querySelector(selector);
|
|
1161
|
+
let hiddenElement = highlightElement;
|
|
1162
|
+
while (hiddenElement) {
|
|
1163
|
+
const ariaHidden = hiddenElement.getAttribute('aria-hidden');
|
|
1164
|
+
if (ariaHidden === 'true') {
|
|
1165
|
+
return null;
|
|
1166
|
+
}
|
|
1167
|
+
hiddenElement = hiddenElement.parentElement;
|
|
1168
|
+
}
|
|
1169
|
+
return highlightElement;
|
|
1170
|
+
}, [selector]);
|
|
1171
|
+
if (!element) {
|
|
1172
|
+
return null;
|
|
1173
|
+
}
|
|
1174
|
+
return interactive ? (React__namespace.createElement(InteractiveSpotlight, { element: element })) : (React__namespace.createElement(StaticSpotlight, { element: element }));
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
const MarkdownHighlightExtension = ({ docContext, rootSelector, }) => {
|
|
1178
|
+
const [selector, setSelector] = React__namespace.useState(null);
|
|
1179
|
+
React__namespace.useEffect(() => {
|
|
1180
|
+
const elements = docContext.querySelectorAll(`${rootSelector} [data-highlight]`);
|
|
1181
|
+
let timeoutId;
|
|
1182
|
+
function startHighlight(e) {
|
|
1183
|
+
const highlightId = e.target.getAttribute('data-highlight');
|
|
1184
|
+
if (!highlightId) {
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
setSelector(null);
|
|
1188
|
+
timeoutId = setTimeout(() => {
|
|
1189
|
+
setSelector(`[data-quickstart-id="${highlightId}"]`);
|
|
1190
|
+
}, 0);
|
|
1191
|
+
}
|
|
1192
|
+
elements && elements.forEach((elm) => elm.addEventListener('click', startHighlight));
|
|
1193
|
+
return () => {
|
|
1194
|
+
clearTimeout(timeoutId);
|
|
1195
|
+
elements && elements.forEach((elm) => elm.removeEventListener('click', startHighlight));
|
|
1196
|
+
};
|
|
1197
|
+
}, [docContext, rootSelector]);
|
|
1198
|
+
React__namespace.useEffect(() => {
|
|
1199
|
+
const elements = docContext.querySelectorAll(`${rootSelector} [class^=data-highlight__]`);
|
|
1200
|
+
let timeoutId;
|
|
1201
|
+
function startHighlight(e) {
|
|
1202
|
+
e.preventDefault();
|
|
1203
|
+
const classes = e.target.getAttribute('class').split(' ');
|
|
1204
|
+
let highlightId;
|
|
1205
|
+
for (const className of classes) {
|
|
1206
|
+
if (className.startsWith('data-highlight__')) {
|
|
1207
|
+
highlightId = className.split('__')[1];
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
if (!highlightId) {
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
setSelector(null);
|
|
1215
|
+
timeoutId = setTimeout(() => {
|
|
1216
|
+
setSelector(`[data-quickstart-id="${highlightId}"]`);
|
|
1217
|
+
}, 0);
|
|
1218
|
+
}
|
|
1219
|
+
elements && elements.forEach((elm) => elm.addEventListener('click', startHighlight));
|
|
1220
|
+
return () => {
|
|
1221
|
+
clearTimeout(timeoutId);
|
|
1222
|
+
elements && elements.forEach((elm) => elm.removeEventListener('click', startHighlight));
|
|
1223
|
+
};
|
|
1224
|
+
}, [docContext, rootSelector]);
|
|
1225
|
+
if (!selector) {
|
|
1226
|
+
return null;
|
|
1227
|
+
}
|
|
1228
|
+
return React__namespace.createElement(Spotlight, { selector: selector, interactive: true });
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
const MARKDOWN_COPY_BUTTON_ID = 'data-copy-for';
|
|
1232
|
+
const MARKDOWN_SNIPPET_ID = 'data-snippet-id';
|
|
1233
|
+
const ACCORDION_MARKDOWN_BUTTON_ID = `accordion-markdown-button-id`;
|
|
1234
|
+
const ACCORDION_MARKDOWN_CONTENT_ID = `accordion-markdown-content-id`;
|
|
1235
|
+
|
|
1236
|
+
const CopyClipboard = ({ element, rootSelector, docContext, }) => {
|
|
1237
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1238
|
+
const [showSuccessContent, setShowSuccessContent] = React__namespace.useState(false);
|
|
1239
|
+
const textToCopy = React__namespace.useMemo(() => {
|
|
1240
|
+
var _a;
|
|
1241
|
+
const copyTextId = element.getAttribute(MARKDOWN_COPY_BUTTON_ID);
|
|
1242
|
+
return (_a = docContext.querySelector(`${rootSelector} [${MARKDOWN_SNIPPET_ID}="${copyTextId}"]`)) === null || _a === void 0 ? void 0 : _a.innerText;
|
|
1243
|
+
}, [element, docContext, rootSelector]);
|
|
1244
|
+
useEventListener(element, 'click', React__namespace.useCallback(() => {
|
|
1245
|
+
navigator.clipboard
|
|
1246
|
+
.writeText(textToCopy.trim())
|
|
1247
|
+
.then(() => {
|
|
1248
|
+
setShowSuccessContent(true);
|
|
1249
|
+
})
|
|
1250
|
+
.catch(() => { });
|
|
1251
|
+
}, [textToCopy]));
|
|
1252
|
+
useEventListener(element, 'mouseleave', React__namespace.useCallback(() => {
|
|
1253
|
+
setShowSuccessContent(false);
|
|
1254
|
+
}, []));
|
|
1255
|
+
return showSuccessContent ? (React__namespace.createElement(reactCore.Tooltip, { key: "after-copy", isVisible: true, triggerRef: () => element, content: getResource('Successfully copied to clipboard!'), className: "pfext-quick-start__base" })) : (React__namespace.createElement(reactCore.Tooltip, { key: "before-copy", triggerRef: () => element, content: getResource('Copy to clipboard'), className: "pfext-quick-start__base" }));
|
|
1256
|
+
};
|
|
1257
|
+
const MarkdownCopyClipboard = ({ docContext, rootSelector, }) => {
|
|
1258
|
+
const elements = docContext.querySelectorAll(`${rootSelector} [${MARKDOWN_COPY_BUTTON_ID}]`);
|
|
1259
|
+
return elements.length > 0 ? (React__namespace.createElement(React__namespace.Fragment, null, Array.from(elements).map((elm) => {
|
|
1260
|
+
const attributeValue = elm.getAttribute(MARKDOWN_COPY_BUTTON_ID);
|
|
1261
|
+
return (React__namespace.createElement(CopyClipboard, { key: attributeValue, element: elm, rootSelector: rootSelector, docContext: docContext }));
|
|
1262
|
+
}))) : null;
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
const removeTemplateWhitespace = (template) => template.replace(/>(?:\s|\n)+</g, '><');
|
|
1266
|
+
|
|
1267
|
+
const useInlineCopyClipboardShowdownExtension = () => {
|
|
1268
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1269
|
+
return React__namespace.useMemo(() => ({
|
|
1270
|
+
type: 'lang',
|
|
1271
|
+
regex: /`([^`](.*?)[^`])`{{copy}}/g,
|
|
1272
|
+
replace: (text, group, _, groupId) => {
|
|
1273
|
+
if (!group || isNaN(groupId)) {
|
|
1274
|
+
return text;
|
|
1275
|
+
}
|
|
1276
|
+
return removeTemplateWhitespace(`<span class="pf-v5-c-clipboard-copy pf-m-inline">
|
|
1277
|
+
<span class="pf-v5-c-clipboard-copy__text" ${MARKDOWN_SNIPPET_ID}="${groupId}">${group}</span>
|
|
1278
|
+
<span class="pf-v5-c-clipboard-copy__actions">
|
|
1279
|
+
<span class="pf-v5-c-clipboard-copy__actions-item">
|
|
1280
|
+
<button class="pf-v5-c-button pf-m-plain" aria-label="${getResource('Copy to clipboard')}" ${MARKDOWN_COPY_BUTTON_ID}="${groupId}">
|
|
1281
|
+
${server.renderToStaticMarkup(React__namespace.createElement(CopyIcon__default['default'], null))}
|
|
1282
|
+
</button>
|
|
1283
|
+
</span>
|
|
1284
|
+
</span>
|
|
1285
|
+
</span>`);
|
|
1286
|
+
},
|
|
1287
|
+
}), [getResource]);
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
const useMultilineCopyClipboardShowdownExtension = () => {
|
|
1291
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1292
|
+
return React__namespace.useMemo(() => ({
|
|
1293
|
+
type: 'lang',
|
|
1294
|
+
regex: /```[\n]\s*((((?!```).)*?\n)+)\s*```{{copy}}/g,
|
|
1295
|
+
replace: (text, group, _1, _2, groupId) => {
|
|
1296
|
+
if (!group || isNaN(groupId)) {
|
|
1297
|
+
return text;
|
|
1298
|
+
}
|
|
1299
|
+
return `<div class="pf-v5-c-code-block">
|
|
1300
|
+
<div class="pf-v5-c-code-block__header">
|
|
1301
|
+
<div class="pf-v5-c-code-block__actions">
|
|
1302
|
+
<div class="pf-v5-c-code-block__actions-item">
|
|
1303
|
+
<button class="pf-v5-c-button pf-m-plain" type="button" aria-label="${getResource('Copy to clipboard')}" ${MARKDOWN_COPY_BUTTON_ID}="${groupId}">
|
|
1304
|
+
${server.renderToStaticMarkup(React__namespace.createElement(CopyIcon__default['default'], null))}
|
|
1305
|
+
</button>
|
|
1306
|
+
</div>
|
|
1307
|
+
</div>
|
|
1308
|
+
</div>
|
|
1309
|
+
<div class="pf-v5-c-code-block__content">
|
|
1310
|
+
<pre class="pf-v5-c-code-block__pre pfext-code-block__pre">
|
|
1311
|
+
<code class="pf-v5-c-code-block__code"
|
|
1312
|
+
${MARKDOWN_SNIPPET_ID}="${groupId}">${group.trim()}</code>
|
|
1313
|
+
</pre>
|
|
1314
|
+
</div>
|
|
1315
|
+
</div>`;
|
|
1316
|
+
},
|
|
1317
|
+
}), [getResource]);
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1321
|
+
const DOMPurify = require('dompurify');
|
|
1322
|
+
const markdownConvert = (markdown, extensions) => {
|
|
1323
|
+
const converter = new showdown.Converter({
|
|
1324
|
+
tables: true,
|
|
1325
|
+
openLinksInNewWindow: true,
|
|
1326
|
+
strikethrough: true,
|
|
1327
|
+
emoji: false,
|
|
1328
|
+
});
|
|
1329
|
+
if (extensions) {
|
|
1330
|
+
converter.addExtension(extensions);
|
|
1331
|
+
}
|
|
1332
|
+
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1333
|
+
// nodeType 1 = element type
|
|
1334
|
+
// transform anchor tags
|
|
1335
|
+
if (node.nodeType === 1 && node.nodeName.toLowerCase() === 'a') {
|
|
1336
|
+
node.setAttribute('rel', 'noopener noreferrer');
|
|
1337
|
+
return node;
|
|
1338
|
+
}
|
|
1339
|
+
// add PF class to ul and ol lists
|
|
1340
|
+
if (node.nodeType === 1 &&
|
|
1341
|
+
(node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol')) {
|
|
1342
|
+
node.setAttribute('class', 'pf-v5-c-list');
|
|
1343
|
+
return node;
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
// Add a hook to make all links open a new window
|
|
1347
|
+
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
|
1348
|
+
// set all elements owning target to target=_blank
|
|
1349
|
+
if ('target' in node) {
|
|
1350
|
+
node.setAttribute('target', '_blank');
|
|
1351
|
+
}
|
|
1352
|
+
// set non-HTML/MathML links to xlink:show=new
|
|
1353
|
+
if (!node.hasAttribute('target') &&
|
|
1354
|
+
(node.hasAttribute('xlink:href') || node.hasAttribute('href'))) {
|
|
1355
|
+
node.setAttribute('xlink:show', 'new');
|
|
1356
|
+
}
|
|
1357
|
+
});
|
|
1358
|
+
return DOMPurify.sanitize(converter.makeHtml(markdown), {
|
|
1359
|
+
USE_PROFILES: {
|
|
1360
|
+
html: true,
|
|
1361
|
+
svg: true,
|
|
1362
|
+
},
|
|
1363
|
+
});
|
|
1364
|
+
};
|
|
1365
|
+
const SyncMarkdownView = ({ content, emptyMsg, extensions, renderExtension, exactHeight, inline, className, }) => {
|
|
1366
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1367
|
+
const markup = React__namespace.useMemo(() => markdownConvert(content || emptyMsg || getResource('Not available'), extensions), [content, emptyMsg, extensions, getResource]);
|
|
1368
|
+
const innerProps = {
|
|
1369
|
+
renderExtension: (extensions === null || extensions === void 0 ? void 0 : extensions.length) > 0 ? renderExtension : undefined,
|
|
1370
|
+
exactHeight,
|
|
1371
|
+
markup,
|
|
1372
|
+
isEmpty: !content,
|
|
1373
|
+
className,
|
|
1374
|
+
};
|
|
1375
|
+
return inline ? React__namespace.createElement(InlineMarkdownView, Object.assign({}, innerProps)) : React__namespace.createElement(IFrameMarkdownView, Object.assign({}, innerProps));
|
|
1376
|
+
};
|
|
1377
|
+
const uniqueId = (function () {
|
|
1378
|
+
let num = 0;
|
|
1379
|
+
return function (prefix) {
|
|
1380
|
+
const prefixStr = String(prefix) || '';
|
|
1381
|
+
num += 1;
|
|
1382
|
+
return prefixStr + num;
|
|
1383
|
+
};
|
|
1384
|
+
})();
|
|
1385
|
+
const RenderExtension = ({ renderExtension, selector, markup, docContext, }) => {
|
|
1386
|
+
const forceRender = useForceRender();
|
|
1387
|
+
const markupRef = React__namespace.useRef(null);
|
|
1388
|
+
const shouldRenderExtension = React__namespace.useCallback(() => {
|
|
1389
|
+
if (markupRef.current === markup) {
|
|
1390
|
+
return true;
|
|
1391
|
+
}
|
|
1392
|
+
markupRef.current = markup;
|
|
1393
|
+
return false;
|
|
1394
|
+
}, [markup]);
|
|
1395
|
+
/**
|
|
1396
|
+
* During a render cycle in which markup changes, renderExtension receives an old copy of document
|
|
1397
|
+
* because react is still updating the dom using `dangerouslySetInnerHTML` with latest markdown markup
|
|
1398
|
+
* which causes the component rendered by renderExtension to receive old copy of document
|
|
1399
|
+
* use forceRender to delay the rendering of extension by one render cycle
|
|
1400
|
+
*/
|
|
1401
|
+
React__namespace.useEffect(() => {
|
|
1402
|
+
if (renderExtension) {
|
|
1403
|
+
forceRender();
|
|
1404
|
+
}
|
|
1405
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1406
|
+
}, [markup]);
|
|
1407
|
+
return (React__namespace.createElement(React__namespace.Fragment, null, shouldRenderExtension() ? renderExtension === null || renderExtension === void 0 ? void 0 : renderExtension(docContext !== null && docContext !== void 0 ? docContext : document, selector) : null));
|
|
1408
|
+
};
|
|
1409
|
+
const InlineMarkdownView = ({ markup, isEmpty, renderExtension, className, }) => {
|
|
1410
|
+
const id = React__namespace.useMemo(() => uniqueId('markdown'), []);
|
|
1411
|
+
return (React__namespace.createElement("div", { className: reactStyles.css('pfext-markdown-view', { 'is-empty': isEmpty }, className), id: id },
|
|
1412
|
+
React__namespace.createElement("div", { dangerouslySetInnerHTML: { __html: markup } }),
|
|
1413
|
+
renderExtension && (React__namespace.createElement(RenderExtension, { renderExtension: renderExtension, selector: `#${id}`, markup: markup }))));
|
|
1414
|
+
};
|
|
1415
|
+
const IFrameMarkdownView = ({ exactHeight, markup, isEmpty, renderExtension, className, }) => {
|
|
1416
|
+
const [frame, setFrame] = React__namespace.useState();
|
|
1417
|
+
const [loaded, setLoaded] = React__namespace.useState(false);
|
|
1418
|
+
const updateTimeoutHandle = React__namespace.useRef();
|
|
1419
|
+
const updateDimensions = React__namespace.useCallback(() => {
|
|
1420
|
+
var _a;
|
|
1421
|
+
if (!((_a = frame === null || frame === void 0 ? void 0 : frame.contentWindow) === null || _a === void 0 ? void 0 : _a.document.body.firstChild)) {
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
frame.style.height = `${frame.contentWindow.document.body.firstElementChild.scrollHeight}px`;
|
|
1425
|
+
// Let the new height take effect, then reset again once we recompute
|
|
1426
|
+
updateTimeoutHandle.current = setTimeout(() => {
|
|
1427
|
+
if (exactHeight) {
|
|
1428
|
+
frame.style.height = `${frame.contentWindow.document.body.firstElementChild.scrollHeight}px`;
|
|
1429
|
+
}
|
|
1430
|
+
else {
|
|
1431
|
+
// Increase by 15px for the case where a horizontal scrollbar might appear
|
|
1432
|
+
frame.style.height = `${frame.contentWindow.document.body.firstElementChild.scrollHeight + 15}px`;
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
}, [frame, exactHeight]);
|
|
1436
|
+
React__namespace.useEffect(() => () => {
|
|
1437
|
+
clearTimeout(updateTimeoutHandle.current);
|
|
1438
|
+
}, []);
|
|
1439
|
+
const onLoad = React__namespace.useCallback(() => {
|
|
1440
|
+
updateDimensions();
|
|
1441
|
+
setLoaded(true);
|
|
1442
|
+
}, [updateDimensions]);
|
|
1443
|
+
// Find the app's stylesheets and inject them into the frame to ensure consistent styling.
|
|
1444
|
+
const filteredLinks = Array.from(document.getElementsByTagName('link')).filter((l) => l.href.includes('app-bundle'));
|
|
1445
|
+
const linkRefs = filteredLinks.reduce((refs, link) => `${refs}
|
|
1446
|
+
<link rel="stylesheet" href="${link.href}">`, '');
|
|
1447
|
+
const contents = `
|
|
1448
|
+
${linkRefs}
|
|
1449
|
+
<style type="text/css">
|
|
1450
|
+
body {
|
|
1451
|
+
background-color: transparent !important;
|
|
1452
|
+
color: ${isEmpty ? '#999' : '#333'};
|
|
1453
|
+
font-family: var(--pf-v5-global--FontFamily--sans-serif);
|
|
1454
|
+
min-width: auto !important;
|
|
1455
|
+
}
|
|
1456
|
+
table {
|
|
1457
|
+
display: block;
|
|
1458
|
+
margin-bottom: 11.5px;
|
|
1459
|
+
overflow-x: auto;
|
|
1460
|
+
}
|
|
1461
|
+
td,
|
|
1462
|
+
th {
|
|
1463
|
+
border-bottom: 1px solid #ededed;
|
|
1464
|
+
padding: 10px;
|
|
1465
|
+
vertical-align: top;
|
|
1466
|
+
}
|
|
1467
|
+
th {
|
|
1468
|
+
padding-top: 0;
|
|
1469
|
+
}
|
|
1470
|
+
</style>
|
|
1471
|
+
<body class="pf-m-redhat-font"><div style="overflow-y: auto;">${markup}</div></body>`;
|
|
1472
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
1473
|
+
React__namespace.createElement("iframe", { sandbox: "allow-popups allow-popups-to-escape-sandbox allow-same-origin", srcDoc: contents, style: { border: '0px', display: 'block', width: '100%', height: '0' }, ref: (r) => setFrame(r), onLoad: () => onLoad(), className: className }),
|
|
1474
|
+
loaded && frame && renderExtension && (React__namespace.createElement(RenderExtension, { markup: markup, selector: '', renderExtension: renderExtension, docContext: frame.contentDocument }))));
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
const LINK_LABEL = '[\\d\\w\\s-()$!]+';
|
|
1478
|
+
const HIGHLIGHT_ACTIONS = ['highlight'];
|
|
1479
|
+
const SELECTOR_ID = `[\\w-]+`;
|
|
1480
|
+
// [linkLabel]{{action id}}
|
|
1481
|
+
const HIGHLIGHT_REGEXP = new RegExp(`\\[(${LINK_LABEL})]{{(${HIGHLIGHT_ACTIONS.join('|')}) (${SELECTOR_ID})}}`, 'g');
|
|
1482
|
+
|
|
1483
|
+
const removeParagraphWrap = (markdown) => markdown.replace(/^<p>|<\/p>$/g, '');
|
|
1484
|
+
const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
1485
|
+
const { markdown } = React__namespace.useContext(QuickStartContext);
|
|
1486
|
+
const inlineCopyClipboardShowdownExtension = useInlineCopyClipboardShowdownExtension();
|
|
1487
|
+
const multilineCopyClipboardShowdownExtension = useMultilineCopyClipboardShowdownExtension();
|
|
1488
|
+
const admonitionShowdownExtension = useAdmonitionShowdownExtension();
|
|
1489
|
+
const codeShowdownExtension = useCodeShowdownExtension();
|
|
1490
|
+
const accordionShowdownExtension = useAccordionShowdownExtension();
|
|
1491
|
+
return (React__namespace.createElement(SyncMarkdownView, { inline: true, content: content, exactHeight: exactHeight, extensions: [
|
|
1492
|
+
{
|
|
1493
|
+
type: 'lang',
|
|
1494
|
+
regex: HIGHLIGHT_REGEXP,
|
|
1495
|
+
replace: (text, linkLabel, linkType, linkId) => {
|
|
1496
|
+
if (!linkLabel || !linkType || !linkId) {
|
|
1497
|
+
return text;
|
|
1498
|
+
}
|
|
1499
|
+
return `<button class="pf-v5-c-button pf-m-inline pf-m-link" data-highlight="${linkId}">${linkLabel}</button>`;
|
|
1500
|
+
},
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
type: 'output',
|
|
1504
|
+
filter(text) {
|
|
1505
|
+
// check HTML for patterns like: <em>Status: unknown</em>{#extension-requirement-status}
|
|
1506
|
+
// and replace with <em id="extension-requirement-status">Status: unknown</em>
|
|
1507
|
+
return text.replace(/<em>(.*)<\/em>{#(.*)}/g, '<em id="$2">$1</em>');
|
|
1508
|
+
},
|
|
1509
|
+
},
|
|
1510
|
+
inlineCopyClipboardShowdownExtension,
|
|
1511
|
+
multilineCopyClipboardShowdownExtension,
|
|
1512
|
+
admonitionShowdownExtension,
|
|
1513
|
+
codeShowdownExtension,
|
|
1514
|
+
accordionShowdownExtension,
|
|
1515
|
+
...(markdown ? markdown.extensions : []),
|
|
1516
|
+
], renderExtension: (docContext, rootSelector) => (React__namespace.createElement(React__namespace.Fragment, null,
|
|
1517
|
+
React__namespace.createElement(AccordionRenderExtension, { docContext: docContext }),
|
|
1518
|
+
React__namespace.createElement(MarkdownHighlightExtension, { docContext: docContext, rootSelector: rootSelector }),
|
|
1519
|
+
React__namespace.createElement(MarkdownCopyClipboard, { docContext: docContext, rootSelector: rootSelector }),
|
|
1520
|
+
markdown &&
|
|
1521
|
+
markdown.renderExtension &&
|
|
1522
|
+
markdown.renderExtension(docContext, rootSelector))), className: className }));
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
var AdmonitionType;
|
|
1526
|
+
(function (AdmonitionType) {
|
|
1527
|
+
AdmonitionType["TIP"] = "TIP";
|
|
1528
|
+
AdmonitionType["NOTE"] = "NOTE";
|
|
1529
|
+
AdmonitionType["IMPORTANT"] = "IMPORTANT";
|
|
1530
|
+
AdmonitionType["WARNING"] = "WARNING";
|
|
1531
|
+
AdmonitionType["CAUTION"] = "CAUTION";
|
|
1532
|
+
})(AdmonitionType || (AdmonitionType = {}));
|
|
1533
|
+
const admonitionToAlertVariantMap = {
|
|
1534
|
+
[AdmonitionType.NOTE]: { variant: 'info' },
|
|
1535
|
+
[AdmonitionType.TIP]: { variant: 'default', customIcon: React__namespace.createElement(LightbulbIcon__default['default'], null) },
|
|
1536
|
+
[AdmonitionType.IMPORTANT]: { variant: 'danger' },
|
|
1537
|
+
[AdmonitionType.CAUTION]: { variant: 'warning', customIcon: React__namespace.createElement(FireIcon__default['default'], null) },
|
|
1538
|
+
[AdmonitionType.WARNING]: { variant: 'warning' },
|
|
1539
|
+
};
|
|
1540
|
+
const useAdmonitionShowdownExtension = () =>
|
|
1541
|
+
// const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
1542
|
+
React__namespace.useMemo(() => ({
|
|
1543
|
+
type: 'lang',
|
|
1544
|
+
regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
|
|
1545
|
+
replace: (text, content, admonitionLabel, admonitionType, groupId) => {
|
|
1546
|
+
if (!content || !admonitionLabel || !admonitionType || !groupId) {
|
|
1547
|
+
return text;
|
|
1548
|
+
}
|
|
1549
|
+
admonitionType = admonitionType.toUpperCase();
|
|
1550
|
+
const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
|
|
1551
|
+
const style = admonitionType === AdmonitionType.CAUTION ? { backgroundColor: '#ec7a0915' } : {};
|
|
1552
|
+
const mdContent = React__namespace.createElement(QuickStartMarkdownView, { content: content });
|
|
1553
|
+
const pfAlert = (React__namespace.createElement(reactCore.Alert, { variant: variant, customIcon: customIcon && customIcon, isInline: true, title: admonitionType, className: "pfext-markdown-admonition", style: style }, mdContent));
|
|
1554
|
+
return removeTemplateWhitespace(server.renderToStaticMarkup(pfAlert));
|
|
1555
|
+
},
|
|
1556
|
+
}), []);
|
|
1557
|
+
|
|
1558
|
+
const useCodeShowdownExtension = () => React__namespace.useMemo(() => ({
|
|
1559
|
+
type: 'output',
|
|
1560
|
+
regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
|
|
1561
|
+
replace: (text, content) => {
|
|
1562
|
+
if (!content) {
|
|
1563
|
+
return text;
|
|
1564
|
+
}
|
|
1565
|
+
const pfCodeBlock = React__namespace.createElement(reactCore.CodeBlock, null, content);
|
|
1566
|
+
return removeTemplateWhitespace(server.renderToStaticMarkup(pfCodeBlock));
|
|
1567
|
+
},
|
|
1568
|
+
}), []);
|
|
1569
|
+
|
|
1570
|
+
const useAccordionShowdownExtension = () => React__namespace.useMemo(() => ({
|
|
1571
|
+
type: 'lang',
|
|
1572
|
+
regex: /\[(.+)]{{(accordion) ("(.*?)")}}/g,
|
|
1573
|
+
replace: (_text, accordionContent, _command, accordionHeading) => {
|
|
1574
|
+
const accordionId = String(accordionHeading).replace(/\s/g, '-');
|
|
1575
|
+
return removeTemplateWhitespace(server.renderToStaticMarkup(React__namespace.createElement(reactCore.Accordion, { asDefinitionList: true },
|
|
1576
|
+
React__namespace.createElement(reactCore.AccordionItem, null,
|
|
1577
|
+
React__namespace.createElement(reactCore.AccordionToggle, { isExpanded: false, id: `${ACCORDION_MARKDOWN_BUTTON_ID}-${accordionId}` }, accordionHeading),
|
|
1578
|
+
React__namespace.createElement(reactCore.AccordionContent, { id: `${ACCORDION_MARKDOWN_CONTENT_ID}-${accordionId}`, isHidden: !false }, accordionContent)))));
|
|
1579
|
+
},
|
|
1580
|
+
}), []);
|
|
1581
|
+
|
|
1582
|
+
const AccordionShowdownHandler = ({ buttonElement, contentElement, }) => {
|
|
1583
|
+
const [expanded, setExpanded] = React__namespace.useState(false);
|
|
1584
|
+
const handleClick = () => {
|
|
1585
|
+
const expandedModifier = 'pf-m-expanded';
|
|
1586
|
+
buttonElement.className = `pf-v5-c-accordion__toggle ${!expanded ? expandedModifier : ''}`;
|
|
1587
|
+
contentElement.hidden = expanded;
|
|
1588
|
+
contentElement.className = `pf-v5-c-accordion__expanded-content ${!expanded ? expandedModifier : ''}`;
|
|
1589
|
+
setExpanded(!expanded);
|
|
1590
|
+
};
|
|
1591
|
+
useEventListener(buttonElement, 'click', handleClick);
|
|
1592
|
+
return React__namespace.createElement(React__namespace.Fragment, null);
|
|
1593
|
+
};
|
|
1594
|
+
const AccordionRenderExtension = ({ docContext }) => {
|
|
1595
|
+
const buttonElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_BUTTON_ID}]`);
|
|
1596
|
+
const contentElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_CONTENT_ID}]`);
|
|
1597
|
+
return buttonElements.length > 0 ? (React__namespace.createElement(React__namespace.Fragment, null, Array.from(buttonElements).map((elm) => {
|
|
1598
|
+
const content = Array.from(contentElements).find((elm2) => {
|
|
1599
|
+
const elmId = elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1];
|
|
1600
|
+
const elm2Id = elm2.id.split(ACCORDION_MARKDOWN_CONTENT_ID)[1];
|
|
1601
|
+
return elmId === elm2Id;
|
|
1602
|
+
});
|
|
1603
|
+
return (React__namespace.createElement(AccordionShowdownHandler, { key: elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1], buttonElement: elm, contentElement: content }));
|
|
1604
|
+
}))) : null;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1608
|
+
const [isSrcValid, setIsSrcValid] = React__namespace.useState(true);
|
|
1609
|
+
if (src && isSrcValid) {
|
|
1610
|
+
return React__namespace.createElement("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
|
|
1611
|
+
}
|
|
1612
|
+
return React__namespace.createElement(React__namespace.Fragment, null, fallback);
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1615
|
+
const DASH = '-';
|
|
1616
|
+
|
|
1617
|
+
const PopoverStatus = ({ hideHeader, children, isVisible = null, statusBody, title, onHide, onShow, }) => (React__namespace.createElement(reactCore.Popover, { position: reactCore.PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible },
|
|
1618
|
+
React__namespace.createElement(reactCore.Button, { variant: "link", isInline: true }, statusBody)));
|
|
1619
|
+
|
|
1620
|
+
const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
|
|
1621
|
+
if (!title) {
|
|
1622
|
+
return React__namespace.createElement(React__namespace.Fragment, null, DASH);
|
|
1623
|
+
}
|
|
1624
|
+
return (React__namespace.createElement("span", { className: reactStyles.css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined },
|
|
1625
|
+
icon &&
|
|
1626
|
+
React__namespace.cloneElement(icon, {
|
|
1627
|
+
className: reactStyles.css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
|
|
1628
|
+
}),
|
|
1629
|
+
!iconOnly && React__namespace.createElement(CamelCaseWrap, { value: title, dataTest: "status-text" })));
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
const GenericStatus = (props) => {
|
|
1633
|
+
const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = tslib.__rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
|
|
1634
|
+
const renderIcon = iconOnly && !noTooltip ? React__namespace.createElement(Icon, { title: title }) : React__namespace.createElement(Icon, null);
|
|
1635
|
+
const statusBody = (React__namespace.createElement(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
|
|
1636
|
+
return React__namespace.Children.toArray(children).length ? (React__namespace.createElement(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }), children)) : (statusBody);
|
|
1637
|
+
};
|
|
1638
|
+
|
|
1639
|
+
const GreenCheckCircleIcon = ({ className, title, size }) => (React__namespace.createElement(reactCore.Icon, { size: size },
|
|
1640
|
+
React__namespace.createElement(CheckCircleIcon__default['default'], { "data-test": "success-icon", color: okColor__default['default'].value, className: className, title: title })));
|
|
1641
|
+
|
|
1642
|
+
const SuccessStatus = (props) => (React__namespace.createElement(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
|
|
1643
|
+
SuccessStatus.displayName = 'SuccessStatus';
|
|
1644
|
+
|
|
1645
|
+
const Status = ({ status, title, iconOnly, noTooltip, className, }) => {
|
|
1646
|
+
const statusProps = { title: title || status, iconOnly, noTooltip, className };
|
|
1647
|
+
switch (status) {
|
|
1648
|
+
case 'In Progress':
|
|
1649
|
+
return React__namespace.createElement(StatusIconAndText, Object.assign({}, statusProps, { icon: React__namespace.createElement(SyncAltIcon__default['default'], null) }));
|
|
1650
|
+
case 'Complete':
|
|
1651
|
+
return React__namespace.createElement(SuccessStatus, Object.assign({}, statusProps));
|
|
1652
|
+
default:
|
|
1653
|
+
return React__namespace.createElement(React__namespace.Fragment, null, status || DASH);
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
const StatusIcon = ({ status }) => (React__namespace.createElement(Status, { status: status, iconOnly: true }));
|
|
1657
|
+
|
|
1658
|
+
const QuickStartTileDescription = ({ description, prerequisites, }) => {
|
|
1659
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1660
|
+
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
|
1661
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
1662
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: description, className: "pfext-quick-start-tile-description" }),
|
|
1663
|
+
(prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (React__namespace.createElement("div", { className: "pfext-quick-start-tile-prerequisites" },
|
|
1664
|
+
React__namespace.createElement(reactCore.Text, { component: reactCore.TextVariants.h5, className: "pfext-quick-start-tile-prerequisites__text" },
|
|
1665
|
+
getResource('Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length),
|
|
1666
|
+
' '),
|
|
1667
|
+
React__namespace.createElement(reactCore.Popover, { "aria-label": getResource('Prerequisites'), headerContent: getResource('Prerequisites'), className: "pfext-quick-start__base", bodyContent: React__namespace.createElement("div", { className: "pfext-popover__base" },
|
|
1668
|
+
React__namespace.createElement(reactCore.TextList, { "aria-label": getResource('Prerequisites'), className: "pfext-quick-start-tile-prerequisites-list" }, prereqs.map((prerequisite, index) => (
|
|
1669
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
1670
|
+
React__namespace.createElement(reactCore.TextListItem, { key: index },
|
|
1671
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: prerequisite })))))) },
|
|
1672
|
+
React__namespace.createElement(reactCore.Button, { variant: "link", isInline: true, className: "pfext-quick-start-tile-prerequisites__icon", "data-testid": "qs-card-prereqs", onClick: (e) => {
|
|
1673
|
+
e.preventDefault();
|
|
1674
|
+
e.stopPropagation();
|
|
1675
|
+
}, "aria-label": getResource('Show prerequisites') },
|
|
1676
|
+
React__namespace.createElement(InfoCircleIcon__default['default'], null)))))));
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
const QuickStartTileFooter = ({ quickStartId, status, totalTasks, }) => {
|
|
1680
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1681
|
+
const { activeQuickStartID, startQuickStart, restartQuickStart } = React__namespace.useContext(QuickStartContext);
|
|
1682
|
+
const start = React__namespace.useCallback((e) => {
|
|
1683
|
+
e.preventDefault();
|
|
1684
|
+
e.stopPropagation();
|
|
1685
|
+
startQuickStart(quickStartId, totalTasks);
|
|
1686
|
+
}, [quickStartId, startQuickStart, totalTasks]);
|
|
1687
|
+
const restart = React__namespace.useCallback((e) => {
|
|
1688
|
+
e.preventDefault();
|
|
1689
|
+
e.stopPropagation();
|
|
1690
|
+
restartQuickStart(quickStartId, totalTasks);
|
|
1691
|
+
}, [quickStartId, restartQuickStart, totalTasks]);
|
|
1692
|
+
return (React__namespace.createElement(reactCore.Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
1693
|
+
status === exports.QuickStartStatus.NOT_STARTED && (React__namespace.createElement(reactCore.FlexItem, null,
|
|
1694
|
+
React__namespace.createElement(reactCore.Button, { onClick: start, variant: "link", isInline: true, "data-testid": "qs-card-notStarted-start", id: `${quickStartId}-start`, "aria-labelledby": `${quickStartId}-start ${quickStartId}` }, getResource('Start')))),
|
|
1695
|
+
status === exports.QuickStartStatus.IN_PROGRESS && activeQuickStartID !== quickStartId && (React__namespace.createElement(reactCore.FlexItem, null,
|
|
1696
|
+
React__namespace.createElement(reactCore.Button, { variant: "link", isInline: true, "data-testid": "qs-card-inProgress-resume", id: `${quickStartId}-continue`, "aria-labelledby": `${quickStartId}-continue ${quickStartId}` }, getResource('Continue')))),
|
|
1697
|
+
status === exports.QuickStartStatus.COMPLETE && (React__namespace.createElement(reactCore.FlexItem, null,
|
|
1698
|
+
React__namespace.createElement(reactCore.Button, { onClick: restart, variant: "link", isInline: true, "data-testid": "qs-card-complete-restart", id: `${quickStartId}-restart`, "aria-labelledby": `${quickStartId}-restart ${quickStartId}` }, getResource('Restart')))),
|
|
1699
|
+
status === exports.QuickStartStatus.IN_PROGRESS && (React__namespace.createElement(reactCore.FlexItem, null,
|
|
1700
|
+
React__namespace.createElement(reactCore.Button, { onClick: restart, variant: "link", isInline: true, "data-testid": "qs-card-inProgress-restart", id: `${quickStartId}-restart`, "aria-labelledby": `${quickStartId}-restart ${quickStartId}` }, getResource('Restart'))))));
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
const QuickStartTileFooterExternal = ({ link, quickStartId, }) => {
|
|
1704
|
+
const { href, text } = link;
|
|
1705
|
+
return (React__namespace.createElement(reactCore.Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
1706
|
+
React__namespace.createElement(reactCore.FlexItem, null,
|
|
1707
|
+
React__namespace.createElement(reactCore.Button, { component: "a", href: href, target: "_blank", rel: "noopener noreferrer", variant: "link", "aria-label": `Open documentation in new window`, isInline: true, icon: React__namespace.createElement(ExternalLinkAltIcon__default['default'], null), iconPosition: "right", id: quickStartId, "aria-labelledby": `${quickStartId}-external ${quickStartId}` }, text || href))));
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
const statusColorMap = {
|
|
1711
|
+
[exports.QuickStartStatus.COMPLETE]: 'green',
|
|
1712
|
+
[exports.QuickStartStatus.IN_PROGRESS]: 'purple',
|
|
1713
|
+
[exports.QuickStartStatus.NOT_STARTED]: 'grey',
|
|
1714
|
+
};
|
|
1715
|
+
const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, action, }) => {
|
|
1716
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1717
|
+
const statusLocaleMap = {
|
|
1718
|
+
[exports.QuickStartStatus.COMPLETE]: getResource('Complete'),
|
|
1719
|
+
[exports.QuickStartStatus.IN_PROGRESS]: getResource('In progress'),
|
|
1720
|
+
[exports.QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
1721
|
+
};
|
|
1722
|
+
const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon__default['default'];
|
|
1723
|
+
return (React__namespace.createElement("div", { className: "pfext-quick-start-tile-header" },
|
|
1724
|
+
React__namespace.createElement(reactCore.Flex, { flexWrap: { default: 'nowrap' } },
|
|
1725
|
+
React__namespace.createElement(reactCore.Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
|
|
1726
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: name })),
|
|
1727
|
+
action && (React__namespace.createElement(reactCore.Button, Object.assign({ "aria-label": action['aria-label'], icon: React__namespace.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps)))),
|
|
1728
|
+
React__namespace.createElement("div", { className: "pfext-quick-start-tile-header__status" },
|
|
1729
|
+
type && (React__namespace.createElement(reactCore.Label, { className: "pfext-quick-start-tile-header--margin", color: type.color }, type.text)),
|
|
1730
|
+
duration && (React__namespace.createElement(reactCore.Label, { variant: "outline", "data-test": "duration", icon: React__namespace.createElement(OutlinedClockIcon__default['default'], null), className: "pfext-quick-start-tile-header--margin" }, getResource('{{duration, number}} minutes', duration).replace('{{duration, number}}', duration))),
|
|
1731
|
+
status !== exports.QuickStartStatus.NOT_STARTED && (React__namespace.createElement(reactCore.Label, { variant: "outline", color: statusColorMap[status], icon: React__namespace.createElement(StatusIcon, { status: status }), "data-test": "status" }, statusLocaleMap[status])))));
|
|
1732
|
+
};
|
|
1733
|
+
|
|
1734
|
+
const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, action, }) => {
|
|
1735
|
+
const { metadata: { name: id }, spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type }, } = quickStart;
|
|
1736
|
+
const { setActiveQuickStart, footer } = React__namespace.useContext(QuickStartContext);
|
|
1737
|
+
const ref = React__namespace.useRef(null);
|
|
1738
|
+
let quickStartIcon;
|
|
1739
|
+
if (typeof icon === 'object') {
|
|
1740
|
+
quickStartIcon = icon;
|
|
1741
|
+
}
|
|
1742
|
+
else {
|
|
1743
|
+
quickStartIcon = (React__namespace.createElement(FallbackImg, { className: "pfext-catalog-item-icon__img--large", src: icon, alt: "", fallback: React__namespace.createElement(RocketIcon__default['default'], null) }));
|
|
1744
|
+
}
|
|
1745
|
+
const footerComponent = React__namespace.useMemo(() => {
|
|
1746
|
+
if (footer && footer.show === false) {
|
|
1747
|
+
return null;
|
|
1748
|
+
}
|
|
1749
|
+
if (link) {
|
|
1750
|
+
return React__namespace.createElement(QuickStartTileFooterExternal, { link: link, quickStartId: id });
|
|
1751
|
+
}
|
|
1752
|
+
return React__namespace.createElement(QuickStartTileFooter, { quickStartId: id, status: status, totalTasks: tasks === null || tasks === void 0 ? void 0 : tasks.length });
|
|
1753
|
+
}, [footer, id, link, status, tasks === null || tasks === void 0 ? void 0 : tasks.length]);
|
|
1754
|
+
const handleClick = (e) => {
|
|
1755
|
+
var _a;
|
|
1756
|
+
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
|
1757
|
+
if (!link) {
|
|
1758
|
+
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1759
|
+
}
|
|
1760
|
+
onClick();
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
const linkProps = link
|
|
1764
|
+
? {
|
|
1765
|
+
href: link.href,
|
|
1766
|
+
target: '_blank',
|
|
1767
|
+
rel: 'noreferrer',
|
|
1768
|
+
}
|
|
1769
|
+
: {};
|
|
1770
|
+
return (React__namespace.createElement("div", { ref: ref, onClick: handleClick },
|
|
1771
|
+
React__namespace.createElement(CatalogTile, Object.assign({ id: id + '-catalog-tile', style: {
|
|
1772
|
+
cursor: 'pointer',
|
|
1773
|
+
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React__namespace.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id, action: action }), onKeyDown: (event) => {
|
|
1774
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1775
|
+
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1776
|
+
onClick();
|
|
1777
|
+
}
|
|
1778
|
+
} }, linkProps, { "data-test": `tile ${id}`, description: React__namespace.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent, tabIndex: 0,
|
|
1779
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1780
|
+
// @ts-ignore-next-line
|
|
1781
|
+
isSelectableRaised: true }))));
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
const QuickStartCatalog = ({ quickStarts }) => {
|
|
1785
|
+
const { activeQuickStartID, allQuickStartStates } = React__namespace.useContext(QuickStartContext);
|
|
1786
|
+
return (React__namespace.createElement("div", { className: "pfext-page-layout__content" },
|
|
1787
|
+
React__namespace.createElement(reactCore.Gallery, { className: "pfext-quick-start-catalog__gallery", hasGutter: true }, quickStarts.map((quickStart) => {
|
|
1788
|
+
const { metadata: { name: id }, } = quickStart;
|
|
1789
|
+
return (React__namespace.createElement(reactCore.GalleryItem, { key: id, className: "pfext-quick-start-catalog__gallery-item" },
|
|
1790
|
+
React__namespace.createElement(QuickStartTile, { quickStart: quickStart, isActive: id === activeQuickStartID, status: getQuickStartStatus(allQuickStartStates, id) })));
|
|
1791
|
+
}))));
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
const QuickStartCatalogFilterSearch = (_a) => {
|
|
1795
|
+
var { searchInputText, handleTextChange } = _a, props = tslib.__rest(_a, ["searchInputText", "handleTextChange"]);
|
|
1796
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1797
|
+
return (React__namespace.createElement(reactCore.ToolbarItem, { className: "pfext-quick-start-catalog-filter__input" },
|
|
1798
|
+
React__namespace.createElement(reactCore.SearchInput, Object.assign({ placeholder: getResource('Filter by keyword...'), value: searchInputText, onChange: (_ev, value) => handleTextChange(value), onClear: () => handleTextChange('') }, props))));
|
|
1799
|
+
};
|
|
1800
|
+
const QuickStartCatalogFilterSelect = (_a) => {
|
|
1801
|
+
var { isDropdownOpen, setIsDropdownOpen, onRowfilterSelect, selectedFilters, dropdownItems } = _a, props = tslib.__rest(_a, ["isDropdownOpen", "setIsDropdownOpen", "onRowfilterSelect", "selectedFilters", "dropdownItems"]);
|
|
1802
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1803
|
+
const toggle = (toggleRef) => (React__namespace.createElement(reactCore.MenuToggle, { isFullWidth: true, ref: toggleRef, onClick: () => setIsDropdownOpen(!isDropdownOpen), isExpanded: isDropdownOpen },
|
|
1804
|
+
getResource('Status'),
|
|
1805
|
+
selectedFilters.length > 0 && React__namespace.createElement(reactCore.Badge, { isRead: true }, selectedFilters.length)));
|
|
1806
|
+
return (React__namespace.createElement(reactCore.ToolbarItem, null,
|
|
1807
|
+
React__namespace.createElement(reactCore.Select, Object.assign({ "aria-label": getResource('Select filter'), isOpen: isDropdownOpen, selected: selectedFilters, onSelect: onRowfilterSelect, onOpenChange: (isOpen) => setIsDropdownOpen(isOpen), toggle: toggle }, props),
|
|
1808
|
+
React__namespace.createElement(reactCore.SelectList, null, dropdownItems))));
|
|
1809
|
+
};
|
|
1810
|
+
const QuickStartCatalogFilterCount = ({ quickStartsCount }) => {
|
|
1811
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1812
|
+
return (React__namespace.createElement(reactCore.ToolbarItem, { className: "pfext-quick-start-catalog-filter__count", align: { default: 'alignRight' } }, getResource('{{count, number}} item', quickStartsCount).replace('{{count, number}}', quickStartsCount)));
|
|
1813
|
+
};
|
|
1814
|
+
const QuickStartCatalogFilterSearchWrapper = ({ onSearchInputChange = () => { } }) => {
|
|
1815
|
+
const { useQueryParams, filter, setFilter } = React__namespace.useContext(QuickStartContext);
|
|
1816
|
+
React__namespace.useEffect(() => {
|
|
1817
|
+
// use this effect to clear the search when a `clear all` action is performed higher up
|
|
1818
|
+
const unlisten = history.listen(({ location }) => {
|
|
1819
|
+
const searchParams = new URLSearchParams(location.search);
|
|
1820
|
+
const searchQuery = searchParams.get(QUICKSTART_SEARCH_FILTER_KEY) || '';
|
|
1821
|
+
if (searchQuery === '') {
|
|
1822
|
+
setFilter('keyword', '');
|
|
1823
|
+
onSearchInputChange('');
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
return () => {
|
|
1827
|
+
unlisten();
|
|
1828
|
+
};
|
|
1829
|
+
}, [onSearchInputChange, setFilter]);
|
|
1830
|
+
const handleTextChange = (val) => {
|
|
1831
|
+
if (val.length > 0) {
|
|
1832
|
+
useQueryParams && setQueryArgument(QUICKSTART_SEARCH_FILTER_KEY, val);
|
|
1833
|
+
}
|
|
1834
|
+
else {
|
|
1835
|
+
useQueryParams && removeQueryArgument(QUICKSTART_SEARCH_FILTER_KEY);
|
|
1836
|
+
}
|
|
1837
|
+
if ((filter === null || filter === void 0 ? void 0 : filter.keyword) !== val) {
|
|
1838
|
+
setFilter('keyword', val);
|
|
1839
|
+
}
|
|
1840
|
+
onSearchInputChange(val);
|
|
1841
|
+
};
|
|
1842
|
+
return (React__namespace.createElement(QuickStartCatalogFilterSearch, { searchInputText: filter === null || filter === void 0 ? void 0 : filter.keyword, handleTextChange: handleTextChange }));
|
|
1843
|
+
};
|
|
1844
|
+
// compare string/number arrays
|
|
1845
|
+
const equalsIgnoreOrder = (a, b) => {
|
|
1846
|
+
if (a.length !== b.length) {
|
|
1847
|
+
return false;
|
|
1848
|
+
}
|
|
1849
|
+
const uniqueValues = new Set([...a, ...b]);
|
|
1850
|
+
for (const v of uniqueValues) {
|
|
1851
|
+
const aCount = a.filter((e) => e === v).length;
|
|
1852
|
+
const bCount = b.filter((e) => e === v).length;
|
|
1853
|
+
if (aCount !== bCount) {
|
|
1854
|
+
return false;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
return true;
|
|
1858
|
+
};
|
|
1859
|
+
const QuickStartCatalogFilterStatusWrapper = ({ onStatusChange = () => { } }) => {
|
|
1860
|
+
const { useQueryParams, filter, setFilter } = React__namespace.useContext(QuickStartContext);
|
|
1861
|
+
React__namespace.useEffect(() => {
|
|
1862
|
+
// use this effect to clear the status when a `clear all` action is performed higher up
|
|
1863
|
+
const unlisten = history.listen(({ location }) => {
|
|
1864
|
+
var _a;
|
|
1865
|
+
const searchParams = new URLSearchParams(location.search);
|
|
1866
|
+
const updatedStatusFilters = ((_a = searchParams.get(QUICKSTART_STATUS_FILTER_KEY)) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
1867
|
+
if (updatedStatusFilters.length === 0) {
|
|
1868
|
+
setFilter('status', []);
|
|
1869
|
+
onStatusChange([]);
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
return () => {
|
|
1873
|
+
unlisten();
|
|
1874
|
+
};
|
|
1875
|
+
});
|
|
1876
|
+
const [isDropdownOpen, setIsDropdownOpen] = React__namespace.useState(false);
|
|
1877
|
+
const onRowfilterSelect = React__namespace.useCallback((_e, selectedValue) => {
|
|
1878
|
+
setIsDropdownOpen(false);
|
|
1879
|
+
const selection = Object.entries(filter.status.statusTypes).find(([_key, value]) => value === selectedValue)[0];
|
|
1880
|
+
const selectedFiltersList = filter.status.statusFilters.includes(selection)
|
|
1881
|
+
? filter.status.statusFilters.filter((status) => status !== selection)
|
|
1882
|
+
: [...filter.status.statusFilters, selection];
|
|
1883
|
+
if (!equalsIgnoreOrder(filter.status.statusFilters, selectedFiltersList)) {
|
|
1884
|
+
setFilter('status', selectedFiltersList);
|
|
1885
|
+
}
|
|
1886
|
+
if (selectedFiltersList.length > 0) {
|
|
1887
|
+
useQueryParams && setQueryArgument('status', selectedFiltersList.join(','));
|
|
1888
|
+
}
|
|
1889
|
+
else {
|
|
1890
|
+
useQueryParams && removeQueryArgument(QUICKSTART_STATUS_FILTER_KEY);
|
|
1891
|
+
}
|
|
1892
|
+
onStatusChange(selectedFiltersList);
|
|
1893
|
+
}, [filter.status.statusFilters, onStatusChange, setFilter, useQueryParams]);
|
|
1894
|
+
const dropdownItems = Object.entries(filter.status.statusTypes).map(([key, value]) => (React__namespace.createElement(reactCore.SelectOption, { key: key, "data-key": key, value: value, hasCheckbox: true, isSelected: filter.status.statusFilters.includes(key) },
|
|
1895
|
+
React__namespace.createElement(React__namespace.Fragment, null, value))));
|
|
1896
|
+
return (React__namespace.createElement(QuickStartCatalogFilterSelect, { isDropdownOpen: isDropdownOpen, setIsDropdownOpen: setIsDropdownOpen, onRowfilterSelect: onRowfilterSelect, selectedFilters: filter.status.statusFilters, dropdownItems: dropdownItems }));
|
|
1897
|
+
};
|
|
1898
|
+
const QuickStartCatalogFilterCountWrapper = ({ quickStartsCount }) => React__namespace.createElement(QuickStartCatalogFilterCount, { quickStartsCount: quickStartsCount });
|
|
1899
|
+
|
|
1900
|
+
const QuickStartCatalogFilter = (_a) => {
|
|
1901
|
+
var { quickStartsCount, onSearchInputChange = () => { }, onStatusChange = () => { } } = _a, props = tslib.__rest(_a, ["quickStartsCount", "onSearchInputChange", "onStatusChange"]);
|
|
1902
|
+
return (React__namespace.createElement(reactCore.Toolbar, Object.assign({ usePageInsets: true, className: "pfext-quick-start-catalog-filter__flex" }, props),
|
|
1903
|
+
React__namespace.createElement(reactCore.ToolbarContent, null,
|
|
1904
|
+
React__namespace.createElement(QuickStartCatalogFilterSearchWrapper, { onSearchInputChange: onSearchInputChange }),
|
|
1905
|
+
React__namespace.createElement(QuickStartCatalogFilterStatusWrapper, { onStatusChange: onStatusChange }),
|
|
1906
|
+
React__namespace.createElement(QuickStartCatalogFilterCountWrapper, { quickStartsCount: quickStartsCount }))));
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1909
|
+
const QuickStartCatalogEmptyState = ({ clearFilters }) => {
|
|
1910
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1911
|
+
return (React__namespace.createElement(reactCore.EmptyState, null,
|
|
1912
|
+
React__namespace.createElement(reactCore.EmptyStateHeader, { titleText: React__namespace.createElement(React__namespace.Fragment, null, getResource('No results found')), icon: React__namespace.createElement(reactCore.EmptyStateIcon, { icon: SearchIcon__default['default'] }), headingLevel: "h4" }),
|
|
1913
|
+
React__namespace.createElement(reactCore.EmptyStateBody, null, getResource('No results match the filter criteria. Remove filters or clear all filters to show results.')),
|
|
1914
|
+
React__namespace.createElement(reactCore.EmptyStateFooter, null,
|
|
1915
|
+
React__namespace.createElement(reactCore.EmptyStateActions, null,
|
|
1916
|
+
React__namespace.createElement(reactCore.Button, { variant: "link", onClick: clearFilters, "data-test": "clear-filter button" }, getResource('Clear all filters'))))));
|
|
1917
|
+
};
|
|
1918
|
+
const QuickStartCatalogPage = ({ quickStarts, showFilter, sortFnc = (q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName), title, hint, showTitle = true, }) => {
|
|
1919
|
+
const sortFncCallback = React__namespace.useCallback(sortFnc, [sortFnc]);
|
|
1920
|
+
const { allQuickStarts = [], setAllQuickStarts, allQuickStartStates, getResource, filter, setFilter, loading, } = React__namespace.useContext(QuickStartContext);
|
|
1921
|
+
React__namespace.useEffect(() => {
|
|
1922
|
+
// passed through prop, not context
|
|
1923
|
+
if (quickStarts && JSON.stringify(quickStarts) !== JSON.stringify(allQuickStarts)) {
|
|
1924
|
+
setAllQuickStarts(quickStarts);
|
|
1925
|
+
}
|
|
1926
|
+
}, [quickStarts, allQuickStarts, setAllQuickStarts]);
|
|
1927
|
+
const initialFilteredQuickStarts = showFilter
|
|
1928
|
+
? filterQuickStarts(allQuickStarts, filter.keyword, filter.status.statusFilters, allQuickStartStates).sort(sortFncCallback)
|
|
1929
|
+
: allQuickStarts;
|
|
1930
|
+
const [filteredQuickStarts, setFilteredQuickStarts] = React__namespace.useState(initialFilteredQuickStarts);
|
|
1931
|
+
React__namespace.useEffect(() => {
|
|
1932
|
+
const filteredQs = showFilter
|
|
1933
|
+
? filterQuickStarts(allQuickStarts, filter.keyword, filter.status.statusFilters, allQuickStartStates).sort(sortFncCallback)
|
|
1934
|
+
: allQuickStarts;
|
|
1935
|
+
// also needs a check whether the content of the QS changed
|
|
1936
|
+
if (filteredQs.length !== filteredQuickStarts.length ||
|
|
1937
|
+
JSON.stringify(filteredQs) !== JSON.stringify(filteredQuickStarts)) {
|
|
1938
|
+
setFilteredQuickStarts(filteredQs);
|
|
1939
|
+
}
|
|
1940
|
+
}, [
|
|
1941
|
+
allQuickStarts,
|
|
1942
|
+
allQuickStartStates,
|
|
1943
|
+
showFilter,
|
|
1944
|
+
filter.keyword,
|
|
1945
|
+
filter.status.statusFilters,
|
|
1946
|
+
sortFncCallback,
|
|
1947
|
+
filteredQuickStarts,
|
|
1948
|
+
]);
|
|
1949
|
+
const clearFilters = () => {
|
|
1950
|
+
setFilter('keyword', '');
|
|
1951
|
+
setFilter('status', []);
|
|
1952
|
+
clearFilterParams();
|
|
1953
|
+
setFilteredQuickStarts(allQuickStarts.sort((q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName)));
|
|
1954
|
+
};
|
|
1955
|
+
const onSearchInputChange = (searchValue) => {
|
|
1956
|
+
const result = filterQuickStarts(allQuickStarts, searchValue, filter.status.statusFilters, allQuickStartStates).sort((q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName));
|
|
1957
|
+
if (searchValue !== filter.keyword) {
|
|
1958
|
+
setFilter('keyword', searchValue);
|
|
1959
|
+
}
|
|
1960
|
+
if (result.length !== filteredQuickStarts.length) {
|
|
1961
|
+
setFilteredQuickStarts(result);
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1964
|
+
const onStatusChange = (statusList) => {
|
|
1965
|
+
const result = filterQuickStarts(allQuickStarts, filter.keyword, statusList, allQuickStartStates).sort((q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName));
|
|
1966
|
+
if (JSON.stringify(statusList) !== JSON.stringify(filter.status)) {
|
|
1967
|
+
setFilter('status', statusList);
|
|
1968
|
+
}
|
|
1969
|
+
if (result.length !== filteredQuickStarts.length) {
|
|
1970
|
+
setFilteredQuickStarts(result);
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
if (loading) {
|
|
1974
|
+
return React__namespace.createElement(LoadingBox, null);
|
|
1975
|
+
}
|
|
1976
|
+
if (!allQuickStarts || allQuickStarts.length === 0) {
|
|
1977
|
+
return React__namespace.createElement(EmptyBox, { label: getResource('Quick Starts') });
|
|
1978
|
+
}
|
|
1979
|
+
return (React__namespace.createElement("div", { className: "pfext-quick-start__base" },
|
|
1980
|
+
showTitle && (React__namespace.createElement("div", { className: "pfext-page-layout__header" },
|
|
1981
|
+
React__namespace.createElement(reactCore.Text, { component: "h1", className: "pfext-page-layout__title", "data-test": "page-title" }, title || getResource('Quick Starts')),
|
|
1982
|
+
hint && React__namespace.createElement("div", { className: "pfext-page-layout__hint" }, hint))),
|
|
1983
|
+
showTitle && React__namespace.createElement(reactCore.Divider, { component: "div" }),
|
|
1984
|
+
showFilter && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
1985
|
+
React__namespace.createElement(QuickStartCatalogFilter, { quickStartsCount: filteredQuickStarts.length, onSearchInputChange: onSearchInputChange, onStatusChange: onStatusChange }),
|
|
1986
|
+
React__namespace.createElement(reactCore.Divider, { component: "div" }))),
|
|
1987
|
+
React__namespace.createElement(React__namespace.Fragment, null, filteredQuickStarts.length === 0 ? (React__namespace.createElement(QuickStartCatalogEmptyState, { clearFilters: clearFilters })) : (React__namespace.createElement(QuickStartCatalog, { quickStarts: filteredQuickStarts })))));
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1990
|
+
const QuickStartCatalogHeader = ({ title, hint, }) => (React__namespace.createElement("div", { className: "pfext-page-layout__header" },
|
|
1991
|
+
React__namespace.createElement("h1", { "data-pf-content": "true", className: "pfext-page-layout__title" }, title),
|
|
1992
|
+
hint && React__namespace.createElement("div", { className: "pfext-page-layout__hint" }, hint)));
|
|
1993
|
+
|
|
1994
|
+
const QuickStartCatalogSection = ({ children }) => (React__namespace.createElement("div", { className: "pfext-page-layout__content" }, children));
|
|
1995
|
+
|
|
1996
|
+
const QuickStartCatalogToolbar = ({ children }) => (React__namespace.createElement(reactCore.Toolbar, { usePageInsets: true, className: "pfext-quick-start-catalog-filter__flex" }, children));
|
|
1997
|
+
|
|
1998
|
+
const QuickStartCloseModal = ({ isOpen, onConfirm, onCancel, }) => {
|
|
1999
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
2000
|
+
return (React__namespace.createElement(Modal, { className: "pfext-quick-start-drawer__modal pfext-quick-start__base", isOpen: isOpen, variant: reactCore.ModalVariant.small, showClose: false, "data-test": "leave-quickstart", title: getResource('Leave quick start?'), footer: React__namespace.createElement(reactCore.Flex, null,
|
|
2001
|
+
React__namespace.createElement(reactCore.FlexItem, { align: { default: 'alignRight' } },
|
|
2002
|
+
React__namespace.createElement(reactCore.Button, { variant: "secondary", "data-test": "cancel button", onClick: onCancel }, getResource('Cancel'))),
|
|
2003
|
+
React__namespace.createElement(reactCore.FlexItem, null,
|
|
2004
|
+
React__namespace.createElement(reactCore.Button, { variant: "primary", "data-test": "leave button", onClick: onConfirm }, getResource('Leave')))), isFullScreen: true }, getResource('Your progress will be saved.')));
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
2008
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
2009
|
+
const success = taskStatus === exports.QuickStartTaskStatus.SUCCESS;
|
|
2010
|
+
const failed = taskStatus === exports.QuickStartTaskStatus.FAILED;
|
|
2011
|
+
const classNames = reactStyles.css('pfext-icon-and-text__icon', {
|
|
2012
|
+
'pfext-quick-start-task-header__task-icon-init': !failed && !success,
|
|
2013
|
+
});
|
|
2014
|
+
let content;
|
|
2015
|
+
if (success) {
|
|
2016
|
+
content = (React__namespace.createElement(reactCore.Icon, { size: "md" },
|
|
2017
|
+
React__namespace.createElement(CheckCircleIcon__default['default'], { className: "pfext-quick-start-task-header__task-icon-success" }),
|
|
2018
|
+
' '));
|
|
2019
|
+
}
|
|
2020
|
+
else if (failed) {
|
|
2021
|
+
content = (React__namespace.createElement(reactCore.Icon, { size: "md" },
|
|
2022
|
+
React__namespace.createElement(ExclamationCircleIcon__default['default'], { className: "pfext-quick-start-task-header__task-icon-failed" })));
|
|
2023
|
+
}
|
|
2024
|
+
else {
|
|
2025
|
+
content = getResource('{{taskIndex, number}}', taskIndex).replace('{{taskIndex, number}}', taskIndex);
|
|
2026
|
+
}
|
|
2027
|
+
return React__namespace.createElement("span", { className: classNames }, content);
|
|
2028
|
+
};
|
|
2029
|
+
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
2030
|
+
const titleRef = React__namespace.useRef(null);
|
|
2031
|
+
React__namespace.useEffect(() => {
|
|
2032
|
+
if (isActiveTask) {
|
|
2033
|
+
// Focus the WizardNavItem button element that contains the title
|
|
2034
|
+
titleRef.current.parentNode.focus();
|
|
2035
|
+
}
|
|
2036
|
+
}, [isActiveTask]);
|
|
2037
|
+
const classNames = reactStyles.css('pfext-quick-start-task-header__title', {
|
|
2038
|
+
'pfext-quick-start-task-header__title-success': taskStatus === exports.QuickStartTaskStatus.SUCCESS,
|
|
2039
|
+
'pfext-quick-start-task-header__title-failed': taskStatus === (exports.QuickStartTaskStatus.FAILED || exports.QuickStartTaskStatus.VISITED),
|
|
2040
|
+
});
|
|
2041
|
+
// const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
|
|
2042
|
+
// const skippedReview = taskStatus === QuickStartTaskStatus.REVIEW;
|
|
2043
|
+
const failedReview = taskStatus === exports.QuickStartTaskStatus.FAILED;
|
|
2044
|
+
// TODO: toned down when this is shown, investigate further when we should display it
|
|
2045
|
+
// related: https://github.com/patternfly/patternfly-quickstarts/issues/104
|
|
2046
|
+
const tryAgain = failedReview && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2047
|
+
React__namespace.createElement("div", null),
|
|
2048
|
+
React__namespace.createElement("div", { className: "pfext-quick-start-task-header__tryagain" }, "Try the steps again.")));
|
|
2049
|
+
const content = (React__namespace.createElement("div", { className: "pfext-quick-start-task-header", ref: titleRef },
|
|
2050
|
+
React__namespace.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
2051
|
+
React__namespace.createElement(reactCore.Title, { headingLevel: "h3", size: size, className: classNames },
|
|
2052
|
+
React__namespace.createElement("span", { dangerouslySetInnerHTML: { __html: removeParagraphWrap(markdownConvert(title)) } }),
|
|
2053
|
+
isActiveTask && subtitle && (React__namespace.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" },
|
|
2054
|
+
' ',
|
|
2055
|
+
subtitle))),
|
|
2056
|
+
tryAgain));
|
|
2057
|
+
return (React__namespace.createElement(reactCore.WizardNavItem, { content: content, stepIndex: taskIndex, onClick: () => onTaskSelect(taskIndex - 1), component: "button", isCurrent: isActiveTask }, children));
|
|
2058
|
+
};
|
|
2059
|
+
|
|
2060
|
+
const QuickStartTaskHeaderList = ({ tasks, allTaskStatuses, onTaskSelect, }) => tasks.length > 0 ? (React__namespace.createElement(reactCore.List, { className: "pfext-quick-start-task-header__list" }, tasks.map((task, index) => (React__namespace.createElement(QuickStartTaskHeader, { key: task.title, title: task.title, taskIndex: index + 1, size: "md", taskStatus: allTaskStatuses[index], onTaskSelect: onTaskSelect }))))) : null;
|
|
2061
|
+
|
|
2062
|
+
const QuickStartConclusion = ({ tasks, conclusion, allTaskStatuses, nextQuickStarts, onQuickStartChange, onTaskSelect, }) => {
|
|
2063
|
+
const hasFailedTask = allTaskStatuses.includes(exports.QuickStartTaskStatus.FAILED);
|
|
2064
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
2065
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2066
|
+
React__namespace.createElement(QuickStartTaskHeaderList, { tasks: tasks, allTaskStatuses: allTaskStatuses, onTaskSelect: onTaskSelect }),
|
|
2067
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: hasFailedTask
|
|
2068
|
+
? getResource('One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.')
|
|
2069
|
+
: conclusion }),
|
|
2070
|
+
!hasFailedTask &&
|
|
2071
|
+
nextQuickStarts &&
|
|
2072
|
+
nextQuickStarts.length > 0 &&
|
|
2073
|
+
nextQuickStarts.map((nextQuickStart, index) => {
|
|
2074
|
+
var _a;
|
|
2075
|
+
return (React__namespace.createElement(reactCore.Button, { variant: "link", onClick: () => onQuickStartChange(nextQuickStart.metadata.name), isInline: true, isBlock: true, key: index },
|
|
2076
|
+
getResource('Start {{nextQSDisplayName}} quick start').replace('{{nextQSDisplayName}}', (_a = nextQuickStart === null || nextQuickStart === void 0 ? void 0 : nextQuickStart.spec) === null || _a === void 0 ? void 0 : _a.displayName),
|
|
2077
|
+
' ',
|
|
2078
|
+
React__namespace.createElement(ArrowRightIcon__default['default'], { style: { marginLeft: 'var(--pf-v5-global--spacer--xs)', verticalAlign: 'middle' } })));
|
|
2079
|
+
})));
|
|
2080
|
+
};
|
|
2081
|
+
|
|
2082
|
+
const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, prerequisites, onTaskSelect, }) => {
|
|
2083
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
2084
|
+
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
|
2085
|
+
const [isPrereqsExpanded, setIsPrereqsExpanded] = React__namespace.useState(false);
|
|
2086
|
+
const prereqList = (prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (React__namespace.createElement(reactCore.ExpandableSection, { toggleText: getResource('View Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length), onToggle: () => setIsPrereqsExpanded(!isPrereqsExpanded), className: "pfext-quick-start-intro__prereq" },
|
|
2087
|
+
React__namespace.createElement(reactCore.List, { className: "pfext-quick-start-intro__prereq-list" }, prereqs.map((pr) => (React__namespace.createElement(reactCore.ListItem, { key: pr, className: "pfext-quick-start-intro__prereq-list__item" },
|
|
2088
|
+
React__namespace.createElement("span", { className: "pfext-quick-start-intro__prereq-list__item-content" },
|
|
2089
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: pr }))))))));
|
|
2090
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2091
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: introduction }),
|
|
2092
|
+
prereqList,
|
|
2093
|
+
React__namespace.createElement("p", { style: { marginBottom: 'var(--pf-v5-global--spacer--md)' } },
|
|
2094
|
+
getResource('In this quick start, you will complete {{count, number}} task', tasks.length).replace('{{count, number}}', tasks.length),
|
|
2095
|
+
":"),
|
|
2096
|
+
React__namespace.createElement(QuickStartTaskHeaderList, { tasks: tasks, allTaskStatuses: allTaskStatuses, onTaskSelect: onTaskSelect })));
|
|
2097
|
+
};
|
|
2098
|
+
|
|
2099
|
+
const getAlertVariant = (status) => {
|
|
2100
|
+
switch (status) {
|
|
2101
|
+
case exports.QuickStartTaskStatus.SUCCESS:
|
|
2102
|
+
return 'success';
|
|
2103
|
+
case exports.QuickStartTaskStatus.FAILED:
|
|
2104
|
+
return 'danger';
|
|
2105
|
+
default:
|
|
2106
|
+
return 'info';
|
|
2107
|
+
}
|
|
2108
|
+
};
|
|
2109
|
+
const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
|
|
2110
|
+
const { instructions, failedTaskHelp: taskHelp } = review;
|
|
2111
|
+
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
2112
|
+
const alertClassNames = reactStyles.css('pfext-quick-start-task-review', {
|
|
2113
|
+
'pfext-quick-start-task-review--success': taskStatus === exports.QuickStartTaskStatus.SUCCESS,
|
|
2114
|
+
'pfext-quick-start-task-review--failed': taskStatus === exports.QuickStartTaskStatus.FAILED,
|
|
2115
|
+
});
|
|
2116
|
+
const title = React__namespace.createElement("span", { className: alertClassNames }, getResource('Check your work'));
|
|
2117
|
+
return (React__namespace.createElement(reactCore.Alert, { className: "pfext-quick-start-task-review-alert", variant: getAlertVariant(taskStatus), title: title, isInline: true, role: "alert" },
|
|
2118
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: instructions }),
|
|
2119
|
+
React__namespace.createElement("span", { className: "pfext-quick-start-task-review__actions" },
|
|
2120
|
+
React__namespace.createElement(reactCore.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 === exports.QuickStartTaskStatus.SUCCESS, onChange: () => onTaskReview(exports.QuickStartTaskStatus.SUCCESS) }),
|
|
2121
|
+
React__namespace.createElement(reactCore.Radio, { id: "review-failed", name: "review-failed", "data-testid": "qs-drawer-check-no", label: getResource('No'), className: "pfext-quick-start-task-review__radio", isChecked: taskStatus === exports.QuickStartTaskStatus.FAILED, onChange: () => onTaskReview(exports.QuickStartTaskStatus.FAILED) })),
|
|
2122
|
+
taskStatus === exports.QuickStartTaskStatus.FAILED && taskHelp && (React__namespace.createElement(QuickStartMarkdownView, { content: taskHelp, exactHeight: true }))));
|
|
2123
|
+
};
|
|
2124
|
+
|
|
2125
|
+
const QuickStartTasks = ({ tasks, taskNumber, allTaskStatuses, onTaskReview, onTaskSelect, }) => {
|
|
2126
|
+
const { getResource, alwaysShowTaskReview } = React__namespace.useContext(QuickStartContext);
|
|
2127
|
+
return (React__namespace.createElement("div", { className: "pfext-quick-start-tasks__list" },
|
|
2128
|
+
React__namespace.createElement("ul", null, tasks
|
|
2129
|
+
.filter((_, index) => allTaskStatuses[index] !== exports.QuickStartTaskStatus.INIT)
|
|
2130
|
+
.map((task, index) => {
|
|
2131
|
+
const { title, description, review } = task;
|
|
2132
|
+
const isActiveTask = index === taskNumber;
|
|
2133
|
+
const taskStatus = allTaskStatuses[index];
|
|
2134
|
+
const shouldShowTaskReview = (!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) || alwaysShowTaskReview) &&
|
|
2135
|
+
review;
|
|
2136
|
+
return (React__namespace.createElement(React__namespace.Fragment, { key: title },
|
|
2137
|
+
React__namespace.createElement(QuickStartTaskHeader, { taskIndex: index + 1, title: title, size: "md", subtitle: getResource('{{index, number}} of {{tasks, number}}')
|
|
2138
|
+
.replace('{{index, number}}', index + 1)
|
|
2139
|
+
.replace('{{tasks, number}}', tasks.length), taskStatus: taskStatus, isActiveTask: isActiveTask, onTaskSelect: onTaskSelect }, isActiveTask && (React__namespace.createElement("div", { className: "pfext-quick-start-task__content" },
|
|
2140
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: description }),
|
|
2141
|
+
shouldShowTaskReview && (React__namespace.createElement(QuickStartTaskReview, { review: review, taskStatus: taskStatus, onTaskReview: onTaskReview })))))));
|
|
2142
|
+
}))));
|
|
2143
|
+
};
|
|
2144
|
+
|
|
2145
|
+
const QuickStartContent = React__namespace.forwardRef(({ quickStart, nextQuickStarts = [], taskNumber, allTaskStatuses, onTaskSelect, onTaskReview, onQuickStartChange, }, ref) => {
|
|
2146
|
+
const { spec: { introduction, tasks, conclusion, prerequisites }, } = quickStart;
|
|
2147
|
+
const totalTasks = tasks.length;
|
|
2148
|
+
return (React__namespace.createElement("div", { className: "pfext-quick-start-content", ref: ref },
|
|
2149
|
+
taskNumber === -1 && (React__namespace.createElement(QuickStartIntroduction, { tasks: tasks, allTaskStatuses: allTaskStatuses, introduction: introduction, prerequisites: prerequisites, onTaskSelect: onTaskSelect })),
|
|
2150
|
+
taskNumber > -1 && taskNumber < totalTasks && (React__namespace.createElement(QuickStartTasks, { tasks: tasks, taskNumber: taskNumber, allTaskStatuses: allTaskStatuses, onTaskReview: onTaskReview, onTaskSelect: onTaskSelect })),
|
|
2151
|
+
taskNumber === totalTasks && (React__namespace.createElement(QuickStartConclusion, { tasks: tasks, conclusion: conclusion, allTaskStatuses: allTaskStatuses, nextQuickStarts: nextQuickStarts, onQuickStartChange: onQuickStartChange, onTaskSelect: onTaskSelect }))));
|
|
2152
|
+
});
|
|
2153
|
+
|
|
2154
|
+
const QuickStartFooter = ({ status, taskNumber, totalTasks, onNext, onBack, footerClass, quickStartId, }) => {
|
|
2155
|
+
const { restartQuickStart, getResource } = React__namespace.useContext(QuickStartContext);
|
|
2156
|
+
const PrimaryButtonText = React__namespace.useMemo(() => ({
|
|
2157
|
+
START: getResource('Start'),
|
|
2158
|
+
CONTINUE: getResource('Continue'),
|
|
2159
|
+
NEXT: getResource('Next'),
|
|
2160
|
+
CLOSE: getResource('Close'),
|
|
2161
|
+
}), [getResource]);
|
|
2162
|
+
const SecondaryButtonText = React__namespace.useMemo(() => ({
|
|
2163
|
+
BACK: getResource('Back'),
|
|
2164
|
+
RESTART: getResource('Restart'),
|
|
2165
|
+
}), [getResource]);
|
|
2166
|
+
const onRestart = React__namespace.useCallback((e) => {
|
|
2167
|
+
e.preventDefault();
|
|
2168
|
+
e.stopPropagation();
|
|
2169
|
+
restartQuickStart(quickStartId, totalTasks);
|
|
2170
|
+
}, [quickStartId, restartQuickStart, totalTasks]);
|
|
2171
|
+
const getPrimaryButtonText = React__namespace.useMemo(() => {
|
|
2172
|
+
if (status === exports.QuickStartStatus.NOT_STARTED) {
|
|
2173
|
+
return PrimaryButtonText.START;
|
|
2174
|
+
}
|
|
2175
|
+
if (taskNumber === totalTasks) {
|
|
2176
|
+
return PrimaryButtonText.CLOSE;
|
|
2177
|
+
}
|
|
2178
|
+
if (taskNumber > -1 && taskNumber < totalTasks) {
|
|
2179
|
+
return PrimaryButtonText.NEXT;
|
|
2180
|
+
}
|
|
2181
|
+
return PrimaryButtonText.CONTINUE;
|
|
2182
|
+
}, [taskNumber, totalTasks, PrimaryButtonText, status]);
|
|
2183
|
+
const getPrimaryButton = React__namespace.useMemo(() => (React__namespace.createElement(reactCore.Button, { variant: "primary", className: "pfext-quick-start-footer__actionbtn", onClick: onNext, "data-testid": `qs-drawer-${camelize(getPrimaryButtonText)}`, "data-test": `${getPrimaryButtonText} button` }, getPrimaryButtonText)), [getPrimaryButtonText, onNext]);
|
|
2184
|
+
const getSecondaryButton = React__namespace.useMemo(() => taskNumber === -1 && status !== exports.QuickStartStatus.NOT_STARTED ? (React__namespace.createElement(reactCore.Button, { variant: "secondary", onClick: onRestart, "data-testid": "qs-drawer-restart" }, SecondaryButtonText.RESTART)) : (taskNumber > -1 && (React__namespace.createElement(reactCore.Button, { variant: "secondary", onClick: onBack, "data-testid": "qs-drawer-back" }, SecondaryButtonText.BACK))), [onRestart, onBack, SecondaryButtonText, status, taskNumber]);
|
|
2185
|
+
const getSideNoteAction = React__namespace.useMemo(() => taskNumber !== -1 && (React__namespace.createElement(reactCore.Button, { variant: "link", className: "pfext-quick-start-footer__restartbtn", onClick: onRestart, "data-testid": "qs-drawer-side-note-action" }, SecondaryButtonText.RESTART)), [taskNumber, onRestart, SecondaryButtonText.RESTART]);
|
|
2186
|
+
return (React__namespace.createElement("div", { className: `pfext-quick-start-footer ${footerClass}` },
|
|
2187
|
+
getPrimaryButton,
|
|
2188
|
+
getSecondaryButton,
|
|
2189
|
+
getSideNoteAction));
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
const QuickStartController = ({ quickStart, nextQuickStarts, contentRef, footerClass, }) => {
|
|
2193
|
+
const { metadata: { name }, spec: { tasks = [] }, } = quickStart;
|
|
2194
|
+
const totalTasks = tasks === null || tasks === void 0 ? void 0 : tasks.length;
|
|
2195
|
+
const { activeQuickStartState, setActiveQuickStart, setQuickStartTaskNumber, setQuickStartTaskStatus, nextStep, previousStep, } = React__namespace.useContext(QuickStartContext);
|
|
2196
|
+
const status = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status;
|
|
2197
|
+
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
2198
|
+
const allTaskStatuses = tasks.map((task, index) => activeQuickStartState[`taskStatus${index}`]);
|
|
2199
|
+
const handleQuickStartChange = React__namespace.useCallback((quickStartId) => setActiveQuickStart(quickStartId), [setActiveQuickStart]);
|
|
2200
|
+
const handleTaskStatusChange = React__namespace.useCallback((newTaskStatus) => setQuickStartTaskStatus(newTaskStatus), [setQuickStartTaskStatus]);
|
|
2201
|
+
const getQuickStartActiveTask = React__namespace.useCallback(() => {
|
|
2202
|
+
let activeTaskNumber = 0;
|
|
2203
|
+
while (activeTaskNumber !== totalTasks &&
|
|
2204
|
+
activeQuickStartState[`taskStatus${activeTaskNumber}`] === exports.QuickStartTaskStatus.SUCCESS) {
|
|
2205
|
+
activeTaskNumber++;
|
|
2206
|
+
}
|
|
2207
|
+
return activeTaskNumber;
|
|
2208
|
+
}, [totalTasks, activeQuickStartState]);
|
|
2209
|
+
const handleQuickStartContinue = React__namespace.useCallback(() => {
|
|
2210
|
+
const activeTaskNumber = getQuickStartActiveTask();
|
|
2211
|
+
setQuickStartTaskNumber(name, activeTaskNumber);
|
|
2212
|
+
}, [getQuickStartActiveTask, setQuickStartTaskNumber, name]);
|
|
2213
|
+
const handleNext = React__namespace.useCallback(() => {
|
|
2214
|
+
if (status === exports.QuickStartStatus.COMPLETE && taskNumber === totalTasks) {
|
|
2215
|
+
return handleQuickStartChange('');
|
|
2216
|
+
}
|
|
2217
|
+
if (status !== exports.QuickStartStatus.NOT_STARTED && taskNumber === -1) {
|
|
2218
|
+
return handleQuickStartContinue();
|
|
2219
|
+
}
|
|
2220
|
+
return nextStep(totalTasks);
|
|
2221
|
+
}, [handleQuickStartChange, nextStep, status, taskNumber, totalTasks, handleQuickStartContinue]);
|
|
2222
|
+
const handleBack = React__namespace.useCallback(() => previousStep(), [previousStep]);
|
|
2223
|
+
const handleTaskSelect = React__namespace.useCallback((selectedTaskNumber) => {
|
|
2224
|
+
setQuickStartTaskNumber(name, selectedTaskNumber);
|
|
2225
|
+
}, [name, setQuickStartTaskNumber]);
|
|
2226
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2227
|
+
React__namespace.createElement(QuickStartContent, { quickStart: quickStart, nextQuickStarts: nextQuickStarts, taskNumber: taskNumber, allTaskStatuses: allTaskStatuses, onTaskSelect: handleTaskSelect, onTaskReview: handleTaskStatusChange, onQuickStartChange: handleQuickStartChange, ref: contentRef }),
|
|
2228
|
+
React__namespace.createElement(QuickStartFooter, { status: status, taskNumber: taskNumber, totalTasks: totalTasks, onNext: handleNext, onBack: handleBack, footerClass: footerClass, quickStartId: quickStart.metadata.name })));
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2231
|
+
const getElement = (appendTo) => {
|
|
2232
|
+
if (typeof appendTo === 'function') {
|
|
2233
|
+
return appendTo();
|
|
2234
|
+
}
|
|
2235
|
+
return appendTo;
|
|
2236
|
+
};
|
|
2237
|
+
const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
|
|
2238
|
+
React__namespace.useEffect(() => {
|
|
2239
|
+
if (node) {
|
|
2240
|
+
node.scrollTo({ top: 0, behavior: 'smooth' });
|
|
2241
|
+
}
|
|
2242
|
+
}, [taskNumber, node]);
|
|
2243
|
+
};
|
|
2244
|
+
const QuickStartPanelContent = (_a) => {
|
|
2245
|
+
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = tslib.__rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
|
|
2246
|
+
const titleRef = React__namespace.useRef(null);
|
|
2247
|
+
const { getResource, activeQuickStartState } = React__namespace.useContext(QuickStartContext);
|
|
2248
|
+
const [contentRef, setContentRef] = React__namespace.useState();
|
|
2249
|
+
const shadows = useScrollShadows(contentRef);
|
|
2250
|
+
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
2251
|
+
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
2252
|
+
useScrollTopOnTaskNumberChange(contentRef, taskNumber);
|
|
2253
|
+
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); });
|
|
2254
|
+
const headerClasses = reactStyles.css('pfext-quick-start-panel-content__header', {
|
|
2255
|
+
'pfext-quick-start-panel-content__header__shadow': shadows === Shadows.top || shadows === Shadows.both,
|
|
2256
|
+
'pfext-quick-start-panel-content__header--blue-white': headerVariant === 'blue-white',
|
|
2257
|
+
});
|
|
2258
|
+
const footerClass = reactStyles.css({
|
|
2259
|
+
'pfext-quick-start-panel-content__footer__shadow': shadows === Shadows.bottom || shadows === Shadows.both,
|
|
2260
|
+
});
|
|
2261
|
+
const getStep = () => {
|
|
2262
|
+
const tasks = quickStart.spec.tasks.length;
|
|
2263
|
+
if (Number.parseInt(taskNumber) === -1) {
|
|
2264
|
+
return 'intro';
|
|
2265
|
+
}
|
|
2266
|
+
if (Number.parseInt(taskNumber) === tasks) {
|
|
2267
|
+
return 'conclusion';
|
|
2268
|
+
}
|
|
2269
|
+
return Number.parseInt(taskNumber) + 1;
|
|
2270
|
+
};
|
|
2271
|
+
React__namespace.useEffect(() => {
|
|
2272
|
+
if (quickStart) {
|
|
2273
|
+
titleRef.current.focus();
|
|
2274
|
+
}
|
|
2275
|
+
}, [quickStart]);
|
|
2276
|
+
const content = quickStart ? (React__namespace.createElement(reactCore.DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base", "data-testid": `qs-drawer-${camelize(quickStart.spec.displayName)}`, "data-qs": `qs-step-${getStep()}`, "data-test": "quickstart drawer" }, props),
|
|
2277
|
+
React__namespace.createElement("div", { className: headerClasses },
|
|
2278
|
+
React__namespace.createElement(reactCore.DrawerHead, null,
|
|
2279
|
+
React__namespace.createElement("div", { className: "pfext-quick-start-panel-content__title", tabIndex: -1, ref: titleRef },
|
|
2280
|
+
React__namespace.createElement(reactCore.Title, { headingLevel: "h2", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-v5-global--spacer--md)' } },
|
|
2281
|
+
React__namespace.createElement("span", { dangerouslySetInnerHTML: {
|
|
2282
|
+
__html: removeParagraphWrap(markdownConvert(quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.displayName)),
|
|
2283
|
+
} }),
|
|
2284
|
+
' ',
|
|
2285
|
+
React__namespace.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, (quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|
|
2286
|
+
? getResource('{{type}} • {{duration, number}} minutes', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|
|
2287
|
+
.replace('{{duration, number}}', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|
|
2288
|
+
.replace('{{type}}', getResource('Type'))
|
|
2289
|
+
: getResource('Type')))),
|
|
2290
|
+
showClose && (React__namespace.createElement(reactCore.DrawerActions, null,
|
|
2291
|
+
React__namespace.createElement(reactCore.DrawerCloseButton, { onClick: handleClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))))),
|
|
2292
|
+
React__namespace.createElement(reactCore.DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
|
|
2293
|
+
React__namespace.createElement(QuickStartController, { quickStart: quickStart, nextQuickStarts: nextQuickStarts, footerClass: footerClass, contentRef: setContentRef })))) : null;
|
|
2294
|
+
if (appendTo) {
|
|
2295
|
+
return ReactDOM__namespace.createPortal(content, getElement(appendTo));
|
|
2296
|
+
}
|
|
2297
|
+
return content;
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2300
|
+
const QuickStartContainer = (_a) => {
|
|
2301
|
+
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 = tslib.__rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
|
|
2302
|
+
const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
|
|
2303
|
+
setActiveQuickStartID,
|
|
2304
|
+
allQuickStartStates,
|
|
2305
|
+
setAllQuickStartStates, footer: {
|
|
2306
|
+
show: showCardFooters,
|
|
2307
|
+
}, useLegacyHeaderColors,
|
|
2308
|
+
language, resourceBundle: Object.assign({}, resourceBundle), loading,
|
|
2309
|
+
useQueryParams,
|
|
2310
|
+
markdown,
|
|
2311
|
+
alwaysShowTaskReview }, contextProps));
|
|
2312
|
+
React__namespace.useEffect(() => {
|
|
2313
|
+
if (quickStarts &&
|
|
2314
|
+
JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)) {
|
|
2315
|
+
valuesForQuickstartContext.setAllQuickStarts(quickStarts);
|
|
2316
|
+
}
|
|
2317
|
+
}, [quickStarts, valuesForQuickstartContext]);
|
|
2318
|
+
React__namespace.useEffect(() => {
|
|
2319
|
+
if (loading !== valuesForQuickstartContext.loading) {
|
|
2320
|
+
valuesForQuickstartContext.setLoading(loading);
|
|
2321
|
+
}
|
|
2322
|
+
}, [loading, valuesForQuickstartContext]);
|
|
2323
|
+
const drawerProps = Object.assign({ appendTo,
|
|
2324
|
+
fullWidth,
|
|
2325
|
+
onCloseInProgress,
|
|
2326
|
+
onCloseNotInProgress }, props);
|
|
2327
|
+
return (React__namespace.createElement(QuickStartContext.Provider, { value: valuesForQuickstartContext },
|
|
2328
|
+
React__namespace.createElement(QuickStartDrawer, Object.assign({}, drawerProps), children)));
|
|
2329
|
+
};
|
|
2330
|
+
const QuickStartDrawer = (_a) => {
|
|
2331
|
+
var { quickStarts = [], children, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress } = _a, props = tslib.__rest(_a, ["quickStarts", "children", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress"]);
|
|
2332
|
+
const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], activeQuickStartState, allQuickStartStates, setAllQuickStartStates, useLegacyHeaderColors, } = React__namespace.useContext(QuickStartContext);
|
|
2333
|
+
const combinedQuickStarts = allQuickStarts.concat(quickStarts);
|
|
2334
|
+
React__namespace.useEffect(() => {
|
|
2335
|
+
const params = new URLSearchParams(window.location.search);
|
|
2336
|
+
// if there is a quick start param, but the quick start is not active, set it
|
|
2337
|
+
// this can happen if a new browser session is opened or an incognito window for example
|
|
2338
|
+
const quickStartIdFromParam = params.get(QUICKSTART_ID_FILTER_KEY) || '';
|
|
2339
|
+
if (quickStartIdFromParam && activeQuickStartID !== quickStartIdFromParam) {
|
|
2340
|
+
const activeQuickStart = getQuickStartByName(quickStartIdFromParam, combinedQuickStarts);
|
|
2341
|
+
// don't try to load a quick start that is actually just an external resource (spec.link)
|
|
2342
|
+
if (combinedQuickStarts.length > 0 && activeQuickStart && !activeQuickStart.spec.link) {
|
|
2343
|
+
setActiveQuickStart(quickStartIdFromParam);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
}, [activeQuickStartID, combinedQuickStarts, setActiveQuickStart]);
|
|
2347
|
+
React__namespace.useEffect(() => {
|
|
2348
|
+
// If activeQuickStartID was changed through prop from QuickStartContainer, need to init the state if it does not exist yet
|
|
2349
|
+
if (activeQuickStartID && !allQuickStartStates[activeQuickStartID]) {
|
|
2350
|
+
setAllQuickStartStates(Object.assign(Object.assign({}, allQuickStartStates), { [activeQuickStartID]: getDefaultQuickStartState() }));
|
|
2351
|
+
}
|
|
2352
|
+
}, [activeQuickStartID, allQuickStartStates, setAllQuickStartStates]);
|
|
2353
|
+
const [modalOpen, setModalOpen] = React__namespace.useState(false);
|
|
2354
|
+
const activeQuickStartStatus = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status;
|
|
2355
|
+
const onClose = () => setActiveQuickStart('');
|
|
2356
|
+
const handleClose = () => {
|
|
2357
|
+
if (activeQuickStartStatus === exports.QuickStartStatus.IN_PROGRESS) {
|
|
2358
|
+
if (onCloseInProgress) {
|
|
2359
|
+
onCloseInProgress();
|
|
2360
|
+
}
|
|
2361
|
+
else {
|
|
2362
|
+
setModalOpen(true);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
else if (onCloseNotInProgress) {
|
|
2366
|
+
onCloseNotInProgress();
|
|
2367
|
+
}
|
|
2368
|
+
else {
|
|
2369
|
+
onClose();
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
const onModalConfirm = () => {
|
|
2373
|
+
setModalOpen(false);
|
|
2374
|
+
onClose();
|
|
2375
|
+
};
|
|
2376
|
+
const onModalCancel = () => setModalOpen(false);
|
|
2377
|
+
const fullWidthPanelStyle = fullWidth
|
|
2378
|
+
? {
|
|
2379
|
+
style: {
|
|
2380
|
+
flex: 1,
|
|
2381
|
+
},
|
|
2382
|
+
}
|
|
2383
|
+
: {};
|
|
2384
|
+
const fullWidthBodyStyle = fullWidth
|
|
2385
|
+
? {
|
|
2386
|
+
style: {
|
|
2387
|
+
display: activeQuickStartID ? 'none' : 'flex',
|
|
2388
|
+
},
|
|
2389
|
+
}
|
|
2390
|
+
: {};
|
|
2391
|
+
const panelContent = (React__namespace.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth, headerVariant: useLegacyHeaderColors ? '' : 'blue-white' }, fullWidthPanelStyle)));
|
|
2392
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2393
|
+
React__namespace.createElement(reactCore.Drawer, Object.assign({ isExpanded: !!activeQuickStartID, isInline: true }, props), children ? (React__namespace.createElement(reactCore.DrawerContent, Object.assign({ panelContent: panelContent }, fullWidthBodyStyle),
|
|
2394
|
+
React__namespace.createElement(reactCore.DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React__namespace.createElement("div", { className: "pf-v5-c-drawer__main" }, panelContent))),
|
|
2395
|
+
React__namespace.createElement(QuickStartCloseModal, { isOpen: modalOpen, onConfirm: onModalConfirm, onCancel: onModalCancel })));
|
|
2396
|
+
};
|
|
2397
|
+
|
|
2398
|
+
const HelpTopicContextDefaults = {
|
|
2399
|
+
helpTopics: [],
|
|
2400
|
+
setHelpTopics: () => { },
|
|
2401
|
+
activeHelpTopic: null,
|
|
2402
|
+
setActiveHelpTopicByName: () => { },
|
|
2403
|
+
filteredHelpTopics: [],
|
|
2404
|
+
setFilteredHelpTopics: () => { },
|
|
2405
|
+
loading: false,
|
|
2406
|
+
};
|
|
2407
|
+
const HelpTopicContext = React__default['default'].createContext(HelpTopicContextDefaults);
|
|
2408
|
+
const useValuesForHelpTopicContext = (value = {}) => {
|
|
2409
|
+
const combinedValue = Object.assign(Object.assign({}, HelpTopicContextDefaults), value);
|
|
2410
|
+
const [loading, setLoading] = React__default['default'].useState(combinedValue.loading);
|
|
2411
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
2412
|
+
const [helpTopics, setHelpTopics] = React__default['default'].useState(combinedValue.helpTopics || []);
|
|
2413
|
+
const [activeHelpTopic, setActiveHelpTopic] = React__default['default'].useState(combinedValue.activeHelpTopic || null);
|
|
2414
|
+
const setActiveHelpTopicByName = React__default['default'].useCallback((helpTopicName) => {
|
|
2415
|
+
const topic = helpTopics.find((t) => t.name === helpTopicName);
|
|
2416
|
+
if (!helpTopicName) {
|
|
2417
|
+
setActiveHelpTopic(null);
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
setActiveHelpTopic(topic);
|
|
2421
|
+
}, [helpTopics]);
|
|
2422
|
+
const [filteredHelpTopics, setFilteredHelpTopics] = React__default['default'].useState(combinedValue.filteredHelpTopics || []);
|
|
2423
|
+
return {
|
|
2424
|
+
helpTopics,
|
|
2425
|
+
setHelpTopics,
|
|
2426
|
+
activeHelpTopic,
|
|
2427
|
+
setActiveHelpTopicByName,
|
|
2428
|
+
filteredHelpTopics,
|
|
2429
|
+
setFilteredHelpTopics,
|
|
2430
|
+
loading,
|
|
2431
|
+
setLoading,
|
|
2432
|
+
};
|
|
2433
|
+
};
|
|
2434
|
+
|
|
2435
|
+
const HelpTopicPanelContent = (_a) => {
|
|
2436
|
+
var _b, _c;
|
|
2437
|
+
var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true, onClose } = _a, props = tslib.__rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable", "onClose"]);
|
|
2438
|
+
const { setActiveHelpTopicByName } = React__namespace.useContext(HelpTopicContext);
|
|
2439
|
+
const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React__namespace.useState(false);
|
|
2440
|
+
const toggleHelpTopicMenu = () => {
|
|
2441
|
+
setIsHelpTopicMenuOpen(!isHelpTopicMenuOpen);
|
|
2442
|
+
};
|
|
2443
|
+
const onSelectHelpTopic = (_event, value) => {
|
|
2444
|
+
const topicName = value;
|
|
2445
|
+
setActiveHelpTopicByName(topicName.toString());
|
|
2446
|
+
toggleHelpTopicMenu();
|
|
2447
|
+
};
|
|
2448
|
+
const helpTopicOptions = filteredHelpTopics.length > 1 &&
|
|
2449
|
+
filteredHelpTopics.map((topic) => (React__namespace.createElement(reactCore.SelectOption, { key: topic.name, value: topic.name }, topic.title)));
|
|
2450
|
+
const paddingContainer = (children) => React__namespace.createElement("div", { style: { padding: '24px' } }, children);
|
|
2451
|
+
const panelBodyItems = (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2452
|
+
paddingContainer(React__namespace.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
|
|
2453
|
+
!!((_b = activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links) === null || _b === void 0 ? void 0 : _b.length) && React__namespace.createElement(reactCore.Divider, null),
|
|
2454
|
+
paddingContainer(React__namespace.createElement(reactCore.Stack, { hasGutter: true }, (_c = activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links) === null || _c === void 0 ? void 0 : _c.map(({ href, text, newTab, isExternal }, index) => (React__namespace.createElement(reactCore.StackItem, { key: index },
|
|
2455
|
+
React__namespace.createElement(reactCore.Button, { component: "a", href: href, target: newTab ? '_blank' : '', rel: "noopener noreferrer", variant: "link", "aria-label": `Open documentation in new window`, isInline: true, icon: isExternal ? React__namespace.createElement(ExternalLinkAltIcon__default['default'], null) : null, iconPosition: "right", style: { fontSize: 'inherit' } }, text || href))))))));
|
|
2456
|
+
const content = (React__namespace.createElement(reactCore.DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
|
|
2457
|
+
React__namespace.createElement("div", null,
|
|
2458
|
+
React__namespace.createElement(reactCore.DrawerHead, null,
|
|
2459
|
+
React__namespace.createElement("div", { className: "pfext-quick-start-panel-content__title" },
|
|
2460
|
+
helpTopicOptions && (React__namespace.createElement(reactCore.Select, { isPlain: true, id: "help-topics-select", selected: activeHelpTopic, isOpen: isHelpTopicMenuOpen, onSelect: onSelectHelpTopic, onOpenChange: (isOpen) => setIsHelpTopicMenuOpen(isOpen), toggle: (toggleRef) => (React__namespace.createElement(reactCore.MenuToggle, { isFullWidth: true, ref: toggleRef, icon: React__namespace.createElement(BarsIcon__default['default'], null), onClick: toggleHelpTopicMenu, isExpanded: isHelpTopicMenuOpen }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.title)) },
|
|
2461
|
+
React__namespace.createElement(reactCore.SelectList, null, helpTopicOptions))),
|
|
2462
|
+
React__namespace.createElement(reactCore.Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-v5-global--spacer--md)' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.title)),
|
|
2463
|
+
React__namespace.createElement(reactCore.DrawerActions, null,
|
|
2464
|
+
React__namespace.createElement(reactCore.DrawerCloseButton, { onClick: onClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))),
|
|
2465
|
+
React__namespace.createElement(reactCore.Divider, null),
|
|
2466
|
+
React__namespace.createElement(reactCore.DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" }, panelBodyItems))));
|
|
2467
|
+
return content;
|
|
2468
|
+
};
|
|
2469
|
+
|
|
2470
|
+
const HelpTopicContainer = (_a) => {
|
|
2471
|
+
var { helpTopics, children, resourceBundle, language, loading = false, markdown, contextProps } = _a, props = tslib.__rest(_a, ["helpTopics", "children", "resourceBundle", "language", "loading", "markdown", "contextProps"]);
|
|
2472
|
+
const valuesForHelpTopicContext = useValuesForHelpTopicContext(Object.assign({ helpTopics,
|
|
2473
|
+
language, resourceBundle: Object.assign({}, resourceBundle), loading,
|
|
2474
|
+
markdown }, contextProps));
|
|
2475
|
+
React__namespace.useEffect(() => {
|
|
2476
|
+
if (loading !== valuesForHelpTopicContext.loading) {
|
|
2477
|
+
valuesForHelpTopicContext.setLoading(loading);
|
|
2478
|
+
}
|
|
2479
|
+
}, [loading, valuesForHelpTopicContext]);
|
|
2480
|
+
React__namespace.useEffect(() => {
|
|
2481
|
+
if (helpTopics &&
|
|
2482
|
+
JSON.stringify(helpTopics) !== JSON.stringify(valuesForHelpTopicContext.helpTopics)) {
|
|
2483
|
+
valuesForHelpTopicContext.setHelpTopics(helpTopics);
|
|
2484
|
+
}
|
|
2485
|
+
}, [helpTopics, valuesForHelpTopicContext]);
|
|
2486
|
+
return (React__namespace.createElement(HelpTopicContext.Provider, { value: valuesForHelpTopicContext },
|
|
2487
|
+
React__namespace.createElement(HelpTopicDrawer, Object.assign({}, props), children)));
|
|
2488
|
+
};
|
|
2489
|
+
const HelpTopicDrawer = (_a) => {
|
|
2490
|
+
var { children } = _a, props = tslib.__rest(_a, ["children"]);
|
|
2491
|
+
const { activeHelpTopic, filteredHelpTopics, setActiveHelpTopicByName } = React__namespace.useContext(HelpTopicContext);
|
|
2492
|
+
const onClose = () => {
|
|
2493
|
+
setActiveHelpTopicByName('');
|
|
2494
|
+
};
|
|
2495
|
+
const panelContent = (React__namespace.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics, onClose: onClose }));
|
|
2496
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2497
|
+
React__namespace.createElement(reactCore.Drawer, Object.assign({ isExpanded: !!activeHelpTopic, isInline: true }, props), children ? (React__namespace.createElement(reactCore.DrawerContent, { panelContent: panelContent },
|
|
2498
|
+
React__namespace.createElement(reactCore.DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React__namespace.createElement("div", { className: "pf-v5-c-drawer__main" }, panelContent)))));
|
|
2499
|
+
};
|
|
2500
|
+
|
|
2501
|
+
const useLocalStorage = (key, initialValue) => {
|
|
2502
|
+
// State to store our value
|
|
2503
|
+
// Pass initial state function to useState so logic is only executed once
|
|
2504
|
+
const [storedValue, setStoredValue] = React.useState(() => {
|
|
2505
|
+
try {
|
|
2506
|
+
// Get from local storage by key
|
|
2507
|
+
const item = window.localStorage.getItem(key);
|
|
2508
|
+
// Parse stored json or if none return initialValue
|
|
2509
|
+
return item ? JSON.parse(item) : initialValue;
|
|
2510
|
+
}
|
|
2511
|
+
catch (error) {
|
|
2512
|
+
// If error also return initialValue
|
|
2513
|
+
// eslint-disable-next-line no-console
|
|
2514
|
+
console.log(error);
|
|
2515
|
+
return initialValue;
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
// Return a wrapped version of useState's setter function that ...
|
|
2519
|
+
// ... persists the new value to localStorage.
|
|
2520
|
+
const setValue = (value) => {
|
|
2521
|
+
try {
|
|
2522
|
+
// Allow value to be a function so we have same API as useState
|
|
2523
|
+
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
2524
|
+
// Save state
|
|
2525
|
+
setStoredValue(valueToStore);
|
|
2526
|
+
// Save to local storage
|
|
2527
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
2528
|
+
}
|
|
2529
|
+
catch (error) {
|
|
2530
|
+
// A more advanced implementation would handle the error case
|
|
2531
|
+
// eslint-disable-next-line no-console
|
|
2532
|
+
console.log(error);
|
|
2533
|
+
}
|
|
2534
|
+
};
|
|
2535
|
+
return [storedValue, setValue];
|
|
2536
|
+
};
|
|
2537
|
+
|
|
2538
|
+
/* eslint-disable */
|
|
2539
|
+
// Brought in from dev to publish this with QS module
|
|
2540
|
+
// Dev now imports from here
|
|
2541
|
+
const ProcQuickStartParser = (quickStart, environmentVariables) => {
|
|
2542
|
+
var _a;
|
|
2543
|
+
const replaceEnvironmentVariables = (s) => s === null || s === void 0 ? void 0 : s.replace(/\${(\w+)}/, (substring, name) => {
|
|
2544
|
+
return environmentVariables ? ([name] ? environmentVariables[name] : substring) : substring;
|
|
2545
|
+
});
|
|
2546
|
+
quickStart.spec.tasks = (_a = quickStart.spec.tasks) === null || _a === void 0 ? void 0 : _a.map((task, index) => {
|
|
2547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2548
|
+
let proc;
|
|
2549
|
+
let answer;
|
|
2550
|
+
if (typeof task === 'string') {
|
|
2551
|
+
proc = task;
|
|
2552
|
+
answer = {};
|
|
2553
|
+
}
|
|
2554
|
+
else {
|
|
2555
|
+
proc = task.proc;
|
|
2556
|
+
answer = task;
|
|
2557
|
+
delete task.proc;
|
|
2558
|
+
}
|
|
2559
|
+
let description = '', procedure, verification, title, summaryFailed, success, reviewFailed, prerequisites;
|
|
2560
|
+
if (proc) {
|
|
2561
|
+
const taskDOM = document.createElement('div');
|
|
2562
|
+
taskDOM.innerHTML = proc;
|
|
2563
|
+
// remove the screencapture images
|
|
2564
|
+
taskDOM.querySelectorAll('.imageblock.screencapture').forEach((node) => {
|
|
2565
|
+
var _a;
|
|
2566
|
+
(_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(node);
|
|
2567
|
+
});
|
|
2568
|
+
title = (_a = taskDOM
|
|
2569
|
+
.querySelector('h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child')) === null || _a === void 0 ? void 0 : _a.innerHTML.trim();
|
|
2570
|
+
let sectionBody = taskDOM.querySelector('.sectionbody');
|
|
2571
|
+
if (!(sectionBody === null || sectionBody === void 0 ? void 0 : sectionBody.hasChildNodes())) {
|
|
2572
|
+
// possibly in other templates, where we want to look for article
|
|
2573
|
+
sectionBody = taskDOM.querySelector('article');
|
|
2574
|
+
}
|
|
2575
|
+
if (sectionBody) {
|
|
2576
|
+
for (let i = 0; i < sectionBody.children.length || 0; i++) {
|
|
2577
|
+
/**
|
|
2578
|
+
child typically looks like:
|
|
2579
|
+
|
|
2580
|
+
<div class="paragraph|olist|ulist|admonitionblock">
|
|
2581
|
+
<div class="title">Procedure|Prerequisites|Verification|Note|Warning</div>
|
|
2582
|
+
<ol|ul class="arabic">
|
|
2583
|
+
<li>
|
|
2584
|
+
<li>...
|
|
2585
|
+
</ol|ul>
|
|
2586
|
+
</div>
|
|
2587
|
+
|
|
2588
|
+
And the below code extracts the <ol> or <ul>
|
|
2589
|
+
Except for when there is no <div class="title|heading"/>, then the description is extracted
|
|
2590
|
+
in the else if below
|
|
2591
|
+
*/
|
|
2592
|
+
const child = sectionBody.children.item(i);
|
|
2593
|
+
// find the title
|
|
2594
|
+
const sectionTitle = child === null || child === void 0 ? void 0 : child.querySelector('.heading,.title');
|
|
2595
|
+
// should this section be assigned to a specific section
|
|
2596
|
+
const sectionTitleText = (_b = sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
2597
|
+
const isKnownSection = ['Procedure', 'Verification', 'Prerequisites'].includes((_c = sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.textContent) === null || _c === void 0 ? void 0 : _c.trim());
|
|
2598
|
+
if (isKnownSection) {
|
|
2599
|
+
switch (sectionTitleText) {
|
|
2600
|
+
case 'Procedure':
|
|
2601
|
+
procedure = (_d = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _d === void 0 ? void 0 : _d.outerHTML.trim();
|
|
2602
|
+
break;
|
|
2603
|
+
case 'Verification':
|
|
2604
|
+
verification = (_e = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _e === void 0 ? void 0 : _e.outerHTML.trim();
|
|
2605
|
+
break;
|
|
2606
|
+
case 'Prerequisites':
|
|
2607
|
+
prerequisites = (_f = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _f === void 0 ? void 0 : _f.outerHTML.trim();
|
|
2608
|
+
break;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
else if (!procedure) {
|
|
2612
|
+
// Otherwise if it comes before a procedure it's part of the description
|
|
2613
|
+
description = description + (child === null || child === void 0 ? void 0 : child.outerHTML.trim());
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
success = (_g = taskDOM.querySelector('.qs-summary.success')) === null || _g === void 0 ? void 0 : _g.innerHTML.trim();
|
|
2618
|
+
reviewFailed = (_h = taskDOM.querySelector('.qs-review.failed')) === null || _h === void 0 ? void 0 : _h.innerHTML.trim();
|
|
2619
|
+
summaryFailed = (_j = taskDOM.querySelector('.qs-summary.failed')) === null || _j === void 0 ? void 0 : _j.innerHTML.trim();
|
|
2620
|
+
}
|
|
2621
|
+
answer.title = replaceEnvironmentVariables(answer.title || title);
|
|
2622
|
+
answer.description = replaceEnvironmentVariables(answer.description || `${description} ${prerequisites || ''} ${procedure}`);
|
|
2623
|
+
answer.review = answer.review || {};
|
|
2624
|
+
answer.review.instructions = replaceEnvironmentVariables(((_k = answer.review) === null || _k === void 0 ? void 0 : _k.instructions) || verification || 'Have you completed these steps?');
|
|
2625
|
+
answer.review.failedTaskHelp = replaceEnvironmentVariables(answer.review.failedTaskHelp ||
|
|
2626
|
+
reviewFailed ||
|
|
2627
|
+
'This task isn’t verified yet. Try the task again.');
|
|
2628
|
+
answer.summary = answer.summary || {};
|
|
2629
|
+
answer.summary.success = replaceEnvironmentVariables(answer.summary.success || success || 'You have completed this task!');
|
|
2630
|
+
answer.summary.failed = replaceEnvironmentVariables(answer.summary.failed || summaryFailed || 'Try the steps again.');
|
|
2631
|
+
return answer;
|
|
2632
|
+
});
|
|
2633
|
+
return quickStart;
|
|
2634
|
+
};
|
|
2635
|
+
|
|
2636
|
+
exports.Box = Box;
|
|
2637
|
+
exports.CamelCaseWrap = CamelCaseWrap;
|
|
2638
|
+
exports.EmptyBox = EmptyBox;
|
|
2639
|
+
exports.HELP_TOPIC_NAME_KEY = HELP_TOPIC_NAME_KEY;
|
|
2640
|
+
exports.HelpTopicContainer = HelpTopicContainer;
|
|
2641
|
+
exports.HelpTopicContext = HelpTopicContext;
|
|
2642
|
+
exports.HelpTopicContextDefaults = HelpTopicContextDefaults;
|
|
2643
|
+
exports.HelpTopicDrawer = HelpTopicDrawer;
|
|
2644
|
+
exports.Loading = Loading;
|
|
2645
|
+
exports.LoadingBox = LoadingBox;
|
|
2646
|
+
exports.ProcQuickStartParser = ProcQuickStartParser;
|
|
2647
|
+
exports.QUICKSTART_ID_FILTER_KEY = QUICKSTART_ID_FILTER_KEY;
|
|
2648
|
+
exports.QUICKSTART_SEARCH_FILTER_KEY = QUICKSTART_SEARCH_FILTER_KEY;
|
|
2649
|
+
exports.QUICKSTART_STATUS_FILTER_KEY = QUICKSTART_STATUS_FILTER_KEY;
|
|
2650
|
+
exports.QUICKSTART_TASKS_INITIAL_STATES = QUICKSTART_TASKS_INITIAL_STATES;
|
|
2651
|
+
exports.QUICK_START_NAME = QUICK_START_NAME;
|
|
2652
|
+
exports.QuickStartCatalog = QuickStartCatalog;
|
|
2653
|
+
exports.QuickStartCatalogEmptyState = QuickStartCatalogEmptyState;
|
|
2654
|
+
exports.QuickStartCatalogFilter = QuickStartCatalogFilter;
|
|
2655
|
+
exports.QuickStartCatalogFilterCount = QuickStartCatalogFilterCount;
|
|
2656
|
+
exports.QuickStartCatalogFilterCountWrapper = QuickStartCatalogFilterCountWrapper;
|
|
2657
|
+
exports.QuickStartCatalogFilterSearch = QuickStartCatalogFilterSearch;
|
|
2658
|
+
exports.QuickStartCatalogFilterSearchWrapper = QuickStartCatalogFilterSearchWrapper;
|
|
2659
|
+
exports.QuickStartCatalogFilterSelect = QuickStartCatalogFilterSelect;
|
|
2660
|
+
exports.QuickStartCatalogFilterStatusWrapper = QuickStartCatalogFilterStatusWrapper;
|
|
2661
|
+
exports.QuickStartCatalogHeader = QuickStartCatalogHeader;
|
|
2662
|
+
exports.QuickStartCatalogPage = QuickStartCatalogPage;
|
|
2663
|
+
exports.QuickStartCatalogSection = QuickStartCatalogSection;
|
|
2664
|
+
exports.QuickStartCatalogToolbar = QuickStartCatalogToolbar;
|
|
2665
|
+
exports.QuickStartCloseModal = QuickStartCloseModal;
|
|
2666
|
+
exports.QuickStartContainer = QuickStartContainer;
|
|
2667
|
+
exports.QuickStartContext = QuickStartContext;
|
|
2668
|
+
exports.QuickStartContextDefaults = QuickStartContextDefaults;
|
|
2669
|
+
exports.QuickStartContextProvider = QuickStartContextProvider;
|
|
2670
|
+
exports.QuickStartDrawer = QuickStartDrawer;
|
|
2671
|
+
exports.QuickStartPanelContent = QuickStartPanelContent;
|
|
2672
|
+
exports.QuickStartTile = QuickStartTile;
|
|
2673
|
+
exports.QuickStartTileDescription = QuickStartTileDescription;
|
|
2674
|
+
exports.QuickStartTileFooter = QuickStartTileFooter;
|
|
2675
|
+
exports.QuickStartTileFooterExternal = QuickStartTileFooterExternal;
|
|
2676
|
+
exports.QuickStartTileHeader = QuickStartTileHeader;
|
|
2677
|
+
exports.camelize = camelize;
|
|
2678
|
+
exports.clearFilterParams = clearFilterParams;
|
|
2679
|
+
exports.equalsIgnoreOrder = equalsIgnoreOrder;
|
|
2680
|
+
exports.filterQuickStarts = filterQuickStarts;
|
|
2681
|
+
exports.getDefaultQuickStartState = getDefaultQuickStartState;
|
|
2682
|
+
exports.getDisabledQuickStarts = getDisabledQuickStarts;
|
|
2683
|
+
exports.getQuickStartByName = getQuickStartByName;
|
|
2684
|
+
exports.getQuickStartStatus = getQuickStartStatus;
|
|
2685
|
+
exports.getQuickStartStatusCount = getQuickStartStatusCount;
|
|
2686
|
+
exports.getResource = getResource;
|
|
2687
|
+
exports.getTaskStatusKey = getTaskStatusKey;
|
|
2688
|
+
exports.history = history;
|
|
2689
|
+
exports.isDisabledQuickStart = isDisabledQuickStart;
|
|
2690
|
+
exports.removeQueryArgument = removeQueryArgument;
|
|
2691
|
+
exports.setQueryArgument = setQueryArgument;
|
|
2692
|
+
exports.useLocalStorage = useLocalStorage;
|
|
2693
|
+
exports.useValuesForHelpTopicContext = useValuesForHelpTopicContext;
|
|
2694
|
+
exports.useValuesForQuickStartContext = useValuesForQuickStartContext;
|
|
2695
|
+
//# sourceMappingURL=index.js.map
|