From 21db642abca2701021e191bd7ced28a2b873b1f8 Mon Sep 17 00:00:00 2001 From: steffchep Date: Mon, 12 Mar 2018 11:30:33 +0100 Subject: [PATCH] #4 read force-update-url from init.json --- src/main/webapp/index.html | 10 +++++----- src/main/webapp/js/store/talks.js | 8 ++++---- src/main/webapp/js/utils/request.js | 9 ++++++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 80bb6e0..314207a 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -18,8 +18,8 @@
- Sign in/Register - Sign Out + Sign in/Register + Sign Out
@@ -31,7 +31,7 @@

Javaland Room Control

Current talks
-
Force Update of Talks Data
+
Force Update of Talks Data

@@ -72,7 +72,7 @@

/{{talk.availableSeats}}
- +
@@ -81,7 +81,7 @@

diff --git a/src/main/webapp/js/store/talks.js b/src/main/webapp/js/store/talks.js index 0b04e84..3d3af1a 100644 --- a/src/main/webapp/js/store/talks.js +++ b/src/main/webapp/js/store/talks.js @@ -5,10 +5,10 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'], } } - function sendWithBearer(event) { + function forceUpdate(event) { event.preventDefault(); store.updating = true; - var href = event.currentTarget.href; + var href = request.getForceUpdateUrl(); console.log(href); request.getWithToken(href, store.token, function(result) { popups.alert("Refresh Data", "Success!", function() { @@ -59,7 +59,7 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'], loadTalks(); }, function() { - theTalk.fullyBooked = isFullyBooked(previousSeats, theTalk.availableSeats);; + theTalk.fullyBooked = isFullyBooked(previousSeats, theTalk.availableSeats); theTalk.occupiedSeats = previousSeats; console.log("aborted"); } @@ -128,7 +128,7 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'], emptyOnEsc: emptyOnEsc, update: confirmAndUpdateOccupiedSeats, toggleFull: confirmAndToggleFull, - sendWithBearer: sendWithBearer, + forceUpdate: forceUpdate, refresh: loadTalks } }); \ No newline at end of file diff --git a/src/main/webapp/js/utils/request.js b/src/main/webapp/js/utils/request.js index 65d9888..5c6f159 100644 --- a/src/main/webapp/js/utils/request.js +++ b/src/main/webapp/js/utils/request.js @@ -4,6 +4,7 @@ define(['dataHelper'], function (helper) { var urls = { conferenceUrl: null, bookingsUrl: null, + forceUpdateUrl: null, adminUrl: null, keyCloakUrl: null, errorState: false @@ -53,6 +54,7 @@ define(['dataHelper'], function (helper) { urls.keyCloakUrl = result.keycloak; urls.conferenceUrl = result.conferences; urls.bookingsUrl = result.events; + urls.forceUpdateUrl = result.forceUpdate; urls.adminUrl = result.admin || ""; urls.adminUrl = urls.adminUrl.replace(/\/$/ig, ""); // make sure there is no space at the end urls.errorState = false; @@ -153,10 +155,15 @@ define(['dataHelper'], function (helper) { httpRequest(urls.bookingsUrl + "/" + talk.id, "POST", onSuccess, onError, headers, data); } + function getForceUpdateUrl() { + return urls.forceUpdateUrl; + } + return { initialize : initialize, get: getList, update: update, - getWithToken: getWithToken + getWithToken: getWithToken, + getForceUpdateUrl: getForceUpdateUrl }; }); \ No newline at end of file