@@ -4,80 +4,81 @@ import {Button, Card, Divider, Grid, Icon} from 'semantic-ui-react';
44import { ProjectPagination } from '../components-ui/ProjectPagination' ;
55import { GATEWAY_LIMIT } from '../const' ;
66import {
7- fetchGatewayApplications ,
8- removeGatewayApplication
7+ fetchGatewayApplications ,
8+ removeGatewayApplication
99} from "../actions/gateways" ;
1010import { GatewayApplicationRemove } from "./GatewayApplicationRemove" ;
1111import { WordWrap } from "../components-ui/WordWrap" ;
1212import { Link } from "react-router-dom" ;
1313
1414
1515class GatewayApplicationList extends Component {
16- componentDidMount ( ) {
17- this . fetchGatewayApplications ( ) ;
18- }
19-
20- fetchGatewayApplications = ( offset = 0 , limit = GATEWAY_LIMIT ) => {
21- this . props . fetchGatewayApplications ( offset , limit ) ;
22- } ;
23-
24- onRemoveGateway = gateway => {
25- this . props . removeGatewayApplication ( gateway . id ) ;
26- }
27-
28- renderApplications ( ) {
29- const gateways = this . props . gateways ;
16+ componentDidMount ( ) {
17+ this . fetchGatewayApplications ( ) ;
18+ }
3019
31- return gateways . list . map ( ( gateway , index ) => {
32- return (
33- < Card fluid key = { index } >
34- < Card . Content >
20+ fetchGatewayApplications = ( offset = 0 , limit = GATEWAY_LIMIT ) => {
21+ this . props . fetchGatewayApplications ( offset , limit ) ;
22+ } ;
3523
36- < Grid . Row >
37- < Grid . Column width = { 8 } >
38- < Link to = { `/applications/${ gateway . id } ` } >
39- < Card . Header >
40- < WordWrap > { gateway . name } </ WordWrap >
41- </ Card . Header >
42- </ Link >
43- < div className = "meta" >
44- Webhook: { gateway . webHook }
45- </ div >
46- </ Grid . Column >
47- </ Grid . Row >
48- </ Card . Content >
49- < Card . Content extra >
50- < div className = 'ui three buttons' >
24+ onRemoveGateway = gateway => {
25+ this . props . removeGatewayApplication ( gateway . id ) ;
26+ }
5127
52- < Button basic color = 'red' >
53- < GatewayApplicationRemove gateway = { gateway } onSubmit = { ( ) => this . onRemoveGateway ( gateway ) } />
54- </ Button >
28+ renderApplications ( ) {
29+ const gateways = this . props . gateways ;
5530
56- </ div >
57- </ Card . Content >
58- </ Card >
59- ) ;
60- } ) ;
61- }
31+ return gateways . list . map ( ( gateway , index ) => {
32+ return (
33+ < Card fluid key = { index } >
34+ < Card . Content >
6235
63- render ( ) {
64- const gateways = this . props . gateways ;
65- return (
6636 < Grid . Row >
67- < Grid . Column width = { 16 } >
68- { this . renderApplications ( ) }
69- < ProjectPagination limit = { GATEWAY_LIMIT } totalCount = { gateways . totalCount } onChange = { this . fetchGatewayApplications } />
70- </ Grid . Column >
37+ < Grid . Column width = { 8 } >
38+ < Link to = { `/applications/${ gateway . id } ` } >
39+ < Card . Header >
40+ < WordWrap > { gateway . name } </ WordWrap >
41+ </ Card . Header >
42+ </ Link >
43+ < div className = "meta" style = { { display : "inline-flex" , width : "100%" } } >
44+ < div className = "webhook" style = { { width : "100%" } } >
45+ Webhook: { gateway . webHook }
46+ </ div >
47+ < div className = 'ui buttons' >
48+ < Button basic color = 'red' >
49+ < GatewayApplicationRemove gateway = { gateway } onSubmit = { ( ) => this . onRemoveGateway ( gateway ) } />
50+ </ Button >
51+ </ div >
52+ </ div >
53+
54+ </ Grid . Column >
7155 </ Grid . Row >
72- ) ;
73- }
56+ </ Card . Content >
57+ </ Card >
58+ ) ;
59+ } ) ;
60+ }
61+
62+ render ( ) {
63+ const gateways = this . props . gateways ;
64+ return (
65+ < Grid . Row >
66+ < Grid . Column width = { 16 } >
67+ { this . renderApplications ( ) }
68+ < ProjectPagination limit = { GATEWAY_LIMIT } totalCount = { gateways . totalCount }
69+ onChange = { this . fetchGatewayApplications } />
70+ </ Grid . Column >
71+ </ Grid . Row >
72+ ) ;
73+ }
7474}
75- const mapStateToProps = ( { gateways } ) => ( { gateways : gateways } ) ;
75+
76+ const mapStateToProps = ( { gateways} ) => ( { gateways : gateways } ) ;
7677
7778export default connect (
78- mapStateToProps ,
79- {
80- fetchGatewayApplications,
81- removeGatewayApplication
82- }
79+ mapStateToProps ,
80+ {
81+ fetchGatewayApplications,
82+ removeGatewayApplication
83+ }
8384) ( GatewayApplicationList ) ;
0 commit comments