Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
#4 read force-update-url from init.json
Browse files Browse the repository at this point in the history
  • Loading branch information
steffchep committed Mar 12, 2018
1 parent e7628ce commit 21db642
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<div v-if="loginAvailable" id="login-area">
<div>
<a class="button" v-bind:class="{ show: !loggedIn }" v-on:click="login"><img alt="Sign in/Register" title="Sign in/Register" src="img/unlock_24px.svg"></a>
<a class="button" v-bind:class="{ show: loggedIn }" v-on:click="logout"><img alt="Sign Out" title="Sign Out" src="img/lock_24px.svg"></a>
<a class="button" :class="{ show: !loggedIn }" v-on:click="login"><img alt="Sign in/Register" title="Sign in/Register" src="img/unlock_24px.svg"></a>
<a class="button" :class="{ show: loggedIn }" v-on:click="logout"><img alt="Sign Out" title="Sign Out" src="img/lock_24px.svg"></a>
</div>
</div>

Expand All @@ -31,7 +31,7 @@ <h1>Javaland Room Control</h1>
<div id="loading" v-if="loading"></div>
<h2 class="dark">
<div>Current talks</div>
<div><a v-if="loggedIn && !updating" v-on:click="sendWithBearer" href="../rest/conferences/update/javaland2018">Force Update of Talks Data</a></div>
<div><a v-if="loggedIn && !updating" v-on:click="forceUpdate" href="#">Force Update of Talks Data</a></div>
<input type="search" v-on:keyup="emptyOnEsc" placeholder="Quick Filter" aria-label="Quick filter" v-model="quickFilter">
<button v-on:click="refresh" id="refresh">&thinsp;</button>
</h2>
Expand Down Expand Up @@ -72,7 +72,7 @@ <h2 class="dark">
<input type="number" :data-id="index" :disabled="!talk.availableSeats" width="4" :value="talk.occupiedSeats"><span>/{{talk.availableSeats}} </span> <button :data-id="index" :disabled="!talk.availableSeats" class="setOccupied" @click="update">Set</button>
</div>
<div>
<input type="checkbox" :id="index" :data-id="index" :disabled="!talk.availableSeats" v-model="talk.fullyBooked" @click="toggleFull"><label v-bind:for="index"></label>
<input type="checkbox" :id="index" :data-id="index" :disabled="!talk.availableSeats" v-model="talk.fullyBooked" @click="toggleFull"><label :for="index"></label>
</div>
</td>
</tr>
Expand All @@ -81,7 +81,7 @@ <h2 class="dark">
</div>

<footer>
<a target="new" rel="noopener noreferrer" href="https://programm.javaland.eu">Return to Javaland 2017 Program</a>
<a target="new" rel="noopener noreferrer" href="https://programm.javaland.eu">Return to Javaland Program</a>
<span>powered by<a href="http://www.dukecon.org" target="_blank" rel="noopener noreferrer">DukeCon</a></span>
</footer>
</body>
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/js/store/talks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -128,7 +128,7 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'],
emptyOnEsc: emptyOnEsc,
update: confirmAndUpdateOccupiedSeats,
toggleFull: confirmAndToggleFull,
sendWithBearer: sendWithBearer,
forceUpdate: forceUpdate,
refresh: loadTalks
}
});
9 changes: 8 additions & 1 deletion src/main/webapp/js/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ define(['dataHelper'], function (helper) {
var urls = {
conferenceUrl: null,
bookingsUrl: null,
forceUpdateUrl: null,
adminUrl: null,
keyCloakUrl: null,
errorState: false
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
};
});

0 comments on commit 21db642

Please sign in to comment.