From 6f00e70ecc3a707954e8888810bca34d114758bc Mon Sep 17 00:00:00 2001
From: Udo Walter
Date: Sat, 8 Aug 2020 02:16:14 +0200
Subject: 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)
---
pom.xml | 6 +++++
.../bwlp_guac/BwlpAuthenticationProvider.java | 2 +-
.../java/de/bwlehrpool/bwlp_guac/BwlpREST.java | 17 ++++++++++++++
.../java/de/bwlehrpool/bwlp_guac/SlxConfig.java | 16 +++++++++++++
src/main/resources/bwlpModule.js | 7 ++++++
.../resources/controllers/groupFieldController.js | 26 +++++++++++++---------
src/main/resources/disclaimer.html | 5 -----
src/main/resources/guac-manifest.json | 2 +-
src/main/resources/login-logo.html | 3 +++
src/main/resources/selection-logo.html | 3 +++
src/main/resources/styles/login.css | 26 +++++++++++++++++-----
src/main/resources/templates/groupField.html | 3 ++-
12 files changed, 93 insertions(+), 23 deletions(-)
create mode 100644 src/main/java/de/bwlehrpool/bwlp_guac/BwlpREST.java
delete mode 100644 src/main/resources/disclaimer.html
create mode 100644 src/main/resources/login-logo.html
create mode 100644 src/main/resources/selection-logo.html
diff --git a/pom.xml b/pom.xml
index 559638e..288cd6b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,5 +118,11 @@
2.5
provided
+
+ javax.ws.rs
+ jsr311-api
+ 1.1.1
+ provided
+
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 @@
-
-
-
-
bwLehrpool
-
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 @@
+
+
+
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 @@
+
+
+
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 @@
{{ 'GROUP_SELECTION.RESOLUTION_INFO' | translate }}
+ ng-click="selectGroup($event, group.id)" ng-dblclick="submitGroup($event, group.id)"
+ ng-class="{ 'selected-group': data.id === group.id }">
{{ group.name }}
|
--
cgit v1.2.3-55-g7522