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>
(cherry picked from commit 0512a12d07)
This commit is contained in:
Tomas Sedovic 2013-05-02 11:56:59 +02:00 committed by Julie Pichon
parent 889f24096a
commit af83ed8bd4
1 changed files with 4 additions and 0 deletions

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));
});