Revision 1faf0b9c

b/snf-app/synnefo/settings/common/ui.py
93 93
             'description': 'DRBD storage.'},
94 94
}
95 95

  
96

  
96 97
#######################
97 98
# UI BEHAVIOUR SETTINGS
98 99
#######################
......
133 134
# set in UI_GLANCE_API_URL, if setting is set to False, ui will
134 135
# request images from Compute API
135 136
UI_ENABLE_GLANCE = True
137

  
138
# a dict of image owner ids and their associate name
139
# to be displayed on images list
140
UI_SYSTEM_IMAGES_OWNERS = {
141
    'admin@synnefo.gr': 'system',
142
    'images@synnefo.gr': 'system'
143
}
144

  
b/snf-app/synnefo/ui/static/snf/js/glance_models.js
27 27

  
28 28
        display_size: function() {
29 29
            return this.get_readable_size();
30
        },
31
        
32
        display_owner: function() {
33
            var owner = this.get_owner();
34
            if (_.include(_.keys(synnefo.config.system_images_owners)), owner) {
35
                return synnefo.config.system_images_owners[owner];
36
            } else {
37
                return owner;
38
            }
30 39
        }
40

  
31 41
    })
32 42

  
33 43
    models.GlanceImages = snf.models.Images.extend({
......
87 97
        },
88 98

  
89 99
        get_system_images: function() {
90
            return _.filter(this.active(), function(i){ return i.get_owner() == snf.config.system_images_owner })
100
            return _.filter(this.active(), function(i) { 
101
                return _.include(_.keys(snf.config.system_images_owners), 
102
                                 i.get_owner());
103
            })
91 104
        },
92 105

  
93 106
        get_personal_images: function() {
94
            return _.filter(this.active(), function(i) { return i.get_owner() == snf.user.username });
107
            return _.filter(this.active(), function(i) { 
108
                return i.get_owner() == snf.user.username 
109
            });
95 110
        },
96 111

  
97 112
        get_public_images: function() {
......
99 114
        },
100 115

  
101 116
        get_shared_images: function() {
102
            return _.filter(this.active(), function(i){ return i.get_owner() != snf.config.system_images_owner && 
117
            return _.filter(this.active(), function(i){ 
118
                return !_.include(_.keys(snf.config.system_images_owners), 
119
                                  i.get_owner()) && 
103 120
                               i.get_owner() != snf.user.username &&
104
                               !i.is_public() })
121
                               !i.is_public();
122
            });
105 123
        }
106 124

  
107 125
    })
b/snf-app/synnefo/ui/static/snf/js/models.js
229 229
        },
230 230

  
231 231
        get_owner: function() {
232
            return this.get('owner') || synnefo.config.system_images_owner;
232
            return this.get('owner') || _.keys(synnefo.config.system_images_owners)[0];
233 233
        },
234 234

  
235 235
        get_readable_size: function() {
b/snf-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js
363 363
                var value;
364 364
                var method = 'get_' + key.toLowerCase();
365 365
                var display_method = 'display_' + key.toLowerCase();
366
                
366
                 
367 367
                if (image[display_method]) {
368 368
                    value = image[display_method]();
369 369
                } else if (image[method]) {
......
425 425
                                                  snf.ui.helpers.os_icon_tag(img.escape("OS")),
426 426
                                                  _.escape(img.get_readable_size()),
427 427
                                                  util.truncate(img.escape("description"), 35),
428
                                                  _.escape(img.get_owner())));
428
                                                  _.escape(img.display_owner())));
429 429
            image.data("image", img);
430 430
            image.data("image_id", img.id);
431 431
            this.images_list.append(image);
b/snf-app/synnefo/ui/static/snf/js/ui/web/ui_custom_images.js
172 172
    });
173 173
})(this);
174 174

  
175

  
b/snf-app/synnefo/ui/templates/home.html
587 587
            synnefo.user.username = '{{ request.user.uniq }}';
588 588
            synnefo.user.token = $.cookie("X-Auth-Token");
589 589
            // images config
590
            synnefo.config.system_images_owner = {{ system_images_owner|safe }};
590
            synnefo.config.system_images_owners = {{ system_images_owners|safe }};
591 591
            synnefo.ui.init();
592 592
            synnefo.ui.main.bind("initial", function(){
593 593
            });
b/snf-app/synnefo/ui/views.py
88 88
VM_NAME_TEMPLATE = getattr(settings, "VM_CREATE_NAME_TPL", "My {0} server")
89 89
MAX_SSH_KEYS_PER_USER = getattr(settings, "USERDATA_MAX_SSH_KEYS_PER_USER")
90 90
FLAVORS_DISK_TEMPLATES_INFO = getattr(settings, "UI_FLAVORS_DISK_TEMPLATES_INFO", {})
91
SYSTEM_IMAGES_OWNER = getattr(settings, "UI_SYSTEM_IMAGES_OWNER", 'synnefo')
91
SYSTEM_IMAGES_OWNERS = getattr(settings, "UI_SYSTEM_IMAGES_OWNERS", {})
92 92

  
93 93
# MEDIA PATHS
94 94
UI_MEDIA_URL = getattr(settings, "UI_MEDIA_URL",
......
158 158
               'support_ssh_os_list': json.dumps(SUPPORT_SSH_OS_LIST),
159 159
               'os_created_users': json.dumps(OS_CREATED_USERS),
160 160
               'userdata_keys_limit': json.dumps(MAX_SSH_KEYS_PER_USER),
161
               'system_images_owner': json.dumps(SYSTEM_IMAGES_OWNER),
162 161
               'use_glance': json.dumps(ENABLE_GLANCE),
163
               'glance_api_url': json.dumps(GLANCE_API_URL)
162
               'glance_api_url': json.dumps(GLANCE_API_URL),
163
               'system_images_owners': json.dumps(SYSTEM_IMAGES_OWNERS)
164 164
               }
165 165
    return template('home', context)
166 166

  

Also available in: Unified diff