Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix(patternfly): updated patternfly to the correct version
Browse files Browse the repository at this point in the history
Our patternfly version was outdated. It has now been updated to the latest version.
That required some other changes in our code.
  • Loading branch information
ziccardi authored and secondsun committed Sep 16, 2020
1 parent d94dd1b commit 4a6d11d
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@aerogear/unifiedpush-admin-client": "0.1.9",
"@fortawesome/fontawesome-free": "^5.13.0",
"@patternfly/react-core": "3.146.0",
"@patternfly/react-core": "4.18.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
Expand Down
39 changes: 39 additions & 0 deletions src/application/ApplicationDetail/ApplicationDetail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component, ReactNode } from 'react';
import { PushApplication } from '@aerogear/unifiedpush-admin-client';
import { Modal, Tabs, Tab } from '@patternfly/react-core';

interface Props {
app?: PushApplication;
show: boolean;
onClose: (app: PushApplication) => void;
}

export class ApplicationDetail extends Component<Props> {
render = () => (
<Modal
title={this.props.app?.name || ''}
isOpen={this.props.show}
onClose={() => this.props.onClose && this.props.onClose(this.props.app!)}
// actions={[
// <Button key="confirm" variant="primary" onClick={this.handleModalToggle}>
// Confirm
// </Button>,
// <Button key="cancel" variant="link" onClick={this.handleModalToggle}>
// Cancel
// </Button>
// ]}
>
<Tabs activeKey={0}>
<Tab eventKey={0} title="Users">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
</Tab>
</Tabs>
</Modal>
);
}
24 changes: 23 additions & 1 deletion src/application/ApplicationList/ApplicationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { DeleteApplicationPage } from '../crud/DeleteApplicationPage';
import { UpdateApplicationPage } from '../crud/UpdateApplicationPage';
import { ApplicationListItem } from './ApplicationListItem';
import { ApplicationDetail } from '../ApplicationDetail/ApplicationDetail';

