Skip to content

Commit

Permalink
Handle all possible states of the connected openHAB installation in i…
Browse files Browse the repository at this point in the history
…ndex.ejs (openhab#33)

Currently, the index page assumes, that the openHAB version is
online, without rechecking this.

With this commit, the openhab-cloud now checks, if there even is a connected
openHAB installation with the current account (app.js says, that it can be
undefined). If there's no installation, an appropriate message with a link
to the account page is printed. If the installation is online, the already
known messages are printed according to the openHAB version. Otherwise (if
the installation is offline) an appropriate error message is printed.

Fixes openhab#28

Signed-off-by: Florian Schmidt <[email protected]>
  • Loading branch information
FlorianSW authored and digitaldan committed Feb 5, 2017
1 parent 9a2ac8d commit 4ee952c
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,30 @@
<section class="slice clearfix">
<div class=" clearfix">
<div class="container" id="threeColumns">
<% if (openhabMajorVersion == '2') { %>
You are using openHAB 2.x. <a href="https://home.myopenhab.org/start/index">Click here to access your openHAB's dashboard</a>
<% } else { %>
You are using openHAB 1.x. To remotely access your openHAB's web interface go to <code>https://myopenhab.org/openhab.app?sitemap=yoursitemapname</code>
<% } %>
<%
switch (openhabstatus) {
case undefined:
%>
You do not have an openHAB installation connected with your account. Please go to your <a href="/account">account settings</a> to add your openHAB installation.
<%
break;
case 'online':
if (openhabMajorVersion == '2') {
%>
You are using openHAB 2.x. <a href="https://home.myopenhab.org/start/index">Click here to access your openHAB's dashboard</a>
<%
} else {
%>
You are using openHAB 1.x. To remotely access your openHAB's web interface go to <code>https://myopenhab.org/openhab.app?sitemap=yoursitemapname</code>
<%
}
break;
default:
%>
Your openHAB is not online. Please check if your installation is running or recheck the openHAB settings in your <a href="/account">account</a>.
<%
}
%>
</div>
</div>
</section>
Expand Down

0 comments on commit 4ee952c

Please sign in to comment.