summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/demoApp/src/views
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-11 14:54:12 +0100
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-11 14:54:53 +0100
commit3d202a04b99f0e61b6ccf8b7a5610e1a15ca58e7 (patch)
treeab756cfa8de5eced886d3947423d198be8c0ce62 /sdnr/wt/odlux/apps/demoApp/src/views
parent12a8c669f52c0e84d580c078cee849b25133b585 (diff)
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 <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/demoApp/src/views')
-rw-r--r--sdnr/wt/odlux/apps/demoApp/src/views/authorsList.tsx70
-rw-r--r--sdnr/wt/odlux/apps/demoApp/src/views/editAuthor.tsx17
2 files changed, 87 insertions, 0 deletions
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<RouteComponentProps & IAuthorsListProps> {
+
+ render(): JSX.Element {
+ const { authors, busy } = this.props;
+ return (
+ <Paper>
+ <Table >
+ <TableHead>
+ <TableRow>
+ <TableCell numeric>Id</TableCell>
+ <TableCell >First Name</TableCell>
+ <TableCell >Last Name</TableCell>
+ </TableRow>
+ </TableHead>
+ <TableBody>
+ { authors.map(author => (
+ <TableRow key={ author.id } onClick={ (e) => this.editAuthor(author) }>
+ <TableCell>{ author.id }</TableCell>
+ <TableCell>{ author.firstName }</TableCell>
+ <TableCell>{ author.lastName }</TableCell>
+ </TableRow>
+ )) }
+ </TableBody>
+ </Table>
+ </Paper>
+ );
+ };
+
+ 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<EditAuthorProps> {
+ render(): JSX.Element {
+ return (
+ <div>
+ <h2>Edit Author { this.props.match.params.authorId }</h2>
+ </div>
+ )
+ }
+}
+
+export const EditAuthor = withRouter(EditAuthorComponent);
+export default EditAuthor; \ No newline at end of file