@patternfly/chatbot 2.1.0 → 2.2.0-prerelease.10

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 (177) hide show
  1. package/dist/cjs/Chatbot/Chatbot.js +0 -9
  2. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +5 -1
  3. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +4 -4
  4. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +3 -3
  5. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
  6. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +14 -0
  7. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
  8. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +2 -2
  9. package/dist/cjs/ChatbotHeader/index.d.ts +1 -0
  10. package/dist/cjs/ChatbotHeader/index.js +1 -0
  11. package/dist/cjs/CodeModal/CodeModal.js +2 -12
  12. package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -1
  13. package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -2
  14. package/dist/cjs/Message/Message.d.ts +16 -6
  15. package/dist/cjs/Message/Message.js +6 -6
  16. package/dist/cjs/Message/Message.test.js +51 -0
  17. package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +15 -0
  18. package/dist/cjs/Message/QuickResponse/QuickResponse.js +33 -0
  19. package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +13 -0
  20. package/dist/cjs/Message/QuickStarts/FallbackImg.js +34 -0
  21. package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +27 -0
  22. package/dist/cjs/Message/QuickStarts/QuickStartTile.js +82 -0
  23. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
  24. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +64 -0
  25. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
  26. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +76 -0
  27. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
  28. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +30 -0
  29. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
  30. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +77 -0
  31. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
  32. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.js +77 -0
  33. package/dist/cjs/Message/QuickStarts/types.d.ts +132 -0
  34. package/dist/cjs/Message/QuickStarts/types.js +17 -0
  35. package/dist/cjs/MessageBar/SendButton.js +1 -1
  36. package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +6 -0
  37. package/dist/cjs/ResponseActions/ResponseActionButton.js +10 -2
  38. package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +1 -0
  39. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +54 -0
  40. package/dist/cjs/ResponseActions/ResponseActions.d.ts +4 -0
  41. package/dist/cjs/ResponseActions/ResponseActions.js +26 -9
  42. package/dist/cjs/ResponseActions/ResponseActions.test.js +79 -5
  43. package/dist/cjs/Settings/SettingsForm.d.ts +13 -0
  44. package/dist/cjs/Settings/SettingsForm.js +27 -0
  45. package/dist/cjs/Settings/index.d.ts +2 -0
  46. package/dist/cjs/Settings/index.js +23 -0
  47. package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +34 -0
  48. package/dist/cjs/TermsOfUse/TermsOfUse.js +49 -0
  49. package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +1 -0
  50. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +79 -0
  51. package/dist/cjs/TermsOfUse/index.d.ts +2 -0
  52. package/dist/cjs/TermsOfUse/index.js +23 -0
  53. package/dist/cjs/index.d.ts +4 -0
  54. package/dist/cjs/index.js +7 -1
  55. package/dist/css/main.css +191 -30
  56. package/dist/css/main.css.map +1 -1
  57. package/dist/dynamic/Settings/package.json +1 -0
  58. package/dist/dynamic/TermsOfUse/package.json +1 -0
  59. package/dist/esm/Chatbot/Chatbot.js +0 -9
  60. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +5 -1
  61. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +4 -4
  62. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +3 -3
  63. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
  64. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +8 -0
  65. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
  66. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +2 -2
  67. package/dist/esm/ChatbotHeader/index.d.ts +1 -0
  68. package/dist/esm/ChatbotHeader/index.js +1 -0
  69. package/dist/esm/CodeModal/CodeModal.js +2 -12
  70. package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -1
  71. package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -2
  72. package/dist/esm/Message/Message.d.ts +16 -6
  73. package/dist/esm/Message/Message.js +7 -7
  74. package/dist/esm/Message/Message.test.js +51 -0
  75. package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +15 -0
  76. package/dist/esm/Message/QuickResponse/QuickResponse.js +26 -0
  77. package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +13 -0
  78. package/dist/esm/Message/QuickStarts/FallbackImg.js +9 -0
  79. package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +27 -0
  80. package/dist/esm/Message/QuickStarts/QuickStartTile.js +52 -0
  81. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
  82. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +35 -0
  83. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
  84. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +48 -0
  85. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
  86. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +5 -0
  87. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
  88. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +74 -0
  89. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
  90. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.js +74 -0
  91. package/dist/esm/Message/QuickStarts/types.d.ts +132 -0
  92. package/dist/esm/Message/QuickStarts/types.js +14 -0
  93. package/dist/esm/MessageBar/SendButton.js +1 -1
  94. package/dist/esm/ResponseActions/ResponseActionButton.d.ts +6 -0
  95. package/dist/esm/ResponseActions/ResponseActionButton.js +10 -2
  96. package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +1 -0
  97. package/dist/esm/ResponseActions/ResponseActionButton.test.js +49 -0
  98. package/dist/esm/ResponseActions/ResponseActions.d.ts +4 -0
  99. package/dist/esm/ResponseActions/ResponseActions.js +26 -9
  100. package/dist/esm/ResponseActions/ResponseActions.test.js +79 -5
  101. package/dist/esm/Settings/SettingsForm.d.ts +13 -0
  102. package/dist/esm/Settings/SettingsForm.js +20 -0
  103. package/dist/esm/Settings/index.d.ts +2 -0
  104. package/dist/esm/Settings/index.js +2 -0
  105. package/dist/esm/TermsOfUse/TermsOfUse.d.ts +34 -0
  106. package/dist/esm/TermsOfUse/TermsOfUse.js +42 -0
  107. package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +1 -0
  108. package/dist/esm/TermsOfUse/TermsOfUse.test.js +74 -0
  109. package/dist/esm/TermsOfUse/index.d.ts +2 -0
  110. package/dist/esm/TermsOfUse/index.js +2 -0
  111. package/dist/esm/index.d.ts +4 -0
  112. package/dist/esm/index.js +4 -0
  113. package/dist/tsconfig.tsbuildinfo +1 -1
  114. package/package.json +7 -13
  115. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +4 -0
  116. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +31 -0
  117. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +26 -4
  118. package/patternfly-docs/content/extensions/chatbot/examples/Messages/explore-pipeline-quickstart.ts +65 -0
  119. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +1 -1
  120. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
  121. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +2 -2
  122. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +67 -0
  123. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +78 -0
  124. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx +26 -0
  125. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-TermsAndConditionsHeader.svg +148 -0
  126. package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +289 -0
  127. package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +1 -1
  128. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +147 -0
  129. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +56 -0
  130. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +2 -2
  131. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +2 -2
  132. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +20 -19
  133. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +1 -1
  134. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -2
  135. package/src/Chatbot/Chatbot.scss +0 -10
  136. package/src/Chatbot/Chatbot.tsx +0 -9
  137. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +14 -0
  138. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +3 -3
  139. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +11 -3
  140. package/src/ChatbotFooter/ChatbotFooter.scss +2 -1
  141. package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +51 -0
  142. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +5 -2
  143. package/src/ChatbotHeader/index.ts +1 -0
  144. package/src/CodeModal/CodeModal.scss +8 -0
  145. package/src/CodeModal/CodeModal.tsx +2 -13
  146. package/src/FileDropZone/__snapshots__/FileDropZone.test.tsx.snap +1 -1
  147. package/src/Message/ListMessage/OrderedListMessage.tsx +2 -2
  148. package/src/Message/Message.scss +0 -14
  149. package/src/Message/Message.test.tsx +76 -0
  150. package/src/Message/Message.tsx +35 -26
  151. package/src/Message/QuickResponse/QuickResponse.scss +33 -0
  152. package/src/Message/QuickResponse/QuickResponse.tsx +50 -0
  153. package/src/Message/QuickStarts/FallbackImg.tsx +24 -0
  154. package/src/Message/QuickStarts/QuickStartTile.scss +25 -0
  155. package/src/Message/QuickStarts/QuickStartTile.tsx +147 -0
  156. package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +57 -0
  157. package/src/Message/QuickStarts/QuickStartTileDescription.tsx +81 -0
  158. package/src/Message/QuickStarts/QuickStartTileHeader.tsx +21 -0
  159. package/src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts +75 -0
  160. package/src/Message/QuickStarts/monitor-sampleapp-quickstart.ts +75 -0
  161. package/src/Message/QuickStarts/types.ts +154 -0
  162. package/src/MessageBar/SendButton.scss +24 -0
  163. package/src/MessageBar/SendButton.tsx +1 -1
  164. package/src/ResponseActions/ResponseActionButton.test.tsx +52 -0
  165. package/src/ResponseActions/ResponseActionButton.tsx +46 -27
  166. package/src/ResponseActions/ResponseActions.scss +10 -8
  167. package/src/ResponseActions/ResponseActions.test.tsx +103 -5
  168. package/src/ResponseActions/ResponseActions.tsx +54 -7
  169. package/src/Settings/Settings.scss +34 -0
  170. package/src/Settings/SettingsForm.tsx +25 -0
  171. package/src/Settings/index.ts +3 -0
  172. package/src/TermsOfUse/TermsOfUse.scss +66 -0
  173. package/src/TermsOfUse/TermsOfUse.test.tsx +138 -0
  174. package/src/TermsOfUse/TermsOfUse.tsx +117 -0
  175. package/src/TermsOfUse/index.ts +3 -0
  176. package/src/index.ts +6 -0
  177. package/src/main.scss +7 -3
