/* eslint react/no-multi-comp:off */
import React, { Component, PureComponent } from 'react';
import { Link } from 'react-router';
import {
Grid, Cell, Card, CardTitle, CardText, CardMenu,
List, ListItem, ListItemContent,
Textfield, Icon, ProgressBar,
Tabs, Tab,
Switch,
} from 'react-mdl';
import { IconLink, shorten, styles as commonStyles } from '../common';
import { formatFullDateTime } from '../common/util';
class StatefulTextfield extends Component {
constructor (props) {
super(props);
this.state = { value: props.value };
this.setValue = function setValue (e) {
this.setState({ value: e.target.value });
}.bind(this);
}
render () {
return (
);
}
}
class ClientApplications extends PureComponent {
constructor (props) {
super(props);
this.state = { activeTab: 0 };
}
componentDidMount () {
this.props.fetchApplication(this.props.appName);
}
render () {
if (!this.props.application) {
return ;
}
const {
application,
storeApplicationMetaData,
} = this.props;
const {
appName,
instances,
strategies,
seenToggles,
url,
description,
icon = 'apps',
color,
} = application;
const content = this.state.activeTab === 0 ? (
Toggles
{seenToggles.map(({ name, description, enabled, notFound }, i) =>
(notFound ?
{name}
:
}
subtitle={shorten(description, 60)}>
{shorten(name, 50)}
)
)}
|
Implemented strategies
{strategies.map(({ name, description, notFound }, i) => (
notFound ?
{name}
:
{shorten(name, 50)}
))}
|
{instances.length} Instances registered
{instances.map(({ instanceId, clientIp, lastSeen }, i) => (
{clientIp} last seen at {formatFullDateTime(lastSeen)}
}>
{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}
{description &&
{description}
}
{url &&
}
this.setState({ activeTab: tabId })} ripple
tabBarProps={{ style: { width: '100%' } }} className="mdl-color--grey-100">
Details
Edit
{content}
);
}
}
export default ClientApplications;