Skip to content

Commit

Permalink
fixed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi-kn committed Feb 5, 2020
1 parent 067ab4e commit a40dd0c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const MonitoringPage: React.FC<MonitoringPageProps> = ({ match }) => {
/>
</>
) : (
<ProjectListPage badge={<TechPreviewBadge />} title="Monitoring">
<ProjectListPage title="Monitoring">
Select a project to view monitoring metrics
</ProjectListPage>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface MonitoringEventsProps {
}

const MonitoringEvents: React.FC<MonitoringEventsProps> = (props) => {
return <EventsList {...props} namespace={props.match.params.ns} pageTitle="" />;
return <EventsList {...props} namespace={props.match.params.ns} />;
};

export default MonitoringEvents;
18 changes: 10 additions & 8 deletions frontend/public/components/events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,7 @@ export class EventsList extends React.Component {

return (
<>
<Helmet>
<title>Events</title>
</Helmet>
<PageHeading
detail={true}
title={this.props.pageTitle !== undefined ? this.props.pageTitle : 'Events'}
>
<PageHeading detail={true} title={this.props.title}>
<div className="co-search-group">
<ResourceListDropdown
onChange={this.toggleSelected}
Expand Down Expand Up @@ -305,7 +299,15 @@ export const ErrorLoadingEvents = () => (

export const EventStreamPage = withStartGuide(({ noProjectsAvailable, ...rest }) => (
<>
<EventsList {...rest} autoFocus={!noProjectsAvailable} mock={noProjectsAvailable} />
<Helmet>
<title>Events</title>
</Helmet>
<EventsList
{...rest}
autoFocus={!noProjectsAvailable}
mock={noProjectsAvailable}
title="Events"
/>
</>
));

Expand Down
78 changes: 40 additions & 38 deletions frontend/public/components/utils/headings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const PageHeading = connectToModel((props: PageHeadingProps) => {
const showActions =
(hasButtonActions || hasMenuActions) && hasData && !_.get(data, 'metadata.deletionTimestamp');
const resourceStatus = hasData && getResourceStatus ? getResourceStatus(data) : null;
const showHeading = props.icon || kind || resourceTitle || resourceStatus || badge || showActions;
return (
<div
className={classNames(
Expand All @@ -119,45 +120,46 @@ export const PageHeading = connectToModel((props: PageHeadingProps) => {
{badge && <SplitItem>{badge}</SplitItem>}
</Split>
)}
<h1
className={classNames('co-m-pane__heading', { 'co-m-pane__heading--logo': props.icon })}
style={resourceTitle ? {} : { margin: 0 }}
>
{props.icon ? (
<props.icon obj={data} />
) : (
<div className="co-m-pane__name co-resource-item">
{kind && <ResourceIcon kind={kind} className="co-m-resource-icon--lg" />}{' '}
<span data-test-id="resource-title" className="co-resource-item__resource-name">
{resourceTitle}
</span>
{resourceStatus && (
<span className="co-resource-item__resource-status hidden-xs">
<Badge className="co-resource-item__resource-status-badge" isRead>
<Status status={resourceStatus} />
</Badge>
{showHeading && (
<h1
className={classNames('co-m-pane__heading', { 'co-m-pane__heading--logo': props.icon })}
>
{props.icon ? (
<props.icon obj={data} />
) : (
<div className="co-m-pane__name co-resource-item">
{kind && <ResourceIcon kind={kind} className="co-m-resource-icon--lg" />}{' '}
<span data-test-id="resource-title" className="co-resource-item__resource-name">
{resourceTitle}
</span>
)}
</div>
)}
{!breadcrumbsFor && badge}
{showActions && (
<div className="co-actions" data-test-id="details-actions">
{hasButtonActions && (
<ActionButtons actionButtons={buttonActions.map((a) => a(kindObj, data))} />
)}
{hasMenuActions && (
<ActionsMenu
actions={
_.isFunction(menuActions)
? menuActions(kindObj, data, extraResources, customData)
: menuActions.map((a) => a(kindObj, data, extraResources, customData))
}
/>
)}
</div>
)}
</h1>
{resourceStatus && (
<span className="co-resource-item__resource-status hidden-xs">
<Badge className="co-resource-item__resource-status-badge" isRead>
<Status status={resourceStatus} />
</Badge>
</span>
)}
</div>
)}
{!breadcrumbsFor && badge}
{showActions && (
<div className="co-actions" data-test-id="details-actions">
{hasButtonActions && (
<ActionButtons actionButtons={buttonActions.map((a) => a(kindObj, data))} />
)}
{hasMenuActions && (
<ActionsMenu
actions={
_.isFunction(menuActions)
? menuActions(kindObj, data, extraResources, customData)
: menuActions.map((a) => a(kindObj, data, extraResources, customData))
}
/>
)}
</div>
)}
</h1>
)}
{props.children}
</div>
);
Expand Down

0 comments on commit a40dd0c

Please sign in to comment.