Skip to content

Commit

Permalink
Merge pull request #144 from patternfly/prereq-links
Browse files Browse the repository at this point in the history
handle prereq links, fix spacing a bit
  • Loading branch information
jschuler authored Mar 10, 2022
2 parents e1800ff + ed56af6 commit 4274842
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/dev/src/AppLocalized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const App3: React.FC<AppProps> = ({ children, showCardFooters }) => {
language,
loading,
useQueryParams: withQueryParams,
alwaysShowTaskReview: false,
alwaysShowTaskReview: true,
};

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/src/AppProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
language,
loading,
useQueryParams: withQueryParams,
alwaysShowTaskReview: false,
alwaysShowTaskReview: true,
};

const toggleQuickStart = (quickStartId: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
description: |-
You just created a sample application. Now, let’s add health checks
to it.
prerequisites: [You completed the "Getting started with a sample" quick start.]
prerequisites: ["A Red Hat user account to access the [Red Hat Hybrid Cloud Console](https://console.redhat.com/).", "An instance of OpenShift Container Platform (OCP) 4.9 or higher running on Red Hat OpenShift Dedicated (OSD), or Red Hat OpenShift Service on AWS (ROSA). When using OSD or ROSA, an Amazon Web Services (AWS) account and credentials are required.", "Access to the OpenShift Cluster Manager (OCM) console.", "A service account with either the [MongoDB Atlas](https://www.mongodb.com/atlas/database), or [Crunchy Data Bridge](https://www.crunchydata.com), or [CockroachDB](https://www.cockroachlabs.com) cloud database provider.", "An existing database instance running on one of these cloud database providers: MongoDB Atlas, Crunchy Data Bridge, or CockroachDB."]
introduction: |-
### This quick start shows you how to add health checks to your sample application.
You should have previously created the **sample-app** application and **nodejs-sample** deployment using the **Get started with a sample** quick start. If you haven't, you may be able to follow these tasks with any existing deployment without configured health checks.
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/src/quickstarts-data/yaml/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ spec:
review:
instructions: |-
- Did you complete the task successfully?
failedTaskHelp: This task isnt verified yet. Try the task again.
failedTaskHelp: This task isn't verified yet. Try the task again.
# optional - the task's success and failure messages
summary:
success: Shows a success message in the task header
Expand All @@ -105,7 +105,7 @@ spec:
review:
instructions: |-
- Thanks for checking out this quick start!
failedTaskHelp: This task isnt verified yet. Try the task again.
failedTaskHelp: This task isn't verified yet. Try the task again.
conclusion: |-
The conclusion appears in the last section of the quick start.
# you can link to the next quick start(s) here
Expand Down
12 changes: 11 additions & 1 deletion packages/module/src/ConsoleInternal/components/markdown-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ export const markdownConvert = (markdown, extensions?: ShowdownExtension[]) => {
converter.addExtension(extensions);
}

// add hook to transform anchor tags
DOMPurify.addHook('beforeSanitizeElements', function(node) {
// nodeType 1 = element type

// transform anchor tags
if (node.nodeType === 1 && node.nodeName.toLowerCase() === 'a') {
node.setAttribute('rel', 'noopener noreferrer');
return node;
}

// add PF class to ul and ol lists
if (
node.nodeType === 1 &&
(node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol')
) {
node.setAttribute('class', 'pf-c-list');
return node;
}
});

// Add a hook to make all links open a new window
Expand Down
2 changes: 1 addition & 1 deletion packages/module/src/QuickStartDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const QuickStartContainer: React.FC<QuickStartContainerProps> = ({
useQueryParams = true,
markdown,
contextProps,
alwaysShowTaskReview = false,
alwaysShowTaskReview = true,
...props
}) => {
const valuesForQuickstartContext: QuickStartContextValues = useValuesForQuickStartContext({
Expand Down
3 changes: 0 additions & 3 deletions packages/module/src/QuickStartPanelContent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
&__body {
display: flex;
flex-direction: column;
ul, ol {
padding-left: 20px;
}
}
&__title {
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions packages/module/src/catalog/QuickStartTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
/>
}
onClick={handleClick}
// https://github.com/patternfly/patternfly-react/issues/7039
href="#"
data-test={`tile ${id}`}
description={
<QuickStartTileDescription description={description} prerequisites={prerequisites} />
Expand Down
4 changes: 3 additions & 1 deletion packages/module/src/controller/QuickStartIntroduction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const QuickStartIntroduction: React.FC<QuickStartIntroductionProps> = ({
{prereqs.map((pr) => {
return (
<ListItem key={pr} className="pfext-quick-start-intro__prereq-list__item">
<span className="pfext-quick-start-intro__prereq-list__item-content">{pr}</span>
<span className="pfext-quick-start-intro__prereq-list__item-content">
<QuickStartMarkdownView content={pr} />
</span>
</ListItem>
);
})}
Expand Down
10 changes: 6 additions & 4 deletions packages/module/src/controller/QuickStartTaskHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ const QuickStartTaskHeader: React.FC<QuickStartTaskHeaderProps> = ({
'pfext-quick-start-task-header__title-failed':
taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
});
const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
const skippedReviewOrFailed =
taskStatus === QuickStartTaskStatus.REVIEW || taskStatus === QuickStartTaskStatus.FAILED;
// const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
// const skippedReview = taskStatus === QuickStartTaskStatus.REVIEW;
const failedReview = taskStatus === QuickStartTaskStatus.FAILED;

const tryAgain = !isActiveTask && (skippedReviewOrFailed || notCompleted) && (
// TODO: toned down when this is shown, investigate further when we should display it
// related: https://github.com/patternfly/patternfly-quickstarts/issues/104
const tryAgain = failedReview && (
<>
<div />
<div className="pfext-quick-start-task-header__tryagain">Try the steps again.</div>
Expand Down
1 change: 0 additions & 1 deletion packages/module/src/controller/QuickStartTasks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
}
}
.pfext-quick-start-task__content {
margin-left: var(--pf-global--spacer--lg);
margin-bottom: var(--pf-global--spacer--md);
}
// Custom styles on PF React List rendered in custom react renderer
Expand Down
4 changes: 4 additions & 0 deletions packages/module/src/styles/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
input[type="radio"] {
margin-right: 7px;
}

.pf-c-list {
--pf-c-list--PaddingLeft: 20px;
}
}

// drawer
Expand Down
2 changes: 1 addition & 1 deletion packages/module/src/utils/quick-start-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const useValuesForQuickStartContext = (
});
setAllQuickStartStates((qs) => ({
...qs,
[quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.IN_PROGRESS),
[quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.NOT_STARTED),
}));
},
[setActiveQuickStartID, setAllQuickStartStates, useQueryParams],
Expand Down

0 comments on commit 4274842

Please sign in to comment.