Last active
March 7, 2017 14:44
-
-
Save Cyreex/012f4bce29a4f861820bb16c1898e3c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _updateNetworks() { | |
var that = this, | |
sortedNetworkList; | |
if (this.vmData.subscriptionId) { | |
$.observable(this.virtualNetworks).refresh([loadingEntryItem]); | |
global.VMExtension.Model.Ajax.getNetworksWithSubnets(this.vmData.subscriptionId) | |
.done(function(response) { | |
sortedNetworkList = response ? response.sort(global.VMExtension.Utilities.dynamicMultiSort([{ propertyName: "displayName", isDescending: false }])) : []; | |
$.observable(that.virtualNetworks).refresh(sortedNetworkList); | |
if (that.virtualNetworks.length === 0) { | |
$.observable(that.virtualNetworks).refresh([notConnectedNetworkItem]); | |
} else { | |
$.observable(that.virtualNetworks).insert(0, notConnectedNetworkItem); | |
that.vmData.network = that.virtualNetworks[0].id; | |
$(that.vmData).triggerHandler("propertyChange", { path: "network", value: that.virtualNetworks[0].id }); | |
} | |
}); | |
} else { | |
$.observable(this.virtualNetworks).refresh([noEntryItem]); | |
} | |
this.vmData.vmNetworks = this.virtualNetworks; | |
this.vmData.stampId = global.Spf.Service.getSubscriptionInfo(this.vmData.subscriptionId).stampId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment