Merge lp:~frankban/juju-gui/bug-1169858-life into lp:juju-gui/experimental
Proposed by
Francesco Banconi
Status: | Merged |
---|---|
Merged at revision: | 567 |
Proposed branch: | lp:~frankban/juju-gui/bug-1169858-life |
Merge into: | lp:juju-gui/experimental |
Diff against target: |
209 lines (+99/-4) 7 files modified
app/models/handlers.js (+1/-0) app/models/models.js (+35/-1) app/views/topology/service.js (+1/-1) test/test_fakebackend.js (+1/-0) test/test_model.js (+36/-0) test/test_model_handlers.js (+6/-2) test/test_service_module.js (+19/-0) |
To merge this branch: | bzr merge lp:~frankban/juju-gui/bug-1169858-life |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email:
|
Description of the change
Handle service life
The Life change included in the juju-core delta stream is
now stored in the service model, and used to avoid displaying
dying services in the topology view.
QA:
- bootstrap a juju-core env;
- deploy a service;
- connect the GUI to the env;
- use the GUI to destroy the service;
- suddenly refresh (or visit the GUI from another browser tab).
At this point, even if the service could be still
present in the db, it should not be alive and you should
not see it in the topology view.
To post a comment you must log in.
Reviewers: mp+159356_ code.launchpad. net,
Message:
Please take a look.
Description:
Handle service life
The Life change included in the juju-core delta stream is
now stored in the service model, and used to avoid displaying
dying services in the topology view.
QA:
- bootstrap a juju-core env;
- deploy a service;
- connect the GUI to the env;
- use the GUI to destroy the service;
- suddenly refresh (or visit the GUI from another browser tab).
At this point, even if the service could be still
present in the db, it should not be alive and you should
not see it in the topology view.
https:/ /code.launchpad .net/~frankban/ juju-gui/ bug-1169858- life/+merge/ 159356
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/8824044/
Affected files: handlers. js models. js topology/ service. js fakebackend. js model_handlers. js service_ module. js
A [revision details]
M app/models/
M app/models/
M app/views/
M test/test_
M test/test_model.js
M test/test_
M test/test_
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision:
<email address hidden>
Index: app/models/ handlers. js handlers. js' handlers. js 2013-04-16 12:24:34 +0000 handlers. js 2013-04-17 10:50:07 +0000
constraints: change.Constraints || {}
db.services. process_ delta(action, data);
=== modified file 'app/models/
--- app/models/
+++ app/models/
@@ -166,6 +166,7 @@
id: change.Name,
charm: change.CharmURL,
exposed: change.Exposed,
+ life: change.Life,
};
Index: app/models/ models. js models. js' models. js 2013-04-12 16:04:02 +0000 models. js 2013-04-17 11:23:44 +0000 Environment = Environment;
=== modified file 'app/models/
--- app/models/
+++ app/models/
@@ -91,7 +91,21 @@
});
models.
- var Service = Y.Base. create( 'service' , Y.Model, [], {}, { create( 'service' , Y.Model, [], {
displayName: {
aggregated_ status: {} create( 'serviceList' , Y.ModelList, [], {
+ var ALIVE = 'alive';
+
+ var Service = Y.Base.
+
+ /**
+ Return true if this service life is "alive", false otherwise.
+
+ @method isAlive
+ @return {Boolean} Whether this service is alive.
+ */
+ isAlive: function() {
+ return this.get('life') === ALIVE;
+ }
+
+ }, {
ATTRS: {
/**
@@ -115,6 +129,9 @@
pending: {
value: false
},
+ life: {
+ value: ALIVE
+ },
unit_count: {},
}
@@ -124,6 +141,18 @@
var ServiceList = Y.Base.
model: Service,
+ /** {asList: true}, function(model) { delta: function(action, data) {
_process_ delta(this, action, data, {exposed: false});
+ Return a list of alive model instances.
+
+ @method alive
+ @return {Y.ModelList} The model instances having life === 'alive'.
+ */
+ alive: function() {
+ return this.filter(
+ return model.isAlive();
+ });
+ },
+
process_
}
...