@@ -15,7 +15,7 @@ var __rest = (this && this.__rest) || function (s, e) {
15
15
  import React from 'react';
16
16
  import Markdown from 'react-markdown';
17
17
  import remarkGfm from 'remark-gfm';
18
- import { Avatar, Label, LabelGroup, Timestamp, Truncate } from '@patternfly/react-core';
18
+ import { Avatar, Label, Timestamp, Truncate } from '@patternfly/react-core';
19
19
  import MessageLoading from './MessageLoading';
20
20
  import CodeBlockMessage from './CodeBlockMessage/CodeBlockMessage';
21
21
  import TextMessage from './TextMessage/TextMessage';
@@ -25,8 +25,10 @@ import SourcesCard from '../SourcesCard';
25
25
  import ListItemMessage from './ListMessage/ListItemMessage';
26
26
  import UnorderedListMessage from './ListMessage/UnorderedListMessage';
27
27
  import OrderedListMessage from './ListMessage/OrderedListMessage';
28
+ import QuickStartTile from './QuickStarts/QuickStartTile';
29
+ import QuickResponse from './QuickResponse/QuickResponse';
28
30
  export const Message = (_a) => {
29
- var { role, content, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps } = _a, props = __rest(_a, ["role", "content", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps"]);
31
+ var { role, content, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts } = _a, props = __rest(_a, ["role", "content", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts"]);
30
32
  let avatarClassName;
31
33
  if (avatarProps && 'className' in avatarProps) {
32
34
  const { className } = avatarProps, rest = __rest(avatarProps, ["className"]);
@@ -50,15 +52,13 @@ export const Message = (_a) => {
50
52
  p: TextMessage,
51
53
  code: ({ children }) => React.createElement(CodeBlockMessage, Object.assign({}, codeBlockProps), children),
52
54
  ul: UnorderedListMessage,
53
- ol: OrderedListMessage,
55
+ ol: (props) => React.createElement(OrderedListMessage, Object.assign({}, props)),
54
56
  li: ListItemMessage
55
57
  }, remarkPlugins: [remarkGfm] }, content)),
56
58
  !isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources)),
59
+ quickStarts && quickStarts.quickStart && (React.createElement(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel })),
57
60
  !isLoading && actions && React.createElement(ResponseActions, { actions: actions }),
58
- !isLoading && quickResponses && (React.createElement(LabelGroup, Object.assign({ className: `pf-chatbot__message-quick-response ${quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className}` }, quickResponseContainerProps), quickResponses.map((_a) => {
59
- var { id, onClick, content } = _a, props = __rest(_a, ["id", "onClick", "content"]);
60
- return (React.createElement(Label, Object.assign({ variant: "outline", color: "blue", key: id, onClick: onClick }, props), content));
61
- })))),
61
+ !isLoading && quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps }))),
62
62
  attachments && (React.createElement("div", { className: "pf-chatbot__message-attachments-container" }, attachments.map((attachment) => {
63
63
  var _a;
64
64
  return (React.createElement("div", { key: (_a = attachment.id) !== null && _a !== void 0 ? _a : attachment.name, className: "pf-chatbot__message-attachment" },
@@ -12,6 +12,8 @@ import { render, screen } from '@testing-library/react';
12
12
  import '@testing-library/jest-dom';
13
13
  import Message from './Message';
14
14
  import userEvent from '@testing-library/user-event';
15
+ import { monitorSampleAppQuickStart } from './QuickStarts/monitor-sampleapp-quickstart';
16
+ import { monitorSampleAppQuickStartWithImage } from './QuickStarts/monitor-sampleapp-quickstart-with-image';
15
17
  const ALL_ACTIONS = [
16
18
  { label: /Good response/i },
17
19
  { label: /Bad response/i },
@@ -55,6 +57,21 @@ spec:
55
57
  url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs
56
58
  `;
57
59
  const INLINE_CODE = `Here is an inline code - \`() => void\``;
60
+ const ORDERED_LIST_WITH_CODE = `
61
+ 1. Item 1
62
+ 2. Item 2
63
+
64
+ \`\`\`yaml
65
+ - name: Hello World Playbook
66
+ hosts: localhost
67
+ tasks:
68
+ - name: Print Hello World
69
+ ansible.builtin.debug:
70
+ msg: "Hello, World!"
71
+ \`\`\`
72
+
73
+ 3. Item 3
74
+ `;
58
75
  const checkListItemsRendered = () => {
59
76
  const items = ['Item 1', 'Item 2', 'Item 3'];
60
77
  expect(screen.getAllByRole('listitem')).toHaveLength(3);
@@ -275,6 +292,12 @@ describe('Message', () => {
275
292
  expect(screen.getByText('Here is an ordered list:')).toBeTruthy();
276
293
  checkListItemsRendered();
277
294
  });
295
+ it('should render ordered lists correctly if there is interstitial content', () => {
296
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: ORDERED_LIST_WITH_CODE }));
297
+ checkListItemsRendered();
298
+ const list = screen.getAllByRole('list')[1];
299
+ expect(list).toHaveAttribute('start', '3');
300
+ });
278
301
  it('should render inline code', () => {
279
302
  render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: INLINE_CODE }));
280
303
  expect(screen.getByText(/() => void/i)).toBeTruthy();
@@ -327,4 +350,32 @@ describe('Message', () => {
327
350
  expect(screen.getByRole('img')).toHaveClass('test');
328
351
  expect(screen.getByRole('img')).toHaveClass('pf-chatbot__message-avatar');
329
352
  });
353
+ it('should handle QuickStart tile correctly', () => {
354
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: "Hi", quickStarts: {
355
+ quickStart: monitorSampleAppQuickStart,
356
+ onSelectQuickStart: (id) => alert(id)
357
+ } }));
358
+ expect(screen.getByRole('button', { name: 'Monitoring your sample application' })).toBeTruthy();
359
+ expect(screen.getByRole('heading', { name: '1 Prerequisite' })).toBeTruthy();
360
+ expect(screen.getByRole('button', { name: 'Show prerequisites' })).toBeTruthy();
361
+ expect(screen.getByRole('button', { name: 'Start' })).toBeTruthy();
362
+ });
363
+ it('should handle click on QuickStart tile correctly', () => __awaiter(void 0, void 0, void 0, function* () {
364
+ const spy = jest.fn();
365
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: "Hi", quickStarts: {
366
+ quickStart: monitorSampleAppQuickStart,
367
+ onSelectQuickStart: (id) => spy(id)
368
+ } }));
369
+ yield userEvent.click(screen.getByRole('button', { name: 'Monitoring your sample application' }));
370
+ expect(spy).toHaveBeenCalledTimes(1);
371
+ expect(spy).toHaveBeenCalledWith(monitorSampleAppQuickStart.metadata.name);
372
+ }));
373
+ it('should handle QuickStart tile with image correctly', () => __awaiter(void 0, void 0, void 0, function* () {
374
+ const spy = jest.fn();
375
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: "Hi", quickStarts: {
376
+ quickStart: monitorSampleAppQuickStartWithImage,
377
+ onSelectQuickStart: (id) => spy(id)
378
+ } }));
379
+ expect(screen.getAllByRole('img')[1]).toHaveAttribute('src', 'test.png');
380
+ }));
330
381
  });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { LabelGroupProps, LabelProps } from '@patternfly/react-core';
