2017-10-31 04:02:40 +00:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
|
|
|
const { Controller, computed } = Ember;
|
|
|
|
|
|
|
|
export default Controller.extend({
|
|
|
|
network: computed.alias('model.resources.networks.firstObject'),
|
|
|
|
ports: computed('network.reservedPorts.[]', 'network.dynamicPorts.[]', function() {
|
2017-11-14 18:50:09 +00:00
|
|
|
return (this.get('network.reservedPorts') || [])
|
2017-10-31 04:02:40 +00:00
|
|
|
.map(port => ({
|
|
|
|
name: port.Label,
|
|
|
|
port: port.Value,
|
|
|
|
isDynamic: false,
|
|
|
|
}))
|
|
|
|
.concat(
|
2017-11-14 18:50:09 +00:00
|
|
|
(this.get('network.dynamicPorts') || []).map(port => ({
|
2017-10-31 04:02:40 +00:00
|
|
|
name: port.Label,
|
|
|
|
port: port.Value,
|
|
|
|
isDynamic: true,
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
.sortBy('name');
|
|
|
|
}),
|
|
|
|
});
|