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

fix(serverless,pipeline): apply release badges to serverless and pipeline pages #2427

Merged
merged 1 commit into from Sep 11, 2019

Conversation

nemesis09
Copy link
Contributor

@nemesis09 nemesis09 commented Aug 20, 2019

Fixes Bugs -

This PR -

  • Adds support for Dev Preview Badge
  • Applies Dev Preview Badge to pipeline list, pipeline details page and pipeline run details pages
  • Applies Tech Preview Badge to serverless pages in the admin perspective

Screens -
Screenshot_2019-09-03 Pipelines · OKD
Screenshot_2019-09-03 Pipelines · OKD(1)
Screenshot_2019-09-03 complex-pipeline · Details · OKD
Screenshot_2019-09-03 Services · OKD
Screenshot_2019-09-03 Revisions · OKD
Screenshot_2019-09-03 Routes · OKD
Screenshot_2019-09-03 complex-pipeline-2b6aew · Details · OKD

@nemesis09
Copy link
Contributor Author

/cc @rohitkrai03 @christianvogt

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. component/core Related to console core functionality component/dev-console Related to dev-console labels Aug 21, 2019
@rohitkrai03
Copy link
Contributor

@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;
Copy link
Contributor

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.

Copy link
Contributor Author

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}/>}
Copy link
Contributor

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

Copy link
Contributor Author

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 />
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't a good layout. Flow layouts will always be more acceptable than absolute positioned elements and less prone to breakages.
image

You may be better off moving the addition of the tech preview badge from Breadcrumbs to PageHeading and applying a flex layout there with align-items center.

Copy link
Contributor Author

@nemesis09 nemesis09 Aug 27, 2019

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.

@nemesis09
Copy link
Contributor Author

@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.

Yes. The serverless resource pages already have the tech preview badge.

@nemesis09 nemesis09 force-pushed the fix-tech-preview branch 2 times, most recently from f9eaafb to 98d1b45 Compare August 22, 2019 12:22
@debsmita1
Copy link
Contributor

/test e2e-aws

@nemesis09 nemesis09 force-pushed the fix-tech-preview branch 3 times, most recently from 6e98149 to f9a72e5 Compare August 27, 2019 15:19
@nemesis09
Copy link
Contributor Author

@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.

Yes. The serverless resource pages already have the tech preview badge.

@nemesis09 nemesis09 closed this Aug 27, 2019
@nemesis09 nemesis09 reopened this Aug 27, 2019
@@ -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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Split>
<Split style={{alignItems: 'baseline'}}>

Copy link
Contributor Author

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">
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@christianvogt
Copy link
Contributor

@nemesis09 any updates on this?

Copy link
Member

@vikram-raj vikram-raj left a 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

@nemesis09
Copy link
Contributor Author

@nemesis09 any updates on this?

Waiting to test a change. other than that, its ready.

@openshift-ci-robot openshift-ci-robot added component/knative Related to knative-plugin component/shared Related to console-shared size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 3, 2019
@nemesis09 nemesis09 changed the title fix(pipeline): apply tech preview badges to pipeline pages fix(serverless,pipeline): apply release badges to serverless and pipeline pages Sep 3, 2019
@nemesis09 nemesis09 force-pushed the fix-tech-preview branch 2 times, most recently from d313da7 to 66dce34 Compare September 3, 2019 16:30
@nemesis09
Copy link
Contributor Author

Isn't pipeline run detail page should also have tech preview badge? @christianvogt @serenamarie125

I guess it should. So I've added it.

<Label style={{ backgroundColor: '#D93F00' }}>Dev Preview</Label>
);

export const ReleaseBadge: React.FC<ReleaseBadgeProps> = ({ releaseBadgeType }) => (
Copy link
Contributor

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.

Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor

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>
Copy link
Contributor

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>
Copy link
Contributor

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

Copy link
Contributor

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 }) => (
Copy link
Contributor

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';
Copy link
Contributor

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.

Suggested change
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>
Copy link
Contributor

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;
Copy link
Contributor

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 .

@nemesis09
Copy link
Contributor Author

@christianvogt @rohitkrai03
I've made the necessary changes conforming to the comments.

import * as React from 'react';
import { Label } from '@patternfly/react-core';

export const TechPreviewBadge: React.FC = () => (
Copy link
Contributor

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.

Copy link
Contributor Author

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)} />}
Copy link
Contributor

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

Copy link
Contributor Author

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.

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 9, 2019
@nemesis09
Copy link
Contributor Author

/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'}}>
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@nemesis09
Copy link
Contributor Author

/test e2e-aws-console-olm

@christianvogt
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2019
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 10, 2019
@nemesis09
Copy link
Contributor Author

/test e2e-aws-console-olm

@spadgett spadgett added this to the v4.2 milestone Sep 11, 2019
@openshift-merge-robot openshift-merge-robot merged commit adaba90 into openshift:master Sep 11, 2019
@nemesis09 nemesis09 deleted the fix-tech-preview branch September 19, 2019 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/knative Related to knative-plugin component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants