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

61 lines
2.1 KiB
JavaScript
Raw Normal View History

2016-12-03 15:54:15 +01:00
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Icon, CircularProgress } from '@material-ui/core';
2017-02-14 12:22:24 +01:00
import { AppsLinkList, styles as commonStyles } from '../common';
import SearchField from '../common/SearchField/SearchField';
import PageContent from '../common/PageContent/PageContent';
import HeaderTitle from '../common/HeaderTitle';
2016-12-03 15:54:15 +01:00
2019-05-04 06:19:21 +02:00
const Empty = () => (
<React.Fragment>
<section style={{ textAlign: 'center' }}>
<Icon>warning</Icon> <br />
2019-05-04 06:19:21 +02:00
<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 how to use Unleash in your application in the{' '}
<a href="https://www.unleash-hosted.com/docs/use-feature-toggle">documentation.</a>
</section>
2019-05-04 06:19:21 +02:00
</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) {
return <CircularProgress variant="indeterminate" />;
2016-12-05 15:15:01 +01:00
}
2016-12-03 15:54:15 +01:00
return (
<>
<div className={commonStyles.searchField}>
2020-09-24 19:31:49 +02:00
<SearchField
value={this.props.settings.filter}
updateValue={this.props.updateSetting.bind(this, 'filter')}
/>
</div>
<PageContent headerContent={<HeaderTitle title="Applications" />}>
<div className={commonStyles.fullwidth}>
{applications.length > 0 ? <AppsLinkList apps={applications} /> : <Empty />}
</div>
</PageContent>
</>
2016-12-03 15:54:15 +01:00
);
}
}
export default ClientStrategies;