Commit 1b35c676 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Configurable changes since attribute alignment

Introduce a new setting (UI_CHANGES_SINCE_ALIGMENT) to allow aligment of
changes-since attribute of consiquent API calls.
parent d3bfd4a0
......@@ -37,6 +37,10 @@ UI_UPDATE_INTERVAL_MAX = UI_UPDATE_INTERVAL * 3
# Fast update interval
UI_UPDATE_INTERVAL_FAST = UI_UPDATE_INTERVAL / 2
# Miliseconds to remove from the previous server response time used in
# consecutive API calls (aligning changes-since attribute).
UI_CHANGES_SINCE_ALIGNMENT = 0
# List of emails used for sending the feedback messages to (following the ADMINS format)
FEEDBACK_CONTACTS = (
# ('Contact Name', 'contact_email@domain.com'),
......
......@@ -1136,7 +1136,9 @@ div.connect-border:hover {
div.indicators {
margin-right: 2px !important;
cursor: pointer;
}
div.indicator1, div.indicator2, div.indicator3, div.indicator4 {
background-color: #63cf1c;
width:10px;
......
......@@ -1535,7 +1535,6 @@
parse: function (resp, xhr) {
// FIXME: depricated global var
if (!resp) { return []};
var data = _.map(resp.networks.values, _.bind(this.parse_net_api_data, this));
return data;
},
......@@ -1611,6 +1610,10 @@
}
return this.api_call(this.path, "create", params, callback);
},
get_public: function(){
return this.filter(function(n){return n.get('public')});
}
})
......@@ -1674,7 +1677,6 @@
},
parse: function (resp, xhr) {
// FIXME: depricated global var
var data = _.map(resp.images.values, _.bind(this.parse_meta, this));
return resp.images.values;
},
......@@ -1760,7 +1762,6 @@
},
parse: function (resp, xhr) {
// FIXME: depricated global var
return _.map(resp.flavors.values, function(o) { o.disk_template = o['SNF:disk_template']; return o});
},
......@@ -1830,7 +1831,6 @@
copy_image_meta: true,
parse: function (resp, xhr) {
// FIXME: depricated after refactoring
var data = resp;
if (!resp) { return [] };
data = _.filter(_.map(resp.servers.values, _.bind(this.parse_vm_api_data, this)), function(v){return v});
......@@ -1950,7 +1950,6 @@
if (synnefo.config.vm_image_common_metadata) {
_.each(synnefo.config.vm_image_common_metadata,
function(key){
console.log(key, image.get(key), "image key");
if (image.get_meta(key)) {
meta[key] = image.get_meta(key);
}
......
......@@ -96,7 +96,9 @@
var path = snf.util.parseUri(url).path;
var d = api_history[path + "_" + method];
if (d) {
url = url + "?changes-since=" + snf.util.ISODateString(d)
// subtract threshold
d = new Date(d - synnefo.config.changes_since_alignment);
url = url + "?changes-since=" + snf.util.ISODateString(d);
}
return url;
}
......
......@@ -610,6 +610,7 @@ We welcome any suggestions, questions and bug reports you may have.{% endblocktr
synnefo.config.js_url = '{{ SYNNEFO_JS_URL }}';
synnefo.config.images_url = '{{ SYNNEFO_IMAGES_URL }}';
synnefo.config.image_deleted_title = {{ image_deleted_title|safe }};
synnefo.config.changes_since_alignment = {{ changes_since_alignment }};
synnefo.config.image_deleted_size_title = {{ image_deleted_size_title|safe }};
synnefo.config.use_glance = {{ use_glance }};
synnefo.config.indicators_icons_url = '{{ SYNNEFO_IMAGES_URL }}icons/indicators/';
......
......@@ -59,6 +59,7 @@ COMPUTE_API_URL = getattr(settings, 'COMPUTE_API_URL', '/api/v1.1')
# UI preferences settings
TIMEOUT = getattr(settings, "TIMEOUT", 10000)
UPDATE_INTERVAL = getattr(settings, "UI_UPDATE_INTERVAL", 5000)
CHANGES_SINCE_ALIGNMENT = getattr(settings, "UI_CHANGES_SINCE_ALIGNMENT", 0)
UPDATE_INTERVAL_INCREASE = getattr(settings, "UI_UPDATE_INTERVAL_INCREASE", 500)
UPDATE_INTERVAL_INCREASE_AFTER_CALLS_COUNT = getattr(settings,
"UI_UPDATE_INTERVAL_INCREASE_AFTER_CALLS_COUNT",
......@@ -165,6 +166,7 @@ def home(request):
'update_interval_increase_after_calls': UPDATE_INTERVAL_INCREASE_AFTER_CALLS_COUNT,
'update_interval_fast': UPDATE_INTERVAL_FAST,
'update_interval_max': UPDATE_INTERVAL_MAX,
'changes_since_alignment': CHANGES_SINCE_ALIGNMENT,
# additional settings
'image_icons': IMAGE_ICONS,
'logout_redirect': LOGOUT_URL,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment