webui: send API version in RPC requests

Currently there is an incorrect behavior that server doesn't send datetime
and dnsname data in new format.

This patch adds the version to each RPC request making the UI look as  the
latest client. Server then sends data in correct format. It also removes
the "unknown version" warning from each RPC response.

https://fedorahosted.org/freeipa/ticket/4394

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik
2014-06-18 15:30:37 +02:00
parent 59f66a156b
commit 9aac0524c9
3 changed files with 7 additions and 1 deletions

View File

@@ -136,6 +136,7 @@ version-update: release-update
> ipatests/setup.py
sed -e s/__NUM_VERSION__/$(IPA_NUM_VERSION)/ install/ui/src/libs/loader.js.in \
> install/ui/src/libs/loader.js
perl -pi -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" install/ui/src/libs/loader.js
perl -pi -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" ipapython/version.py
perl -pi -e "s:__VENDOR_VERSION__:$(IPA_VENDOR_VERSION):" ipapython/version.py
perl -pi -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" ipapython/version.py

View File

@@ -362,6 +362,8 @@ rpc.command = function(spec) {
}
}
that.options.version = window.ipa_loader.api_version;
that.data = {
method: that.get_command(),
params: [that.args, that.options]
@@ -512,6 +514,8 @@ rpc.batch_command = function(spec) {
that.execute = function() {
that.errors.clear();
that.options.version = window.ipa_loader.api_version;
var command = rpc.command({
name: that.name,
entity: that.entity,

View File

@@ -20,7 +20,8 @@
(function() {
var loader = window.ipa_loader = {
num_version: '__NUM_VERSION__'
num_version: '__NUM_VERSION__',
api_version: '__API_VERSION__'
};
var head = document.getElementsByTagName('head')[0];