juju/juju-gui — pull request #280 by huwshimi (2014-05-08 08:10:47+00:00)
Title: WIP - Update the machine tokens instead of re-rendering the entire machine view

WIP

The machine tokens should be updated instead of the whole machine view being re-rendered.

However, I can't figure out why the first item that gets added does not appear in this.get('db').machines.

It looks like this is why the tests are failing.

I've been using the following in the Chrome console to simulate the changes:

Adding a machine:
models = yui.namespace('juju.models'); newId = Math.floor(Math.random() * 100).toString(); app.db.machines.add(new models.Machine({id: newId, displayName: newId, hardware: {disk: 1024, mem: 1024, cpuPower: 1024, cpuCores: 1}}));

Removing a machine:
app.db.machines.remove(0);

You should see that when you add a machine it does not appear in the list, but if you add a second one it does. If you switch to the service and then back to the machine view all the machines will appear. However, if you then add new machines, the first you add will not appear, just like before.