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
fix(serverless,pipeline): apply release badges to serverless and pipeline pages #2427
fix(serverless,pipeline): apply release badges to serverless and pipeline pages #2427
Conversation
@nemesis09 The JIRA issue mentions the badge needs to be applied in Serverless resource pages as well. The import flows with serverless checkbox already has the badge so that's done. |
@@ -54,11 +62,15 @@ export const PageHeading = connectToModel((props: PageHeadingProps) => { | |||
const hasButtonActions = !_.isEmpty(buttonActions); | |||
const hasMenuActions = _.isFunction(menuActions) || !_.isEmpty(menuActions); | |||
const showActions = (hasButtonActions || hasMenuActions) && !_.isEmpty(data) && !_.get(data, 'deletionTimestamp'); | |||
const isTechPreview = props.isTechPreview; |
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.
Deconstruct this value on line 50 with the other props.
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.
Done!
@@ -236,7 +237,7 @@ export const FireMan_ = connect(null, {filterList})( | |||
|
|||
const {title} = this.props; | |||
return <React.Fragment> | |||
{title && <PageHeading title={title} />} | |||
{title && <PageHeading title={title} isTechPreview={this.props.isTechPreview}/>} |
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.
Deconstruct isTechPreview
at line 238
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.
Done!
</ol> | ||
</div> | ||
<div className="co-breadcrumbs--tech-preview-badge"> | ||
<TechPreviewBadge /> |
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 are applying the TechPreviewBadge
to all Breadcrumbs
which is wrong.
This should be conditional and probably better controlled outside of the Breadcrumbs
component and in the heading itself.
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.
Done!
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.
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 added the badge to PageHeading
using Split
layout.
Yes. The serverless resource pages already have the tech preview badge. |
f9eaafb
to
98d1b45
Compare
/test e2e-aws |
6e98149
to
f9a72e5
Compare
|
@@ -56,9 +62,19 @@ export const PageHeading = connectToModel((props: PageHeadingProps) => { | |||
const showActions = (hasButtonActions || hasMenuActions) && !_.isEmpty(data) && !_.get(data, 'deletionTimestamp'); | |||
|
|||
return <div className={classNames('co-m-nav-title', {'co-m-nav-title--detail': detail}, {'co-m-nav-title--logo': isCSV}, {'co-m-nav-title--breadcrumbs': breadcrumbsFor && !_.isEmpty(data)})} style={style}> | |||
{ breadcrumbsFor && !_.isEmpty(data) && <BreadCrumbs breadcrumbs={breadcrumbsFor(data)} /> } | |||
<Split> |
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.
<Split> | |
<Split style={{alignItems: 'baseline'}}> |
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.
Done
{ breadcrumbsFor && !_.isEmpty(data) && <BreadCrumbs breadcrumbs={breadcrumbsFor(data)} />} | ||
</SplitItem> | ||
<SplitItem> | ||
<div className="co-pipeline-details--tech-preview-badge"> |
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.
Remove this <div>
and the associated class co-pipeline-details--tech-preview-badge
and style file.
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.
Done
@@ -119,6 +135,7 @@ export type PageHeadingProps = { | |||
title?: string | JSX.Element; | |||
titleFunc?: (obj: K8sResourceKind) => string | JSX.Element; | |||
customData?: any; | |||
isTechPreview?: boolean; |
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 should probably look at supporting the new DevPreviewBadge
as well now instead of a boolean.
Maybe accept a component named badge
and let the parent container provide either a TechPreviewBadge
or DevPreviewBadge
?
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.
Done
@nemesis09 any updates on this? |
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.
Isn't pipeline run detail page should also have tech preview badge? @christianvogt @serenamarie125
Waiting to test a change. other than that, its ready. |
f9a72e5
to
5ebff8e
Compare
d313da7
to
66dce34
Compare
I guess it should. So I've added it. |
66dce34
to
e119ade
Compare
<Label style={{ backgroundColor: '#D93F00' }}>Dev Preview</Label> | ||
); | ||
|
||
export const ReleaseBadge: React.FC<ReleaseBadgeProps> = ({ releaseBadgeType }) => ( |
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 component wouldn't be necessary if there was no string to bade mapping.
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 agree here. This could quickly get messy if we add more badges in future. It's better if parent sends the . component directly instead of sending badge type prop.
@@ -119,6 +131,7 @@ export type PageHeadingProps = { | |||
title?: string | JSX.Element; | |||
titleFunc?: (obj: K8sResourceKind) => string | JSX.Element; | |||
customData?: any; | |||
releaseBadgeType?: string; |
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.
If you made this badge: React.ReactNode
then the parent could simply supply a custom badge component of either DevPreviewBadge
or TechPreviewBadge
instead of mapping a string to a badge type in case we later have additional badges or badges that are linked to documentation or some other customization.
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.
@nemesis09 Better just remove the ReleaseBadge
component and use individual DevPreviewBadge
and TechPreviewComponent
components as suggested by @christianvogt .
<SplitItem isFilled> | ||
{ breadcrumbsFor && !_.isEmpty(data) && <BreadCrumbs breadcrumbs={breadcrumbsFor(data)} />} | ||
</SplitItem> | ||
<SplitItem> |
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 can omit this SplitItem
as well if there is no badge to display.
@@ -50,7 +50,7 @@ const CommandLineTools: React.FC<CommandLineToolsProps> = ({obj}) => { | |||
</p> | |||
<hr /> | |||
<h2 className="co-section-heading">odo - Developer-focused CLI for OpenShift</h2> | |||
<p><TechPreviewBadge /></p> | |||
<p><ReleaseBadge releaseBadgeType="tech-preview" /></p> |
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.
No reason to change this from TechPreviewBadge
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.
Yes, and for that you need to export both DevPreviewBadge
and TechPreviewBadge
in the index file of @console/shared
as suggested above.
<Label style={{ backgroundColor: '#D93F00' }}>Dev Preview</Label> | ||
); | ||
|
||
export const ReleaseBadge: React.FC<ReleaseBadgeProps> = ({ releaseBadgeType }) => ( |
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 agree here. This could quickly get messy if we add more badges in future. It's better if parent sends the . component directly instead of sending badge type prop.
@@ -1,3 +1,3 @@ | |||
export { default as TechPreviewBadge } from './TechPreviewBadge'; | |||
export { default as ReleaseBadge } from './ReleaseBadge'; |
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.
@nemesis09 This change will break the Serverless
section in import flows as it imports TechPreviewBadge
.
export { default as ReleaseBadge } from './ReleaseBadge'; | |
export * from './ReleaseBadge'; |
@@ -50,7 +50,7 @@ const CommandLineTools: React.FC<CommandLineToolsProps> = ({obj}) => { | |||
</p> | |||
<hr /> | |||
<h2 className="co-section-heading">odo - Developer-focused CLI for OpenShift</h2> | |||
<p><TechPreviewBadge /></p> | |||
<p><ReleaseBadge releaseBadgeType="tech-preview" /></p> |
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.
Yes, and for that you need to export both DevPreviewBadge
and TechPreviewBadge
in the index file of @console/shared
as suggested above.
@@ -119,6 +131,7 @@ export type PageHeadingProps = { | |||
title?: string | JSX.Element; | |||
titleFunc?: (obj: K8sResourceKind) => string | JSX.Element; | |||
customData?: any; | |||
releaseBadgeType?: string; |
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.
@nemesis09 Better just remove the ReleaseBadge
component and use individual DevPreviewBadge
and TechPreviewComponent
components as suggested by @christianvogt .
e119ade
to
2ef62b8
Compare
@christianvogt @rohitkrai03 |
2ef62b8
to
d1b5521
Compare
import * as React from 'react'; | ||
import { Label } from '@patternfly/react-core'; | ||
|
||
export const TechPreviewBadge: React.FC = () => ( |
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.
These should be their own separate components since we want to follow the convention of one Component per file.
If you want to make a sub dir named badges, that's ok.
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.
Done.
{ breadcrumbsFor && !_.isEmpty(data) && <BreadCrumbs breadcrumbs={breadcrumbsFor(data)} /> } | ||
<Split style={{alignItems: 'baseline'}}> | ||
<SplitItem isFilled> | ||
{ breadcrumbsFor && !_.isEmpty(data) && <BreadCrumbs breadcrumbs={breadcrumbsFor(data)} />} |
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.
Looks like you should omit the entire <Split>
component if breadcrumbsFor
is false
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.
Yes. It's fixed now.
d1b5521
to
5856cb6
Compare
/retest |
return <div className={classNames('co-m-nav-title', {'co-m-nav-title--detail': detail}, {'co-m-nav-title--logo': isCSV}, {'co-m-nav-title--breadcrumbs': breadcrumbsFor && !_.isEmpty(data)})} style={style}> | ||
{ breadcrumbsFor && !_.isEmpty(data) && <BreadCrumbs breadcrumbs={breadcrumbsFor(data)} /> } | ||
<Split style={{alignItems: 'baseline'}}> |
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.
Only add this when breadcumbsFor
is truthy.
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.
Done
5856cb6
to
ba40aa4
Compare
ba40aa4
to
1f2f925
Compare
/test e2e-aws-console-olm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, nemesis09 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 |
/test e2e-aws-console-olm |
Fixes Bugs -
This PR -
Screens -