Skip to content

Commit

Permalink
GUACAMOLE-377: Merge client-side support for frame tracking, RemoteFX…
Browse files Browse the repository at this point in the history
… parameter, and performance tracking extension.
  • Loading branch information
jmuehlner committed Jun 13, 2022
2 parents 8822db7 + be90de9 commit 4b161a5
Show file tree
Hide file tree
Showing 16 changed files with 804 additions and 8 deletions.
1 change: 1 addition & 0 deletions extensions/guacamole-display-statistics/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/main/resources/generated/
1 change: 1 addition & 0 deletions extensions/guacamole-display-statistics/.ratignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/main/resources/html/*.html
124 changes: 124 additions & 0 deletions extensions/guacamole-display-statistics/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-display-statistics</artifactId>
<packaging>jar</packaging>
<version>1.4.0</version>
<name>guacamole-display-statistics</name>
<url>http://guacamole.apache.org/</url>

<parent>
<groupId>org.apache.guacamole</groupId>
<artifactId>extensions</artifactId>
<version>1.4.0</version>
<relativePath>../</relativePath>
</parent>

<build>
<plugins>

<!-- Pre-cache Angular templates with maven-angular-plugin -->
<plugin>
<groupId>com.keithbranton.mojo</groupId>
<artifactId>angular-maven-plugin</artifactId>
<version>0.3.4</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>html2js</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDir>${basedir}/src/main/resources</sourceDir>
<include>**/*.html</include>
<target>${basedir}/src/main/resources/generated/templates-main/templates.js</target>
<prefix>app/ext/display-stats</prefix>
</configuration>
</plugin>

<!-- JS/CSS Minification Plugin -->
<plugin>
<groupId>com.github.buckelieg</groupId>
<artifactId>minify-maven-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<charset>UTF-8</charset>

<webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
<webappTargetDir>${project.build.directory}/classes</webappTargetDir>

<cssSourceDir>/</cssSourceDir>
<cssTargetDir>/</cssTargetDir>
<cssFinalFile>display-stats.css</cssFinalFile>

<cssSourceFiles>
<cssSourceFile>license.txt</cssSourceFile>
</cssSourceFiles>

<cssSourceIncludes>
<cssSourceInclude>**/*.css</cssSourceInclude>
</cssSourceIncludes>

<jsSourceDir>/</jsSourceDir>
<jsTargetDir>/</jsTargetDir>
<jsFinalFile>display-stats.js</jsFinalFile>

<jsSourceFiles>
<jsSourceFile>license.txt</jsSourceFile>
</jsSourceFiles>

<jsSourceIncludes>
<jsSourceInclude>**/*.js</jsSourceInclude>
</jsSourceIncludes>

<!-- Do not minify and include tests -->
<jsSourceExcludes>
<jsSourceExclude>**/*.test.js</jsSourceExclude>
</jsSourceExcludes>
<jsEngine>CLOSURE</jsEngine>

<!-- Disable warnings for JSDoc annotations -->
<closureWarningLevels>
<misplacedTypeAnnotation>OFF</misplacedTypeAnnotation>
<nonStandardJsDocs>OFF</nonStandardJsDocs>
</closureWarningLevels>

</configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

</project>
53 changes: 53 additions & 0 deletions extensions/guacamole-display-statistics/src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">

<id>dist</id>
<baseDirectory>${project.artifactId}-${project.version}</baseDirectory>

<!-- Output tar.gz -->
<formats>
<format>tar.gz</format>
</formats>

<!-- Include licenses and extension .jar -->
<fileSets>

<!-- Include licenses -->
<fileSet>
<outputDirectory></outputDirectory>
<directory>target/licenses</directory>
</fileSet>

<!-- Include extension .jar -->
<fileSet>
<directory>target</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>

</fileSets>

</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* A directive which displays frame rendering performance statistics for a
* Guacamole client.
*/
angular.module('client').directive('guacClientStatistics', [function guacClientStatistics() {

const directive = {
restrict: 'E',
templateUrl: 'app/ext/display-stats/templates/guacClientStatistics.html',
};

directive.scope = {

/**
* The Guacamole client to display frame rendering statistics for.
*
* @type ManagedClient
*/
client : '='

};

directive.controller = ['$scope', function guacClientStatisticsController($scope) {

/**
* Updates the displayed frame rendering statistics to the values
* within the given statistics object.
*
* @param {!Guacamole.Display.Statistics} stats
* An object containing general rendering performance statistics for
* the remote desktop, Guacamole server, and Guacamole client.
*/
var updateStatistics = function updateStatistics(stats) {
$scope.$apply(function statisticsChanged() {
$scope.statistics = stats;
});
};

/**
* Returns whether the given value is a defined value that should be
* rendered within the statistics toolbar.
*
* @param {number} value
* The value to test.
*
* @returns {!boolean}
* true if the given value should be rendered within the statistics
* toolbar, false otherwise.
*/
$scope.hasValue = function hasValue(value) {
return value || value === 0;
};

/**
* Rounds the given numeric value to the nearest hundredth (two decimal places).
*
* @param {!number} value
* The value to round.
*
* @param {!number}
* The given value, rounded to the nearest hundredth.
*/
$scope.round = function round(value) {
return Math.round(value * 100) / 100;
};

// Assign/remove onstatistics handlers to track the statistics of the
// current client
$scope.$watch('client', function clientChanged(client, oldClient) {

if (oldClient)
oldClient.managedDisplay.display.onstatistics = null;

client.managedDisplay.display.statisticWindow = 1000;
client.managedDisplay.display.onstatistics = updateStatistics;

});

// Clear onstatistics handler when directive is being unloaded
$scope.$on('$destroy', function scopeDestroyed() {
if ($scope.client)
$scope.client.managedDisplay.display.onstatistics = null;
});

}];

return directive;

}]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{

"guacamoleVersion" : "1.4.0",

"name" : "Display Statistic Toolbar",
"namespace" : "display-stats",

"translations" : [
"translations/en.json"
],

"js" : [
"display-stats.min.js"
],

"css" : [
"display-stats.min.css"
],

"html" : [
"html/add-statistics.html"
],

"resources" : {
"templates/guacClientStatistics.html" : "text/html"
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<meta name="after" content=".client-tile guac-client">

<!-- Guacamole display statistics -->
<guac-client-statistics client="client"></guac-client-statistics>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

0 comments on commit 4b161a5

Please sign in to comment.