1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/component/application/application-list-component.js

57 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-12-03 15:54:15 +01:00
import React, { Component } from 'react';
import PropTypes from 'prop-types';
2019-05-04 06:26:02 +02:00
import { ProgressBar, Card, CardText, Icon } from 'react-mdl';
2017-02-14 12:22:24 +01:00
import { AppsLinkList, styles as commonStyles } from '../common';
2020-09-24 19:31:49 +02:00
import SearchField from '../common/search-field';
2016-12-03 15:54:15 +01:00
2019-05-04 06:19:21 +02:00
const Empty = () => (
<React.Fragment>
<CardText style={{ textAlign: 'center' }}>
<Icon name="warning" style={{ fontSize: '5em' }} /> <br />
<br />
Oh snap, it does not seem like you have connected any applications. To connect your application to Unleash
you will require a Client SDK.
<br />
<br />
You can read more about the available Client SDKs in the{' '}
<a href="https://unleash.github.io/docs/client_sdk">documentation.</a>
</CardText>
</React.Fragment>
);
2016-12-03 15:54:15 +01:00
class ClientStrategies extends Component {
static propTypes = {
applications: PropTypes.array,
fetchAll: PropTypes.func.isRequired,
2020-09-24 19:31:49 +02:00
settings: PropTypes.object.isRequired,
updateSetting: PropTypes.func.isRequired,
};
componentDidMount() {
2016-12-05 15:15:01 +01:00
this.props.fetchAll();
2016-12-03 15:54:15 +01:00
}
render() {
const { applications } = this.props;
2016-12-03 15:54:15 +01:00
2016-12-05 15:15:01 +01:00
if (!applications) {
2016-12-10 14:19:52 +01:00
return <ProgressBar indeterminate />;
2016-12-05 15:15:01 +01:00
}
2016-12-03 15:54:15 +01:00
return (
2020-09-24 19:31:49 +02:00
<div>
<div className={commonStyles.toolbar}>
<SearchField
value={this.props.settings.filter}
updateValue={this.props.updateSetting.bind(this, 'filter')}
/>
</div>
<Card shadow={0} className={commonStyles.fullwidth}>
{applications.length > 0 ? <AppsLinkList apps={applications} /> : <Empty />}
</Card>
</div>
2016-12-03 15:54:15 +01:00
);
}
}
export default ClientStrategies;