mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-800: Migrate to JSON for protocol descriptions. Use full Forms instead of simply Fields for protocol parameters (allow sections).
This commit is contained in:
@@ -24,7 +24,7 @@ package org.glyptodon.guacamole.net.basic.rest;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.form.Field;
|
||||
|
||||
/**
|
||||
* Describes an error that occurred within a REST endpoint.
|
||||
@@ -40,9 +40,9 @@ public class APIError {
|
||||
private final String message;
|
||||
|
||||
/**
|
||||
* All expected request parameters, if any.
|
||||
* All expected request parameters, if any, as a collection of fields.
|
||||
*/
|
||||
private final Collection<Parameter> expected;
|
||||
private final Collection<Field> expected;
|
||||
|
||||
/**
|
||||
* The type of error that occurred.
|
||||
@@ -140,9 +140,9 @@ public class APIError {
|
||||
*
|
||||
* @param expected
|
||||
* All parameters expected in the original request, or now required as
|
||||
* a result of the original request.
|
||||
* a result of the original request, as a collection of fields.
|
||||
*/
|
||||
public APIError(Type type, String message, Collection<Parameter> expected) {
|
||||
public APIError(Type type, String message, Collection<Field> expected) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
this.expected = expected;
|
||||
@@ -159,12 +159,13 @@ public class APIError {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object which describes the required credentials.
|
||||
* Returns a collection of all required parameters, where each parameter is
|
||||
* represented by a field.
|
||||
*
|
||||
* @return
|
||||
* An object which describes the required credentials.
|
||||
* A collection of all required parameters.
|
||||
*/
|
||||
public Collection<Parameter> getExpected() {
|
||||
public Collection<Field> getExpected() {
|
||||
return expected;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ package org.glyptodon.guacamole.net.basic.rest;
|
||||
import java.util.Collection;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.form.Field;
|
||||
|
||||
/**
|
||||
* An exception that will result in the given error error information being
|
||||
@@ -76,9 +76,9 @@ public class APIException extends WebApplicationException {
|
||||
*
|
||||
* @param expected
|
||||
* All parameters expected in the original request, or now required as
|
||||
* a result of the original request.
|
||||
* a result of the original request, as a collection of fields.
|
||||
*/
|
||||
public APIException(APIError.Type type, String message, Collection<Parameter> expected) {
|
||||
public APIException(APIError.Type type, String message, Collection<Field> expected) {
|
||||
this(new APIError(type, message, expected));
|
||||
}
|
||||
|
||||
|
@@ -22,14 +22,12 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.glyptodon.guacamole.GuacamoleClientException;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleResourceNotFoundException;
|
||||
import org.glyptodon.guacamole.GuacamoleSecurityException;
|
||||
import org.glyptodon.guacamole.net.auth.credentials.CredentialsInfo;
|
||||
import org.glyptodon.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
|
||||
import org.glyptodon.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
|
||||
import org.slf4j.Logger;
|
||||
@@ -65,7 +63,7 @@ public class AuthProviderRESTExceptionWrapper implements MethodInterceptor {
|
||||
throw new APIException(
|
||||
APIError.Type.INSUFFICIENT_CREDENTIALS,
|
||||
message,
|
||||
e.getCredentialsInfo().getParameters()
|
||||
e.getCredentialsInfo().getFields()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +78,7 @@ public class AuthProviderRESTExceptionWrapper implements MethodInterceptor {
|
||||
throw new APIException(
|
||||
APIError.Type.INVALID_CREDENTIALS,
|
||||
message,
|
||||
e.getCredentialsInfo().getParameters()
|
||||
e.getCredentialsInfo().getFields()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.form.Field;
|
||||
import org.glyptodon.guacamole.net.auth.UserContext;
|
||||
import org.glyptodon.guacamole.net.basic.rest.AuthProviderRESTExposure;
|
||||
import org.glyptodon.guacamole.net.basic.rest.auth.AuthenticationService;
|
||||
@@ -65,8 +65,8 @@ public class SchemaRESTService {
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a user object.
|
||||
* A collection of form fields which describe the possible attributes
|
||||
* of a user object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
@@ -74,7 +74,7 @@ public class SchemaRESTService {
|
||||
@GET
|
||||
@Path("/users/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getUserAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
public Collection<Field> getUserAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible user attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
@@ -90,8 +90,8 @@ public class SchemaRESTService {
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a connection object.
|
||||
* A collection of form fields which describe the possible attributes
|
||||
* of a connection object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
@@ -99,7 +99,7 @@ public class SchemaRESTService {
|
||||
@GET
|
||||
@Path("/connections/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getConnectionAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
public Collection<Field> getConnectionAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible connection attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
@@ -115,8 +115,8 @@ public class SchemaRESTService {
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a connection group object.
|
||||
* A collection of form fields which describe the possible attributes
|
||||
* of a connection group object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
@@ -124,7 +124,7 @@ public class SchemaRESTService {
|
||||
@GET
|
||||
@Path("/connectionGroups/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getConnectionGroupAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
public Collection<Field> getConnectionGroupAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible connection group attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
.connection-parameters .form .fields {
|
||||
display: table;
|
||||
padding-left: .5em;
|
||||
border-left: 3px solid rgba(0,0,0,0.125);
|
||||
}
|
||||
|
||||
.connection-parameters .form .fields .labeled-field {
|
||||
@@ -41,3 +43,7 @@
|
||||
padding: 0.125em;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.connection-parameters .form .fields .field-header {
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ THE SOFTWARE.
|
||||
<h2 class="header">{{'MANAGE_CONNECTION.SECTION_HEADER_PARAMETERS' | translate}}</h2>
|
||||
<div class="section connection-parameters" ng-class="{loading: !parameters}">
|
||||
<guac-form namespace="getNamespace(connection.protocol)"
|
||||
content="protocols[connection.protocol].parameters"
|
||||
content="protocols[connection.protocol].forms"
|
||||
model="parameters"></guac-form>
|
||||
</div>
|
||||
|
||||
|
@@ -54,13 +54,13 @@ angular.module('rest').factory('Protocol', [function defineProtocol() {
|
||||
this.title = template.title;
|
||||
|
||||
/**
|
||||
* An array of all known parameters for this protocol, their types,
|
||||
* and other information.
|
||||
* An array of forms containing all known parameters for this protocol,
|
||||
* their types, and other information.
|
||||
*
|
||||
* @type Field[]
|
||||
* @type Form[]
|
||||
* @default []
|
||||
*/
|
||||
this.parameters = template.parameters || [];
|
||||
this.forms = template.forms || [];
|
||||
|
||||
};
|
||||
|
||||
|
@@ -247,7 +247,7 @@
|
||||
"FIELD_HEADER_DISABLE_AUDIO" : "Disable audio:",
|
||||
"FIELD_HEADER_DISABLE_AUTH" : "Disable authentication:",
|
||||
"FIELD_HEADER_DOMAIN" : "Domain:",
|
||||
"FIELD_HEADER_DPI" : "Display resolution (DPI):",
|
||||
"FIELD_HEADER_DPI" : "Resolution (DPI):",
|
||||
"FIELD_HEADER_DRIVE_PATH" : "Drive path:",
|
||||
"FIELD_HEADER_ENABLE_DRIVE" : "Enable drive:",
|
||||
"FIELD_HEADER_ENABLE_PRINTING" : "Enable printing:",
|
||||
@@ -257,9 +257,9 @@
|
||||
"FIELD_HEADER_INITIAL_PROGRAM" : "Initial program:",
|
||||
"FIELD_HEADER_PASSWORD" : "Password:",
|
||||
"FIELD_HEADER_PORT" : "Port:",
|
||||
"FIELD_HEADER_REMOTE_APP_ARGS" : "RemoteApp parameters:",
|
||||
"FIELD_HEADER_REMOTE_APP_DIR" : "RemoteApp working directory:",
|
||||
"FIELD_HEADER_REMOTE_APP" : "RemoteApp program:",
|
||||
"FIELD_HEADER_REMOTE_APP_ARGS" : "Parameters:",
|
||||
"FIELD_HEADER_REMOTE_APP_DIR" : "Working directory:",
|
||||
"FIELD_HEADER_REMOTE_APP" : "Program:",
|
||||
"FIELD_HEADER_SECURITY" : "Security mode:",
|
||||
"FIELD_HEADER_SERVER_LAYOUT" : "Keyboard layout:",
|
||||
"FIELD_HEADER_USERNAME" : "Username:",
|
||||
@@ -286,7 +286,14 @@
|
||||
"FIELD_OPTION_SERVER_LAYOUT_IT_IT_QWERTY" : "Italian (Qwerty)",
|
||||
"FIELD_OPTION_SERVER_LAYOUT_SV_SE_QWERTY" : "Swedish (Qwerty)",
|
||||
|
||||
"NAME" : "RDP"
|
||||
"NAME" : "RDP",
|
||||
|
||||
"SECTION_HEADER_AUTHENTICATION" : "Authentication",
|
||||
"SECTION_HEADER_BASIC_PARAMETERS" : "Basic Settings",
|
||||
"SECTION_HEADER_DEVICE_REDIRECTION" : "Device Redirection",
|
||||
"SECTION_HEADER_DISPLAY" : "Display",
|
||||
"SECTION_HEADER_NETWORK" : "Network",
|
||||
"SECTION_HEADER_REMOTEAPP" : "RemoteApp"
|
||||
|
||||
},
|
||||
|
||||
@@ -318,7 +325,12 @@
|
||||
"FIELD_OPTION_FONT_SIZE_96" : "96",
|
||||
"FIELD_OPTION_FONT_SIZE_EMPTY" : "",
|
||||
|
||||
"NAME" : "SSH"
|
||||
"NAME" : "SSH",
|
||||
|
||||
"SECTION_HEADER_AUTHENTICATION" : "Authentication",
|
||||
"SECTION_HEADER_DISPLAY" : "Display",
|
||||
"SECTION_HEADER_NETWORK" : "Network",
|
||||
"SECTION_HEADER_SFTP" : "SFTP"
|
||||
|
||||
},
|
||||
|
||||
@@ -348,7 +360,11 @@
|
||||
"FIELD_OPTION_FONT_SIZE_96" : "96",
|
||||
"FIELD_OPTION_FONT_SIZE_EMPTY" : "",
|
||||
|
||||
"NAME" : "Telnet"
|
||||
"NAME" : "Telnet",
|
||||
|
||||
"SECTION_HEADER_AUTHENTICATION" : "Authentication",
|
||||
"SECTION_HEADER_DISPLAY" : "Display",
|
||||
"SECTION_HEADER_NETWORK" : "Network"
|
||||
|
||||
},
|
||||
|
||||
@@ -357,8 +373,8 @@
|
||||
"FIELD_HEADER_AUDIO_SERVERNAME" : "Audio server name:",
|
||||
"FIELD_HEADER_COLOR_DEPTH" : "Color depth:",
|
||||
"FIELD_HEADER_CURSOR" : "Cursor:",
|
||||
"FIELD_HEADER_DEST_HOST" : "Repeater destination host:",
|
||||
"FIELD_HEADER_DEST_PORT" : "Repeater destination port:",
|
||||
"FIELD_HEADER_DEST_HOST" : "Destination host:",
|
||||
"FIELD_HEADER_DEST_PORT" : "Destination port:",
|
||||
"FIELD_HEADER_ENABLE_AUDIO" : "Enable audio:",
|
||||
"FIELD_HEADER_HOSTNAME" : "Hostname:",
|
||||
"FIELD_HEADER_PASSWORD" : "Password:",
|
||||
@@ -376,7 +392,13 @@
|
||||
"FIELD_OPTION_CURSOR_LOCAL" : "Local",
|
||||
"FIELD_OPTION_CURSOR_REMOTE" : "Remote",
|
||||
|
||||
"NAME" : "VNC"
|
||||
"NAME" : "VNC",
|
||||
|
||||
"SECTION_HEADER_AUDIO" : "Audio",
|
||||
"SECTION_HEADER_AUTHENTICATION" : "Authentication",
|
||||
"SECTION_HEADER_DISPLAY" : "Display",
|
||||
"SECTION_HEADER_NETWORK" : "Network",
|
||||
"SECTION_HEADER_REPEATER" : "VNC Repeater"
|
||||
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user