diff --git a/ui/src/pages/Clients.js b/ui/src/pages/Clients.js
deleted file mode 100644
index 0082d81..0000000
--- a/ui/src/pages/Clients.js
+++ /dev/null
@@ -1,146 +0,0 @@
-import React, {Component} from 'react';
-import Grid from 'material-ui/Grid';
-import Table, {TableBody, TableCell, TableHead, TableRow} from 'material-ui/Table';
-import Paper from 'material-ui/Paper';
-import Button from 'material-ui/Button';
-import IconButton from 'material-ui/IconButton';
-import Dialog, {DialogActions, DialogContent, DialogTitle} from 'material-ui/Dialog';
-import TextField from 'material-ui/TextField';
-import Tooltip from 'material-ui/Tooltip';
-import ClientStore from '../stores/ClientStore';
-import ToggleVisibility from '../component/ToggleVisibility';
-import * as ClientAction from '../actions/ClientAction';
-import DefaultPage from '../component/DefaultPage';
-import ConfirmDialog from '../component/ConfirmDialog';
-import PropTypes from 'prop-types';
-import Delete from 'material-ui-icons/Delete';
-
-class Clients extends Component {
- constructor() {
- super();
- this.state = {clients: [], showDialog: false, deleteId: -1};
- }
-
- componentWillMount() {
- ClientStore.on('change', this.updateClients);
- this.updateClients();
- }
-
- componentWillUnmount() {
- ClientStore.removeListener('change', this.updateClients);
- }
-
- updateClients = () => this.setState({...this.state, clients: ClientStore.get()});
-
- showCreateDialog = () => this.setState({...this.state, showDialog: true});
- hideCreateDialog = () => this.setState({...this.state, showDialog: false});
-
- showDeleteDialog = (deleteId) => this.setState({...this.state, deleteId});
- hideDeleteDelete = () => this.setState({...this.state, deleteId: -1});
-
- render() {
- const {clients, deleteId, showDialog} = this.state;
- return (
-
-
-
-
-
-
- Name
- token
-
-
-
-
- {clients.map((client) => {
- return (
- this.showDeleteDialog(client.id)}/>
- );
- })}
-
-
-
-
- {showDialog && }
- {deleteId !== -1 && ClientAction.deleteClient(deleteId)}/>}
-
- );
- }
-}
-
-class Row extends Component {
- static propTypes = {
- name: PropTypes.string.isRequired,
- value: PropTypes.string.isRequired,
- fDelete: PropTypes.func.isRequired,
- };
-
- render() {
- const {name, value, fDelete} = this.props;
- return (
-
- {name}
-
-
-
-
-
-
-
- );
- }
-}
-
-class AddDialog extends Component {
- static propTypes = {
- fClose: PropTypes.func.isRequired,
- fOnSubmit: PropTypes.func.isRequired,
- };
-
- constructor() {
- super();
- this.state = {name: ''};
- }
-
- handleChange(propertyName, event) {
- const state = this.state;
- state[propertyName] = event.target.value;
- this.setState(state);
- }
-
- render() {
- const {fClose, fOnSubmit} = this.props;
- const {name} = this.state;
- const submitEnabled = this.state.name.length !== 0;
- const submitAndClose = () => {
- fOnSubmit(name);
- fClose();
- };
- return (
-
- );
- }
-}
-
-export default Clients;
diff --git a/ui/src/pages/Clients.tsx b/ui/src/pages/Clients.tsx
new file mode 100644
index 0000000..d8a0ed4
--- /dev/null
+++ b/ui/src/pages/Clients.tsx
@@ -0,0 +1,96 @@
+import Delete from 'material-ui-icons/Delete';
+import Grid from 'material-ui/Grid';
+import IconButton from 'material-ui/IconButton';
+import Paper from 'material-ui/Paper';
+import Table, {TableBody, TableCell, TableHead, TableRow} from 'material-ui/Table';
+import React, {Component, SFC} from 'react';
+import * as ClientAction from '../actions/ClientAction';
+import ConfirmDialog from '../component/ConfirmDialog';
+import DefaultPage from '../component/DefaultPage';
+import ToggleVisibility from '../component/ToggleVisibility';
+import ClientStore from '../stores/ClientStore';
+import AddClientDialog from './dialog/AddClientDialog';
+
+interface IState {
+ clients: IClient[]
+ showDialog: boolean
+ deleteId: number
+}
+
+class Clients extends Component<{}, IState> {
+ public state = {clients: [], showDialog: false, deleteId: -1};
+
+ public componentWillMount() {
+ ClientStore.on('change', this.updateClients);
+ this.updateClients();
+ }
+
+ public componentWillUnmount() {
+ ClientStore.removeListener('change', this.updateClients);
+ }
+
+ public render() {
+ const {clients, deleteId, showDialog} = this.state;
+ return (
+
+
+
+
+
+
+ Name
+ token
+
+
+
+
+ {clients.map((client: IClient) => {
+ return (
+ this.showDeleteDialog(client.id)}/>
+ );
+ })}
+
+
+
+
+ {showDialog && }
+ {deleteId !== -1 && }
+
+ );
+ }
+
+ private deleteClient = () => ClientAction.deleteClient(this.state.deleteId);
+
+ private updateClients = () => this.setState({...this.state, clients: ClientStore.get()});
+ private showCreateDialog = () => this.setState({...this.state, showDialog: true});
+
+ private hideCreateDialog = () => this.setState({...this.state, showDialog: false});
+ private showDeleteDialog = (deleteId: number) => this.setState({...this.state, deleteId});
+
+ private hideDeleteDelete = () => this.setState({...this.state, deleteId: -1});
+}
+
+interface IRowProps {
+ name: string
+ value: string
+ fDelete: VoidFunction
+}
+
+const Row: SFC = ({name, value, fDelete}) => (
+
+ {name}
+
+
+
+
+
+
+
+);
+
+
+export default Clients;
diff --git a/ui/src/pages/dialog/AddClientDialog.tsx b/ui/src/pages/dialog/AddClientDialog.tsx
new file mode 100644
index 0000000..3703fef
--- /dev/null
+++ b/ui/src/pages/dialog/AddClientDialog.tsx
@@ -0,0 +1,49 @@
+import Button from 'material-ui/Button';
+import Dialog, {DialogActions, DialogContent, DialogTitle} from 'material-ui/Dialog';
+import TextField from 'material-ui/TextField';
+import Tooltip from 'material-ui/Tooltip';
+import React, {Component} from 'react';
+
+interface IProps {
+ fClose: VoidFunction
+ fOnSubmit: (name: string) => void
+}
+
+export default class AddDialog extends Component {
+ public state = {name: ''};
+
+ public render() {
+ const {fClose, fOnSubmit} = this.props;
+ const {name} = this.state;
+ const submitEnabled = this.state.name.length !== 0;
+ const submitAndClose = () => {
+ fOnSubmit(name);
+ fClose();
+ };
+ return (
+
+ );
+ }
+
+ private handleChange(propertyName: string, event: React.ChangeEvent) {
+ const state = this.state;
+ state[propertyName] = event.target.value;
+ this.setState(state);
+ }
+}
\ No newline at end of file