New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI enhancement to support Quickstarts as CRs #6979
UI enhancement to support Quickstarts as CRs #6979
Conversation
2b09f45
to
f7a1c66
Compare
1db24ff
to
1418117
Compare
const [qsData, qsLoaded, qsError] = useK8sWatchResource<QuickStart[]>({ | ||
kind: referenceForModel(QuickStartModel), | ||
namespaced: false, | ||
isList: true, | ||
}); | ||
|
||
React.useEffect(() => { | ||
if (qsData && qsLoaded && !qsError) { | ||
const index = qsData.findIndex((qs) => qs.metadata.name === activeQuickStartID); | ||
index > -1 && setQuickStart(qsData[index]); | ||
} | ||
}, [activeQuickStartID, qsData, qsLoaded, qsError]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not load the quick starts here directly. instead use QuickStartsLoader
to load the quick starts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapped Drawer inside Loader
@@ -0,0 +1,201 @@ | |||
apiVersion: apiextensions.k8s.io/v1beta1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the CRD yaml anymore. The console operator has been updated with new CRD after this PR merged - openshift/console-operator#480
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the CRD
|
||
React.useEffect(() => { | ||
setQuickStarts(getQuickStarts()); | ||
}, []); | ||
if (qs && qsLoaded && !qsError) setQuickStarts(qs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need extra state for this. Just use whatever is returned from the useK8sWatchResource
hook. No need for this effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed it
@@ -1,4 +1,6 @@ | |||
export const sampleApplicationQuickStart = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still need typescript files for quick starts if everything is converted to yamls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retaining most as test data for QSCatalog and QS related components. Removed a couple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tests I think keeping just one would be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now kept only 3 quickStarts as I am checking them in the QuickStart Catalog for 3 concurrent quickStarts. removed rest.
1418117
to
c3a2c38
Compare
const index = quickStarts.findIndex((qs) => qs.metadata.name === activeQuickStartID); | ||
const quickStart = quickStarts[index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const index = quickStarts.findIndex((qs) => qs.metadata.name === activeQuickStartID); | |
const quickStart = quickStarts[index]; | |
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also wrap this in useMemo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, not using Memo as quickStarts now moved to props.
@@ -1,4 +1,6 @@ | |||
export const sampleApplicationQuickStart = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tests I think keeping just one would be fine.
@@ -0,0 +1,16 @@ | |||
import { exploreServerlessQuickStart } from './mocks/json/explore-serverless-quickstart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now kept only 3 quickStarts as I am checking them in the QuickStart Catalog for 3 concurrent quickStarts. removed rest.
const [quickStarts] = useK8sWatchResource<QuickStart[]>({ | ||
kind: referenceForModel(QuickStartModel), | ||
isList: true, | ||
}); | ||
const [allowedQuickStarts, setAllowedQuickStarts] = React.useState<QuickStart[]>([]); | ||
const [loaded, setLoaded] = React.useState<boolean>(!(quickStarts.length > 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useK8sWatchResource
hook returns a loaded variable to track loading of resource. use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using quickStartsLoaded
frontend/public/components/app.jsx
Outdated
<GuidedTour /> | ||
<ConsoleNotifier location="BannerBottom" /> | ||
</QuickStartDrawer> | ||
<QuickStartsLoader> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move QuickStartsLoader
into QuickStartsDrawer
. use an intermediate component in between if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved inside drawer and separated the panel component
2463001
to
b9f30b7
Compare
@@ -51,7 +51,7 @@ const QuickStartContent: React.FC<QuickStartContentProps> = ({ | |||
tasks={tasks} | |||
conclusion={conclusion} | |||
allTaskStatuses={allTaskStatuses} | |||
nextQuickStart={nextQuickStart} | |||
nextQuickStart={nextQuickStart[0]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextQuickStart
could also be undefined in some cases where a quick start doesn't define any next quick start. Better to add a null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
panelContent={ | ||
<QuickStartsLoader> | ||
{(quickStarts) => ( | ||
<QuickStartPanelContent | ||
quickStarts={quickStarts} | ||
handleClose={handleClose} | ||
activeQuickStartID={activeQuickStartID} | ||
/> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this into panelContent variable above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
/assign |
778c226
to
7b8fadd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abhinandan13jan I don't see icons for any of the quick starts in the catalog.
21bce75
to
226cec9
Compare
@rohitkrai03 Updated the icons. Just to note, the monitoring, healthcheck and sample doesn't have icons in the current JSONs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
DrawerCloseButton, | ||
Title, | ||
} from '@patternfly/react-core'; | ||
import { QuickStart } from './utils/quick-start-types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: absolute import statements should be above others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
/retest |
226cec9
to
67e1c3b
Compare
/retest |
1 similar comment
/retest |
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinandan13jan, nemesis09, rohitkrai03 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
8 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Issue
Addresses https://issues.redhat.com/browse/ODC-4751
and part of https://issues.redhat.com/browse/ODC-4752
Solution
Adds UI support for migration of QuickStarts to CRD
How to Test the PR
The QuickStart CRD and the CRs are placed in
frontend/packages/console-app/components/quickstarts/data/mock/yamls
Step 1:
Apply(API now contains the CRD)quick-start-crd.yaml
and wait for sometime for the server to updateStep 2: Apply a few CRs present in individual YAML files in same directory.
Step 3: Check for the
QuickStartTile
in+Add
pageStep 4: Check for
/quickstart
URL for theQuickStart
catalogStep 5: Click on a quickstart and check the
DrawerPanel
Screenshot
Implementation
Tests
Quick Start test suites updated
Browser conformance
Chrome