From 3d202a04b99f0e61b6ccf8b7a5610e1a15ca58e7 Mon Sep 17 00:00:00 2001 From: Herbert Eiselt Date: Mon, 11 Feb 2019 14:54:12 +0100 Subject: Add sdnr wt odlux Add complete sdnr wireless transport app odlux core and apps Change-Id: I5dcbfb8f3b790e3bda7c8df67bd69d81958f65e5 Issue-ID: SDNC-576 Signed-off-by: Herbert Eiselt --- .../odlux/apps/demoApp/src/views/authorsList.tsx | 70 ++++++++++++++++++++++ .../wt/odlux/apps/demoApp/src/views/editAuthor.tsx | 17 ++++++ 2 files changed, 87 insertions(+) create mode 100644 sdnr/wt/odlux/apps/demoApp/src/views/authorsList.tsx create mode 100644 sdnr/wt/odlux/apps/demoApp/src/views/editAuthor.tsx (limited to 'sdnr/wt/odlux/apps/demoApp/src/views') diff --git a/sdnr/wt/odlux/apps/demoApp/src/views/authorsList.tsx b/sdnr/wt/odlux/apps/demoApp/src/views/authorsList.tsx new file mode 100644 index 000000000..b192fccf8 --- /dev/null +++ b/sdnr/wt/odlux/apps/demoApp/src/views/authorsList.tsx @@ -0,0 +1,70 @@ +import * as React from 'react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; + +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; +import Paper from '@material-ui/core/Paper'; // means border + +import connect from '../../../../framework/src/flux/connect'; + +import { loadAllAuthorsAsync } from '../actions/authorActions'; +import { IAuthor } from '../models/author'; + +interface IAuthorsListProps { + authors: IAuthor[], + busy: boolean, + onLoadAllAuthors: () => void +} + +class AuthorsListComponent extends React.Component { + + render(): JSX.Element { + const { authors, busy } = this.props; + return ( + + + + + Id + First Name + Last Name + + + + { authors.map(author => ( + this.editAuthor(author) }> + { author.id } + { author.firstName } + { author.lastName } + + )) } + +
+
+ ); + }; + + public componentDidMount() { + this.props.onLoadAllAuthors(); + } + + private editAuthor = (author: IAuthor) => { + author && this.props.history.push(this.props.match.path + '/' + author.id); + }; +} + +export const AuthorsList = withRouter( + connect( + ({ demoApp: state }) => ({ + authors: state.listAuthors.authors, + busy: state.listAuthors.busy + }), + (dispatcher) => ({ + onLoadAllAuthors: () => { + dispatcher.dispatch(loadAllAuthorsAsync) + } + }))(AuthorsListComponent)); +export default AuthorsList; diff --git a/sdnr/wt/odlux/apps/demoApp/src/views/editAuthor.tsx b/sdnr/wt/odlux/apps/demoApp/src/views/editAuthor.tsx new file mode 100644 index 000000000..31bfafc75 --- /dev/null +++ b/sdnr/wt/odlux/apps/demoApp/src/views/editAuthor.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; + +type EditAuthorProps = RouteComponentProps<{ authorId: string}>; + +class EditAuthorComponent extends React.Component { + render(): JSX.Element { + return ( +
+

Edit Author { this.props.match.params.authorId }

+
+ ) + } +} + +export const EditAuthor = withRouter(EditAuthorComponent); +export default EditAuthor; \ No newline at end of file -- cgit 1.2.3-korg