@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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Divider,
|
|
5
|
+
EmptyState,
|
|
6
|
+
EmptyStateBody,
|
|
7
|
+
EmptyStateIcon,
|
|
8
|
+
Text,
|
|
9
|
+
EmptyStateFooter,
|
|
10
|
+
EmptyStateActions,
|
|
11
|
+
EmptyStateHeader,
|
|
12
|
+
} from '@patternfly/react-core';
|
|
13
|
+
import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
14
|
+
import { EmptyBox, LoadingBox, clearFilterParams } from '@console/internal/components/utils';
|
|
15
|
+
import QuickStartCatalog from './catalog/QuickStartCatalog';
|
|
16
|
+
import QuickStartCatalogFilter from './catalog/Toolbar/QuickStartCatalogFilter';
|
|
17
|
+
import { QuickStartContext, QuickStartContextValues } from './utils/quick-start-context';
|
|
18
|
+
import { QuickStart } from './utils/quick-start-types';
|
|
19
|
+
import { filterQuickStarts } from './utils/quick-start-utils';
|
|
20
|
+
|
|
21
|
+
export interface QuickStartCatalogPageProps {
|
|
22
|
+
quickStarts?: QuickStart[];
|
|
23
|
+
showFilter?: boolean;
|
|
24
|
+
sortFnc?: (q1: QuickStart, q2: QuickStart) => number;
|
|
25
|
+
title?: string;
|
|
26
|
+
hint?: string;
|
|
27
|
+
showTitle?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const QuickStartCatalogEmptyState = ({ clearFilters }) => {
|
|
31
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
32
|
+
return (
|
|
33
|
+
<EmptyState>
|
|
34
|
+
<EmptyStateHeader
|
|
35
|
+
titleText={<>{getResource('No results found')}</>}
|
|
36
|
+
icon={<EmptyStateIcon icon={SearchIcon} />}
|
|
37
|
+
headingLevel="h4"
|
|
38
|
+
/>
|
|
39
|
+
<EmptyStateBody>
|
|
40
|
+
{getResource(
|
|
41
|
+
'No results match the filter criteria. Remove filters or clear all filters to show results.',
|
|
42
|
+
)}
|
|
43
|
+
</EmptyStateBody>
|
|
44
|
+
|
|
45
|
+
<EmptyStateFooter>
|
|
46
|
+
<EmptyStateActions>
|
|
47
|
+
<Button variant="link" onClick={clearFilters} data-test="clear-filter button">
|
|
48
|
+
{getResource('Clear all filters')}
|
|
49
|
+
</Button>
|
|
50
|
+
</EmptyStateActions>
|
|
51
|
+
</EmptyStateFooter>
|
|
52
|
+
</EmptyState>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const QuickStartCatalogPage: React.FC<QuickStartCatalogPageProps> = ({
|
|
57
|
+
quickStarts,
|
|
58
|
+
showFilter,
|
|
59
|
+
sortFnc = (q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName),
|
|
60
|
+
title,
|
|
61
|
+
hint,
|
|
62
|
+
showTitle = true,
|
|
63
|
+
}) => {
|
|
64
|
+
const sortFncCallback = React.useCallback(sortFnc, [sortFnc]);
|
|
65
|
+
const {
|
|
66
|
+
allQuickStarts = [],
|
|
67
|
+
setAllQuickStarts,
|
|
68
|
+
allQuickStartStates,
|
|
69
|
+
getResource,
|
|
70
|
+
filter,
|
|
71
|
+
setFilter,
|
|
72
|
+
loading,
|
|
73
|
+
} = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
74
|
+
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
// passed through prop, not context
|
|
77
|
+
if (quickStarts && JSON.stringify(quickStarts) !== JSON.stringify(allQuickStarts)) {
|
|
78
|
+
setAllQuickStarts(quickStarts);
|
|
79
|
+
}
|
|
80
|
+
}, [quickStarts, allQuickStarts, setAllQuickStarts]);
|
|
81
|
+
|
|
82
|
+
const initialFilteredQuickStarts = showFilter
|
|
83
|
+
? filterQuickStarts(
|
|
84
|
+
allQuickStarts,
|
|
85
|
+
filter.keyword,
|
|
86
|
+
filter.status.statusFilters,
|
|
87
|
+
allQuickStartStates,
|
|
88
|
+
).sort(sortFncCallback)
|
|
89
|
+
: allQuickStarts;
|
|
90
|
+
|
|
91
|
+
const [filteredQuickStarts, setFilteredQuickStarts] = React.useState(initialFilteredQuickStarts);
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
const filteredQs = showFilter
|
|
94
|
+
? filterQuickStarts(
|
|
95
|
+
allQuickStarts,
|
|
96
|
+
filter.keyword,
|
|
97
|
+
filter.status.statusFilters,
|
|
98
|
+
allQuickStartStates,
|
|
99
|
+
).sort(sortFncCallback)
|
|
100
|
+
: allQuickStarts;
|
|
101
|
+
// also needs a check whether the content of the QS changed
|
|
102
|
+
if (
|
|
103
|
+
filteredQs.length !== filteredQuickStarts.length ||
|
|
104
|
+
JSON.stringify(filteredQs) !== JSON.stringify(filteredQuickStarts)
|
|
105
|
+
) {
|
|
106
|
+
setFilteredQuickStarts(filteredQs);
|
|
107
|
+
}
|
|
108
|
+
}, [
|
|
109
|
+
allQuickStarts,
|
|
110
|
+
allQuickStartStates,
|
|
111
|
+
showFilter,
|
|
112
|
+
filter.keyword,
|
|
113
|
+
filter.status.statusFilters,
|
|
114
|
+
sortFncCallback,
|
|
115
|
+
filteredQuickStarts,
|
|
116
|
+
]);
|
|
117
|
+
|
|
118
|
+
const clearFilters = () => {
|
|
119
|
+
setFilter('keyword', '');
|
|
120
|
+
setFilter('status', []);
|
|
121
|
+
clearFilterParams();
|
|
122
|
+
setFilteredQuickStarts(
|
|
123
|
+
allQuickStarts.sort((q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName)),
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const onSearchInputChange = (searchValue) => {
|
|
128
|
+
const result = filterQuickStarts(
|
|
129
|
+
allQuickStarts,
|
|
130
|
+
searchValue,
|
|
131
|
+
filter.status.statusFilters,
|
|
132
|
+
allQuickStartStates,
|
|
133
|
+
).sort((q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName));
|
|
134
|
+
if (searchValue !== filter.keyword) {
|
|
135
|
+
setFilter('keyword', searchValue);
|
|
136
|
+
}
|
|
137
|
+
if (result.length !== filteredQuickStarts.length) {
|
|
138
|
+
setFilteredQuickStarts(result);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const onStatusChange = (statusList) => {
|
|
143
|
+
const result = filterQuickStarts(
|
|
144
|
+
allQuickStarts,
|
|
145
|
+
filter.keyword,
|
|
146
|
+
statusList,
|
|
147
|
+
allQuickStartStates,
|
|
148
|
+
).sort((q1, q2) => q1.spec.displayName.localeCompare(q2.spec.displayName));
|
|
149
|
+
if (JSON.stringify(statusList) !== JSON.stringify(filter.status)) {
|
|
150
|
+
setFilter('status', statusList);
|
|
151
|
+
}
|
|
152
|
+
if (result.length !== filteredQuickStarts.length) {
|
|
153
|
+
setFilteredQuickStarts(result);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
if (loading) {
|
|
158
|
+
return <LoadingBox />;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!allQuickStarts || allQuickStarts.length === 0) {
|
|
162
|
+
return <EmptyBox label={getResource('Quick Starts')} />;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div className="pfext-quick-start__base">
|
|
167
|
+
{showTitle && (
|
|
168
|
+
<div className="pfext-page-layout__header">
|
|
169
|
+
<Text component="h1" className="pfext-page-layout__title" data-test="page-title">
|
|
170
|
+
{title || getResource('Quick Starts')}
|
|
171
|
+
</Text>
|
|
172
|
+
{hint && <div className="pfext-page-layout__hint">{hint}</div>}
|
|
173
|
+
</div>
|
|
174
|
+
)}
|
|
175
|
+
{showTitle && <Divider component="div" />}
|
|
176
|
+
{showFilter && (
|
|
177
|
+
<>
|
|
178
|
+
<QuickStartCatalogFilter
|
|
179
|
+
quickStartsCount={filteredQuickStarts.length}
|
|
180
|
+
onSearchInputChange={onSearchInputChange}
|
|
181
|
+
onStatusChange={onStatusChange}
|
|
182
|
+
/>
|
|
183
|
+
<Divider component="div" />
|
|
184
|
+
</>
|
|
185
|
+
)}
|
|
186
|
+
<>
|
|
187
|
+
{filteredQuickStarts.length === 0 ? (
|
|
188
|
+
<QuickStartCatalogEmptyState clearFilters={clearFilters} />
|
|
189
|
+
) : (
|
|
190
|
+
<QuickStartCatalog quickStarts={filteredQuickStarts} />
|
|
191
|
+
)}
|
|
192
|
+
</>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button, Flex, FlexItem, ModalVariant } from '@patternfly/react-core';
|
|
3
|
+
import { Modal } from '@console/shared';
|
|
4
|
+
import { QuickStartContext, QuickStartContextValues } from './utils/quick-start-context';
|
|
5
|
+
|
|
6
|
+
interface QuickStartCloseModalProps {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onConfirm: () => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const QuickStartCloseModal: React.FC<QuickStartCloseModalProps> = ({
|
|
13
|
+
isOpen,
|
|
14
|
+
onConfirm,
|
|
15
|
+
onCancel,
|
|
16
|
+
}) => {
|
|
17
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
18
|
+
return (
|
|
19
|
+
<Modal
|
|
20
|
+
className="pfext-quick-start-drawer__modal pfext-quick-start__base"
|
|
21
|
+
isOpen={isOpen}
|
|
22
|
+
variant={ModalVariant.small}
|
|
23
|
+
showClose={false}
|
|
24
|
+
data-test="leave-quickstart"
|
|
25
|
+
title={getResource('Leave quick start?')}
|
|
26
|
+
footer={
|
|
27
|
+
<Flex>
|
|
28
|
+
<FlexItem align={{ default: 'alignRight' }}>
|
|
29
|
+
<Button variant="secondary" data-test="cancel button" onClick={onCancel}>
|
|
30
|
+
{getResource('Cancel')}
|
|
31
|
+
</Button>
|
|
32
|
+
</FlexItem>
|
|
33
|
+
<FlexItem>
|
|
34
|
+
<Button variant="primary" data-test="leave button" onClick={onConfirm}>
|
|
35
|
+
{getResource('Leave')}
|
|
36
|
+
</Button>
|
|
37
|
+
</FlexItem>
|
|
38
|
+
</Flex>
|
|
39
|
+
}
|
|
40
|
+
isFullScreen
|
|
41
|
+
>
|
|
42
|
+
{getResource('Your progress will be saved.')}
|
|
43
|
+
</Modal>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default QuickStartCloseModal;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import QuickStartContent from './controller/QuickStartContent';
|
|
3
|
+
import QuickStartFooter from './controller/QuickStartFooter';
|
|
4
|
+
import { QuickStartContext, QuickStartContextValues } from './utils/quick-start-context';
|
|
5
|
+
import { QuickStart, QuickStartStatus, QuickStartTaskStatus } from './utils/quick-start-types';
|
|
6
|
+
|
|
7
|
+
interface QuickStartControllerProps {
|
|
8
|
+
quickStart: QuickStart;
|
|
9
|
+
nextQuickStarts?: QuickStart[];
|
|
10
|
+
footerClass: string;
|
|
11
|
+
contentRef: React.Ref<HTMLDivElement>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const QuickStartController: React.FC<QuickStartControllerProps> = ({
|
|
15
|
+
quickStart,
|
|
16
|
+
nextQuickStarts,
|
|
17
|
+
contentRef,
|
|
18
|
+
footerClass,
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
metadata: { name },
|
|
22
|
+
spec: { tasks = [] },
|
|
23
|
+
} = quickStart;
|
|
24
|
+
const totalTasks = tasks?.length;
|
|
25
|
+
const {
|
|
26
|
+
activeQuickStartState,
|
|
27
|
+
setActiveQuickStart,
|
|
28
|
+
setQuickStartTaskNumber,
|
|
29
|
+
setQuickStartTaskStatus,
|
|
30
|
+
nextStep,
|
|
31
|
+
previousStep,
|
|
32
|
+
} = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
33
|
+
const status = activeQuickStartState?.status as QuickStartStatus;
|
|
34
|
+
const taskNumber = activeQuickStartState?.taskNumber as number;
|
|
35
|
+
const allTaskStatuses = tasks.map(
|
|
36
|
+
(task, index) => activeQuickStartState[`taskStatus${index}`],
|
|
37
|
+
) as QuickStartTaskStatus[];
|
|
38
|
+
|
|
39
|
+
const handleQuickStartChange = React.useCallback(
|
|
40
|
+
(quickStartId: string) => setActiveQuickStart(quickStartId),
|
|
41
|
+
[setActiveQuickStart],
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const handleTaskStatusChange = React.useCallback(
|
|
45
|
+
(newTaskStatus: QuickStartTaskStatus) => setQuickStartTaskStatus(newTaskStatus),
|
|
46
|
+
[setQuickStartTaskStatus],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const getQuickStartActiveTask = React.useCallback(() => {
|
|
50
|
+
let activeTaskNumber = 0;
|
|
51
|
+
while (
|
|
52
|
+
activeTaskNumber !== totalTasks &&
|
|
53
|
+
activeQuickStartState[`taskStatus${activeTaskNumber}`] === QuickStartTaskStatus.SUCCESS
|
|
54
|
+
) {
|
|
55
|
+
activeTaskNumber++;
|
|
56
|
+
}
|
|
57
|
+
return activeTaskNumber;
|
|
58
|
+
}, [totalTasks, activeQuickStartState]);
|
|
59
|
+
|
|
60
|
+
const handleQuickStartContinue = React.useCallback(() => {
|
|
61
|
+
const activeTaskNumber = getQuickStartActiveTask();
|
|
62
|
+
setQuickStartTaskNumber(name, activeTaskNumber);
|
|
63
|
+
}, [getQuickStartActiveTask, setQuickStartTaskNumber, name]);
|
|
64
|
+
|
|
65
|
+
const handleNext = React.useCallback(() => {
|
|
66
|
+
if (status === QuickStartStatus.COMPLETE && taskNumber === totalTasks) {
|
|
67
|
+
return handleQuickStartChange('');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (status !== QuickStartStatus.NOT_STARTED && taskNumber === -1) {
|
|
71
|
+
return handleQuickStartContinue();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return nextStep(totalTasks);
|
|
75
|
+
}, [handleQuickStartChange, nextStep, status, taskNumber, totalTasks, handleQuickStartContinue]);
|
|
76
|
+
|
|
77
|
+
const handleBack = React.useCallback(() => previousStep(), [previousStep]);
|
|
78
|
+
|
|
79
|
+
const handleTaskSelect = React.useCallback(
|
|
80
|
+
(selectedTaskNumber: number) => {
|
|
81
|
+
setQuickStartTaskNumber(name, selectedTaskNumber);
|
|
82
|
+
},
|
|
83
|
+
[name, setQuickStartTaskNumber],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<>
|
|
88
|
+
<QuickStartContent
|
|
89
|
+
quickStart={quickStart}
|
|
90
|
+
nextQuickStarts={nextQuickStarts}
|
|
91
|
+
taskNumber={taskNumber}
|
|
92
|
+
allTaskStatuses={allTaskStatuses}
|
|
93
|
+
onTaskSelect={handleTaskSelect}
|
|
94
|
+
onTaskReview={handleTaskStatusChange}
|
|
95
|
+
onQuickStartChange={handleQuickStartChange}
|
|
96
|
+
ref={contentRef}
|
|
97
|
+
/>
|
|
98
|
+
<QuickStartFooter
|
|
99
|
+
status={status}
|
|
100
|
+
taskNumber={taskNumber}
|
|
101
|
+
totalTasks={totalTasks}
|
|
102
|
+
onNext={handleNext}
|
|
103
|
+
onBack={handleBack}
|
|
104
|
+
footerClass={footerClass}
|
|
105
|
+
quickStartId={quickStart.metadata.name}
|
|
106
|
+
/>
|
|
107
|
+
</>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default QuickStartController;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import './QuickStartDrawer.scss';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Drawer, DrawerContent, DrawerContentBody } from '@patternfly/react-core';
|
|
4
|
+
import QuickStartCloseModal from './QuickStartCloseModal';
|
|
5
|
+
import QuickStartPanelContent from './QuickStartPanelContent';
|
|
6
|
+
import {
|
|
7
|
+
getDefaultQuickStartState,
|
|
8
|
+
QuickStartContext,
|
|
9
|
+
QuickStartContextValues,
|
|
10
|
+
useValuesForQuickStartContext,
|
|
11
|
+
} from './utils/quick-start-context';
|
|
12
|
+
import { QUICKSTART_ID_FILTER_KEY } from './utils/const';
|
|
13
|
+
import { QuickStart, QuickStartStatus, AllQuickStartStates } from './utils/quick-start-types';
|
|
14
|
+
import { getQuickStartByName } from './utils/quick-start-utils';
|
|
15
|
+
|
|
16
|
+
export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement> {
|
|
17
|
+
/** array of quick starts */
|
|
18
|
+
quickStarts: QuickStart[];
|
|
19
|
+
/** id of the currently active quick start */
|
|
20
|
+
activeQuickStartID: string;
|
|
21
|
+
/** setter for the active quick starts */
|
|
22
|
+
setActiveQuickStartID: React.Dispatch<React.SetStateAction<string>>;
|
|
23
|
+
/** quick starts state object */
|
|
24
|
+
allQuickStartStates: AllQuickStartStates;
|
|
25
|
+
/** setter for the quick starts state object */
|
|
26
|
+
setAllQuickStartStates: React.Dispatch<React.SetStateAction<AllQuickStartStates>>;
|
|
27
|
+
/** content to render within the container */
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/** element to render the drawer panel into */
|
|
30
|
+
appendTo?: HTMLElement | (() => HTMLElement);
|
|
31
|
+
/** if true, the panel will take up the full browser width */
|
|
32
|
+
fullWidth?: boolean;
|
|
33
|
+
/** callback when an in-progress quick start is closed */
|
|
34
|
+
onCloseInProgress?: any;
|
|
35
|
+
/** callback when a not-in-progress quick start is closed */
|
|
36
|
+
onCloseNotInProgress?: any;
|
|
37
|
+
/** true to show footer buttons in the catalog tiles (default true) */
|
|
38
|
+
showCardFooters?: boolean;
|
|
39
|
+
/** true to use legacy drawer header variant colors */
|
|
40
|
+
useLegacyHeaderColors?: boolean;
|
|
41
|
+
/** text resources object */
|
|
42
|
+
resourceBundle?: any;
|
|
43
|
+
/** language of the current resource bundle
|
|
44
|
+
* Add custom strings: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#localization
|
|
45
|
+
*/
|
|
46
|
+
language?: string;
|
|
47
|
+
/** if true, will show a loading spinner on the catalog page (default false) */
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
/** if true, will update the browser URL with ?quickstart={ID} (default true) */
|
|
50
|
+
useQueryParams?: boolean;
|
|
51
|
+
/** if true, the TaskReview component, aka "Check your work", will be shown regardless of task status */
|
|
52
|
+
alwaysShowTaskReview?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Additional markdown extensions and renderers to use
|
|
55
|
+
* Example usage: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#markdown-extensions
|
|
56
|
+
*/
|
|
57
|
+
markdown?: {
|
|
58
|
+
extensions?: any[];
|
|
59
|
+
renderExtension?: (docContext: Document, rootSelector: string) => React.ReactNode;
|
|
60
|
+
};
|
|
61
|
+
/** additional quick start context props */
|
|
62
|
+
contextProps?: QuickStartContextValues;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const QuickStartContainer: React.FC<QuickStartContainerProps> = ({
|
|
66
|
+
quickStarts,
|
|
67
|
+
children,
|
|
68
|
+
activeQuickStartID,
|
|
69
|
+
allQuickStartStates,
|
|
70
|
+
setActiveQuickStartID,
|
|
71
|
+
setAllQuickStartStates,
|
|
72
|
+
appendTo,
|
|
73
|
+
fullWidth,
|
|
74
|
+
onCloseInProgress,
|
|
75
|
+
onCloseNotInProgress,
|
|
76
|
+
resourceBundle,
|
|
77
|
+
showCardFooters,
|
|
78
|
+
useLegacyHeaderColors,
|
|
79
|
+
language,
|
|
80
|
+
loading = false,
|
|
81
|
+
useQueryParams = true,
|
|
82
|
+
markdown,
|
|
83
|
+
contextProps,
|
|
84
|
+
alwaysShowTaskReview = true,
|
|
85
|
+
...props
|
|
86
|
+
}: QuickStartContainerProps) => {
|
|
87
|
+
const valuesForQuickstartContext: QuickStartContextValues = useValuesForQuickStartContext({
|
|
88
|
+
allQuickStarts: quickStarts,
|
|
89
|
+
activeQuickStartID,
|
|
90
|
+
setActiveQuickStartID,
|
|
91
|
+
allQuickStartStates,
|
|
92
|
+
setAllQuickStartStates,
|
|
93
|
+
footer: {
|
|
94
|
+
show: showCardFooters,
|
|
95
|
+
},
|
|
96
|
+
useLegacyHeaderColors,
|
|
97
|
+
language,
|
|
98
|
+
resourceBundle: {
|
|
99
|
+
...resourceBundle,
|
|
100
|
+
// Start: "Let's go!",
|
|
101
|
+
// Continue: 'Resume',
|
|
102
|
+
// Restart: 'Start over',
|
|
103
|
+
},
|
|
104
|
+
loading,
|
|
105
|
+
useQueryParams,
|
|
106
|
+
markdown,
|
|
107
|
+
alwaysShowTaskReview,
|
|
108
|
+
...contextProps,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
if (
|
|
113
|
+
quickStarts &&
|
|
114
|
+
JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)
|
|
115
|
+
) {
|
|
116
|
+
valuesForQuickstartContext.setAllQuickStarts(quickStarts);
|
|
117
|
+
}
|
|
118
|
+
}, [quickStarts, valuesForQuickstartContext]);
|
|
119
|
+
|
|
120
|
+
React.useEffect(() => {
|
|
121
|
+
if (loading !== valuesForQuickstartContext.loading) {
|
|
122
|
+
valuesForQuickstartContext.setLoading(loading);
|
|
123
|
+
}
|
|
124
|
+
}, [loading, valuesForQuickstartContext]);
|
|
125
|
+
|
|
126
|
+
const drawerProps = {
|
|
127
|
+
appendTo,
|
|
128
|
+
fullWidth,
|
|
129
|
+
onCloseInProgress,
|
|
130
|
+
onCloseNotInProgress,
|
|
131
|
+
...props,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<QuickStartContext.Provider value={valuesForQuickstartContext}>
|
|
136
|
+
<QuickStartDrawer {...drawerProps}>{children}</QuickStartDrawer>
|
|
137
|
+
</QuickStartContext.Provider>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export interface QuickStartDrawerProps extends React.HTMLProps<HTMLDivElement> {
|
|
142
|
+
quickStarts?: QuickStart[];
|
|
143
|
+
children?: React.ReactNode;
|
|
144
|
+
appendTo?: HTMLElement | (() => HTMLElement);
|
|
145
|
+
fullWidth?: boolean;
|
|
146
|
+
onCloseInProgress?: any;
|
|
147
|
+
onCloseNotInProgress?: any;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const QuickStartDrawer: React.FC<QuickStartDrawerProps> = ({
|
|
151
|
+
quickStarts = [],
|
|
152
|
+
children,
|
|
153
|
+
appendTo,
|
|
154
|
+
fullWidth,
|
|
155
|
+
onCloseInProgress,
|
|
156
|
+
onCloseNotInProgress,
|
|
157
|
+
...props
|
|
158
|
+
}) => {
|
|
159
|
+
const {
|
|
160
|
+
activeQuickStartID,
|
|
161
|
+
setActiveQuickStart,
|
|
162
|
+
allQuickStarts = [],
|
|
163
|
+
activeQuickStartState,
|
|
164
|
+
allQuickStartStates,
|
|
165
|
+
setAllQuickStartStates,
|
|
166
|
+
useLegacyHeaderColors,
|
|
167
|
+
} = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
168
|
+
const combinedQuickStarts = allQuickStarts.concat(quickStarts);
|
|
169
|
+
React.useEffect(() => {
|
|
170
|
+
const params = new URLSearchParams(window.location.search);
|
|
171
|
+
// if there is a quick start param, but the quick start is not active, set it
|
|
172
|
+
// this can happen if a new browser session is opened or an incognito window for example
|
|
173
|
+
const quickStartIdFromParam = params.get(QUICKSTART_ID_FILTER_KEY) || '';
|
|
174
|
+
if (quickStartIdFromParam && activeQuickStartID !== quickStartIdFromParam) {
|
|
175
|
+
const activeQuickStart = getQuickStartByName(quickStartIdFromParam, combinedQuickStarts);
|
|
176
|
+
// don't try to load a quick start that is actually just an external resource (spec.link)
|
|
177
|
+
if (combinedQuickStarts.length > 0 && activeQuickStart && !activeQuickStart.spec.link) {
|
|
178
|
+
setActiveQuickStart(quickStartIdFromParam);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, [activeQuickStartID, combinedQuickStarts, setActiveQuickStart]);
|
|
182
|
+
|
|
183
|
+
React.useEffect(() => {
|
|
184
|
+
// If activeQuickStartID was changed through prop from QuickStartContainer, need to init the state if it does not exist yet
|
|
185
|
+
if (activeQuickStartID && !allQuickStartStates[activeQuickStartID]) {
|
|
186
|
+
setAllQuickStartStates({
|
|
187
|
+
...allQuickStartStates,
|
|
188
|
+
[activeQuickStartID]: getDefaultQuickStartState(),
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}, [activeQuickStartID, allQuickStartStates, setAllQuickStartStates]);
|
|
192
|
+
|
|
193
|
+
const [modalOpen, setModalOpen] = React.useState<boolean>(false);
|
|
194
|
+
const activeQuickStartStatus = activeQuickStartState?.status;
|
|
195
|
+
const onClose = () => setActiveQuickStart('');
|
|
196
|
+
const handleClose = () => {
|
|
197
|
+
if (activeQuickStartStatus === QuickStartStatus.IN_PROGRESS) {
|
|
198
|
+
if (onCloseInProgress) {
|
|
199
|
+
onCloseInProgress();
|
|
200
|
+
} else {
|
|
201
|
+
setModalOpen(true);
|
|
202
|
+
}
|
|
203
|
+
} else if (onCloseNotInProgress) {
|
|
204
|
+
onCloseNotInProgress();
|
|
205
|
+
} else {
|
|
206
|
+
onClose();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const onModalConfirm = () => {
|
|
211
|
+
setModalOpen(false);
|
|
212
|
+
onClose();
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const onModalCancel = () => setModalOpen(false);
|
|
216
|
+
|
|
217
|
+
const fullWidthPanelStyle = fullWidth
|
|
218
|
+
? {
|
|
219
|
+
style: {
|
|
220
|
+
flex: 1,
|
|
221
|
+
},
|
|
222
|
+
}
|
|
223
|
+
: {};
|
|
224
|
+
|
|
225
|
+
const fullWidthBodyStyle = fullWidth
|
|
226
|
+
? {
|
|
227
|
+
style: {
|
|
228
|
+
display: activeQuickStartID ? 'none' : 'flex',
|
|
229
|
+
},
|
|
230
|
+
}
|
|
231
|
+
: {};
|
|
232
|
+
|
|
233
|
+
const panelContent = (
|
|
234
|
+
<QuickStartPanelContent
|
|
235
|
+
quickStarts={combinedQuickStarts}
|
|
236
|
+
handleClose={handleClose}
|
|
237
|
+
activeQuickStartID={activeQuickStartID}
|
|
238
|
+
appendTo={appendTo}
|
|
239
|
+
isResizable={!fullWidth}
|
|
240
|
+
headerVariant={useLegacyHeaderColors ? '' : 'blue-white'}
|
|
241
|
+
{...fullWidthPanelStyle}
|
|
242
|
+
/>
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<>
|
|
247
|
+
<Drawer isExpanded={!!activeQuickStartID} isInline {...props}>
|
|
248
|
+
{children ? (
|
|
249
|
+
<DrawerContent panelContent={panelContent} {...fullWidthBodyStyle}>
|
|
250
|
+
<DrawerContentBody className="pfext-quick-start-drawer__body">
|
|
251
|
+
{children}
|
|
252
|
+
</DrawerContentBody>
|
|
253
|
+
</DrawerContent>
|
|
254
|
+
) : (
|
|
255
|
+
<div className="pf-v5-c-drawer__main">{panelContent}</div>
|
|
256
|
+
)}
|
|
257
|
+
</Drawer>
|
|
258
|
+
<QuickStartCloseModal
|
|
259
|
+
isOpen={modalOpen}
|
|
260
|
+
onConfirm={onModalConfirm}
|
|
261
|
+
onCancel={onModalCancel}
|
|
262
|
+
/>
|
|
263
|
+
</>
|
|
264
|
+
);
|
|
265
|
+
};
|