diff --git a/frontend/src/component/application/application-edit-component.js b/frontend/src/component/application/application-edit-component.js index 53e0b73c63..70b150b879 100644 --- a/frontend/src/component/application/application-edit-component.js +++ b/frontend/src/component/application/application-edit-component.js @@ -2,7 +2,12 @@ import React, { Component, PureComponent } from 'react'; import { Link } from 'react-router'; -import { Grid, Cell, List, ListItem, ListItemContent, Textfield, Icon, ProgressBar } from 'react-mdl'; +import { + Grid, Cell, + List, ListItem, ListItemContent, + Textfield, Icon, ProgressBar, + Tabs, Tab, +} from 'react-mdl'; import { HeaderTitle, ExternalIconLink } from '../common'; class StatefulTextfield extends Component { @@ -27,7 +32,12 @@ class StatefulTextfield extends Component { } } -class ClientStrategies extends PureComponent { +class ClientApplications extends PureComponent { + constructor (props) { + super(props); + this.state = { activeTab: 0 }; + } + componentDidMount () { this.props.fetchApplication(this.props.appName); } @@ -51,80 +61,92 @@ class ClientStrategies extends PureComponent { color, } = application; + const content = this.state.activeTab === 0 ? ( + + +
Toggles
+
+ + {seenToggles.map((name, i) => + + + + {name} + + + )} + +
+ +
Implemented strategies
+
+ + {strategies.map((name, i) => ( + + + + {name} + + + + ))} + +
+ +
{instances.length} Instances connected
+
+ + {instances.map(({ instanceId, clientIp, lastSeen }, i) => ( + + {clientIp} last seen at {new Date(lastSeen).toLocaleString('nb-NO')} + }> + {instanceId} + + + ))} + +
+
) : ( + + +
Edit app meta data
+
+ + storeApplicationMetaData(appName, 'url', e.target.value)} />
+ storeApplicationMetaData(appName, 'description', e.target.value)} /> +
+ + storeApplicationMetaData(appName, 'icon', e.target.value)} /> + storeApplicationMetaData(appName, 'color', e.target.value)} /> + +
); + + + return (
{appName}} subtitle={description} actions={url && Visit site} /> - - -
Toggles
-
- - {seenToggles.map((name, i) => - - - - {name} - - - )} - -
- -
Implemented strategies
-
- - {strategies.map((name, i) => ( - - - - {name} - - - - ))} - -
- -
{instances.length} Instances connected
-
- - {instances.map(({ instanceId, clientIp, lastSeen }, i) => ( - - {clientIp} last seen at {new Date(lastSeen).toLocaleString('nb-NO')} - }> - {instanceId} - - - ))} - -
- -
Edit app meta data
-
- - storeApplicationMetaData(appName, 'url', e.target.value)} />
- storeApplicationMetaData(appName, 'description', e.target.value)} /> -
- - storeApplicationMetaData(appName, 'icon', e.target.value)} /> - storeApplicationMetaData(appName, 'color', e.target.value)} /> - -
+ this.setState({ activeTab: tabId })} ripple> + Metrics + Edit + + + {content}
); } } -export default ClientStrategies; +export default ClientApplications; diff --git a/frontend/src/component/common/index.js b/frontend/src/component/common/index.js index 0e6e4ad458..047c3ec78e 100644 --- a/frontend/src/component/common/index.js +++ b/frontend/src/component/common/index.js @@ -24,7 +24,7 @@ export const AppsLinkList = ({ apps }) => ( export const HeaderTitle = ({ title, actions, subtitle }) => (
-
+
{title}
{subtitle && {subtitle}}