Revision 4bf6778f

b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js
787 787
      tpl: '#networks-select-public-tpl',
788 788
      model_view_cls: views.NetworkSelectPublicNetwork,
789 789
      get_floating_ips: function() {
790
        return _.map(this._subviews[1]._subviews[0].selected_ips, function(m) {
791
          return m.id;
792
        });
790
        var ips = [];
791
        _.each(this._subviews, function(view) {
792
          _.each(view._subviews, function(view) {
793
            if (view.selected_ips) {
794
              _.each(view.selected_ips, function(m) {
795
                ips.push(m.id);
796
              }, this);
797
            }
798
          }, this);
799
        }, this);
800
        return ips;
793 801
      }
794 802
    });
795 803
    
......
979 987
      rivets_view: true,
980 988
      tpl: '#networks-select-view-tpl',
981 989
      select_public: true,
990
      
991
      forced_values_title_map: {
992
        "SNF:ANY_PUBLIC_IPV6": "Public IPv6 Network",
993
        "SNF:ANY_PUBLIC_IPV4": "Public IPv4 Network"
994
      },
982 995

  
983 996
      initialize: function(options) {
984 997
        this.quotas = synnefo.storage.quotas.get('cyclades.private_network');
......
991 1004
        }});
992 1005

  
993 1006
        this.public_networks = new Backbone.Collection();
994

  
995
        // forced networks
996
        // TODO: check config
997
        this.forced = new models.networks.Network({
998
          name: 'Public IPv6 Network', 
999
          subnets: [],
1000
          is_public: true,
1001
          forced: true
1002
        });
1003
        this.public_networks.add(this.forced);
1007
        this.public_networks.comparator = function(m) {
1008
          if (m.get('forced')) {
1009
            return -1
1010
          }  
1011
          return 100;
1012
        }
1013
        
1014
        if (synnefo.config.forced_server_networks.length) {
1015
          _.each(synnefo.config.forced_server_networks, function(network) {
1016
            var forced = synnefo.storage.networks.get(network);
1017
            if (!forced) {
1018
              var name = this.forced_values_title_map[network];
1019
              if (!name) { name = "Forced network ({0})".format(network)}
1020
              forced = new models.networks.Network({
1021
                id: network,
1022
                name: name, 
1023
                subnets: [],
1024
                is_public: true,
1025
                forced: true
1026
              });
1027
            } else {
1028
              forced.set({'forced': true});
1029
            }
1030
            this.public_networks.add(forced);
1031
          }, this);
1032
        }
1004 1033

  
1005 1034
        // combined public
1006 1035
        this.combined_public = new models.networks.CombinedPublicNetwork();
1007
        this.combined_public.set({noselect: true, name: 'Internet'});
1036
        this.combined_public.set({noselect: true, name: 'Internet', forced: false});
1008 1037
        this.public_networks.add(this.combined_public);
1009 1038

  
1010 1039
        model_attrs = {
b/snf-cyclades-app/synnefo/ui/templates/home.html
688 688
            synnefo.config.vm_hostname_format = {{ vm_hostname_format|safe }};
689 689
            synnefo.config.automatic_network_range_format = {{ automatic_network_range_format|safe }};
690 690
            synnefo.config.custom_image_help_url = '{{ custom_image_help_url|safe }}';
691
            synnefo.config.forced_server_networks = {{ forced_server_networks|safe }};
691 692
            
692 693
            synnefo.auth_client = new synnefo.auth.AstakosClient({
693 694
                login_url: synnefo.config.login_redirect,
b/snf-cyclades-app/synnefo/ui/views.py
169 169
    getattr(settings, 'UI_GROUPED_PUBLIC_NETWORK_NAME', 'Internet')
170 170

  
171 171

  
172
DEFAULT_FORCED_SERVER_NETWORKS = getattr(settings,
173
                                         "CYCLADES_FORCED_SERVER_NETWORKS", []);
174
FORCED_SERVER_NETWORKS = getattr(settings, "UI_FORCED_SERVER_NETWORKS",
175
                                 DEFAULT_FORCED_SERVER_NETWORKS)
176

  
172 177
def template(name, request, context):
173 178
    template_path = os.path.join(os.path.dirname(__file__), "templates/")
174 179
    current_template = template_path + name + '.html'
......
234 239
               'image_deleted_size_title': json.dumps(IMAGE_DELETED_SIZE_TITLE),
235 240
               'network_suggested_subnets': json.dumps(NETWORK_SUBNETS),
236 241
               'network_available_types': json.dumps(NETWORK_TYPES),
242
               'forced_server_networks': json.dumps(FORCED_SERVER_NETWORKS),
237 243
               'network_allow_duplicate_vm_nics':
238 244
               json.dumps(NETWORK_DUPLICATE_NICS),
239 245
               'network_strict_destroy': json.dumps(NETWORK_STRICT_DESTROY),

Also available in: Unified diff