Sorting of networks within a protocol based on name
Signed-off-by: Oliver Hunt <oliver@hunt.bz>
This commit is contained in:
parent
ded2f95003
commit
16357a9bc7
1 changed files with 15 additions and 1 deletions
|
@ -150,7 +150,21 @@ export default class NetworkDropdown extends React.Component {
|
||||||
if (this.props.protocols) {
|
if (this.props.protocols) {
|
||||||
for (const proto of Object.keys(this.props.protocols)) {
|
for (const proto of Object.keys(this.props.protocols)) {
|
||||||
if (!this.props.protocols[proto].instances) continue;
|
if (!this.props.protocols[proto].instances) continue;
|
||||||
for (const instance of this.props.protocols[proto].instances) {
|
|
||||||
|
const sortedInstances = this.props.protocols[proto].instances;
|
||||||
|
sortedInstances.sort(function(x, y) {
|
||||||
|
const a = x.desc
|
||||||
|
const b = y.desc
|
||||||
|
if (a < b) {
|
||||||
|
return -1;
|
||||||
|
} else if (a > b) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const instance of sortedInstances) {
|
||||||
if (!instance.instance_id) continue;
|
if (!instance.instance_id) continue;
|
||||||
options.push(this._makeMenuOption(server, instance, false));
|
options.push(this._makeMenuOption(server, instance, false));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue