Revision 8f53cfa3
b/snf-cyclades-app/synnefo/ui/static/snf/css/main.css | ||
---|---|---|
20 | 20 |
background: url("../images/body-bg.png") repeat-x #FFFFFF; |
21 | 21 |
text-align:center; |
22 | 22 |
font-size: 16px; |
23 |
background-position: 0px 35px;
|
|
23 |
background-position: 0px 34px;
|
|
24 | 24 |
overflow-y: scroll; |
25 | 25 |
} |
26 | 26 |
|
b/snf-cyclades-app/synnefo/ui/static/snf/js/glance_models.js | ||
---|---|---|
122 | 122 |
|
123 | 123 |
get_personal_images: function() { |
124 | 124 |
return _.filter(this.active(), function(i) { |
125 |
return i.get_owner() == snf.user.username
|
|
125 |
return i.get_owner_uuid() == snf.user.username;
|
|
126 | 126 |
}); |
127 | 127 |
}, |
128 | 128 |
|
... | ... | |
134 | 134 |
return _.filter(this.active(), function(i){ |
135 | 135 |
return !_.include(_.keys(snf.config.system_images_owners), |
136 | 136 |
i.get_owner()) && |
137 |
i.get_owner() != snf.user.username && |
|
137 |
i.get_owner_uuid() != snf.user.username &&
|
|
138 | 138 |
!i.is_public(); |
139 | 139 |
}); |
140 | 140 |
} |
b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js | ||
---|---|---|
229 | 229 |
// Image model |
230 | 230 |
models.Image = models.Model.extend({ |
231 | 231 |
path: 'images', |
232 |
|
|
232 |
|
|
233 | 233 |
get_size: function() { |
234 | 234 |
return parseInt(this.get('metadata') ? this.get('metadata').values.size : -1) |
235 | 235 |
}, |
... | ... | |
261 | 261 |
return this.get('owner') || _.keys(synnefo.config.system_images_owners)[0]; |
262 | 262 |
}, |
263 | 263 |
|
264 |
get_owner_uuid: function() { |
|
265 |
return this.get('owner_uuid'); |
|
266 |
}, |
|
267 |
|
|
264 | 268 |
is_system_image: function() { |
265 | 269 |
var owner = this.get_owner(); |
266 | 270 |
return _.include(_.keys(synnefo.config.system_images_owners), owner) |
... | ... | |
268 | 272 |
|
269 | 273 |
owned_by: function(user) { |
270 | 274 |
if (!user) { user = synnefo.user } |
271 |
return user.username == this.get_owner();
|
|
275 |
return user.username == this.get('owner_uuid');
|
|
272 | 276 |
}, |
273 | 277 |
|
274 | 278 |
display_owner: function() { |
... | ... | |
1740 | 1744 |
}, |
1741 | 1745 |
|
1742 | 1746 |
parse: function (resp, xhr) { |
1743 |
var data = _.map(resp.images.values, _.bind(this.parse_meta, this)); |
|
1744 |
return resp.images.values; |
|
1747 |
var parsed = _.map(resp.images.values, _.bind(this.parse_meta, this)); |
|
1748 |
parsed = this.fill_owners(parsed); |
|
1749 |
return parsed; |
|
1750 |
}, |
|
1751 |
|
|
1752 |
fill_owners: function(images) { |
|
1753 |
// do translate uuid->displayname if needed |
|
1754 |
// store display name in owner attribute for compatibility |
|
1755 |
var uuids = []; |
|
1756 |
|
|
1757 |
var images = _.map(images, function(img, index) { |
|
1758 |
if (synnefo.config.translate_uuids) { |
|
1759 |
uuids.push(img['owner']); |
|
1760 |
} |
|
1761 |
img['owner_uuid'] = img['owner']; |
|
1762 |
return img; |
|
1763 |
}); |
|
1764 |
|
|
1765 |
if (uuids.length > 0) { |
|
1766 |
var handle_results = function(data) { |
|
1767 |
_.each(images, function (img) { |
|
1768 |
img['owner'] = data.uuid_catalog[img['owner_uuid']]; |
|
1769 |
}); |
|
1770 |
} |
|
1771 |
// notice the async false |
|
1772 |
var uuid_map = this.translate_uuids(uuids, false, |
|
1773 |
handle_results) |
|
1774 |
} |
|
1775 |
return images; |
|
1776 |
}, |
|
1777 |
|
|
1778 |
translate_uuids: function(uuids, async, cb) { |
|
1779 |
var url = synnefo.config.user_catalog_url; |
|
1780 |
var data = JSON.stringify({'uuids': uuids}); |
|
1781 |
|
|
1782 |
// post to user_catalogs api |
|
1783 |
snf.api.sync('create', undefined, { |
|
1784 |
url: url, |
|
1785 |
data: data, |
|
1786 |
async: async, |
|
1787 |
success: cb |
|
1788 |
}); |
|
1745 | 1789 |
}, |
1746 | 1790 |
|
1747 | 1791 |
get_meta_key: function(img, key) { |
b/snf-cyclades-app/synnefo/ui/templates/home.html | ||
---|---|---|
635 | 635 |
synnefo.config.login_redirect = '{{ login_redirect }}'; |
636 | 636 |
synnefo.config.auth_cookie_name = '{{ auth_cookie_name }}'; |
637 | 637 |
|
638 |
synnefo.config.translate_uuids = {{ translate_uuids|safe }}; |
|
639 |
synnefo.config.user_catalog_url = {{ user_catalog_url|safe }}; |
|
640 |
|
|
638 | 641 |
synnefo.config.network_suggested_subnets = {{ network_suggested_subnets|safe }}; |
639 | 642 |
synnefo.config.network_available_types = {{ network_available_types|safe }}; |
640 | 643 |
synnefo.config.network_allow_duplicate_vm_nics = {{ network_allow_duplicate_vm_nics }}; |
b/snf-cyclades-app/synnefo/ui/views.py | ||
---|---|---|
150 | 150 |
GROUP_PUBLIC_NETWORKS = getattr(settings, 'UI_GROUP_PUBLIC_NETWORKS', True) |
151 | 151 |
GROUPED_PUBLIC_NETWORK_NAME = getattr(settings, 'UI_GROUPED_PUBLIC_NETWORK_NAME', 'Internet') |
152 | 152 |
|
153 |
USER_CATALOG_URL = getattr(settings, 'UI_USER_CATALOG_URL', '/user_catalogs') |
|
154 |
TRANSLATE_UUIDS = not getattr(settings, 'TRANSLATE_UUIDS', False) |
|
155 |
|
|
153 | 156 |
def template(name, request, context): |
154 | 157 |
template_path = os.path.join(os.path.dirname(__file__), "templates/") |
155 | 158 |
current_template = template_path + name + '.html' |
... | ... | |
173 | 176 |
'request': request, |
174 | 177 |
'current_lang': get_language() or 'en', |
175 | 178 |
'compute_api_url': json.dumps(COMPUTE_API_URL), |
179 |
'user_catalog_url': json.dumps(USER_CATALOG_URL), |
|
180 |
'translate_uuids': json.dumps(TRANSLATE_UUIDS), |
|
176 | 181 |
# update interval settings |
177 | 182 |
'update_interval': UPDATE_INTERVAL, |
178 | 183 |
'update_interval_increase': UPDATE_INTERVAL_INCREASE, |
Also available in: Unified diff