summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUdo Walter2020-08-08 02:16:14 +0200
committerUdo Walter2020-08-08 02:16:14 +0200
commit6f00e70ecc3a707954e8888810bca34d114758bc (patch)
tree3a3f0b4a951544357d4a86d6aed84948261d81cb
parentReduce SPAM by using .debug() not .info() (diff)
downloadbwlp-guacamole-ext-6f00e70ecc3a707954e8888810bca34d114758bc.tar.gz
bwlp-guacamole-ext-6f00e70ecc3a707954e8888810bca34d114758bc.tar.xz
bwlp-guacamole-ext-6f00e70ecc3a707954e8888810bca34d114758bc.zip
Some UI changes:
- add double click to select location and continue - add a preselected location (first one in the list without a password) - add logo above the location selection - remove redundant text at the bottom - the logo is now customizable via the guacamole.properties file (property name: slx-logo-url)
-rw-r--r--pom.xml6
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java2
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/BwlpREST.java17
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/SlxConfig.java16
-rw-r--r--src/main/resources/bwlpModule.js7
-rw-r--r--src/main/resources/controllers/groupFieldController.js26
-rw-r--r--src/main/resources/disclaimer.html5
-rw-r--r--src/main/resources/guac-manifest.json2
-rw-r--r--src/main/resources/login-logo.html3
-rw-r--r--src/main/resources/selection-logo.html3
-rw-r--r--src/main/resources/styles/login.css26
-rw-r--r--src/main/resources/templates/groupField.html3
12 files changed, 93 insertions, 23 deletions
diff --git a/pom.xml b/pom.xml
index 559638e..288cd6b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,5 +118,11 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
index c737c4f..f73de84 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java
@@ -24,7 +24,7 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider {
}
public Object getResource() throws GuacamoleException {
- return null;
+ return new BwlpREST();
}
public AuthenticatedUser authenticateUser(Credentials credentials) throws GuacamoleException {
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpREST.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpREST.java
new file mode 100644
index 0000000..65258f7
--- /dev/null
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpREST.java
@@ -0,0 +1,17 @@
+package de.bwlehrpool.bwlp_guac;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public class BwlpREST {
+
+ @GET
+ @Path("logoUrl")
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getLogoUrl() {
+ return SlxConfig.logoUrl();
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/SlxConfig.java b/src/main/java/de/bwlehrpool/bwlp_guac/SlxConfig.java
index 48c707f..f93c965 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/SlxConfig.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/SlxConfig.java
@@ -20,6 +20,13 @@ public class SlxConfig {
}
};
+ private static final StringGuacamoleProperty LOGO_URL = new StringGuacamoleProperty() {
+ @Override
+ public String getName() {
+ return "slx-logo-url";
+ }
+ };
+
static {
Environment e;
try {
@@ -40,4 +47,13 @@ public class SlxConfig {
}
}
+ public static String logoUrl() {
+ try {
+ return ENVIRONMENT.getProperty(LOGO_URL);
+ } catch (GuacamoleException e) {
+ LOGGER.warn("Cannot get logo url from properties", e);
+ return null;
+ }
+ }
+
}
diff --git a/src/main/resources/bwlpModule.js b/src/main/resources/bwlpModule.js
index 0a0f116..f0605e3 100644
--- a/src/main/resources/bwlpModule.js
+++ b/src/main/resources/bwlpModule.js
@@ -3,3 +3,10 @@ angular.module('group', [
]);
angular.module('index').requires.push('group');
+
+// Set custom logo
+$http = angular.injector(["ng"]).get("$http");
+$http.get('api/ext/de.bwlehrpool.bwgpul/logoUrl').then(function (response) {
+ if (!response.data) return
+ document.documentElement.style.setProperty('--logo', "url('" + response.data + "')")
+})
diff --git a/src/main/resources/controllers/groupFieldController.js b/src/main/resources/controllers/groupFieldController.js
index ce80854..7dc1612 100644
--- a/src/main/resources/controllers/groupFieldController.js
+++ b/src/main/resources/controllers/groupFieldController.js
@@ -1,6 +1,14 @@
-angular.module('group').controller('groupFieldController', ['$scope', function groupFieldController($scope) {
+angular.module('group').controller('groupFieldController', ['$scope', function groupFieldController($scope, $http) {
- $scope.data = { id: 0, password: '', resolution: window.innerWidth + 'x' + window.innerHeight };
+ $scope.data = {id: 0, password: '', resolution: window.innerWidth + 'x' + window.innerHeight};
+
+ // Preselect the first location without a password
+ if ($scope.field && $scope.field.groups && Array.isArray($scope.field.groups)) {
+ for (let i in $scope.field.groups) {
+ let group = $scope.field.groups[i];
+ if (!group.password) $scope.data.id = group.id;
+ }
+ }
$scope.$watch('data', function(newValue) {
if (window.location.hash !== '#/') {
@@ -12,17 +20,15 @@ angular.module('group').controller('groupFieldController', ['$scope', function g
$scope.selectGroup = function selectGroup($event, id) {
if (angular.element($event.target).hasClass('bwlp-password-input')) return;
- $scope.data.password = '';
- if ($scope.data.id === id) {
- $scope.data.id = 0;
- angular.element('.selected-group').removeClass('selected-group');
- return;
- }
+ if ($scope.data.id !== id) $scope.data.password = '';
$scope.data.id = id;
- angular.element('.selected-group').removeClass('selected-group');
- angular.element($event.currentTarget).addClass('selected-group');
};
+ $scope.submitGroup = function submitGroup($event, id) {
+ $scope.selectGroup($event, id);
+ angular.element($event.currentTarget.closest('form')).scope().login();
+ }
+
$scope.logout = function logout() {
window.localStorage.removeItem('GUAC_AUTH');
window.location.hash = '#/';
diff --git a/src/main/resources/disclaimer.html b/src/main/resources/disclaimer.html
deleted file mode 100644
index b6c6190..0000000
--- a/src/main/resources/disclaimer.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<meta name="after" content=".login-ui .login-dialog">
-
-<div class="welcome">
- <h2>bwLehrpool</h2>
-</div>
diff --git a/src/main/resources/guac-manifest.json b/src/main/resources/guac-manifest.json
index 2e301e9..de2a5cf 100644
--- a/src/main/resources/guac-manifest.json
+++ b/src/main/resources/guac-manifest.json
@@ -6,7 +6,7 @@
"largeIcon" : "images/Logo_bwLehrpool_symbol.png",
"authProviders": ["de.bwlehrpool.bwlp_guac.BwlpAuthenticationProvider"],
"listeners" : ["de.bwlehrpool.bwlp_guac.TunnelListener"],
- "html" : [ "disclaimer.html" ],
+ "html" : [ "login-logo.html", "selection-logo.html" ],
"translations" : [
"translations/en.json",
"translations/de.json"
diff --git a/src/main/resources/login-logo.html b/src/main/resources/login-logo.html
new file mode 100644
index 0000000..2a097a4
--- /dev/null
+++ b/src/main/resources/login-logo.html
@@ -0,0 +1,3 @@
+<meta name="replace" content=".login-ui .login-dialog .logo">
+
+<img class="login-logo">
diff --git a/src/main/resources/selection-logo.html b/src/main/resources/selection-logo.html
new file mode 100644
index 0000000..b5620c4
--- /dev/null
+++ b/src/main/resources/selection-logo.html
@@ -0,0 +1,3 @@
+<meta name="before" content=".login-ui .login-dialog">
+
+<img class="selection-logo">
diff --git a/src/main/resources/styles/login.css b/src/main/resources/styles/login.css
index ab3b04d..8fe590b 100644
--- a/src/main/resources/styles/login.css
+++ b/src/main/resources/styles/login.css
@@ -1,11 +1,27 @@
-.login-ui .login-dialog .logo {
+:root {
+ --logo: url('app/ext/de.bwlehrpool/images/Logo_bwLehrpool.svg');
+}
+
+.login-ui .login-logo, .login-ui .selection-logo {
width: 215px;
- height: 50px;
- background-image: url('app/ext/de.bwlehrpool/images/Logo_bwLehrpool.svg');
- background-size: cover;
- background-position: center;
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+ content: var(--logo);
+}
+
+.login-ui .selection-logo {
+ margin-bottom: 40px;
+}
+
+.login-ui.initial .selection-logo, .login-ui.continuation .login-logo {
+ display: none;
}
.login-ui .login-dialog .app-name {
display: none;
}
+
+.login-ui.continuation .login-form p:first-of-type {
+ margin-top: 0;
+} \ No newline at end of file
diff --git a/src/main/resources/templates/groupField.html b/src/main/resources/templates/groupField.html
index 168d13b..8c3ce4f 100644
--- a/src/main/resources/templates/groupField.html
+++ b/src/main/resources/templates/groupField.html
@@ -1,7 +1,8 @@
<div style="font-size: 0.9em; color: grey; margin: -5px 0 20px 0">{{ 'GROUP_SELECTION.RESOLUTION_INFO' | translate }}</div>
<table class="bwlp-group-container">
<tr ng-repeat="group in field.groups" class="bwlp-group"
- ng-click="selectGroup($event, group.id)">
+ ng-click="selectGroup($event, group.id)" ng-dblclick="submitGroup($event, group.id)"
+ ng-class="{ 'selected-group': data.id === group.id }">
<td>
{{ group.name }}
</td>