[WIP] Preparing REST API calls

This commit is contained in:
Robert von Burg 2016-03-27 19:55:48 +02:00
parent 53d21eefd2
commit f73c207076
6 changed files with 52 additions and 55 deletions

View File

@ -59,7 +59,7 @@
<depends>SessionHandler</depends>
<Properties>
<corsEnabled>true</corsEnabled>
<corsOrigin>http://localhost:8180</corsOrigin>
<corsOrigin>http://localhost:8080</corsOrigin>
</Properties>
</Component>
<Component>

View File

@ -13,7 +13,7 @@ strolch.const = {
url_base: 'planningwebapp',
urls: {
auth: 'rest/strolch/authentication',
version: 'rest/version',
version: 'rest/strolch/version'
},
auth_token: 'auth_token',

View File

@ -67,48 +67,48 @@ strolch.fn.setLocale = function (locale) {
localStorage['language_locale'] = locale;
};
strolch.fn.const.version = null;
strolch.const.version = null;
strolch.fn.version = function () {
if (strolch.fn.const.version == null) {
strolch.fn.const.version = "unknown";
if (strolch.const.version == null) {
strolch.const.version = "unknown";
$.ajax({
async: false,
url: localStorage['url_version']
url: strolch.fn.url(strolch.const.urls.version)
}
).done(function (data) {
if (data != null) {
var ver = data['artifactVersion'];
if (data['scmRevision'] == '${buildNumber}') {
strolch.fn.const.version = ver;
} else {
ver = ver ? ver.substr(0, 9) : '?';
var rev = data['scmRevision'];
var rev = rev ? rev.substr(0, 7) : '?';
strolch.fn.const.version = ver + " - " + rev;
}
if (data != null) {
var ver = data['artifactVersion'];
if (data['scmRevision'] == '${buildNumber}') {
strolch.const.version = ver;
} else {
ver = ver ? ver.substr(0, 9) : '?';
var rev = data['scmRevision'];
var rev = rev ? rev.substr(0, 7) : '?';
strolch.const.version = ver + " - " + rev;
}
});
}
});
}
return strolch.fn.const.version;
return strolch.const.version;
};
strolch.fn.const.revision = null;
strolch.const.revision = null;
strolch.fn.revision = function () {
if (strolch.fn.const.revision == null) {
strolch.fn.const.revision = Math.floor(Math.random() * 10000000);
if (strolch.const.revision == null) {
strolch.const.revision = Math.floor(Math.random() * 10000000);
$.ajax({
async: false,
url: strolch.fn.url(subPath)
url: strolch.fn.url(strolch.const.urls.version)
}
).done(function (data) {
if (data != null && data['scmRevision'] != '${buildNumber}') {
uoms.fn.const.revision = data['scmRevision'];
}
});
if (data != null && data['scmRevision'] != '${buildNumber}') {
strolch.const.revision = data['scmRevision'];
}
});
}
return uoms.fn.const.revision;
return strolch.const.revision;
};
@ -116,7 +116,7 @@ strolch.fn.revision = function () {
* Session management
*/
strolch.fn.showReAuthForm = function () {
$('#reauthFormModal').on('shown.bs.modal', function () {
$('#reauthFormModal').on('shown.bs.modal', function () {
$('#auth-password').focus();
});
$('#reauthFormModal').modal('show');

View File

@ -53,4 +53,9 @@ strolch.index.registerHandlers = function () {
strolch.index.start = function () {
var components = ['model'];
$.forEach(components, function (index) {
alert(index);
})
};

View File

@ -15,15 +15,15 @@ jQuery(document).ready(function ($) {
});
strolch.parts.model.init = function (domParent) {
strolch.parts.model.registerHandlers();
$("#page-content").load("parts/model.html");
strolch.parts.model.registerHandlers();
};
strolch.parts.model.registerHandlers = function () {
};
strolch.parts.model.start = function () {

View File

@ -1,28 +1,20 @@
<html>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#resources" role="tab">Resources</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a></li>
</ul>
<div id="content-model" style="display: none">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="resources" role="tabpanel">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#resources" role="tab">Resources</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a></li>
</ul>
<h1>Resources</h1>
<table id="resourcesTable" class="table table-striped">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="resources" role="tabpanel">
<caption>The resources for the current user's realm</caption>
<h1>Resources</h1>
<table id="resourcesTable" class="table table-striped">
</table>
<caption>The resources for the current user's realm</caption>
</table>
</div>
<div class="tab-pane" id="orders" role="tabpanel">Orders</div>
</div>
</div>
</html>
</div>
<div class="tab-pane" id="orders" role="tabpanel">Orders</div>
</div>