Skip to content

Commit

Permalink
Merge branch 'develop' into export-with-series
Browse files Browse the repository at this point in the history
  • Loading branch information
hatched authored Sep 28, 2018
2 parents f49454c + f97f7d7 commit 1d4c821
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports[`StatusApplicationList renders 1`] = `
"content": <span>
<img
className="status-view__icon"
src="v5/~containers/etcd-126/icon.svg"
src="icon.svg"
/>
etcd
</span>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const { urls } = require('jaaslib');
const maracaPropTypes = require('../../../../maraca/prop-types');
const StatusLabel = require('../label/label');
const StatusTable = require('../table/table');

const utils = require('../../../../init/utils');
const {
getStatusClass,
normaliseStatus
Expand Down Expand Up @@ -44,7 +42,7 @@ class StatusApplicationList extends React.Component {
content: (
<span>
<img className="status-view__icon"
src={utils.getIconPath(app.charmURL, false)} />
src={this.props.getIconPath(app)} />
{app.name}
</span>)
}, {
Expand Down Expand Up @@ -115,6 +113,7 @@ StatusApplicationList.propTypes = {
generateApplicationOnClick: PropTypes.func.isRequired,
generateApplicationURL: PropTypes.func.isRequired,
generateCharmURL: PropTypes.func.isRequired,
getIconPath: PropTypes.func.isRequired,
onCharmClick: PropTypes.func.isRequired,
statusFilter: PropTypes.string,
units: maracaPropTypes.units
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('StatusApplicationList', () => {
generateApplicationURL={
options.generateApplicationURL || sinon.stub().returns('http://example.com')}
generateCharmURL={options.generateCharmURL || sinon.stub()}
getIconPath={options.getIconPath || sinon.stub().returns('icon.svg')}
onCharmClick={options.onCharmClick || sinon.stub()}
statusFilter={options.statusFilter}
units={options.units || units} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`StatusRelationList renders 1`] = `
>
<img
className="status-view__icon"
src="v5/~containers/etcd-126/icon.svg"
src="icon.svg"
/>
kubernetes-master
</a>,
Expand All @@ -51,7 +51,7 @@ exports[`StatusRelationList renders 1`] = `
>
<img
className="status-view__icon"
src="v5/~containers/etcd-126/icon.svg"
src="icon.svg"
/>
etcd
</a>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const React = require('react');

const maracaPropTypes = require('../../../../maraca/prop-types');
const StatusTable = require('../table/table');
const utils = require('../../../../init/utils');

class StatusRelationList extends React.Component {

Expand All @@ -27,7 +26,7 @@ class StatusRelationList extends React.Component {
href={this.props.generateApplicationURL(name)}
onClick={this.props.onApplicationClick.bind(this, name)}>
<img className="status-view__icon"
src={utils.getIconPath(app.charmURL, false)} />
src={this.props.getIconPath(app)} />
{name}
</a>);
}
Expand Down Expand Up @@ -109,6 +108,7 @@ class StatusRelationList extends React.Component {
StatusRelationList.propTypes = {
applications: maracaPropTypes.applications,
generateApplicationURL: PropTypes.func.isRequired,
getIconPath: PropTypes.func.isRequired,
onApplicationClick: PropTypes.func.isRequired,
relations: maracaPropTypes.relations,
statusFilter: PropTypes.string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('StatusRelationList', () => {
changeState={options.changeState || sinon.stub()}
generateApplicationURL={options.generateApplicationURL || sinon.stub()}
generatePath={options.generatePath || sinon.stub()}
getIconPath={options.getIconPath || sinon.stub().returns('icon.svg')}
onApplicationClick={options.onApplicationClick || sinon.stub()}
relations={options.relations || relations}
statusFilter={options.statusFilter} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ exports[`Status renders with entites 1`] = `
generateApplicationOnClick={[Function]}
generateApplicationURL={[Function]}
generateCharmURL={[Function]}
getIconPath={[Function]}
onCharmClick={[Function]}
statusFilter={null}
units={
Expand Down Expand Up @@ -83,6 +84,7 @@ exports[`Status renders with entites 1`] = `
generateMachineURL={[Function]}
generateUnitOnClick={[Function]}
generateUnitURL={[Function]}
getIconPath={[Function]}
onMachineClick={[Function]}
statusFilter={null}
units={
Expand Down Expand Up @@ -123,6 +125,7 @@ exports[`Status renders with entites 1`] = `
}
}
generateApplicationURL={[Function]}
getIconPath={[Function]}
onApplicationClick={[Function]}
relations={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class Status extends React.Component {
generateApplicationOnClick={this.props.generateApplicationOnClick}
generateApplicationURL={this.props.generateApplicationURL}
generateCharmURL={this.props.generateCharmURL}
getIconPath={this.props.getIconPath}
onCharmClick={this.props.navigateToCharm}
statusFilter={this.state.statusFilter}
units={this.props.valueStore.units} />);
Expand All @@ -143,6 +144,7 @@ class Status extends React.Component {
generateMachineURL={this.props.generateMachineURL}
generateUnitOnClick={this.props.generateUnitOnClick}
generateUnitURL={this.props.generateUnitURL}
getIconPath={this.props.getIconPath}
onMachineClick={this.props.navigateToMachine}
statusFilter={this.state.statusFilter}
units={units} />);
Expand Down Expand Up @@ -178,6 +180,7 @@ class Status extends React.Component {
<StatusRelationList
applications={this.props.valueStore.applications}
generateApplicationURL={this.props.generateApplicationURL}
getIconPath={this.props.getIconPath}
onApplicationClick={this.props.navigateToApplication}
relations={relations}
statusFilter={this.state.statusFilter} />);
Expand Down Expand Up @@ -221,6 +224,7 @@ Status.propTypes = {
generateMachineURL: PropTypes.func.isRequired,
generateUnitOnClick: PropTypes.func.isRequired,
generateUnitURL: PropTypes.func.isRequired,
getIconPath: PropTypes.func.isRequired,
model: shapeup.shape({
cloud: PropTypes.string,
environmentName: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ describe('Status', () => {

const renderComponent = (options = {}) => enzyme.shallow(
<Status
generateApplicationOnClick={options._generateApplicationOnClick || sinon.stub()}
generateApplicationURL={options._generateApplicationURL || sinon.stub()}
generateCharmURL={options._generateCharmURL || sinon.stub()}
generateMachineOnClick={options._generateMachineOnClick || sinon.stub()}
generateMachineURL={options._generateMachineURL || sinon.stub()}
generateUnitOnClick={options._generateUnitOnClick || sinon.stub()}
generateUnitURL={options._generateUnitURL || sinon.stub()}
generateApplicationOnClick={options.generateApplicationOnClick || sinon.stub()}
generateApplicationURL={options.generateApplicationURL || sinon.stub()}
generateCharmURL={options.generateCharmURL || sinon.stub()}
generateMachineOnClick={options.generateMachineOnClick || sinon.stub()}
generateMachineURL={options.generateMachineURL || sinon.stub()}
generateUnitOnClick={options.generateUnitOnClick || sinon.stub()}
generateUnitURL={options.generateUnitURL || sinon.stub()}
getIconPath={options.getIconPath || sinon.stub()}
model={options.model || model}
navigateToApplication={options._navigateToApplication || sinon.stub()}
navigateToCharm={options._navigateToCharm || sinon.stub()}
navigateToMachine={options._navigateToMachine || sinon.stub()}
navigateToApplication={options.navigateToApplication || sinon.stub()}
navigateToCharm={options.navigateToCharm || sinon.stub()}
navigateToMachine={options.navigateToMachine || sinon.stub()}
valueStore={options.valueStore || valueStore} />
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports[`StatusUnitList renders 1`] = `
"content": <span>
<img
className="status-view__icon"
src="v5/~containers/etcd-126/icon.svg"
src="icon.svg"
/>
etcd/0
</span>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('StatusUnitList', () => {
options.generateUnitOnClick || sinon.stub().returns(sinon.stub())}
generateUnitURL={
options.generateUnitURL || sinon.stub().returns('http://example.com')}
getIconPath={options.getIconPath || sinon.stub().returns('icon.svg')}
onMachineClick={options.onCharmClick || sinon.stub()}
statusFilter={options.statusFilter}
units={options.units || units} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const StatusTable = require('../table/table');

const maracaPropTypes = require('../../../../maraca/prop-types');
const utils = require('../../utils');
const initUtils = require('../../../../init/utils');

class StatusUnitList extends React.Component {

Expand Down Expand Up @@ -67,7 +66,7 @@ class StatusUnitList extends React.Component {
content: (
<span>
<img className="status-view__icon"
src={initUtils.getIconPath(application.charmURL, false)} />
src={this.props.getIconPath(application)} />
{unit.name}
</span>)
}, {
Expand Down Expand Up @@ -139,6 +138,7 @@ StatusUnitList.propTypes = {
generateMachineURL: PropTypes.func.isRequired,
generateUnitOnClick: PropTypes.func.isRequired,
generateUnitURL: PropTypes.func.isRequired,
getIconPath: PropTypes.func.isRequired,
onMachineClick: PropTypes.func.isRequired,
statusFilter: PropTypes.string,
units: maracaPropTypes.units
Expand Down
11 changes: 11 additions & 0 deletions jujugui/static/gui/src/app/components/status/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const PropTypes = require('prop-types');
const React = require('react');
const shapeup = require('shapeup');

const initUtils = require('../../init/utils');
const maracaPropTypes = require('../../maraca/prop-types');
const SharedStatus = require('../shared/status/status/status');

Expand Down Expand Up @@ -176,6 +177,15 @@ class Status extends React.Component {
this, this._generateMachineClickState(machineId));
}

/**
Generate an icon path for an app.
@param {Object} app - The details for an app.
@returns {String} The icon path.
*/
_getIconPath(app) {
return initUtils.getIconPath(app.charmURL, false);
}

render() {

return (
Expand All @@ -187,6 +197,7 @@ class Status extends React.Component {
generateMachineURL={this._generateMachineURL.bind(this)}
generateUnitOnClick={this._generateUnitOnClick.bind(this)}
generateUnitURL={this._generateUnitURL.bind(this)}
getIconPath={this._getIconPath.bind(this)}
model={this.props.model}
navigateToApplication={this._navigateToApplication.bind(this)}
navigateToCharm={this._navigateToCharm.bind(this)}
Expand Down
3 changes: 2 additions & 1 deletion jujugui/static/gui/src/app/init/test-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ describe('App', () => {
switchModel={options.switchModel || sinon.stub()}
terms={options.terms || {}}
topology={options.topology || topology}
user={options.user || {}} />
user={options.user || {}}
valueStore={options.valueStore || {}} />
);

beforeEach(() => {
Expand Down

0 comments on commit 1d4c821

Please sign in to comment.