3
+ export interface QuickResponse extends Omit<LabelProps, 'children'> {
4
+ content: string;
5
+ id: string;
6
+ onClick: () => void;
7
+ }
8
+ export interface QuickResponseProps {
9
+ /** Props for quick responses */
10
+ quickResponses: QuickResponse[];
11
+ /** Props for quick responses container */
12
+ quickResponseContainerProps?: Omit<LabelGroupProps, 'ref'>;
13
+ }
14
+ export declare const QuickResponse: React.FunctionComponent<QuickResponseProps>;
15
+ export default QuickResponse;
@@ -0,0 +1,26 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from 'react';
13
+ import { Label, LabelGroup } from '@patternfly/react-core';
14
+ import { CheckIcon } from '@patternfly/react-icons';
15
+ export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 } }) => {
16
+ const [selectedQuickResponse, setSelectedQuickResponse] = React.useState();
17
+ const handleQuickResponseClick = (id, onClick) => {
18
+ setSelectedQuickResponse(id);
19
+ onClick && onClick();
20
+ };
21
+ return (React.createElement(LabelGroup, Object.assign({ className: `pf-chatbot__message-quick-response ${quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className}` }, quickResponseContainerProps), quickResponses.map((_a) => {
22
+ var { id, onClick, content, className } = _a, props = __rest(_a, ["id", "onClick", "content", "className"]);
23
+ return (React.createElement(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? React.createElement(CheckIcon, null) : undefined, color: "blue", key: id, onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}` }, props), content));
24
+ })));
25
+ };
26
+ export default QuickResponse;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ interface FallbackImgProps {
3
+ /** Image source */
4
+ src: string;
5
+ /** Alt text for image */
6
+ alt?: string;
7
+ /** ClassName applied to image */
8
+ className?: string;
9
+ /** Fallback */
10
+ fallback?: React.ReactNode;
11
+ }
12
+ declare const FallbackImg: React.FC<FallbackImgProps>;
13
+ export default FallbackImg;
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ const FallbackImg = ({ src, alt, className, fallback }) => {
3
+ const [isSrcValid, setIsSrcValid] = React.useState(true);
4
+ if (src && isSrcValid) {
5
+ return React.createElement("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
6
+ }
7
+ return React.createElement(React.Fragment, null, fallback);
8
+ };
9
+ export default FallbackImg;
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import { QuickStart, QuickstartAction } from './types';
3
+ export declare const camelize: (str: string) => string;
4
+ export interface QuickStartTileProps {
5
+ /** ClassName applied to the card */
6
+ className?: string;
7
+ /** The quickstart object triggered by this tile */
8
+ quickStart: QuickStart;
9
+ /** Event handler attached to the tile */
10
+ onClick?: () => void;
11
+ /** Action config for button rendered next to title */
12
+ action?: QuickstartAction;
13
+ /** Callback that returns active quick start value when clicked */
14
+ onSelectQuickStart: (id?: string) => void;
15
+ /** Label for the English word "minute". */
16
+ minuteWord?: string;
17
+ /** Label for the English word "minutes". */
18
+ minuteWordPlural?: string;
19
+ /** Label for the English word "Prerequisite" */
20
+ prerequisiteWord?: string;
21
+ /** Label for the English word "Prerequisites" */
22
+ prerequisiteWordPlural?: string;
23
+ /** Aria-label for the quick start description button */
24
+ quickStartButtonAriaLabel?: string;
25
+ }
26
+ declare const QuickStartTile: React.FC<QuickStartTileProps>;
27
+ export default QuickStartTile;
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+ import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
3
+ import OutlinedBookmarkIcon from '@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon';
4
+ import { Card, CardBody, CardHeader, CardFooter, CardTitle, Icon, Button, Flex, Stack, Label, pluralize } from '@patternfly/react-core';
5
+ import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
6
+ import QuickStartTileHeader from './QuickStartTileHeader';
7
+ import QuickStartTileDescription from './QuickStartTileDescription';
8
+ import FallbackImg from './FallbackImg';
9
+ export const camelize = (str) => str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
10
+ if (+match === 0) {
11
+ return '';
12
+ } // or if (/\s+/.test(match)) for white spaces
13
+ return index === 0 ? match.toLowerCase() : match.toUpperCase();
14
+ });
15
+ const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action }) => {
16
+ const { metadata: { name: id }, spec: { icon, displayName, description, durationMinutes, prerequisites, link, type } } = quickStart;
17
+ let quickStartIcon;
18
+ if (typeof icon === 'object') {
19
+ quickStartIcon = React.createElement(Icon, { size: "2xl" }, icon);
20
+ }
21
+ else {
22
+ quickStartIcon = (React.createElement(Icon, { size: "2xl" },
23
+ React.createElement(FallbackImg, { src: icon, alt: "", className: "pfext-catalog-item-icon__img", fallback: React.createElement(RocketIcon, null) })));
24
+ }
25
+ const onSelect = () => {
26
+ if (!link) {
27
+ onSelectQuickStart(id);
28
+ }
29
+ else {
30
+ window.open(link.href, '_blank', 'noopener,noreferrer');
31
+ }
32
+ onClick && onClick();
33
+ };
34
+ const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon;
35
+ const additionalAction = action ? (React.createElement(Button, Object.assign({ "aria-label": action['aria-label'], icon: React.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps))) : undefined;
36
+ return (React.createElement(Card, { className: `pf-chatbot__quickstarts-tile ${className ? className : ''}`, id: `${id}-chatbot-qs-tile`, style: { height: '100%' }, "data-testid": `chatbot-qs-card-${camelize(displayName)}` },
37
+ React.createElement(CardHeader, Object.assign({}, (action && {
38
+ actions: { actions: additionalAction }
39
+ })), quickStartIcon),
40
+ React.createElement(CardTitle, null,
41
+ React.createElement(QuickStartTileHeader, { name: displayName, onSelect: onSelect, quickStartId: id })),
42
+ React.createElement(CardBody, null,
43
+ React.createElement(Stack, { hasGutter: true },
44
+ React.createElement(Flex, { spaceItems: { default: 'spaceItemsSm' } },
45
+ type && React.createElement(Label, { color: type.color }, type.text),
46
+ durationMinutes && (React.createElement(Label, { variant: "outline", "data-test": "duration", icon: React.createElement(OutlinedClockIcon, null) }, pluralize(durationMinutes, minuteWord, minuteWordPlural)))),
47
+ React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites, prerequisiteWord: prerequisiteWord, prerequisiteWordPlural: prerequisiteWordPlural, quickStartButtonAriaLabel: quickStartButtonAriaLabel }))),
48
+ React.createElement(CardFooter, null,
49
+ React.createElement(Button, { variant: "link", isInline: true, onClick: onSelect },
50
+ React.createElement("span", { className: "pf-v6-c-button__text" }, "Start")))));
51
+ };
52
+ export default QuickStartTile;
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ interface QuickStartTileDescriptionProps {
3
+ /** QuickStart description */
4
+ description: string;
5
+ /** QuickStart prerequisites */
6
+ prerequisites?: string[];
7
+ /** Label for the English word "Prerequisite" */
8
+ prerequisiteWord?: string;
9
+ /** Label for the English word "Prerequisites" */
10
+ prerequisiteWordPlural?: string;
11
+ /** Aria-label for the quick start button */
12
+ quickStartButtonAriaLabel?: string;
13
+ }
14
+ /** This function is a helper for pluralizing strings stolen from React.
15
+ *
16
+ * @param {number} i The quantity of the string you want to pluralize
17
+ * @param {string} singular The singular version of the string
18
+ * @param {string} plural The change to the string that should occur if the quantity is not equal to 1.
19
+ * Defaults to adding an 's'.
20
+ */
21
+ export declare function pluralizeWord(i: number, singular: string, plural?: string): string;
22
+ declare const QuickStartTileDescription: React.FC<QuickStartTileDescriptionProps>;
23
+ export default QuickStartTileDescription;
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import { Button, Flex, pluralize, Popover } from '@patternfly/react-core';
3
+ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
4
+ /** This function is a helper for pluralizing strings stolen from React.
5
+ *
6
+ * @param {number} i The quantity of the string you want to pluralize
7
+ * @param {string} singular The singular version of the string
8
+ * @param {string} plural The change to the string that should occur if the quantity is not equal to 1.
9
+ * Defaults to adding an 's'.
10
+ */
11
+ export function pluralizeWord(i, singular, plural) {
12
+ if (!plural) {
13
+ plural = `${singular}s`;
14
+ }
15
+ return `${i === 1 ? singular : plural}`;
16
+ }
17
+ const QuickStartTileDescription = ({ description, prerequisites, prerequisiteWord = 'Prerequisite', prerequisiteWordPlural = 'Prerequisites', quickStartButtonAriaLabel = 'Show prerequisites' }) => {
18
+ const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
19
+ const buttonRef = React.useRef(null);
20
+ const pluralizedPrereq = pluralizeWord((prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) || 0, prerequisiteWord, prerequisiteWordPlural);
21
+ return (React.createElement(React.Fragment, null,
22
+ description,
23
+ prereqs && prereqs.length > 0 && (React.createElement(Flex, { spaceItems: { default: 'spaceItemsSm' } },
24
+ React.createElement("h5", null, pluralize(prereqs.length, prerequisiteWord, prerequisiteWordPlural)),
25
+ React.createElement(Button, { variant: "link", isInline: true, "data-testid": "qs-card-prereqs", ref: buttonRef, onClick: (e) => {
26
+ e.preventDefault();
27
+ e.stopPropagation();
28
+ }, "aria-label": quickStartButtonAriaLabel },
29
+ React.createElement(InfoCircleIcon, null)),
30
+ React.createElement(Popover, { "aria-label": pluralizedPrereq, headerContent: pluralizedPrereq, triggerRef: buttonRef, bodyContent: React.createElement("div", null,
31
+ React.createElement("ul", { "aria-label": pluralizedPrereq }, prereqs.map((prerequisite, index) => (
32
+ // eslint-disable-next-line react/no-array-index-key
33
+ React.createElement("li", { key: index }, prerequisite))))) })))));
34
+ };
35
+ export default QuickStartTileDescription;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,48 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import React from 'react';
11
+ import { render, screen } from '@testing-library/react';
12
+ import '@testing-library/jest-dom';
13
+ import userEvent from '@testing-library/user-event';
14
+ import { monitorSampleAppQuickStart } from './monitor-sampleapp-quickstart';
15
+ import QuickStartTileDescription, { pluralizeWord } from './QuickStartTileDescription';
16
+ describe('pluralizeWord function', () => {
17
+ it('should render no plural correctly', () => {
18
+ expect(pluralizeWord(2, 'pizza')).toBe('pizzas');
19
+ });
20
+ });
21
+ describe('QuickStart tile description', () => {
22
+ it('should render no prereqs correctly', () => {
23
+ render(React.createElement(QuickStartTileDescription, { description: monitorSampleAppQuickStart.spec.description }));
24
+ expect(screen.queryByRole('heading')).toBeFalsy();
25
+ });
26
+ it('should render singular prereq correctly', () => {
27
+ render(React.createElement(QuickStartTileDescription, { description: monitorSampleAppQuickStart.spec.description, prerequisites: [`You completed the "Getting started with a sample" quick start.`] }));
28
+ expect(screen.getByRole('heading', { name: /1 Prerequisite/i })).toBeTruthy();
29
+ expect(screen.getByRole('button', { name: /Show prerequisite/i })).toBeTruthy();
30
+ });
31
+ it('should render plural prereq correctly', () => {
32
+ render(React.createElement(QuickStartTileDescription, { description: monitorSampleAppQuickStart.spec.description, prerequisites: [
33
+ `You completed the "Getting started with a sample" quick start.`,
34
+ `You completed the app quick start`
35
+ ] }));
36
+ expect(screen.getByRole('heading', { name: /2 Prerequisites/i })).toBeTruthy();
37
+ expect(screen.getByRole('button', { name: /Show prerequisites/i })).toBeTruthy();
38
+ });
39
+ it('should be able to click prereqs link', () => __awaiter(void 0, void 0, void 0, function* () {
40
+ render(React.createElement(QuickStartTileDescription, { description: monitorSampleAppQuickStart.spec.description, prerequisites: [`You completed the "Getting started with a sample" quick start.`] }));
41
+ const button = screen.getByRole('button', { name: /Show prerequisites/i });
42
+ expect(screen.queryByRole('dialog', { name: /Prerequisite/i })).toBeFalsy();
43
+ yield userEvent.click(button);
44
+ expect(screen.getByRole('dialog', { name: /Prerequisite/i })).toBeTruthy();
45
+ expect(screen.getByRole('button', { name: /Close/i })).toBeTruthy();
46
+ expect(screen.getByText(/You completed the "Getting started with a sample" quick start./i)).toBeTruthy();
47
+ }));
48
+ });
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ interface QuickStartTileHeaderProps {
3
+ /** Name for the header */
4
+ name: string;
5
+ /** Id for the QuickStart */
6
+ quickStartId?: string;
7
+ /** Callback for when the name of the QuickStart is clicked */
8
+ onSelect: (e: React.FormEvent<HTMLInputElement> | React.MouseEvent<Element, MouseEvent>) => void;
9
+ }
10
+ declare const QuickStartTileHeader: React.FC<QuickStartTileHeaderProps>;
11
+ export default QuickStartTileHeader;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { Button, Flex } from '@patternfly/react-core';
3
+ const QuickStartTileHeader = ({ name, quickStartId, onSelect }) => (React.createElement(Flex, { flexWrap: { default: 'nowrap' } },
4
+ React.createElement(Button, { "data-test": "title", id: quickStartId, variant: "link", isInline: true, onClick: onSelect }, name)));
5
+ export default QuickStartTileHeader;
@@ -0,0 +1,30 @@
1
+ export declare const monitorSampleAppQuickStartWithImage: {
2
+ apiVersion: string;
3
+ kind: string;
4
+ metadata: {
5
+ name: string;
6
+ };
7
+ spec: {
8
+ icon: string;
9
+ version: number;
10
+ displayName: string;
11
+ durationMinutes: number;
12
+ description: string;
13
+ prerequisites: string[];
14
+ introduction: string;
15
+ tasks: {
16
+ title: string;
17
+ description: string;
18
+ review: {
19
+ instructions: string;
20
+ failedTaskHelp: string;
21
+ };
22
+ summary: {
23
+ success: string;
24
+ failed: string;
25
+ };
26
+ }[];
27
+ conclusion: string;
28
+ nextQuickStart: string[];
29
+ };
30
+ };
@@ -0,0 +1,74 @@
1
+ export const monitorSampleAppQuickStartWithImage = {
2
+ apiVersion: 'console.openshift.io/v1',
3
+ kind: 'QuickStarts',
4
+ metadata: {
5
+ name: 'monitor-sampleapp'
6
+ },
7
+ spec: {
8
+ icon: 'test.png', // this is only difference
9
+ version: 4.7,
10
+ displayName: 'Monitoring your sample application',
11
+ durationMinutes: 10,
12
+ description: `Now that you’ve created a sample application and added health checks, let’s monitor your application.`,
13
+ prerequisites: [`You completed the "Getting started with a sample" quick start.`],
14
+ introduction: `### This quick start shows you how to monitor your sample application.
15
+ You should have previously created the **sample-app** application and **nodejs-sample** deployment via the **Get started with a sample** quick start. If you haven't, you may be able to follow these tasks with any existing deployment.`,
16
+ tasks: [
17
+ {
18
+ title: `Viewing the monitoring details of your sample application`,
19
+ description: `### To view the details of your sample application:
20
+ 1. Go to the project your sample application was created in.
21
+ 2. In the **</> Developer** perspective, go to **Topology** view.
22
+ 3. Click on the **nodejs-sample** deployment to view its details.
23
+ 4. Click on the **Monitoring** tab in the side panel.
24
+ You can see context sensitive metrics and alerts in the **Monitoring** tab.`,
25
+ review: {
26
+ instructions: `#### To verify you can view the monitoring information:
27
+ 1. Do you see a **Metrics** accordion in the side panel?
28
+ 2. Do you see a **View monitoring dashboard** link in the **Metrics** accordion?
29
+ 3. Do you see three charts in the **Metrics** accordion: **CPU Usage**, **Memory Usage** and **Receive Bandwidth**?`,
30
+ failedTaskHelp: `This task isn’t verified yet. Try the task again.`
31
+ },
32
+ summary: {
33
+ success: `You have learned how you can monitor your sample app!`,
34
+ failed: `Try the steps again.`
35
+ }
36
+ },
37
+ {
38
+ title: `Viewing your project monitoring dashboard`,
39
+ description: `### To view the project monitoring dashboard in the context of **nodejs-sample**:
40
+ 1. Click on the **View monitoring dashboard** link in the side panel.
41
+ 2. You can change the **Time Range** and **Refresh Interval** of the dashboard.
42
+ 3. You can change the context of the dashboard as well by clicking on the drop-down list. Select a specific workload or **All Workloads** to view the dashboard in the context of the entire project.`,
43
+ review: {
44
+ instructions: `#### To verify that you are able to view the monitoring dashboard:
45
+ Do you see metrics charts in the dashboard?`,
46
+ failedTaskHelp: `This task isn’t verified yet. Try the task again.`
47
+ },
48
+ summary: {
49
+ success: `You have learned how to view the dashboard in the context of your sample app!`,
50
+ failed: `Try the steps again.`
51
+ }
52
+ },
53
+ {
54
+ title: `Viewing custom metrics`,
55
+ description: `### To view custom metrics:
56
+ 1. Click on the **Metrics** tab of the **Monitoring** page.
57
+ 2. Click the **Select Query** drop-down list to see the available queries.
58
+ 3. Click on **Filesystem Usage** from the list to run the query.`,
59
+ review: {
60
+ instructions: `#### Verify you can see the chart associated with the query:
61
+ Do you see a chart displayed with filesystem usage for your project? Note: select **Custom Query** from the dropdown to create and run a custom query utilizing PromQL.
62
+ `,
63
+ failedTaskHelp: `This task isn’t verified yet. Try the task again.`
64
+ },
65
+ summary: {
66
+ success: `You have learned how to run a query!`,
67
+ failed: `Try the steps again.`
68
+ }
69
+ }
70
+ ],
71
+ conclusion: `You have learned how to access workload monitoring and metrics!`,
72
+ nextQuickStart: [``]
73
+ }
74
+ };
@@ -0,0 +1,30 @@
1
+ export declare const monitorSampleAppQuickStart: {
2
+ apiVersion: string;
3
+ kind: string;
4
+ metadata: {
5
+ name: string;
6
+ };
7
+ spec: {
8
+ version: number;
9
+ displayName: string;
10
+ durationMinutes: number;
11
+ icon: string;
12
+ description: string;
13
+ prerequisites: string[];
14
+ introduction: string;
15
+ tasks: {
16
+ title: string;
17
+ description: string;
18
+ review: {
19
+ instructions: string;
20
+ failedTaskHelp: string;
21
+ };
22
+ summary: {
23
+ success: string;
24
+ failed: string;
25
+ };
26
+ }[];
27
+ conclusion: string;
28
+ nextQuickStart: string[];
29
+ };
30
+ };
@@ -0,0 +1,74 @@
1
+ export const monitorSampleAppQuickStart = {
2
+ apiVersion: 'console.openshift.io/v1',
3
+ kind: 'QuickStarts',
4
+ metadata: {
5
+ name: 'monitor-sampleapp'
6
+ },
7
+ spec: {
8
+ version: 4.7,
9
+ displayName: 'Monitoring your sample application',
10
+ durationMinutes: 10,
11
+ icon: '',
12
+ description: `Now that you’ve created a sample application and added health checks, let’s monitor your application.`,
13
+ prerequisites: [`You completed the "Getting started with a sample" quick start.`],
14
+ introduction: `### This quick start shows you how to monitor your sample application.
15
+ You should have previously created the **sample-app** application and **nodejs-sample** deployment via the **Get started with a sample** quick start. If you haven't, you may be able to follow these tasks with any existing deployment.`,
16
+ tasks: [
17
+ {
18
+ title: `Viewing the monitoring details of your sample application`,
19
+ description: `### To view the details of your sample application:
20
+ 1. Go to the project your sample application was created in.
21
+ 2. In the **</> Developer** perspective, go to **Topology** view.
22
+ 3. Click on the **nodejs-sample** deployment to view its details.
23
+ 4. Click on the **Monitoring** tab in the side panel.
24
+ You can see context sensitive metrics and alerts in the **Monitoring** tab.`,
25
+ review: {
26
+ instructions: `#### To verify you can view the monitoring information:
27
+ 1. Do you see a **Metrics** accordion in the side panel?
28
+ 2. Do you see a **View monitoring dashboard** link in the **Metrics** accordion?
29
+ 3. Do you see three charts in the **Metrics** accordion: **CPU Usage**, **Memory Usage** and **Receive Bandwidth**?`,
30
+ failedTaskHelp: `This task isn’t verified yet. Try the task again.`
31
+ },
32
+ summary: {
33
+ success: `You have learned how you can monitor your sample app!`,
34
+ failed: `Try the steps again.`
35
+ }
36
+ },
37
+ {
38
+ title: `Viewing your project monitoring dashboard`,
39
+ description: `### To view the project monitoring dashboard in the context of **nodejs-sample**:
40
+ 1. Click on the **View monitoring dashboard** link in the side panel.
41
+ 2. You can change the **Time Range** and **Refresh Interval** of the dashboard.
42
+ 3. You can change the context of the dashboard as well by clicking on the drop-down list. Select a specific workload or **All Workloads** to view the dashboard in the context of the entire project.`,
43
+ review: {
44
+ instructions: `#### To verify that you are able to view the monitoring dashboard:
45
+ Do you see metrics charts in the dashboard?`,
46
+ failedTaskHelp: `This task isn’t verified yet. Try the task again.`
47
+ },
48
+ summary: {
49
+ success: `You have learned how to view the dashboard in the context of your sample app!`,
50
+ failed: `Try the steps again.`
51
+ }
52
+ },
53
+ {
54
+ title: `Viewing custom metrics`,
55
+ description: `### To view custom metrics:
56
+ 1. Click on the **Metrics** tab of the **Monitoring** page.
57
+ 2. Click the **Select Query** drop-down list to see the available queries.
58
+ 3. Click on **Filesystem Usage** from the list to run the query.`,
59
+ review: {
60
+ instructions: `#### Verify you can see the chart associated with the query:
61
+ Do you see a chart displayed with filesystem usage for your project? Note: select **Custom Query** from the dropdown to create and run a custom query utilizing PromQL.
62
+ `,
63
+ failedTaskHelp: `This task isn’t verified yet. Try the task again.`
64
+ },
65
+ summary: {
66
+ success: `You have learned how to run a query!`,
67
+ failed: `Try the steps again.`
68
+ }
69
+ }
70
+ ],
71
+ conclusion: `You have learned how to access workload monitoring and metrics!`,
72
+ nextQuickStart: [``]
73
+ }
74
+ };