interface Props {
apps: PushApplication[];
Expand All @@ -28,6 +29,7 @@ interface State {
openCreateAppWizard: boolean;
deleteApplicationPage: boolean;
updateApplicationPage: boolean;
showAppDetailPage: boolean;
selectedApp?: PushApplication;
currentPage: number;
totalApps: number;
Expand All @@ -40,6 +42,7 @@ export class ApplicationList extends Component<Props, State> {
openCreateAppWizard: false,
deleteApplicationPage: false,
updateApplicationPage: false,
showAppDetailPage: false,
currentPage: 0,
totalApps: 0,
};
Expand All @@ -58,11 +61,29 @@ export class ApplicationList extends Component<Props, State> {
selectedApp: app,
});

const showAppDetails = (app: PushApplication) =>
this.setState({
showAppDetailPage: true,
selectedApp: app,
});

const closeAllDialogs = () =>
this.setState({
showAppDetailPage: false,
deleteApplicationPage: false,
updateApplicationPage: false,
});

return (
<ApplicationListConsumer>
{({ applications, refresh, total }: ContextInterface): ReactNode => {
return (
<>
<ApplicationDetail
app={this.state.selectedApp}
show={this.state.showAppDetailPage}
onClose={(app: PushApplication) => closeAllDialogs()}
/>
<UpdateApplicationPage
open={this.state.updateApplicationPage}
app={this.state.selectedApp}
Expand Down Expand Up @@ -117,11 +138,12 @@ export class ApplicationList extends Component<Props, State> {
</SplitItem>
</Split>
<DataList aria-label="Data list for Push Applications on the Server">
{applications.map(app => (
{applications.map((app: PushApplication) => (
<ApplicationListItem
app={app}
onEdit={editApp}
onDelete={deleteApp}
onClick={showAppDetails}
/>
))}
</DataList>
Expand Down
31 changes: 18 additions & 13 deletions src/application/ApplicationList/ApplicationListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface Props {
app: PushApplication;
onEdit?: (app: PushApplication) => void;
onDelete?: (app: PushApplication) => void;
onClick?: (app: PushApplication) => void;
}

export class ApplicationListItem extends Component<Props> {
Expand All @@ -30,6 +31,7 @@ export class ApplicationListItem extends Component<Props> {
aria-labelledby={'item'}
key={this.props.app.pushApplicationID}
className="appList"
onClick={() => this.props.onClick && this.props.onClick(this.props.app)}
>
<DataListItemRow>
<DataListItemCells
Expand Down Expand Up @@ -76,24 +78,27 @@ export class ApplicationListItem extends Component<Props> {
className="editBtn"
variant="secondary"
icon={<EditIcon />}
onClick={() =>
this.props.onEdit && this.props.onEdit(this.props.app)
}
>
<EditIcon />
</Button>
onClick={evt => {
evt.stopPropagation();
return (
this.props.onEdit && this.props.onEdit(this.props.app)
);
}}
/>
</ListItem>
<ListItem>
<Button
className="deleteBtn"
variant="danger"
icon={TrashIcon}
onClick={() =>
this.props.onDelete && this.props.onDelete(this.props.app)
}
>
<TrashIcon />
</Button>
icon={<TrashIcon />}
onClick={evt => {
evt.stopPropagation();
return (
this.props.onDelete &&
this.props.onDelete(this.props.app)
);
}}
/>
</ListItem>
</List>
</DataListCell>,
Expand Down
1 change: 0 additions & 1 deletion src/application/crud/CreateApplicationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class CreateApplicationPage extends Component<Props, State> {
placeholder={'Application name'}
type="text"
aria-label="Text Input for Application Name"
css={''}
/>
<Button
variant="primary"
Expand Down
3 changes: 1 addition & 2 deletions src/application/crud/DeleteApplicationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export class DeleteApplicationPage extends Component<Props, State> {
render(): React.ReactNode {
return this.props.app ? (
<Modal
isSmall
title="Delete Application"
isOpen={this.props.open}
onClose={this.props.close}
variant={'small'}
>
<Form className="dialog-form">
<FormGroup
Expand All @@ -68,7 +68,6 @@ export class DeleteApplicationPage extends Component<Props, State> {
className="formInput"
onChange={value => this.setState({ name: value })}
isRequired
css={''}
/>
</FormGroup>
<div className="formButtons">
Expand Down
3 changes: 1 addition & 2 deletions src/application/crud/UpdateApplicationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export class UpdateApplicationPage extends Component<Props, State> {
render(): React.ReactNode {
return this.props.app ? (
<Modal
isSmall
title="Edit Application name"
isOpen={this.props.open}
onClose={this.props.close}
variant={'small'}
>
<Form className="dialog-form">
<FormGroup fieldId="simple-form-title" helperText="Enter a new name">
Expand All @@ -54,7 +54,6 @@ export class UpdateApplicationPage extends Component<Props, State> {
defaultValue={this.props.app?.name}
onChange={value => this.setState({ name: value })}
isRequired
css={''}
/>
</FormGroup>
<div className="formButtons">
Expand Down
15 changes: 10 additions & 5 deletions src/landing/components/ActionBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Component } from 'react';

import { Card, CardHead, CardHeader, CardBody } from '@patternfly/react-core';
import { Card, CardTitle, CardHeader, CardBody } from '@patternfly/react-core';

interface Props {
icon?: string;
Expand All @@ -18,15 +18,20 @@ export class ActionBox extends Component<Props> {
<div className="ups-number">
<span>{this.props.index}</span>
</div>
<CardHead className={'CardHead'}>
<CardTitle className={'CardHead'}>
<div className={'ActionBox-content'}>
{this.props.icon ? (
<i className={`fas ${this.props.icon} fa-3x muted`} />
) : null}
<CardHeader>{this.props.title}</CardHeader>
<CardBody className="small">{this.props.description}</CardBody>
</div>
</CardHead>
</CardTitle>
<CardHeader>
<div className={'ActionBox-content'}>{this.props.title}</div>
</CardHeader>

<CardBody className="small">
<div className={'ActionBox-content'}>{this.props.description}</div>
</CardBody>
</Card>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/landing/components/GeneralStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class GeneralStats extends Component<Props> {
<div className={'apps-dashboard'}>
<Title
headingLevel="h1"
size="xs"
size="md"
style={{ paddingTop: 51, paddingLeft: 20, paddingBottom: 21 }}
>
General Statistics
Expand Down
2 changes: 1 addition & 1 deletion src/landing/components/NoApplicationsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class NoApplicationsPage extends Component<{}, State> {
</PageSection>
<Divider />
<LightPageSection>
<Grid sm={3} gutter={'sm'}>
<Grid sm={3} hasGutter>
<ActionBox
first
index={1}
Expand Down
1 change: 1 addition & 0 deletions src/styles/app-list.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'globals.scss' ;
.title {
font-size: 22px;
color: rgb(85,85,85);
Expand Down
6 changes: 2 additions & 4 deletions src/styles/landing-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
font-family: "Font Awesome 5 Free", serif;
font-weight: 900;
position: absolute;
left: -17px;
left: -13px;
top: 100px;
color: $lightColor;
z-index: auto;
Expand All @@ -40,11 +40,9 @@
border-style: solid;
background-color: $offWhite;
box-shadow: 5px 5px 8px $shadowBlur;

}

.ActionBox-content {
margin-top: 30px;
text-align: center;
width: 100%;
}
Expand All @@ -55,7 +53,7 @@
}

.CardHead {
margin-top: 5px;
margin-top: 30px;
}

.muted {
Expand Down

0 comments on commit 4a6d11d

Please sign in to comment.