-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #21737 - move about page to react
- Loading branch information
Showing
17 changed files
with
323 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
webpack/assets/javascripts/react_app/components/about/compute/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import Status from '../../common/status'; | ||
import Table from '../../common/table'; | ||
import helpers from '../../../common/helpers'; | ||
|
||
class AboutComputeTable extends React.Component { | ||
render() { | ||
const columns = [ | ||
{ | ||
Header: 'Name', | ||
accessor: 'id', | ||
Cell: props => ( | ||
<a href={helpers.urlBuilder('compute_resources', '', props.value.id)}> | ||
{props.value.name} | ||
</a> | ||
), | ||
}, | ||
{ | ||
Header: 'Type', | ||
accessor: 'type', | ||
}, | ||
{ | ||
Header: 'Status', | ||
accessor: 'id', | ||
Cell: props => ( | ||
<Status | ||
data={{ | ||
id: `compute_${props.value.id}`, | ||
url: helpers.urlBuilder( | ||
'compute_resources', | ||
'ping', | ||
props.value.id, | ||
), | ||
}} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<Table data={this.props.data} columns={columns} showPagination={false} /> | ||
); | ||
} | ||
} | ||
export default AboutComputeTable; |
30 changes: 30 additions & 0 deletions
30
webpack/assets/javascripts/react_app/components/about/plugin/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import Table from '../../common/table'; | ||
|
||
class AboutPluginTable extends React.Component { | ||
render() { | ||
const columns = [ | ||
{ | ||
Header: 'Name', | ||
accessor: 'name', | ||
}, | ||
{ | ||
Header: 'Description', | ||
accessor: 'description', | ||
}, | ||
{ | ||
Header: 'Author', | ||
accessor: 'author', | ||
}, | ||
{ | ||
Header: 'Version', | ||
accessor: 'version', | ||
}, | ||
]; | ||
|
||
return ( | ||
<Table data={this.props.data} columns={columns} showPagination={false} /> | ||
); | ||
} | ||
} | ||
export default AboutPluginTable; |
24 changes: 24 additions & 0 deletions
24
webpack/assets/javascripts/react_app/components/about/provider/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import Table from '../../common/table'; | ||
import Icon from '../../common/Icon'; | ||
|
||
class AboutProviderTable extends React.Component { | ||
render() { | ||
const columns = [ | ||
{ | ||
Header: 'Provider', | ||
accessor: 'provider', | ||
}, | ||
{ | ||
Header: 'Installed', | ||
accessor: 'status', | ||
Cell: data => <Icon type={data.value ? 'ok' : 'error'} />, | ||
}, | ||
]; | ||
|
||
return ( | ||
<Table data={this.props.data} columns={columns} showPagination={false} /> | ||
); | ||
} | ||
} | ||
export default AboutProviderTable; |
60 changes: 60 additions & 0 deletions
60
webpack/assets/javascripts/react_app/components/about/proxies/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import Status from '../../common/status'; | ||
import { simpleLoader } from '../../common/Loader'; | ||
import Table from '../../common/table'; | ||
import helpers from '../../../common/helpers'; | ||
|
||
class AboutProxyTable extends React.Component { | ||
render() { | ||
const columns = [ | ||
{ | ||
Header: 'Name', | ||
accessor: 'id', | ||
width: 100, | ||
Cell: data => ( | ||
<a href={helpers.urlBuilder('smart_proxies', '', data.value.id)}> | ||
{data.value.name} | ||
</a> | ||
), | ||
}, | ||
{ | ||
Header: 'Features', | ||
accessor: 'features', | ||
width: 250, | ||
}, | ||
{ | ||
Header: 'Status', | ||
accessor: 'id', | ||
width: 50, | ||
Cell: data => ( | ||
<Status | ||
data={{ | ||
id: `proxy_${data.value.id}`, | ||
url: helpers.urlBuilder('smart_proxies', 'ping', data.value.id), | ||
}} | ||
/> | ||
), | ||
}, | ||
{ | ||
Header: 'Version', | ||
accessor: 'id', | ||
width: 100, | ||
Cell: data => ( | ||
<span> | ||
{this.props.status[`proxy_${data.value.id}`] | ||
? this.props.status[`proxy_${data.value.id}`].message.version | ||
: simpleLoader('xs')} | ||
</span> | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<Table data={this.props.data} columns={columns} showPagination={false} /> | ||
); | ||
} | ||
} | ||
const mapStateToProps = ({ status }) => ({ status }); | ||
|
||
export default connect(mapStateToProps)(AboutProxyTable); |
43 changes: 43 additions & 0 deletions
43
webpack/assets/javascripts/react_app/components/common/status/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { simpleLoader } from '../../common/Loader'; | ||
import * as StatusAction from '../../../redux/actions/status/'; | ||
import Icon from '../../common/Icon'; | ||
|
||
class Status extends React.Component { | ||
componentDidMount() { | ||
const { data: { id, url }, getStatus } = this.props; | ||
|
||
getStatus({ id, url }); | ||
} | ||
|
||
render() { | ||
const { | ||
status, message, error, success, | ||
} = this.props.status; | ||
|
||
if (status || success !== undefined) { | ||
return ( | ||
<div title={message}> | ||
<Icon type={status === 'OK' || success ? 'ok' : 'error'} /> | ||
</div> | ||
); | ||
} | ||
|
||
if (error) { | ||
return ( | ||
<div title={message}> | ||
<Icon type="error" /> | ||
</div> | ||
); | ||
} | ||
|
||
return simpleLoader('xs'); | ||
} | ||
} | ||
|
||
const mapStateToProps = (state, ownProps) => ({ | ||
status: state.status[ownProps.data.id] || {}, | ||
}); | ||
|
||
export default connect(mapStateToProps, StatusAction)(Status); |
Oops, something went wrong.