Skip to content
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

Improve the Dashboard Landing Page Experience #2615

Closed

Conversation

jeff-phillips-18
Copy link
Contributor

@jeff-phillips-18 jeff-phillips-18 commented Mar 20, 2024

Closes: RHOAISTRAT-119

Description

Adds a new landing page.

Screenshots

image

image

How Has This Been Tested?

Test Impact

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Commits have been squashed into descriptive, self-contained units of work (e.g. 'WIP' and 'Implements feedback' style messages have been removed)
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change (find relevant UX in the SMEs section).

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress This PR is in WIP state label Mar 20, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase PR needs to be rebased label Mar 22, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase PR needs to be rebased label Mar 22, 2024
@jeff-phillips-18 jeff-phillips-18 changed the title [WIP] Improve the Dashboard Landing Page Experience Improve the Dashboard Landing Page Experience Mar 25, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress This PR is in WIP state label Mar 25, 2024
showFavorite,
favorite = false,
updateFavorite = () => {
// do nothing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD?

If you legit mean do nothing as a default... maybe use _.noop just so you don't need to have a comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh -- well don't add code that has no use 😛 I didn't reverse lookup usage lol

@@ -28,6 +28,8 @@ export enum SupportedArea {
USER_MANAGEMENT = 'user-management',
ACCELERATOR_PROFILES = 'accelerator-profiles',

HOME = 'home',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, can we get this at the top of the enum?

@@ -1126,6 +1126,7 @@ export type DashboardCommonConfig = {
disableProjects: boolean;
disableModelServing: boolean;
disableProjectSharing: boolean;
disableHome: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should add this to the backend type too... we really need one shared type lol

<HintBody>
Your home page summarizes the projects you have access to, and includes helpful
resources such as quick starts.
<br />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paragraph tags not a better use-case? It may be a personal feel, but I think if you're going to break a line, you should also have a gap.

<br />
The old{' '}
<Button
style={{ fontSize: 'initial' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? What is impacting the fontSize?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PF inline link buttons set the font size smaller. This overrides the setting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you log a bug against PF if they cannot provide inline styles like that?

This seems like one of those "override it because it's wrong" and not "we want to do it because we want styles to be prescriptive" -- which has been the DS Projects & Home page goal here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see the bug logged as a comment above weird edge-case code so we know when we can remove it

<CardBody>
<Stack hasGutter>
<Bullseye>
<img height={32} src={imgSrc} alt="" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really shouldn't have no alt -- fairly certain that violates a11y.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really depends on the usage of the image. If it's decorative and not meant to convey specific information, an empty alt will allow a decorative image to be hidden: https://www.w3.org/WAI/tutorials/images/decorative/

onSelect: () => void;
}

const OrganizeCard: React.FC<OrganizeCardProps> = ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its own file please.

<PageSection data-testid="landing-page-organize" variant="light" {...rest}>
<Stack hasGutter>
<TextContent>
<Text component="h1">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless this is the Home component, I don't imagine you should say h1 -- since it's not the top level control. Wouldn't this be h2 at the min?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a single title here so there is no main h1. a11y folks tell me multiple h1's are better than none.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, ideally we can have one h1 and then have subsequent h2s that are beneath the h1, to convey the information architecture of the page. However, we couldn't really tell what makes sense to have as the main heading of the page that all of the other headings are a part of. Ideally, we could add another heading that would be the h1, but I imagine that changes the design a bit.

Comment on lines 13 to 23
const qsContext = React.useContext<QuickStartContextValues>(QuickStartContext);
const { components, loaded, loadError } = useWatchComponents(false);
const [shownQuickStarts, setShownQuickStarts] = React.useState<OdhDocument[]>([]);

React.useEffect(() => {
if (loaded && !loadError) {
const quickStarts =
qsContext.allQuickStarts?.slice(0, 4).map((quickStart) => {
const odhDoc = quickStart as unknown as OdhDocument;
const odhApp = components.find((c) => c.metadata.name === odhDoc.spec.appName);
const updatedDoc = {
...odhDoc,
spec: { ...odhDoc.spec, type: OdhDocumentType.QuickStart },
};
if (odhApp) {
updatedDoc.spec.appDisplayName = odhApp.spec.displayName;
updatedDoc.spec.img = odhDoc.spec.img || odhApp.spec.img;
updatedDoc.spec.description = odhDoc.spec.description || odhApp.spec.description;
}
return updatedDoc;
}) ?? [];
setShownQuickStarts(quickStarts);
}
}, [loaded, loadError, qsContext.allQuickStarts, components]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, this is probably best not done by this component and you just return a list of items, then slice out you 5 -- you're trying to duplicate the wonky logic we have for Components -- which is currently on the backend (so not sharable code 😞).

Can we do a little organization and just make it a hook for "enabled components" or something that you steal the first 5 or filter and steal the first 5?

Also I believe this is a memo with extra steps -- not sure this async methodology is needed.

};

const OrganizeSection: React.FC<OrganizeSectionProps> = ({ allowCreateProjects, ...rest }) => {
const { pipelinesServer } = usePipelinesAPI();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API is not available outside a project context... I think you mean to check the useIsAreaAvailable for Pipelines.


const Home: React.FC = () => {
const navigate = useNavigate();
const [hintHidden, setHintHidden] = useLocalStorage('rhodsNewLandingPageMessage', null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this odh.dashboard.<something> (eg. odh.dashboard.landing.message) or something to match with the other ODH storage flags we have?

image

Copy link
Contributor

openshift-ci bot commented Mar 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from andrewballantyne. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the needs-rebase PR needs to be rebased label Apr 7, 2024
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temp review -- we will break down the PR, so this is not needed changes with this PR.

Comment on lines +72 to +73
<Route path="/" element={<HomePage />} />
<Route path="/applications" element={<InstalledApplications />} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a feature flag but it is not going to be used to redirect the home back to InstalledApplications?

<Button aria-label="close" isInline variant="plain" onClick={onClose}>
<TimesIcon />
<Button aria-label={closeAlt || 'close'} isInline variant="plain" onClick={onClose}>
<TimesIcon alt={`close ${closeAlt}`} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you default closeAlt to close in the props? Wouldn't this just be close if you omit the property?

<br />
The old{' '}
<Button
style={{ fontSize: 'initial' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see the bug logged as a comment above weird edge-case code so we know when we can remove it


return (
<>
{!hintHidden ? (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this whole hint block into another component? It has a lot of text and nuance that really doesn't belong to the Home page component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase PR needs to be rebased
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants