@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,101 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
|
+
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
4
|
+
import { QuickStartStatus } from '../utils/quick-start-types';
|
|
5
|
+
|
|
6
|
+
interface QuickStartTileFooterProps {
|
|
7
|
+
quickStartId: string;
|
|
8
|
+
status: string;
|
|
9
|
+
totalTasks?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const QuickStartTileFooter: React.FC<QuickStartTileFooterProps> = ({
|
|
13
|
+
quickStartId,
|
|
14
|
+
status,
|
|
15
|
+
totalTasks,
|
|
16
|
+
}) => {
|
|
17
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
18
|
+
const { activeQuickStartID, startQuickStart, restartQuickStart } = React.useContext<
|
|
19
|
+
QuickStartContextValues
|
|
20
|
+
>(QuickStartContext);
|
|
21
|
+
|
|
22
|
+
const start = React.useCallback(
|
|
23
|
+
(e: React.SyntheticEvent) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
startQuickStart(quickStartId, totalTasks);
|
|
27
|
+
},
|
|
28
|
+
[quickStartId, startQuickStart, totalTasks],
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const restart = React.useCallback(
|
|
32
|
+
(e: React.SyntheticEvent) => {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
restartQuickStart(quickStartId, totalTasks);
|
|
36
|
+
},
|
|
37
|
+
[quickStartId, restartQuickStart, totalTasks],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Flex justifyContent={{ default: 'justifyContentSpaceBetween' }}>
|
|
42
|
+
{status === QuickStartStatus.NOT_STARTED && (
|
|
43
|
+
<FlexItem>
|
|
44
|
+
<Button
|
|
45
|
+
onClick={start}
|
|
46
|
+
variant="link"
|
|
47
|
+
isInline
|
|
48
|
+
data-testid="qs-card-notStarted-start"
|
|
49
|
+
id={`${quickStartId}-start`}
|
|
50
|
+
aria-labelledby={`${quickStartId}-start ${quickStartId}`}
|
|
51
|
+
>
|
|
52
|
+
{getResource('Start')}
|
|
53
|
+
</Button>
|
|
54
|
+
</FlexItem>
|
|
55
|
+
)}
|
|
56
|
+
{status === QuickStartStatus.IN_PROGRESS && activeQuickStartID !== quickStartId && (
|
|
57
|
+
<FlexItem>
|
|
58
|
+
<Button
|
|
59
|
+
variant="link"
|
|
60
|
+
isInline
|
|
61
|
+
data-testid="qs-card-inProgress-resume"
|
|
62
|
+
id={`${quickStartId}-continue`}
|
|
63
|
+
aria-labelledby={`${quickStartId}-continue ${quickStartId}`}
|
|
64
|
+
>
|
|
65
|
+
{getResource('Continue')}
|
|
66
|
+
</Button>
|
|
67
|
+
</FlexItem>
|
|
68
|
+
)}
|
|
69
|
+
{status === QuickStartStatus.COMPLETE && (
|
|
70
|
+
<FlexItem>
|
|
71
|
+
<Button
|
|
72
|
+
onClick={restart}
|
|
73
|
+
variant="link"
|
|
74
|
+
isInline
|
|
75
|
+
data-testid="qs-card-complete-restart"
|
|
76
|
+
id={`${quickStartId}-restart`}
|
|
77
|
+
aria-labelledby={`${quickStartId}-restart ${quickStartId}`}
|
|
78
|
+
>
|
|
79
|
+
{getResource('Restart')}
|
|
80
|
+
</Button>
|
|
81
|
+
</FlexItem>
|
|
82
|
+
)}
|
|
83
|
+
{status === QuickStartStatus.IN_PROGRESS && (
|
|
84
|
+
<FlexItem>
|
|
85
|
+
<Button
|
|
86
|
+
onClick={restart}
|
|
87
|
+
variant="link"
|
|
88
|
+
isInline
|
|
89
|
+
data-testid="qs-card-inProgress-restart"
|
|
90
|
+
id={`${quickStartId}-restart`}
|
|
91
|
+
aria-labelledby={`${quickStartId}-restart ${quickStartId}`}
|
|
92
|
+
>
|
|
93
|
+
{getResource('Restart')}
|
|
94
|
+
</Button>
|
|
95
|
+
</FlexItem>
|
|
96
|
+
)}
|
|
97
|
+
</Flex>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default QuickStartTileFooter;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button, Flex, FlexItem } from '@patternfly/react-core';
|
|
3
|
+
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
4
|
+
import { QuickStartExternal } from '../utils/quick-start-types';
|
|
5
|
+
|
|
6
|
+
interface QuickStartTileFooterProps {
|
|
7
|
+
link: QuickStartExternal;
|
|
8
|
+
quickStartId?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const QuickStartTileFooterExternal: React.FC<QuickStartTileFooterProps> = ({
|
|
12
|
+
link,
|
|
13
|
+
quickStartId,
|
|
14
|
+
}) => {
|
|
15
|
+
const { href, text } = link;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Flex justifyContent={{ default: 'justifyContentSpaceBetween' }}>
|
|
19
|
+
<FlexItem>
|
|
20
|
+
<Button
|
|
21
|
+
component="a"
|
|
22
|
+
href={href}
|
|
23
|
+
target="_blank"
|
|
24
|
+
rel="noopener noreferrer"
|
|
25
|
+
variant="link"
|
|
26
|
+
aria-label={`Open documentation in new window`}
|
|
27
|
+
isInline
|
|
28
|
+
icon={<ExternalLinkAltIcon />}
|
|
29
|
+
iconPosition="right"
|
|
30
|
+
id={quickStartId}
|
|
31
|
+
aria-labelledby={`${quickStartId}-external ${quickStartId}`}
|
|
32
|
+
>
|
|
33
|
+
{text || href}
|
|
34
|
+
</Button>
|
|
35
|
+
</FlexItem>
|
|
36
|
+
</Flex>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default QuickStartTileFooterExternal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.pfext-quick-start-tile-header {
|
|
2
|
+
&__status {
|
|
3
|
+
margin: var(--pf-v5-global--spacer--sm) 0;
|
|
4
|
+
}
|
|
5
|
+
&--margin {
|
|
6
|
+
margin-right: var(--pf-v5-global--spacer--sm);
|
|
7
|
+
margin-bottom: var(--pf-v5-global--spacer--sm);
|
|
8
|
+
}
|
|
9
|
+
& .pf-v5-c-badge:not(:last-of-type) {
|
|
10
|
+
margin-right: var(--pf-v5-global--spacer--sm);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
h3 {
|
|
14
|
+
flex: 1;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import './QuickStartTileHeader.scss';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Button, ButtonProps, Flex, Label, Title } from '@patternfly/react-core';
|
|
4
|
+
import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
|
|
5
|
+
import OutlinedBookmarkIcon from '@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon';
|
|
6
|
+
import { StatusIcon } from '@console/shared';
|
|
7
|
+
import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
|
|
8
|
+
import { QuickStartStatus, QuickStartType } from '../utils/quick-start-types';
|
|
9
|
+
import QuickStartMarkdownView from '../QuickStartMarkdownView';
|
|
10
|
+
|
|
11
|
+
export interface QuickstartAction {
|
|
12
|
+
/** Screen reader aria label. */
|
|
13
|
+
'aria-label': string;
|
|
14
|
+
/** Icon to be rendered as a plain button, by default Bookmark outlined will be used. */
|
|
15
|
+
icon?: React.ComponentType<unknown>;
|
|
16
|
+
/** Callback with synthetic event parameter. */
|
|
17
|
+
onClick?: (e: React.SyntheticEvent) => void;
|
|
18
|
+
/** Additional button props to be rendered as extra props. */
|
|
19
|
+
buttonProps?: ButtonProps;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface QuickStartTileHeaderProps {
|
|
23
|
+
status: string;
|
|
24
|
+
duration: number;
|
|
25
|
+
name: string;
|
|
26
|
+
type?: QuickStartType;
|
|
27
|
+
quickStartId?: string;
|
|
28
|
+
action?: QuickstartAction;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const statusColorMap = {
|
|
32
|
+
[QuickStartStatus.COMPLETE]: 'green',
|
|
33
|
+
[QuickStartStatus.IN_PROGRESS]: 'purple',
|
|
34
|
+
[QuickStartStatus.NOT_STARTED]: 'grey',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const QuickStartTileHeader: React.FC<QuickStartTileHeaderProps> = ({
|
|
38
|
+
status,
|
|
39
|
+
duration,
|
|
40
|
+
name,
|
|
41
|
+
type,
|
|
42
|
+
quickStartId,
|
|
43
|
+
action,
|
|
44
|
+
}) => {
|
|
45
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
46
|
+
|
|
47
|
+
const statusLocaleMap = {
|
|
48
|
+
[QuickStartStatus.COMPLETE]: getResource('Complete'),
|
|
49
|
+
[QuickStartStatus.IN_PROGRESS]: getResource('In progress'),
|
|
50
|
+
[QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const ActionIcon = action?.icon || OutlinedBookmarkIcon;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className="pfext-quick-start-tile-header">
|
|
57
|
+
<Flex flexWrap={{ default: 'nowrap' }}>
|
|
58
|
+
<Title headingLevel="h3" data-test="title" id={quickStartId}>
|
|
59
|
+
<QuickStartMarkdownView content={name} />
|
|
60
|
+
</Title>
|
|
61
|
+
{action && (
|
|
62
|
+
<Button
|
|
63
|
+
aria-label={action['aria-label']}
|
|
64
|
+
icon={<ActionIcon />}
|
|
65
|
+
variant="plain"
|
|
66
|
+
onClick={action.onClick}
|
|
67
|
+
{...action.buttonProps}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
</Flex>
|
|
71
|
+
<div className="pfext-quick-start-tile-header__status">
|
|
72
|
+
{type && (
|
|
73
|
+
<Label className="pfext-quick-start-tile-header--margin" color={type.color}>
|
|
74
|
+
{type.text}
|
|
75
|
+
</Label>
|
|
76
|
+
)}
|
|
77
|
+
{duration && (
|
|
78
|
+
<Label
|
|
79
|
+
variant="outline"
|
|
80
|
+
data-test="duration"
|
|
81
|
+
icon={<OutlinedClockIcon />}
|
|
82
|
+
className="pfext-quick-start-tile-header--margin"
|
|
83
|
+
>
|
|
84
|
+
{getResource('{{duration, number}} minutes', duration).replace(
|
|
85
|
+
'{{duration, number}}',
|
|
86
|
+
duration,
|
|
87
|
+
)}
|
|
88
|
+
</Label>
|
|
89
|
+
)}
|
|
90
|
+
{status !== QuickStartStatus.NOT_STARTED && (
|
|
91
|
+
<Label
|
|
92
|
+
variant="outline"
|
|
93
|
+
color={statusColorMap[status]}
|
|
94
|
+
icon={<StatusIcon status={status} />}
|
|
95
|
+
data-test="status"
|
|
96
|
+
>
|
|
97
|
+
{statusLocaleMap[status]}
|
|
98
|
+
</Label>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default QuickStartTileHeader;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.pfext-quick-start-catalog-filter {
|
|
2
|
+
&__input {
|
|
3
|
+
flex-grow: 1;
|
|
4
|
+
max-width: 500px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&__count {
|
|
8
|
+
font-weight: var(--pf-v5-global--FontWeight--bold);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pf-v5-c-toolbar.pf-m-page-insets.pfext-quick-start-catalog-filter__flex {
|
|
13
|
+
--pf-v5-c-toolbar--PaddingBottom: var(--pf-v5-global--spacer--sm);
|
|
14
|
+
--pf-v5-c-toolbar--PaddingTop: var(--pf-v5-global--spacer--sm);
|
|
15
|
+
--pf-v5-c-toolbar--RowGap: 0;
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
|
|
18
|
+
.pf-v5-c-select {
|
|
19
|
+
--pf-v5-c-select__toggle--FontSize: 14px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pf-v5-c-check {
|
|
23
|
+
--pf-v5-c-check__label--FontSize: 14px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Toolbar, ToolbarContent, ToolbarProps } from '@patternfly/react-core';
|
|
3
|
+
import {
|
|
4
|
+
QuickStartCatalogFilterCountWrapper,
|
|
5
|
+
QuickStartCatalogFilterSearchWrapper,
|
|
6
|
+
QuickStartCatalogFilterStatusWrapper,
|
|
7
|
+
} from './QuickStartCatalogFilterItems';
|
|
8
|
+
|
|
9
|
+
import './QuickStartCatalogFilter.scss';
|
|
10
|
+
|
|
11
|
+
interface QuickStartCatalogFilterProps extends Omit<ToolbarProps, 'ref'> {
|
|
12
|
+
quickStartsCount: number;
|
|
13
|
+
onSearchInputChange: any;
|
|
14
|
+
onStatusChange: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const QuickStartCatalogFilter: React.FC<QuickStartCatalogFilterProps> = ({
|
|
18
|
+
quickStartsCount,
|
|
19
|
+
onSearchInputChange = () => {},
|
|
20
|
+
onStatusChange = () => {},
|
|
21
|
+
...props
|
|
22
|
+
}) => (
|
|
23
|
+
<Toolbar usePageInsets className="pfext-quick-start-catalog-filter__flex" {...props}>
|
|
24
|
+
<ToolbarContent>
|
|
25
|
+
<QuickStartCatalogFilterSearchWrapper onSearchInputChange={onSearchInputChange} />
|
|
26
|
+
<QuickStartCatalogFilterStatusWrapper onStatusChange={onStatusChange} />
|
|
27
|
+
<QuickStartCatalogFilterCountWrapper quickStartsCount={quickStartsCount} />
|
|
28
|
+
</ToolbarContent>
|
|
29
|
+
</Toolbar>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export default QuickStartCatalogFilter;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Badge,
|
|
4
|
+
MenuToggle,
|
|
5
|
+
MenuToggleElement,
|
|
6
|
+
SearchInput,
|
|
7
|
+
Select,
|
|
8
|
+
SelectList,
|
|
9
|
+
SelectOption,
|
|
10
|
+
ToolbarItem,
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
import { removeQueryArgument, setQueryArgument } from '@console/internal/components/utils';
|
|
13
|
+
import { history } from '../../ConsoleInternal/components/utils/router';
|
|
14
|
+
import { QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY } from '../../utils/const';
|
|
15
|
+
import { QuickStartContext, QuickStartContextValues } from '../../utils/quick-start-context';
|
|
16
|
+
|
|
17
|
+
export const QuickStartCatalogFilterSearch = ({ searchInputText, handleTextChange, ...props }) => {
|
|
18
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
19
|
+
return (
|
|
20
|
+
<ToolbarItem className="pfext-quick-start-catalog-filter__input">
|
|
21
|
+
<SearchInput
|
|
22
|
+
placeholder={getResource('Filter by keyword...')}
|
|
23
|
+
value={searchInputText}
|
|
24
|
+
onChange={(_ev, value) => handleTextChange(value)}
|
|
25
|
+
onClear={() => handleTextChange('')}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
</ToolbarItem>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const QuickStartCatalogFilterSelect = ({
|
|
33
|
+
isDropdownOpen,
|
|
34
|
+
setIsDropdownOpen,
|
|
35
|
+
onRowfilterSelect,
|
|
36
|
+
selectedFilters,
|
|
37
|
+
dropdownItems,
|
|
38
|
+
...props
|
|
39
|
+
}) => {
|
|
40
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
41
|
+
|
|
42
|
+
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
|
43
|
+
<MenuToggle
|
|
44
|
+
isFullWidth
|
|
45
|
+
ref={toggleRef}
|
|
46
|
+
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
|
47
|
+
isExpanded={isDropdownOpen}
|
|
48
|
+
>
|
|
49
|
+
{getResource('Status')}
|
|
50
|
+
{selectedFilters.length > 0 && <Badge isRead>{selectedFilters.length}</Badge>}
|
|
51
|
+
</MenuToggle>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<ToolbarItem>
|
|
56
|
+
<Select
|
|
57
|
+
aria-label={getResource('Select filter')}
|
|
58
|
+
isOpen={isDropdownOpen}
|
|
59
|
+
selected={selectedFilters}
|
|
60
|
+
onSelect={onRowfilterSelect}
|
|
61
|
+
onOpenChange={(isOpen) => setIsDropdownOpen(isOpen)}
|
|
62
|
+
toggle={toggle}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
<SelectList>{dropdownItems}</SelectList>
|
|
66
|
+
</Select>
|
|
67
|
+
</ToolbarItem>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const QuickStartCatalogFilterCount = ({ quickStartsCount }) => {
|
|
72
|
+
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
73
|
+
return (
|
|
74
|
+
<ToolbarItem
|
|
75
|
+
className="pfext-quick-start-catalog-filter__count"
|
|
76
|
+
align={{ default: 'alignRight' }}
|
|
77
|
+
>
|
|
78
|
+
{getResource('{{count, number}} item', quickStartsCount).replace(
|
|
79
|
+
'{{count, number}}',
|
|
80
|
+
quickStartsCount,
|
|
81
|
+
)}
|
|
82
|
+
</ToolbarItem>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
interface QuickStartCatalogFilterSearchWrapperProps {
|
|
87
|
+
onSearchInputChange: any;
|
|
88
|
+
}
|
|
89
|
+
export const QuickStartCatalogFilterSearchWrapper: React.FC<
|
|
90
|
+
QuickStartCatalogFilterSearchWrapperProps
|
|
91
|
+
> = ({ onSearchInputChange = () => {} }) => {
|
|
92
|
+
const { useQueryParams, filter, setFilter } =
|
|
93
|
+
React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
// use this effect to clear the search when a `clear all` action is performed higher up
|
|
96
|
+
const unlisten = history.listen(({ location }) => {
|
|
97
|
+
const searchParams = new URLSearchParams(location.search);
|
|
98
|
+
const searchQuery = searchParams.get(QUICKSTART_SEARCH_FILTER_KEY) || '';
|
|
99
|
+
if (searchQuery === '') {
|
|
100
|
+
setFilter('keyword', '');
|
|
101
|
+
onSearchInputChange('');
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return () => {
|
|
105
|
+
unlisten();
|
|
106
|
+
};
|
|
107
|
+
}, [onSearchInputChange, setFilter]);
|
|
108
|
+
const handleTextChange = (val: string) => {
|
|
109
|
+
if (val.length > 0) {
|
|
110
|
+
useQueryParams && setQueryArgument(QUICKSTART_SEARCH_FILTER_KEY, val);
|
|
111
|
+
} else {
|
|
112
|
+
useQueryParams && removeQueryArgument(QUICKSTART_SEARCH_FILTER_KEY);
|
|
113
|
+
}
|
|
114
|
+
if (filter?.keyword !== val) {
|
|
115
|
+
setFilter('keyword', val);
|
|
116
|
+
}
|
|
117
|
+
onSearchInputChange(val);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<QuickStartCatalogFilterSearch
|
|
122
|
+
searchInputText={filter?.keyword}
|
|
123
|
+
handleTextChange={handleTextChange}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// compare string/number arrays
|
|
129
|
+
export const equalsIgnoreOrder = (a: any[], b: any[]) => {
|
|
130
|
+
if (a.length !== b.length) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
const uniqueValues = new Set([...a, ...b]);
|
|
134
|
+
for (const v of uniqueValues) {
|
|
135
|
+
const aCount = a.filter((e) => e === v).length;
|
|
136
|
+
const bCount = b.filter((e) => e === v).length;
|
|
137
|
+
if (aCount !== bCount) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
interface QuickStartCatalogFilterStatusWrapperProps {
|
|
145
|
+
onStatusChange: any;
|
|
146
|
+
}
|
|
147
|
+
export const QuickStartCatalogFilterStatusWrapper: React.FC<
|
|
148
|
+
QuickStartCatalogFilterStatusWrapperProps
|
|
149
|
+
> = ({ onStatusChange = () => {} }) => {
|
|
150
|
+
const { useQueryParams, filter, setFilter } =
|
|
151
|
+
React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
152
|
+
React.useEffect(() => {
|
|
153
|
+
// use this effect to clear the status when a `clear all` action is performed higher up
|
|
154
|
+
const unlisten = history.listen(({ location }) => {
|
|
155
|
+
const searchParams = new URLSearchParams(location.search);
|
|
156
|
+
const updatedStatusFilters = searchParams.get(QUICKSTART_STATUS_FILTER_KEY)?.split(',') || [];
|
|
157
|
+
if (updatedStatusFilters.length === 0) {
|
|
158
|
+
setFilter('status', []);
|
|
159
|
+
onStatusChange([]);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return () => {
|
|
163
|
+
unlisten();
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
|
|
167
|
+
|
|
168
|
+
const onRowfilterSelect = React.useCallback(
|
|
169
|
+
(_e, selectedValue) => {
|
|
170
|
+
setIsDropdownOpen(false);
|
|
171
|
+
const selection = Object.entries(filter.status.statusTypes).find(
|
|
172
|
+
([_key, value]) => value === selectedValue,
|
|
173
|
+
)[0];
|
|
174
|
+
const selectedFiltersList = filter.status.statusFilters.includes(selection)
|
|
175
|
+
? filter.status.statusFilters.filter((status) => status !== selection)
|
|
176
|
+
: [...filter.status.statusFilters, selection];
|
|
177
|
+
if (!equalsIgnoreOrder(filter.status.statusFilters, selectedFiltersList)) {
|
|
178
|
+
setFilter('status', selectedFiltersList);
|
|
179
|
+
}
|
|
180
|
+
if (selectedFiltersList.length > 0) {
|
|
181
|
+
useQueryParams && setQueryArgument('status', selectedFiltersList.join(','));
|
|
182
|
+
} else {
|
|
183
|
+
useQueryParams && removeQueryArgument(QUICKSTART_STATUS_FILTER_KEY);
|
|
184
|
+
}
|
|
185
|
+
onStatusChange(selectedFiltersList);
|
|
186
|
+
},
|
|
187
|
+
[filter.status.statusFilters, onStatusChange, setFilter, useQueryParams],
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const dropdownItems = Object.entries(filter.status.statusTypes).map(([key, value]) => (
|
|
191
|
+
<SelectOption
|
|
192
|
+
key={key}
|
|
193
|
+
data-key={key}
|
|
194
|
+
value={value}
|
|
195
|
+
hasCheckbox
|
|
196
|
+
isSelected={filter.status.statusFilters.includes(key)}
|
|
197
|
+
>
|
|
198
|
+
<>{value}</>
|
|
199
|
+
</SelectOption>
|
|
200
|
+
));
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<QuickStartCatalogFilterSelect
|
|
204
|
+
isDropdownOpen={isDropdownOpen}
|
|
205
|
+
setIsDropdownOpen={setIsDropdownOpen}
|
|
206
|
+
onRowfilterSelect={onRowfilterSelect}
|
|
207
|
+
selectedFilters={filter.status.statusFilters}
|
|
208
|
+
dropdownItems={dropdownItems}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
interface QuickStartCatalogFilterCountWrapperProps {
|
|
214
|
+
quickStartsCount: number;
|
|
215
|
+
}
|
|
216
|
+
export const QuickStartCatalogFilterCountWrapper: React.FC<
|
|
217
|
+
QuickStartCatalogFilterCountWrapperProps
|
|
218
|
+
> = ({ quickStartsCount }) => <QuickStartCatalogFilterCount quickStartsCount={quickStartsCount} />;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Gallery, GalleryItem } from '@patternfly/react-core';
|
|
3
|
+
import { shallow } from 'enzyme';
|
|
4
|
+
import { EmptyBox } from '@console/internal/components/utils';
|
|
5
|
+
import { getQuickStarts } from '../../data/test-utils';
|
|
6
|
+
import { QuickStartCatalogPage } from '../../QuickStartCatalogPage';
|
|
7
|
+
import QuickStartCatalog from '../QuickStartCatalog';
|
|
8
|
+
|
|
9
|
+
jest.mock('@console/shared', () => {
|
|
10
|
+
const ActualShared = require.requireActual('@console/shared');
|
|
11
|
+
return {
|
|
12
|
+
...ActualShared,
|
|
13
|
+
useQueryParams: () => new Map(),
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('QuickStartCatalog', () => {
|
|
18
|
+
it('should load an emptybox if no QS exist', () => {
|
|
19
|
+
const QuickStartCatalogProps = { quickStarts: [], onClick: jest.fn() };
|
|
20
|
+
const QuickStartCatalogWrapper = shallow(<QuickStartCatalogPage {...QuickStartCatalogProps} />);
|
|
21
|
+
expect(QuickStartCatalogWrapper.find(EmptyBox).exists()).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
it('should load a gallery if QS exist', () => {
|
|
24
|
+
const QuickStartCatalogProps = { quickStarts: getQuickStarts(), onClick: jest.fn() };
|
|
25
|
+
const QuickStartCatalogWrapper = shallow(<QuickStartCatalog {...QuickStartCatalogProps} />);
|
|
26
|
+
expect(QuickStartCatalogWrapper.find(Gallery).exists()).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
it('should load galleryItems equal to the number of QS', () => {
|
|
29
|
+
const QuickStartCatalogProps = { quickStarts: getQuickStarts(), onClick: jest.fn() };
|
|
30
|
+
const QuickStartCatalogWrapper = shallow(<QuickStartCatalog {...QuickStartCatalogProps} />);
|
|
31
|
+
const galleryItems = QuickStartCatalogWrapper.find(GalleryItem);
|
|
32
|
+
expect(galleryItems.exists()).toBeTruthy();
|
|
33
|
+
expect(galleryItems.length).toEqual(getQuickStarts().length);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CatalogTile } from '@patternfly/react-catalog-view-extension';
|
|
3
|
+
import { shallow } from 'enzyme';
|
|
4
|
+
import { getQuickStarts } from '../../data/test-utils';
|
|
5
|
+
import { QuickStartStatus } from '../../utils/quick-start-types';
|
|
6
|
+
import QuickStartTile from '../QuickStartTile';
|
|
7
|
+
|
|
8
|
+
describe('QuickStartTile', () => {
|
|
9
|
+
const quickstarts = getQuickStarts();
|
|
10
|
+
|
|
11
|
+
it('should load proper catalog tile without featured property', () => {
|
|
12
|
+
const wrapper = shallow(
|
|
13
|
+
<QuickStartTile
|
|
14
|
+
quickStart={quickstarts[0]}
|
|
15
|
+
status={QuickStartStatus.NOT_STARTED}
|
|
16
|
+
onClick={jest.fn()}
|
|
17
|
+
isActive={false}
|
|
18
|
+
/>,
|
|
19
|
+
);
|
|
20
|
+
const catalogTile = wrapper.find(CatalogTile);
|
|
21
|
+
expect(catalogTile.exists()).toBeTruthy();
|
|
22
|
+
expect(catalogTile.prop('featured')).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should load proper catalog tile with featured property', () => {
|
|
26
|
+
const wrapper = shallow(
|
|
27
|
+
<QuickStartTile
|
|
28
|
+
quickStart={quickstarts[1]}
|
|
29
|
+
status={QuickStartStatus.IN_PROGRESS}
|
|
30
|
+
onClick={jest.fn()}
|
|
31
|
+
isActive
|
|
32
|
+
/>,
|
|
33
|
+
);
|
|
34
|
+
const catalogTile = wrapper.find(CatalogTile);
|
|
35
|
+
expect(catalogTile.exists()).toBeTruthy();
|
|
36
|
+
expect(catalogTile.prop('featured')).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Popover, Text } from '@patternfly/react-core';
|
|
3
|
+
import { shallow } from 'enzyme';
|
|
4
|
+
import { getQuickStarts } from '../../data/test-utils';
|
|
5
|
+
import QuickStartTileDescription from '../QuickStartTileDescription';
|
|
6
|
+
|
|
7
|
+
jest.mock('react', () => {
|
|
8
|
+
const ActualReact = require.requireActual('react');
|
|
9
|
+
return {
|
|
10
|
+
...ActualReact,
|
|
11
|
+
useContext: () => jest.fn(),
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('QuickStartCatalog', () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
spyOn(React, 'useContext').and.returnValue({
|
|
18
|
+
activeQuickStartID: '',
|
|
19
|
+
startQuickStart: () => {},
|
|
20
|
+
restartQuickStart: () => {},
|
|
21
|
+
getResource: (key) => `quickstart~${key}`,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should show prerequisites only if provided', () => {
|
|
26
|
+
// this quick start does not have prereqs
|
|
27
|
+
const quickStart = getQuickStarts()[0].spec;
|
|
28
|
+
const QuickStartTileDescriptionWrapper = shallow(
|
|
29
|
+
<QuickStartTileDescription description={quickStart.description} />,
|
|
30
|
+
);
|
|
31
|
+
expect(QuickStartTileDescriptionWrapper.find(Text)).toHaveLength(0);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('shoould render prerequisites inside a popover', () => {
|
|
35
|
+
const quickStart = getQuickStarts()[2].spec;
|
|
36
|
+
const QuickStartTileDescriptionWrapper = shallow(
|
|
37
|
+
<QuickStartTileDescription
|
|
38
|
+
description={quickStart.description}
|
|
39
|
+
prerequisites={quickStart.prerequisites}
|
|
40
|
+
/>,
|
|
41
|
+
);
|
|
42
|
+
expect(QuickStartTileDescriptionWrapper.find(Popover)).toHaveLength(1);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as QuickStartCatalog } from './QuickStartCatalog';
|
|
2
|
+
export { default as QuickStartCatalogFilter } from './Toolbar/QuickStartCatalogFilter';
|
|
3
|
+
export { default as QuickStartTile } from './QuickStartTile';
|
|
4
|
+
export { default as QuickStartTileDescription } from './QuickStartTileDescription';
|
|
5
|
+
export { default as QuickStartTileFooter } from './QuickStartTileFooter';
|
|
6
|
+
export { default as QuickStartTileFooterExternal } from './QuickStartTileFooterExternal';
|
|
7
|
+
export { default as QuickStartTileHeader, QuickstartAction } from './QuickStartTileHeader';
|
|
8
|
+
export * from './Toolbar/QuickStartCatalogFilterItems';
|
|
9
|
+
export * from './Catalog';
|