diff --git a/web/app/js/components/ConfigureProfilesMsg.jsx b/web/app/js/components/ConfigureProfilesMsg.jsx index 3572ff63c..6f5723619 100644 --- a/web/app/js/components/ConfigureProfilesMsg.jsx +++ b/web/app/js/components/ConfigureProfilesMsg.jsx @@ -1,11 +1,12 @@ import Button from '@material-ui/core/Button'; -import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; +import IconButton from '@material-ui/core/IconButton'; +import NoteAddIcon from '@material-ui/icons/NoteAdd'; import PropTypes from 'prop-types'; import React from 'react'; import TextField from '@material-ui/core/TextField'; @@ -18,6 +19,9 @@ const styles = theme => ({ button: { margin: theme.spacing.unit, }, + margin: { + marginRight: theme.spacing.unit, + }, container: { display: 'flex', flexWrap: 'wrap', @@ -62,19 +66,36 @@ class ConfigureProfilesMsg extends React.Component { } renderDownloadProfileForm = () => { - const { api, classes } = this.props; + const { api, classes, showAsIcon } = this.props; let { query } = this.state; let downloadUrl = api.prefixedUrl(`/profiles/new?service=${query.service}&namespace=${query.namespace}`); + let button; - return ( - + if (showAsIcon) { + button = ( + + + + ); + } else { + button = ( + ); + } + return ( + + {button} + if (showAsIcon) { + return this.renderDownloadProfileForm(); + } else { + return ( - No traffic found. Does the service have a service profile? + No named route traffic found. This could be because the service is not receiving any traffic, + or because there is no service profile configured. Does the service have a service profile? {this.renderDownloadProfileForm()} - - ); + ); + } } } ConfigureProfilesMsg.propTypes = { api: PropTypes.shape({ - prefixedFetch: PropTypes.func.isRequired, + prefixedUrl: PropTypes.func.isRequired, }).isRequired, - classes: PropTypes.shape({}).isRequired + classes: PropTypes.shape({}).isRequired, + showAsIcon: PropTypes.bool +}; + +ConfigureProfilesMsg.defaultProps = { + showAsIcon: false }; export default withContext(withStyles(styles, { withTheme: true })(ConfigureProfilesMsg)); diff --git a/web/app/js/components/Navigation.jsx b/web/app/js/components/Navigation.jsx index 00cce2ed6..2e485d52f 100644 --- a/web/app/js/components/Navigation.jsx +++ b/web/app/js/components/Navigation.jsx @@ -199,7 +199,7 @@ class NavigationBase extends React.Component { ); } render() { - const { classes, ChildComponent } = this.props; + const { classes, ChildComponent, ...otherProps } = this.props; return (
@@ -287,7 +287,7 @@ class NavigationBase extends React.Component {
-
+
); diff --git a/web/app/js/components/TopRoutes.jsx b/web/app/js/components/TopRoutes.jsx index 0217a6b19..5cc1073d7 100644 --- a/web/app/js/components/TopRoutes.jsx +++ b/web/app/js/components/TopRoutes.jsx @@ -1,6 +1,8 @@ import Button from '@material-ui/core/Button'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; +import ConfigureProfilesMsg from './ConfigureProfilesMsg.jsx'; +import Divider from '@material-ui/core/Divider'; import ErrorBanner from './ErrorBanner.jsx'; import FormControl from '@material-ui/core/FormControl'; import FormHelperText from '@material-ui/core/FormHelperText'; @@ -12,15 +14,28 @@ import QueryToCliCmd from './QueryToCliCmd.jsx'; import React from 'react'; import Select from '@material-ui/core/Select'; import TopRoutesModule from './TopRoutesModule.jsx'; +import Typography from '@material-ui/core/Typography'; import _ from 'lodash'; import { groupResourcesByNs } from './util/MetricUtils.jsx'; import { withContext } from './util/AppContext.jsx'; +import { withStyles } from '@material-ui/core/styles'; + +const styles = theme => ({ + root: { + marginTop: 3 * theme.spacing.unit, + marginBottom:theme.spacing.unit, + }, + formControl: { + minWidth: 200, + }, +}); class TopRoutes extends React.Component { static propTypes = { api: PropTypes.shape({ PrefixedLink: PropTypes.func.isRequired, - }).isRequired + }).isRequired, + classes: PropTypes.shape({}).isRequired } constructor(props) { @@ -125,20 +140,20 @@ class TopRoutes extends React.Component { } renderRoutesQueryForm = () => { + const { classes } = this.props; + return ( - - + + { this.renderNamespaceDropdown("Namespace", "namespace", "Namespace to query") } - + { this.renderServiceDropdown() } - -