@patternfly/quickstarts 2.2.1 → 2.2.4

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.
Files changed (203) hide show
  1. package/README.md +20 -20
  2. package/dist/ConsoleShared/src/components/markdown-extensions/code-extension.d.ts +7 -0
  3. package/dist/ConsoleShared/src/components/markdown-extensions/index.d.ts +1 -0
  4. package/dist/HelpTopicDrawer.d.ts +8 -2
  5. package/dist/QuickStartDrawer.d.ts +21 -2
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.es.js +127 -21
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/index.js +126 -19
  10. package/dist/index.js.map +1 -1
  11. package/dist/patternfly-docs/quick-starts/design-guidelines/design-guidelines.md +105 -0
  12. package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements copy.png +0 -0
  13. package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements.png +0 -0
  14. package/dist/patternfly-docs/quick-starts/design-guidelines/img/catalog-elements.png +0 -0
  15. package/dist/patternfly-docs/quick-starts/design-guidelines/img/check-your-work.png +0 -0
  16. package/dist/patternfly-docs/quick-starts/design-guidelines/img/introduction-screen.png +0 -0
  17. package/dist/patternfly-docs/quick-starts/design-guidelines/img/mixed-catalog.png +0 -0
  18. package/dist/patternfly-docs/quick-starts/design-guidelines/img/prerequisites.png +0 -0
  19. package/dist/patternfly-docs/quick-starts/design-guidelines/img/qs-context.png +0 -0
  20. package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-elements.png +0 -0
  21. package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-resized.png +0 -0
  22. package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel.png +0 -0
  23. package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-no.png +0 -0
  24. package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-yes.png +0 -0
  25. package/dist/patternfly-docs/quick-starts/design-guidelines/img/task.png +0 -0
  26. package/dist/patternfly-docs/quick-starts/examples/Basic.jsx +73 -0
  27. package/dist/patternfly-docs/quick-starts/examples/HelpTopic.jsx +53 -0
  28. package/dist/patternfly-docs/quick-starts/examples/about.md +77 -0
  29. package/dist/patternfly-docs/quick-starts/examples/basic.md +27 -0
  30. package/dist/patternfly-docs/quick-starts/examples/example-data/example-help-topics.js +173 -0
  31. package/dist/patternfly-docs/quick-starts/examples/example-data/example-quickstarts.js +215 -0
  32. package/dist/patternfly-docs/quick-starts/examples/example-data/index.js +15 -0
  33. package/dist/patternfly-docs/quick-starts/examples/help-topics.md +25 -0
  34. package/dist/patternfly-docs/quick-starts/examples/img/catalog.png +0 -0
  35. package/dist/patternfly-docs/quick-starts/examples/img/help-topic.png +0 -0
  36. package/dist/patternfly-docs/quick-starts/examples/img/side-panel.png +0 -0
  37. package/dist/patternfly-nested.css +11 -1
  38. package/dist/quickstarts-base.css +49 -11
  39. package/dist/quickstarts-full.es.js +451 -305
  40. package/dist/quickstarts-full.es.js.map +1 -1
  41. package/dist/quickstarts-standalone.css +5 -15
  42. package/dist/quickstarts-standalone.min.css +1 -1
  43. package/dist/quickstarts.css +49 -11
  44. package/dist/quickstarts.min.css +1 -1
  45. package/dist/utils/asciidoc-procedure-parser.d.ts +12 -0
  46. package/dist/utils/help-topic-types.d.ts +7 -1
  47. package/package.json +11 -4
  48. package/src/ConsoleInternal/components/_icon-and-text.scss +14 -0
  49. package/src/ConsoleInternal/components/_markdown-view.scss +19 -0
  50. package/src/ConsoleInternal/components/catalog/_catalog.scss +390 -0
  51. package/src/ConsoleInternal/components/markdown-view.tsx +305 -0
  52. package/src/ConsoleInternal/components/utils/_status-box.scss +58 -0
  53. package/src/ConsoleInternal/components/utils/camel-case-wrap.tsx +33 -0
  54. package/src/ConsoleInternal/components/utils/index.tsx +3 -0
  55. package/src/ConsoleInternal/components/utils/router.ts +47 -0
  56. package/src/ConsoleInternal/components/utils/status-box.tsx +94 -0
  57. package/src/ConsoleInternal/module/k8s/types.ts +53 -0
  58. package/src/ConsoleShared/index.ts +1 -0
  59. package/src/ConsoleShared/src/components/index.ts +7 -0
  60. package/src/ConsoleShared/src/components/layout/PageLayout.scss +29 -0
  61. package/src/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.tsx +93 -0
  62. package/src/ConsoleShared/src/components/markdown-extensions/__tests__/MarkdownCopyClipboard.spec.tsx +25 -0
  63. package/src/ConsoleShared/src/components/markdown-extensions/__tests__/test-data.ts +5 -0
  64. package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +66 -0
  65. package/src/ConsoleShared/src/components/markdown-extensions/code-extension.tsx +25 -0
  66. package/src/ConsoleShared/src/components/markdown-extensions/const.ts +3 -0
  67. package/src/ConsoleShared/src/components/markdown-extensions/index.ts +5 -0
  68. package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +45 -0
  69. package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +50 -0
  70. package/src/ConsoleShared/src/components/markdown-extensions/showdown-extension.scss +52 -0
  71. package/src/ConsoleShared/src/components/markdown-extensions/utils.ts +3 -0
  72. package/src/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.tsx +64 -0
  73. package/src/ConsoleShared/src/components/markdown-highlight-extension/highlight-consts.ts +9 -0
  74. package/src/ConsoleShared/src/components/markdown-highlight-extension/index.ts +1 -0
  75. package/src/ConsoleShared/src/components/modal/Modal.scss +3 -0
  76. package/src/ConsoleShared/src/components/modal/Modal.tsx +19 -0
  77. package/src/ConsoleShared/src/components/modal/index.ts +1 -0
  78. package/src/ConsoleShared/src/components/popper/Portal.tsx +23 -0
  79. package/src/ConsoleShared/src/components/popper/SimplePopper.tsx +90 -0
  80. package/src/ConsoleShared/src/components/popper/index.ts +2 -0
  81. package/src/ConsoleShared/src/components/spotlight/InteractiveSpotlight.tsx +58 -0
  82. package/src/ConsoleShared/src/components/spotlight/Spotlight.tsx +35 -0
  83. package/src/ConsoleShared/src/components/spotlight/StaticSpotlight.tsx +32 -0
  84. package/src/ConsoleShared/src/components/spotlight/index.ts +1 -0
  85. package/src/ConsoleShared/src/components/spotlight/spotlight.scss +63 -0
  86. package/src/ConsoleShared/src/components/status/GenericStatus.tsx +33 -0
  87. package/src/ConsoleShared/src/components/status/NotStartedIcon.tsx +27 -0
  88. package/src/ConsoleShared/src/components/status/PopoverStatus.tsx +42 -0
  89. package/src/ConsoleShared/src/components/status/Status.tsx +38 -0
  90. package/src/ConsoleShared/src/components/status/StatusIconAndText.tsx +42 -0
  91. package/src/ConsoleShared/src/components/status/icons.tsx +77 -0
  92. package/src/ConsoleShared/src/components/status/index.tsx +1 -0
  93. package/src/ConsoleShared/src/components/status/statuses.tsx +36 -0
  94. package/src/ConsoleShared/src/components/status/types.ts +7 -0
  95. package/src/ConsoleShared/src/components/utils/FallbackImg.tsx +20 -0
  96. package/src/ConsoleShared/src/components/utils/index.ts +1 -0
  97. package/src/ConsoleShared/src/constants/index.ts +1 -0
  98. package/src/ConsoleShared/src/constants/ui.ts +1 -0
  99. package/src/ConsoleShared/src/hooks/index.ts +6 -0
  100. package/src/ConsoleShared/src/hooks/scroll.ts +52 -0
  101. package/src/ConsoleShared/src/hooks/useBoundingClientRect.ts +18 -0
  102. package/src/ConsoleShared/src/hooks/useEventListener.ts +14 -0
  103. package/src/ConsoleShared/src/hooks/useForceRender.ts +6 -0
  104. package/src/ConsoleShared/src/hooks/useResizeObserver.ts +20 -0
  105. package/src/ConsoleShared/src/hooks/useScrollShadows.ts +45 -0
  106. package/src/ConsoleShared/src/index.ts +4 -0
  107. package/src/ConsoleShared/src/utils/index.ts +1 -0
  108. package/src/ConsoleShared/src/utils/useCombineRefs.ts +17 -0
  109. package/src/HelpTopicDrawer.tsx +124 -0
  110. package/src/HelpTopicPanelContent.tsx +152 -0
  111. package/src/QuickStartCatalogPage.tsx +190 -0
  112. package/src/QuickStartCloseModal.tsx +47 -0
  113. package/src/QuickStartController.tsx +113 -0
  114. package/src/QuickStartDrawer.scss +11 -0
  115. package/src/QuickStartDrawer.tsx +265 -0
  116. package/src/QuickStartMarkdownView.tsx +75 -0
  117. package/src/QuickStartPanelContent.scss +46 -0
  118. package/src/QuickStartPanelContent.tsx +153 -0
  119. package/src/__tests__/quick-start-utils.spec.tsx +16 -0
  120. package/src/catalog/Catalog/QuickStartCatalogHeader.tsx +18 -0
  121. package/src/catalog/Catalog/QuickStartCatalogSection.tsx +9 -0
  122. package/src/catalog/Catalog/QuickStartCatalogToolbar.tsx +12 -0
  123. package/src/catalog/Catalog/index.ts +3 -0
  124. package/src/catalog/QuickStartCatalog.scss +8 -0
  125. package/src/catalog/QuickStartCatalog.tsx +42 -0
  126. package/src/catalog/QuickStartTile.scss +11 -0
  127. package/src/catalog/QuickStartTile.tsx +105 -0
  128. package/src/catalog/QuickStartTileDescription.scss +29 -0
  129. package/src/catalog/QuickStartTileDescription.tsx +79 -0
  130. package/src/catalog/QuickStartTileFooter.tsx +101 -0
  131. package/src/catalog/QuickStartTileFooterExternal.tsx +40 -0
  132. package/src/catalog/QuickStartTileHeader.scss +12 -0
  133. package/src/catalog/QuickStartTileHeader.tsx +77 -0
  134. package/src/catalog/Toolbar/QuickStartCatalogFilter.scss +25 -0
  135. package/src/catalog/Toolbar/QuickStartCatalogFilter.tsx +34 -0
  136. package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +199 -0
  137. package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +35 -0
  138. package/src/catalog/__tests__/QuickStartTile.spec.tsx +38 -0
  139. package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +44 -0
  140. package/src/catalog/index.ts +9 -0
  141. package/src/controller/QuickStartConclusion.tsx +63 -0
  142. package/src/controller/QuickStartContent.scss +12 -0
  143. package/src/controller/QuickStartContent.tsx +72 -0
  144. package/src/controller/QuickStartFooter.scss +13 -0
  145. package/src/controller/QuickStartFooter.tsx +128 -0
  146. package/src/controller/QuickStartIntroduction.scss +35 -0
  147. package/src/controller/QuickStartIntroduction.tsx +66 -0
  148. package/src/controller/QuickStartTaskHeader.scss +58 -0
  149. package/src/controller/QuickStartTaskHeader.tsx +116 -0
  150. package/src/controller/QuickStartTaskHeaderList.scss +17 -0
  151. package/src/controller/QuickStartTaskHeaderList.tsx +35 -0
  152. package/src/controller/QuickStartTaskReview.scss +30 -0
  153. package/src/controller/QuickStartTaskReview.tsx +81 -0
  154. package/src/controller/QuickStartTasks.scss +89 -0
  155. package/src/controller/QuickStartTasks.tsx +75 -0
  156. package/src/controller/__tests__/QuickStartConclusion.spec.tsx +95 -0
  157. package/src/controller/__tests__/QuickStartContent.spec.tsx +52 -0
  158. package/src/controller/__tests__/QuickStartFooter.spec.tsx +148 -0
  159. package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +56 -0
  160. package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +45 -0
  161. package/src/controller/__tests__/QuickStartTasks.spec.tsx +81 -0
  162. package/src/data/mocks/json/explore-pipeline-quickstart.ts +66 -0
  163. package/src/data/mocks/json/explore-serverless-quickstart.ts +90 -0
  164. package/src/data/mocks/json/monitor-sampleapp-quickstart.ts +77 -0
  165. package/src/data/mocks/json/tour-icons.ts +3 -0
  166. package/src/data/mocks/yamls/add-healthchecks-quickstart.yaml +67 -0
  167. package/src/data/mocks/yamls/explore-pipeline-quickstart.yaml +57 -0
  168. package/src/data/mocks/yamls/explore-serverless-quickstart.yaml +83 -0
  169. package/src/data/mocks/yamls/install-associate-pipeline-quickstart.yaml +74 -0
  170. package/src/data/mocks/yamls/monitor-sampleapp-quickstart.yaml +66 -0
  171. package/src/data/mocks/yamls/sample-application-quickstart.yaml +97 -0
  172. package/src/data/mocks/yamls/serverless-application-quickstart.yaml +141 -0
  173. package/src/data/quick-start-test-data.ts +10 -0
  174. package/src/data/test-utils.ts +11 -0
  175. package/src/declaration.d.ts +2 -0
  176. package/src/index.ts +17 -0
  177. package/src/locales/en/quickstart.json +46 -0
  178. package/src/styles/_base.scss +54 -0
  179. package/src/styles/_dark-custom-override.scss +62 -0
  180. package/src/styles/legacy-bootstrap/README.md +21 -0
  181. package/src/styles/legacy-bootstrap/_code.scss +44 -0
  182. package/src/styles/legacy-bootstrap/_tables.scss +38 -0
  183. package/src/styles/legacy-bootstrap/_type.scss +90 -0
  184. package/src/styles/legacy-bootstrap/_variables.scss +48 -0
  185. package/src/styles/legacy-bootstrap.scss +5 -0
  186. package/src/styles/patternfly-global-entry.ts +1 -0
  187. package/src/styles/patternfly-global.scss +28 -0
  188. package/src/styles/patternfly-nested-entry.ts +1 -0
  189. package/src/styles/patternfly-nested.scss +18 -0
  190. package/src/styles/quickstarts-standalone-entry.ts +1 -0
  191. package/src/styles/quickstarts-standalone.scss +7 -0
  192. package/src/styles/style.scss +12 -0
  193. package/src/styles/vendor-entry.ts +1 -0
  194. package/src/styles/vendor.scss +7 -0
  195. package/src/utils/PluralResolver.ts +356 -0
  196. package/src/utils/asciidoc-procedure-parser.ts +132 -0
  197. package/src/utils/const.ts +10 -0
  198. package/src/utils/help-topic-context.tsx +74 -0
  199. package/src/utils/help-topic-types.ts +16 -0
  200. package/src/utils/quick-start-context.tsx +477 -0
  201. package/src/utils/quick-start-types.ts +72 -0
  202. package/src/utils/quick-start-utils.ts +92 -0
  203. package/src/utils/useLocalStorage.ts +38 -0
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import QuickStartMarkdownView from '../QuickStartMarkdownView';
3
+ import { QUICKSTART_TASKS_INITIAL_STATES } from '../utils/const';
4
+ import { QuickStartContext, QuickStartContextValues } from '../utils/quick-start-context';
5
+ import { QuickStartTask, QuickStartTaskStatus } from '../utils/quick-start-types';
6
+ import TaskHeader from './QuickStartTaskHeader';
7
+ import QuickStartTaskReview from './QuickStartTaskReview';
8
+
9
+ import './QuickStartTasks.scss';
10
+
11
+ type QuickStartTaskProps = {
12
+ tasks: QuickStartTask[];
13
+ taskNumber: number;
14
+ allTaskStatuses: QuickStartTaskStatus[];
15
+ onTaskReview: (reviewState: QuickStartTaskStatus) => void;
16
+ onTaskSelect: (activeQuickStartId) => void;
17
+ };
18
+
19
+ const QuickStartTasks: React.FC<QuickStartTaskProps> = ({
20
+ tasks,
21
+ taskNumber,
22
+ allTaskStatuses,
23
+ onTaskReview,
24
+ onTaskSelect,
25
+ }) => {
26
+ const { getResource, alwaysShowTaskReview } = React.useContext<QuickStartContextValues>(
27
+ QuickStartContext,
28
+ );
29
+ return (
30
+ <div className="pfext-quick-start-tasks__list">
31
+ <ul>
32
+ {tasks
33
+ .filter((_, index) => allTaskStatuses[index] !== QuickStartTaskStatus.INIT)
34
+ .map((task, index) => {
35
+ const { title, description, review } = task;
36
+ const isActiveTask = index === taskNumber;
37
+ const taskStatus = allTaskStatuses[index];
38
+ const shouldShowTaskReview =
39
+ (!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) || alwaysShowTaskReview) &&
40
+ review;
41
+ return (
42
+ <React.Fragment key={title}>
43
+ <TaskHeader
44
+ taskIndex={index + 1}
45
+ title={title}
46
+ size="md"
47
+ subtitle={getResource('{{index, number}} of {{tasks, number}}')
48
+ .replace('{{index, number}}', index + 1)
49
+ .replace('{{tasks, number}}', tasks.length)}
50
+ taskStatus={taskStatus}
51
+ isActiveTask={isActiveTask}
52
+ onTaskSelect={onTaskSelect}
53
+ >
54
+ {isActiveTask && (
55
+ <div className="pfext-quick-start-task__content">
56
+ <QuickStartMarkdownView content={description} />
57
+ {shouldShowTaskReview && (
58
+ <QuickStartTaskReview
59
+ review={review}
60
+ taskStatus={taskStatus}
61
+ onTaskReview={onTaskReview}
62
+ />
63
+ )}
64
+ </div>
65
+ )}
66
+ </TaskHeader>
67
+ </React.Fragment>
68
+ );
69
+ })}
70
+ </ul>
71
+ </div>
72
+ );
73
+ };
74
+
75
+ export default QuickStartTasks;
@@ -0,0 +1,95 @@
1
+ import * as React from 'react';
2
+ import { Button } from '@patternfly/react-core';
3
+ import { ShallowWrapper, shallow } from 'enzyme';
4
+ import { allQuickStarts } from '../../data/quick-start-test-data';
5
+ import QuickStartMarkdownView from '../../QuickStartMarkdownView';
6
+ import { QuickStartTaskStatus } from '../../utils/quick-start-types';
7
+ import { getQuickStartByName } from '../../utils/quick-start-utils';
8
+ import QuickStartConclusion from '../QuickStartConclusion';
9
+
10
+ jest.mock('react', () => {
11
+ const ActualReact = require.requireActual('react');
12
+ return {
13
+ ...ActualReact,
14
+ useContext: () => jest.fn(),
15
+ };
16
+ });
17
+
18
+ const i18nNS = 'quickstart';
19
+
20
+ type QuickStartConclusionProps = React.ComponentProps<typeof QuickStartConclusion>;
21
+ let wrapper: ShallowWrapper<QuickStartConclusionProps>;
22
+ const props: QuickStartConclusionProps = {
23
+ tasks: getQuickStartByName('explore-pipelines', allQuickStarts).spec.tasks,
24
+ allTaskStatuses: [
25
+ QuickStartTaskStatus.SUCCESS,
26
+ QuickStartTaskStatus.SUCCESS,
27
+ QuickStartTaskStatus.SUCCESS,
28
+ ],
29
+ conclusion: 'conclusion',
30
+ onTaskSelect: jest.fn(),
31
+ onQuickStartChange: jest.fn(),
32
+ };
33
+
34
+ describe('QuickStartConclusion', () => {
35
+ beforeEach(() => {
36
+ spyOn(React, 'useContext').and.returnValue({
37
+ activeQuickStartID: '',
38
+ startQuickStart: () => {},
39
+ restartQuickStart: () => {},
40
+ getResource: (key) => `quickstart~${key}`,
41
+ });
42
+ wrapper = shallow(<QuickStartConclusion {...props} />);
43
+ });
44
+
45
+ it('should render conclusion if there are no failed tasks', () => {
46
+ expect(
47
+ wrapper
48
+ .find(QuickStartMarkdownView)
49
+ .first()
50
+ .props().content,
51
+ ).toEqual('conclusion');
52
+ });
53
+
54
+ it('should render link for next quick start if nextQuickStart prop is available and there are no failed tasks', () => {
55
+ wrapper = shallow(
56
+ <QuickStartConclusion
57
+ {...props}
58
+ nextQuickStarts={[getQuickStartByName('explore-pipelines', allQuickStarts)]}
59
+ />,
60
+ );
61
+ expect(
62
+ wrapper
63
+ .find(Button)
64
+ .at(0)
65
+ .props().children[0],
66
+ ).toEqual(`${i18nNS}~Start Installing the Pipelines Operator quick start`);
67
+ });
68
+
69
+ it('should not render link for next quick start if nextQuickStart props is not available', () => {
70
+ expect(wrapper.find(Button).length).toBe(0);
71
+ });
72
+
73
+ it('should not render conclusion, link for next quick start and should render message for retrying if there are failed tasks', () => {
74
+ wrapper = shallow(
75
+ <QuickStartConclusion
76
+ {...props}
77
+ nextQuickStart={getQuickStartByName('explore-pipelines', allQuickStarts)}
78
+ allTaskStatuses={[
79
+ QuickStartTaskStatus.FAILED,
80
+ QuickStartTaskStatus.SUCCESS,
81
+ QuickStartTaskStatus.SUCCESS,
82
+ ]}
83
+ />,
84
+ );
85
+ expect(
86
+ wrapper
87
+ .find(QuickStartMarkdownView)
88
+ .first()
89
+ .props().content,
90
+ ).toEqual(
91
+ `${i18nNS}~One or more verifications did not pass during this quick start. Revisit the tasks or the help links, and then try again.`,
92
+ );
93
+ expect(wrapper.find(Button).length).toBe(0);
94
+ });
95
+ });
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+ import { ShallowWrapper, shallow } from 'enzyme';
3
+ import { allQuickStarts } from '../../data/quick-start-test-data';
4
+ import { QuickStartTaskStatus } from '../../utils/quick-start-types';
5
+ import { getQuickStartByName } from '../../utils/quick-start-utils';
6
+ import QuickStartConclusion from '../QuickStartConclusion';
7
+ import QuickStartContent from '../QuickStartContent';
8
+ import QuickStartIntroduction from '../QuickStartIntroduction';
9
+ import QuickStartTasks from '../QuickStartTasks';
10
+
11
+ type QuickStartContentProps = React.ComponentProps<typeof QuickStartContent>;
12
+
13
+ let wrapper: ShallowWrapper<QuickStartContentProps>;
14
+
15
+ const props: QuickStartContentProps = {
16
+ quickStart: getQuickStartByName('explore-serverless', allQuickStarts),
17
+ allTaskStatuses: [
18
+ QuickStartTaskStatus.INIT,
19
+ QuickStartTaskStatus.INIT,
20
+ QuickStartTaskStatus.INIT,
21
+ ],
22
+ taskNumber: -1,
23
+ onTaskReview: jest.fn(),
24
+ onTaskSelect: jest.fn(),
25
+ onQuickStartChange: jest.fn(),
26
+ };
27
+
28
+ describe('QuickStartContent', () => {
29
+ beforeEach(() => {
30
+ wrapper = shallow(<QuickStartContent {...props} />);
31
+ });
32
+
33
+ it('should render QuickStartIntroduction when the tour status is Not Started', () => {
34
+ expect(wrapper.find(QuickStartIntroduction).length).toBe(1);
35
+ expect(wrapper.find(QuickStartTasks).length).toBe(0);
36
+ expect(wrapper.find(QuickStartConclusion).length).toBe(0);
37
+ });
38
+
39
+ it('should render QuickStartTasks when the tour is In Progress', () => {
40
+ wrapper = shallow(<QuickStartContent {...props} taskNumber={1} />);
41
+ expect(wrapper.find(QuickStartIntroduction).length).toBe(0);
42
+ expect(wrapper.find(QuickStartTasks).length).toBe(1);
43
+ expect(wrapper.find(QuickStartConclusion).length).toBe(0);
44
+ });
45
+
46
+ it('should render QuickStartConclusion when the tour is Complete', () => {
47
+ wrapper = shallow(<QuickStartContent {...props} taskNumber={2} />);
48
+ expect(wrapper.find(QuickStartIntroduction).length).toBe(0);
49
+ expect(wrapper.find(QuickStartTasks).length).toBe(0);
50
+ expect(wrapper.find(QuickStartConclusion).length).toBe(1);
51
+ });
52
+ });
@@ -0,0 +1,148 @@
1
+ import * as React from 'react';
2
+ import { Button } from '@patternfly/react-core';
3
+ import { shallow } from 'enzyme';
4
+ import { QuickStartStatus } from '../../utils/quick-start-types';
5
+ import QuickStartFooter from '../QuickStartFooter';
6
+
7
+ jest.mock('react', () => {
8
+ const ActualReact = require.requireActual('react');
9
+ return {
10
+ ...ActualReact,
11
+ useContext: () => jest.fn(),
12
+ };
13
+ });
14
+
15
+ describe('QuickStartFooter', () => {
16
+ type QuickStartFooterProps = React.ComponentProps<typeof QuickStartFooter>;
17
+ let quickStartFooterProps: QuickStartFooterProps;
18
+ beforeEach(() => {
19
+ spyOn(React, 'useContext').and.returnValue({
20
+ activeQuickStartID: '',
21
+ startQuickStart: () => {},
22
+ restartQuickStart: () => {},
23
+ getResource: (key) => `quickstart~${key}`,
24
+ });
25
+ });
26
+
27
+ it('should load Start button for not started tours', () => {
28
+ quickStartFooterProps = {
29
+ status: QuickStartStatus.NOT_STARTED,
30
+ footerClass: 'test',
31
+ quickStartId: 'test-quickstart',
32
+ onNext: () => null,
33
+ onBack: () => null,
34
+ totalTasks: 4,
35
+ taskNumber: -1,
36
+ };
37
+
38
+ const quickStartFooterWrapper = shallow(<QuickStartFooter {...quickStartFooterProps} />);
39
+ const footerButtons = quickStartFooterWrapper.find(Button);
40
+ expect(footerButtons.exists()).toBeTruthy();
41
+ expect(footerButtons.length).toEqual(1);
42
+ expect(
43
+ footerButtons
44
+ .at(0)
45
+ .childAt(0)
46
+ .text(),
47
+ ).toBe('quickstart~Start');
48
+ });
49
+
50
+ it('should load Continue and Restart buttons for in progress tours at into page', () => {
51
+ quickStartFooterProps = {
52
+ status: QuickStartStatus.IN_PROGRESS,
53
+ footerClass: 'test',
54
+ quickStartId: 'test-quickstart',
55
+ onNext: () => null,
56
+ onBack: () => null,
57
+ totalTasks: 4,
58
+ taskNumber: -1,
59
+ };
60
+
61
+ const quickStartFooterWrapper = shallow(<QuickStartFooter {...quickStartFooterProps} />);
62
+ const footerButtons = quickStartFooterWrapper.find(Button);
63
+ expect(footerButtons.exists()).toBeTruthy();
64
+ expect(footerButtons.length).toEqual(2);
65
+ expect(
66
+ footerButtons
67
+ .at(0)
68
+ .childAt(0)
69
+ .text(),
70
+ ).toBe('quickstart~Continue');
71
+ expect(
72
+ footerButtons
73
+ .at(1)
74
+ .childAt(0)
75
+ .text(),
76
+ ).toBe('quickstart~Restart');
77
+ });
78
+
79
+ it('should load Next and Back buttons, and Restart link for in progress tours in task page', () => {
80
+ quickStartFooterProps = {
81
+ status: QuickStartStatus.IN_PROGRESS,
82
+ footerClass: 'test',
83
+ quickStartId: 'test-quickstart',
84
+ onNext: () => null,
85
+ onBack: () => null,
86
+ totalTasks: 4,
87
+ taskNumber: 2,
88
+ };
89
+
90
+ const quickStartFooterWrapper = shallow(<QuickStartFooter {...quickStartFooterProps} />);
91
+ const footerButtons = quickStartFooterWrapper.find(Button);
92
+ expect(footerButtons.exists()).toBeTruthy();
93
+ expect(footerButtons.length).toEqual(3);
94
+ expect(
95
+ footerButtons
96
+ .at(0)
97
+ .childAt(0)
98
+ .text(),
99
+ ).toBe('quickstart~Next');
100
+ expect(
101
+ footerButtons
102
+ .at(1)
103
+ .childAt(0)
104
+ .text(),
105
+ ).toBe('quickstart~Back');
106
+ expect(
107
+ footerButtons
108
+ .at(2)
109
+ .childAt(0)
110
+ .text(),
111
+ ).toBe('quickstart~Restart');
112
+ });
113
+
114
+ it('should load Close, Back and Restart buttons for completed tours in conclusion page', () => {
115
+ quickStartFooterProps = {
116
+ status: QuickStartStatus.COMPLETE,
117
+ footerClass: 'test',
118
+ quickStartId: 'test-quickstart',
119
+ onNext: () => null,
120
+ onBack: () => null,
121
+ totalTasks: 4,
122
+ taskNumber: 4,
123
+ };
124
+
125
+ const quickStartFooterWrapper = shallow(<QuickStartFooter {...quickStartFooterProps} />);
126
+ const footerButtons = quickStartFooterWrapper.find(Button);
127
+ expect(footerButtons.exists()).toBeTruthy();
128
+ expect(footerButtons.length).toEqual(3);
129
+ expect(
130
+ footerButtons
131
+ .at(0)
132
+ .childAt(0)
133
+ .text(),
134
+ ).toBe('quickstart~Close');
135
+ expect(
136
+ footerButtons
137
+ .at(1)
138
+ .childAt(0)
139
+ .text(),
140
+ ).toBe('quickstart~Back');
141
+ expect(
142
+ footerButtons
143
+ .at(2)
144
+ .childAt(0)
145
+ .text(),
146
+ ).toBe('quickstart~Restart');
147
+ });
148
+ });
@@ -0,0 +1,56 @@
1
+ import * as React from 'react';
2
+ import { Title, WizardNavItem } from '@patternfly/react-core';
3
+ import { ShallowWrapper, shallow } from 'enzyme';
4
+ import { QuickStartTaskStatus } from '../../utils/quick-start-types';
5
+ import QuickStartTaskHeader from '../QuickStartTaskHeader';
6
+
7
+ type QuickStartTaskHeaderProps = React.ComponentProps<typeof QuickStartTaskHeader>;
8
+ let wrapper: ShallowWrapper<QuickStartTaskHeaderProps>;
9
+ const props: QuickStartTaskHeaderProps = {
10
+ title: 'title',
11
+ taskIndex: 1,
12
+ subtitle: 'subtitle',
13
+ taskStatus: QuickStartTaskStatus.INIT,
14
+ size: 'lg',
15
+ isActiveTask: true,
16
+ onTaskSelect: jest.fn(),
17
+ };
18
+
19
+ describe('QuickStartTaskHeader', () => {
20
+ beforeEach(() => {
21
+ // DOMPurify.addHook = jest.fn();
22
+ wrapper = shallow(<QuickStartTaskHeader {...props} />);
23
+ });
24
+
25
+ it('should render subtitle for active task', () => {
26
+ expect(
27
+ wrapper
28
+ .find(WizardNavItem)
29
+ .dive()
30
+ .find(Title).length,
31
+ ).toBe(1);
32
+ expect(
33
+ wrapper
34
+ .find(WizardNavItem)
35
+ .dive()
36
+ .find('[data-test-id="quick-start-task-subtitle"]')
37
+ .props().children,
38
+ ).toEqual([' ', props.subtitle]);
39
+ });
40
+ it('should not render subtitle if task is not active', () => {
41
+ wrapper = shallow(<QuickStartTaskHeader {...props} isActiveTask={false} />);
42
+ expect(
43
+ wrapper
44
+ .find(WizardNavItem)
45
+ .dive()
46
+ .find(Title).length,
47
+ ).toBe(1);
48
+ expect(
49
+ wrapper
50
+ .find(WizardNavItem)
51
+ .dive()
52
+ .find('[data-test-id="quick-start-task-subtitle"]')
53
+ .exists(),
54
+ ).toBe(false);
55
+ });
56
+ });
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import { Alert } from '@patternfly/react-core';
3
+ import { ShallowWrapper, shallow } from 'enzyme';
4
+ import { allQuickStarts } from '../../data/quick-start-test-data';
5
+ import QuickStartMarkdownView from '../../QuickStartMarkdownView';
6
+ import { QuickStartTaskStatus } from '../../utils/quick-start-types';
7
+ import { getQuickStartByName } from '../../utils/quick-start-utils';
8
+ import QuickStartTaskReview from '../QuickStartTaskReview';
9
+
10
+ type QuickStartTaskReviewProps = React.ComponentProps<typeof QuickStartTaskReview>;
11
+ let wrapper: ShallowWrapper<QuickStartTaskReviewProps>;
12
+ const props: QuickStartTaskReviewProps = {
13
+ review: getQuickStartByName('explore-serverless', allQuickStarts).spec.tasks[0].review,
14
+ taskStatus: QuickStartTaskStatus.REVIEW,
15
+ onTaskReview: jest.fn(),
16
+ };
17
+
18
+ describe('QuickStartTaskReview', () => {
19
+ it('should render alert with info variant when task status is review', () => {
20
+ wrapper = shallow(<QuickStartTaskReview {...props} />);
21
+ expect(wrapper.find(Alert).props().variant).toBe('info');
22
+ });
23
+
24
+ it('should render alert with success variant when task status is success', () => {
25
+ props.taskStatus = QuickStartTaskStatus.SUCCESS;
26
+ wrapper = shallow(<QuickStartTaskReview {...props} />);
27
+ expect(wrapper.find(Alert).props().variant).toBe('success');
28
+ });
29
+
30
+ it('should render alert with danger variant when task status is failed', () => {
31
+ props.taskStatus = QuickStartTaskStatus.FAILED;
32
+ wrapper = shallow(<QuickStartTaskReview {...props} />);
33
+ expect(wrapper.find(Alert).props().variant).toBe('danger');
34
+ });
35
+
36
+ it('should render task help in markdown when task status is failed', () => {
37
+ wrapper = shallow(<QuickStartTaskReview {...props} />);
38
+ expect(
39
+ wrapper
40
+ .find(QuickStartMarkdownView)
41
+ .at(1)
42
+ .props().content,
43
+ ).toEqual(props.review.failedTaskHelp);
44
+ });
45
+ });
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+ import { ShallowWrapper, shallow } from 'enzyme';
3
+ import { allQuickStarts } from '../../data/quick-start-test-data';
4
+ import QuickStartMarkdownView from '../../QuickStartMarkdownView';
5
+ import { QuickStartTaskStatus } from '../../utils/quick-start-types';
6
+ import { getQuickStartByName } from '../../utils/quick-start-utils';
7
+ import TaskHeader from '../QuickStartTaskHeader';
8
+ import QuickStartTaskReview from '../QuickStartTaskReview';
9
+ import QuickStartTask from '../QuickStartTasks';
10
+
11
+ jest.mock('react', () => {
12
+ const ActualReact = require.requireActual('react');
13
+ return {
14
+ ...ActualReact,
15
+ useContext: () => jest.fn(),
16
+ };
17
+ });
18
+
19
+ type QuickStartTaskProps = React.ComponentProps<typeof QuickStartTask>;
20
+ let wrapper: ShallowWrapper<QuickStartTaskProps>;
21
+ const props: QuickStartTaskProps = {
22
+ tasks: getQuickStartByName('monitor-sampleapp', allQuickStarts).spec.tasks,
23
+ allTaskStatuses: [
24
+ QuickStartTaskStatus.SUCCESS,
25
+ QuickStartTaskStatus.INIT,
26
+ QuickStartTaskStatus.INIT,
27
+ ],
28
+ taskNumber: 1,
29
+ onTaskReview: jest.fn(),
30
+ onTaskSelect: jest.fn(),
31
+ };
32
+
33
+ describe('QuickStartTasks', () => {
34
+ beforeEach(() => {
35
+ spyOn(React, 'useContext').and.returnValue({
36
+ activeQuickStartID: '',
37
+ startQuickStart: () => {},
38
+ restartQuickStart: () => {},
39
+ getResource: (key) => `quickstart~${key}`,
40
+ });
41
+ wrapper = shallow(<QuickStartTask {...props} />);
42
+ });
43
+
44
+ it('should render correct number of tasks based on currentTaskIndex', () => {
45
+ expect(wrapper.find(TaskHeader).length).toBe(1);
46
+ });
47
+
48
+ it('should render SyncMarkdownView with description if a task is active', () => {
49
+ wrapper = shallow(
50
+ <QuickStartTask
51
+ {...props}
52
+ allTaskStatuses={[
53
+ QuickStartTaskStatus.SUCCESS,
54
+ QuickStartTaskStatus.FAILED,
55
+ QuickStartTaskStatus.VISITED,
56
+ ]}
57
+ taskNumber={2}
58
+ />,
59
+ );
60
+ expect(
61
+ wrapper
62
+ .find(QuickStartMarkdownView)
63
+ .at(0)
64
+ .props().content,
65
+ ).toEqual(props.tasks[2].description);
66
+ });
67
+
68
+ it('should render review when task is active and in Review state', () => {
69
+ wrapper = shallow(
70
+ <QuickStartTask
71
+ {...props}
72
+ allTaskStatuses={[
73
+ QuickStartTaskStatus.SUCCESS,
74
+ QuickStartTaskStatus.REVIEW,
75
+ QuickStartTaskStatus.INIT,
76
+ ]}
77
+ />,
78
+ );
79
+ expect(wrapper.find(QuickStartTaskReview).exists()).toBe(true);
80
+ });
81
+ });
@@ -0,0 +1,66 @@
1
+ import { QuickStart } from '@patternfly/quickstarts';
2
+ import { pipelineIcon } from './tour-icons';
3
+
4
+ export const explorePipelinesQuickStart: QuickStart = {
5
+ apiVersion: 'console.openshift.io/v1',
6
+ kind: 'QuickStarts',
7
+ metadata: {
8
+ name: 'explore-pipelines',
9
+ },
10
+ spec: {
11
+ version: 4.7,
12
+ displayName: `Installing the Pipelines Operator`,
13
+ durationMinutes: 10,
14
+ icon: pipelineIcon,
15
+ description: `Install the OpenShift® Pipelines Operator to build Pipelines using Tekton.`,
16
+ prerequisites: [''],
17
+ introduction: `OpenShift® Pipelines is a cloud-native, continuous integration and continuous delivery (CI/CD) solution based on Kubernetes resources. It uses Tekton building blocks to automate deployments across multiple Kubernetes distributions by abstracting away the underlying implementation details.
18
+ * OpenShift Pipelines is a serverless CI/CD system that runs pipelines with all the required dependencies in isolated containers.
19
+ * They are designed for decentralized teams that work on a microservice-based architecture.
20
+ * They are defined using standard Custom Resource Definitions making them extensible and easy to integrate with the existing Kubernetes tools. This enables you to scale on-demand.
21
+ * You can use OpenShift Pipelines to build images with Kubernetes tools such as Source-to-Image (S2I), Buildah, Buildpacks, and Kaniko that are portable across any Kubernetes platform.
22
+ * You can use the Developer perspective to create and manage pipelines and view logs in your namespaces.
23
+
24
+ To start using Pipelines, install the OpenShift® Pipelines Operator on your cluster.`,
25
+ tasks: [
26
+ {
27
+ title: `Installing the OpenShift Pipelines Operator`,
28
+ description: `### To install the OpenShift Pipelines Operator:
29
+
30
+ 1. From the **Administrator** perspective in the console navigation panel, click **Operators > OperatorHub**.
31
+ 2. In the **Filter by keyword** field, type \`OpenShift Pipelines Operator\`.
32
+ 3. If the tile has an Installed label, the Operator is already installed. Proceed to the next quick start to create a Pipeline.
33
+ 4. Click the **tile** to open the Operator details.
34
+ 5. At the top of the OpenShift Pipelines Operator panel that opens, click **Install**.
35
+ 6. Fill out the Operator subscription form by selecting the channel that matches your OpenShift cluster, and then click **Install**.
36
+ 7. On the **Installed Operators** page, wait for the OpenShift Pipelines Operator's status to change from **Installing** to **Succeeded**. `,
37
+ review: {
38
+ instructions: `#### To verify that the OpenShift Pipelines Operator is installed:
39
+ 1. From the **Operators** section of the navigation, go to the **Installed Operators** page.
40
+ 2. Verify that the **OpenShift Pipelines Operator** appears in the list of Operators.
41
+
42
+ In the status column, is the status of the OpenShift Pipelines Operator **Succeeded**?`,
43
+ failedTaskHelp: `This task isn’t verified yet. Try the task again, or [read more](https://docs.openshift.com/container-platform/4.6/pipelines/installing-pipelines.html#op-installing-pipelines-operator-in-web-console_installing-pipelines) about this topic.`,
44
+ },
45
+ summary: {
46
+ success: `You have installed the Pipelines Operator!`,
47
+ failed: `Try the steps again.`,
48
+ },
49
+ },
50
+ ],
51
+ conclusion: `You successfully installed the OpenShift Pipelines Operator! If you want to learn how to deploy an application and associate a Pipeline with it, take the Creating a Pipeline quick start.`,
52
+ nextQuickStart: [`install-app-and-associate-pipeline`],
53
+ accessReviewResources: [
54
+ {
55
+ group: 'operators.coreos.com',
56
+ resource: 'operatorgroups',
57
+ verb: 'list',
58
+ },
59
+ {
60
+ group: 'packages.operators.coreos.com',
61
+ resource: 'packagemanifests',
62
+ verb: 'list',
63
+ },
64
+ ],
65
+ },
66
+ };