2018-06-27 20:39:57 +00:00
|
|
|
import Controller from '@ember/controller';
|
2017-12-15 21:39:18 +00:00
|
|
|
import { computed } from '@ember/object';
|
2018-03-13 21:59:03 +00:00
|
|
|
import { alias } from '@ember/object/computed';
|
2017-10-31 04:02:40 +00:00
|
|
|
|
|
|
|
export default Controller.extend({
|
2017-12-15 21:39:18 +00:00
|
|
|
network: alias('model.resources.networks.firstObject'),
|
2017-10-31 04:02:40 +00:00
|
|
|
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');
|
|
|
|
}),
|
|
|
|
});
|