diff --git a/jujugui/static/gui/src/app/components/shared/status/application-list/__snapshots__/test-application-list.js.snap b/jujugui/static/gui/src/app/components/shared/status/application-list/__snapshots__/test-application-list.js.snap
index f8046a9679..2b362b17a2 100644
--- a/jujugui/static/gui/src/app/components/shared/status/application-list/__snapshots__/test-application-list.js.snap
+++ b/jujugui/static/gui/src/app/components/shared/status/application-list/__snapshots__/test-application-list.js.snap
@@ -47,7 +47,7 @@ exports[`StatusApplicationList renders 1`] = `
"content":
etcd
,
diff --git a/jujugui/static/gui/src/app/components/shared/status/application-list/application-list.js b/jujugui/static/gui/src/app/components/shared/status/application-list/application-list.js
index 32b9971e66..386c04a490 100644
--- a/jujugui/static/gui/src/app/components/shared/status/application-list/application-list.js
+++ b/jujugui/static/gui/src/app/components/shared/status/application-list/application-list.js
@@ -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
@@ -44,7 +42,7 @@ class StatusApplicationList extends React.Component {
content: (
+ src={this.props.getIconPath(app)} />
{app.name}
)
}, {
@@ -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
diff --git a/jujugui/static/gui/src/app/components/shared/status/application-list/test-application-list.js b/jujugui/static/gui/src/app/components/shared/status/application-list/test-application-list.js
index ff03cf6b07..c3b9cc1959 100644
--- a/jujugui/static/gui/src/app/components/shared/status/application-list/test-application-list.js
+++ b/jujugui/static/gui/src/app/components/shared/status/application-list/test-application-list.js
@@ -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} />
diff --git a/jujugui/static/gui/src/app/components/shared/status/relation-list/__snapshots__/test-relation-list.js.snap b/jujugui/static/gui/src/app/components/shared/status/relation-list/__snapshots__/test-relation-list.js.snap
index bd8c6dd83f..cbf1085a25 100644
--- a/jujugui/static/gui/src/app/components/shared/status/relation-list/__snapshots__/test-relation-list.js.snap
+++ b/jujugui/static/gui/src/app/components/shared/status/relation-list/__snapshots__/test-relation-list.js.snap
@@ -38,7 +38,7 @@ exports[`StatusRelationList renders 1`] = `
>
kubernetes-master
,
@@ -51,7 +51,7 @@ exports[`StatusRelationList renders 1`] = `
>
etcd
,
diff --git a/jujugui/static/gui/src/app/components/shared/status/relation-list/relation-list.js b/jujugui/static/gui/src/app/components/shared/status/relation-list/relation-list.js
index fc9d8ae6be..7153bdc3f7 100644
--- a/jujugui/static/gui/src/app/components/shared/status/relation-list/relation-list.js
+++ b/jujugui/static/gui/src/app/components/shared/status/relation-list/relation-list.js
@@ -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 {
@@ -27,7 +26,7 @@ class StatusRelationList extends React.Component {
href={this.props.generateApplicationURL(name)}
onClick={this.props.onApplicationClick.bind(this, name)}>
+ src={this.props.getIconPath(app)} />
{name}
);
}
@@ -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
diff --git a/jujugui/static/gui/src/app/components/shared/status/relation-list/test-relation-list.js b/jujugui/static/gui/src/app/components/shared/status/relation-list/test-relation-list.js
index e97e059bb3..eaafa554ec 100644
--- a/jujugui/static/gui/src/app/components/shared/status/relation-list/test-relation-list.js
+++ b/jujugui/static/gui/src/app/components/shared/status/relation-list/test-relation-list.js
@@ -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} />
diff --git a/jujugui/static/gui/src/app/components/shared/status/status/__snapshots__/test-status.js.snap b/jujugui/static/gui/src/app/components/shared/status/status/__snapshots__/test-status.js.snap
index 52c30476f5..c3b7cddc81 100644
--- a/jujugui/static/gui/src/app/components/shared/status/status/__snapshots__/test-status.js.snap
+++ b/jujugui/static/gui/src/app/components/shared/status/status/__snapshots__/test-status.js.snap
@@ -55,6 +55,7 @@ exports[`Status renders with entites 1`] = `
generateApplicationOnClick={[Function]}
generateApplicationURL={[Function]}
generateCharmURL={[Function]}
+ getIconPath={[Function]}
onCharmClick={[Function]}
statusFilter={null}
units={
@@ -83,6 +84,7 @@ exports[`Status renders with entites 1`] = `
generateMachineURL={[Function]}
generateUnitOnClick={[Function]}
generateUnitURL={[Function]}
+ getIconPath={[Function]}
onMachineClick={[Function]}
statusFilter={null}
units={
@@ -123,6 +125,7 @@ exports[`Status renders with entites 1`] = `
}
}
generateApplicationURL={[Function]}
+ getIconPath={[Function]}
onApplicationClick={[Function]}
relations={
Object {
diff --git a/jujugui/static/gui/src/app/components/shared/status/status/status.js b/jujugui/static/gui/src/app/components/shared/status/status/status.js
index be5264c184..66d3cfea95 100644
--- a/jujugui/static/gui/src/app/components/shared/status/status/status.js
+++ b/jujugui/static/gui/src/app/components/shared/status/status/status.js
@@ -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} />);
@@ -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} />);
@@ -178,6 +180,7 @@ class Status extends React.Component {
);
@@ -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,
diff --git a/jujugui/static/gui/src/app/components/shared/status/status/test-status.js b/jujugui/static/gui/src/app/components/shared/status/status/test-status.js
index 52d3594ed5..77106f1271 100644
--- a/jujugui/static/gui/src/app/components/shared/status/status/test-status.js
+++ b/jujugui/static/gui/src/app/components/shared/status/status/test-status.js
@@ -11,17 +11,18 @@ describe('Status', () => {
const renderComponent = (options = {}) => enzyme.shallow(
);
diff --git a/jujugui/static/gui/src/app/components/shared/status/unit-list/__snapshots__/test-unit-list.js.snap b/jujugui/static/gui/src/app/components/shared/status/unit-list/__snapshots__/test-unit-list.js.snap
index df861eb897..8bea826ca0 100644
--- a/jujugui/static/gui/src/app/components/shared/status/unit-list/__snapshots__/test-unit-list.js.snap
+++ b/jujugui/static/gui/src/app/components/shared/status/unit-list/__snapshots__/test-unit-list.js.snap
@@ -47,7 +47,7 @@ exports[`StatusUnitList renders 1`] = `
"content":
etcd/0
,
diff --git a/jujugui/static/gui/src/app/components/shared/status/unit-list/test-unit-list.js b/jujugui/static/gui/src/app/components/shared/status/unit-list/test-unit-list.js
index 705ae01c47..c330838b8c 100644
--- a/jujugui/static/gui/src/app/components/shared/status/unit-list/test-unit-list.js
+++ b/jujugui/static/gui/src/app/components/shared/status/unit-list/test-unit-list.js
@@ -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} />
diff --git a/jujugui/static/gui/src/app/components/shared/status/unit-list/unit-list.js b/jujugui/static/gui/src/app/components/shared/status/unit-list/unit-list.js
index 81b05f20b0..717b396c3b 100644
--- a/jujugui/static/gui/src/app/components/shared/status/unit-list/unit-list.js
+++ b/jujugui/static/gui/src/app/components/shared/status/unit-list/unit-list.js
@@ -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 {
@@ -67,7 +66,7 @@ class StatusUnitList extends React.Component {
content: (
+ src={this.props.getIconPath(application)} />
{unit.name}
)
}, {
@@ -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
diff --git a/jujugui/static/gui/src/app/components/status/status.js b/jujugui/static/gui/src/app/components/status/status.js
index db1c95f48f..a1cede2d96 100644
--- a/jujugui/static/gui/src/app/components/status/status.js
+++ b/jujugui/static/gui/src/app/components/status/status.js
@@ -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');
@@ -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 (
@@ -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)}
diff --git a/jujugui/static/gui/src/app/init/test-app.js b/jujugui/static/gui/src/app/init/test-app.js
index 7e6e704d70..94b1ca7fec 100644
--- a/jujugui/static/gui/src/app/init/test-app.js
+++ b/jujugui/static/gui/src/app/init/test-app.js
@@ -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(() => {