Don't duplicate networks list on keypair import

In the Launch Instance modal, if the user clicks on the button to import
a keypair, the networks listed in the Networking tab get duplicated.

The import keypair button calls `workflow_init` which in turn calls
`generate_networklist_html` which appended the networks to the list, not
clearing it beforehand.

This makes sure both Selected Networks and Available Networks lists are
emptied before the networks are added.

Fixes bug 1170193

Change-Id: Icb750caa08673068c509af6c8df1ad57a2a30d93
Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
This commit is contained in:
Tomas Sedovic 2013-05-02 11:56:59 +02:00
parent 9cdee05678
commit 0512a12d07

View File

@ -301,9 +301,13 @@ horizon.projects = {
$("#networkListSortContainer").show();
$("#networkListIdContainer").hide();
self.init_network_list();
// Make sure we don't duplicate the networks in the list
$("#available_network").empty();
$.each(self.networks_available, function(index, value){
$("#available_network").append(self.generate_network_element(value.name, value.id, value.value));
});
// Make sure we don't duplicate the networks in the list
$("#selected_network").empty();
$.each(self.networks_selected, function(index, value){
$("#selected_network").append(self.generate_network_element(value.name, value.id, value.value));
});