Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Remove the mv based dispatch to service inspector vs ghost inspector #576

Merged
merged 3 commits into from
Sep 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
</div>
<script src="/juju-ui/assets/javascripts/spin.min.js"></script>
<script id="app-startup">
//var flags = {}; // Declare an empty set of feature flags.
var flags = {}; // Declare an empty set of feature flags.
startSpinner = function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a drive by fix; this shouldn't have been commented out previously.

var opts = {
lines: 17, // The number of lines to draw
Expand Down
4 changes: 0 additions & 4 deletions app/modules-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@ var GlobalConfig = {
fullpath: '/juju-ui/views/inspectors/local-new-upgrade.js'
},

'ghost-service-inspector': {
fullpath: '/juju-ui/views/inspectors/ghost-service-inspector.js'
},

'service-inspector': {
fullpath: '/juju-ui/views/inspectors/service-inspector.js'
},
Expand Down
45 changes: 17 additions & 28 deletions app/subapps/browser/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,7 @@ YUI.add('subapp-browser', function(Y) {
@method machine
*/
machine: function(req, res, next) {
if (window.flags.mv) {
this._renderMachineViewPanelView(this.get('db'));
}
this._renderMachineViewPanelView(this.get('db'));
},

/**
Expand Down Expand Up @@ -576,8 +574,8 @@ YUI.add('subapp-browser', function(Y) {
},

/**
Renders the service or ghost service inspector, handling updates to the
existing service inspector if necessary.
Renders the service inspector, handling updates to the existing service
inspector if necessary.

@method renderServiceInspector
@param {Object} metadata The dispatched view metadata.
Expand Down Expand Up @@ -610,33 +608,24 @@ YUI.add('subapp-browser', function(Y) {
}

if (model && charm) {
if (model.get('pending') && !(window.flags && window.flags.mv)) {
cfg.showCharm = metadata.charm || false;
cfg.enableDatabinding = true;
cfg.activeUnit = metadata.unit;

if (!this._inspector ||
this._inspector.name !== 'service-inspector' ||
(this._inspector.get('model').get('id') !==
model.get('id'))) {
// This is a new service.
previousInspector = this._inspector;
cfg.charmModel = db.charms.getById(model.get('charm'));
activeInspector = new Y.juju.views.GhostServiceInspector(cfg);
activeInspector = new Y.juju.views.ServiceInspector(cfg);
activeInspector.render();
activeInspector.addTarget(this);
} else {
// This is a service inspector.
cfg.showCharm = metadata.charm || false;
cfg.enableDatabinding = true;
cfg.activeUnit = metadata.unit;

if (!this._inspector ||
this._inspector.name !== 'service-inspector' ||
(this._inspector.get('model').get('id') !==
model.get('id'))) {
// This is a new service.
previousInspector = this._inspector;
activeInspector = new Y.juju.views.ServiceInspector(cfg);
activeInspector.render();
activeInspector.addTarget(this);
} else {
// This is a dispatch for the existing inspector
activeInspector = this._inspector;
activeInspector.setAttrs(cfg);
activeInspector.renderUI();
}
// This is a dispatch for the existing inspector
activeInspector = this._inspector;
activeInspector.setAttrs(cfg);
activeInspector.renderUI();
}
} else {
// If we found no model, begin the retry loop.
Expand Down
43 changes: 11 additions & 32 deletions app/views/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,37 +91,17 @@ YUI.add('juju-view-environment', function(Y) {
charm = db.charms.getById(model.get('charm')),
inspector = {};

// This method is called with a charm or service. If it's called with a
// charm then it needs to show the ghost inspector instead of the service
// inspector.
if (model.get('pending') && (window.flags && !window.flags.mv)) {
model.set('packageName', charm.get('package_name'));
// XXX In order to support the events below we need to use the same
// object structure. Once the Service inspector is converted to
// an inspector subclass the following events can be fixed.
inspector = new Y.juju.views.GhostServiceInspector({
db: db,
model: model,
env: env,
ecs: ecs,
environment: this,
charmModel: charm,
topo: topo,
store: topo.get('store')
}).render();
} else {
var inspectorConfig = Y.mix({
db: db,
model: model,
env: env,
ecs: ecs,
environment: this,
enableDatabinding: true,
topo: topo,
store: topo.get('store')
}, config, true);
inspector = new Y.juju.views.ServiceInspector(inspectorConfig).render();
}
var inspectorConfig = Y.mix({
db: db,
model: model,
env: env,
ecs: ecs,
environment: this,
enableDatabinding: true,
topo: topo,
store: topo.get('store')
}, config, true);
inspector = new Y.juju.views.ServiceInspector(inspectorConfig).render();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look into this a little further. I don't think that this createServiceInspector method is used any longer because we instantiate everything from the browser.js so the whole thing can go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's got a call site in topology.js; there's probably work to be done there excising unused code, but I don't think it's in scope for the main work here, e.g. removing the MV flag.


// Because the inspector can trigger it's own destruction we need to
// listen for the event and remove it from the list of open inspectors
Expand Down Expand Up @@ -286,7 +266,6 @@ YUI.add('juju-view-environment', function(Y) {
'juju-topology',
'juju-view-utils',
'service-inspector',
'ghost-service-inspector',
'node',
'view'
]
Expand Down
227 changes: 0 additions & 227 deletions app/views/inspectors/ghost-service-inspector.js

This file was deleted.

1 change: 0 additions & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<script src="test_fakebackend.js"></script>
<script src="test_filter_widget.js"></script>
<script src="test_service_inspector.js"></script>
<script src="test_ghost_inspector.js"></script>
<script src="test_ghost_deployer_extension.js"></script>
<script src="test_help_dropdown.js"></script>
<script src="test_inspector_base.js"></script>
Expand Down