GUAC-1176: Remove all human-readable title properties from the REST form objects.

This commit is contained in:
Michael Jumper
2015-06-08 16:15:31 -07:00
parent 4eb5989c18
commit dcd82f9e63
23 changed files with 79 additions and 611 deletions

View File

@@ -69,9 +69,9 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
* All attributes related to restricting user accounts, within a logical * All attributes related to restricting user accounts, within a logical
* form. * form.
*/ */
public static final Form ACCOUNT_RESTRICTIONS = new Form("restrictions", "Account Restrictions", Arrays.<Field>asList( public static final Form ACCOUNT_RESTRICTIONS = new Form("restrictions", Arrays.<Field>asList(
new BooleanField(DISABLED_ATTRIBUTE_NAME, "Disabled", "true"), new BooleanField(DISABLED_ATTRIBUTE_NAME, "true"),
new BooleanField(EXPIRED_ATTRIBUTE_NAME, "Password expired", "true") new BooleanField(EXPIRED_ATTRIBUTE_NAME, "true")
)); ));
/** /**

View File

@@ -82,7 +82,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
* The password field to provide the user when their password is expired * The password field to provide the user when their password is expired
* and must be changed. * and must be changed.
*/ */
private static final Field NEW_PASSWORD = new PasswordField(NEW_PASSWORD_PARAMETER, "New password"); private static final Field NEW_PASSWORD = new PasswordField(NEW_PASSWORD_PARAMETER);
/** /**
* The name of the HTTP password confirmation parameter to expect if the * The name of the HTTP password confirmation parameter to expect if the
@@ -94,7 +94,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
* The password confirmation field to provide the user when their password * The password confirmation field to provide the user when their password
* is expired and must be changed. * is expired and must be changed.
*/ */
private static final Field CONFIRM_NEW_PASSWORD = new PasswordField(CONFIRM_NEW_PASSWORD_PARAMETER, "Confirm new password"); private static final Field CONFIRM_NEW_PASSWORD = new PasswordField(CONFIRM_NEW_PASSWORD_PARAMETER);
/** /**
* Information describing the expected credentials if a user's password is * Information describing the expected credentials if a user's password is

View File

@@ -35,24 +35,19 @@ import java.util.Collections;
public class BooleanField extends Field { public class BooleanField extends Field {
/** /**
* Creates a new BooleanField with the given name, title, and truth value. * Creates a new BooleanField with the given name and truth value. The
* The truth value is the value that, when assigned to this field, means * truth value is the value that, when assigned to this field, means that
* that this field is "true". * this field is "true".
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
* *
* @param title
* The human-readable title to associate with this field.
*
* @param truthValue * @param truthValue
* The value to consider "true" for this field. All other values will * The value to consider "true" for this field. All other values will
* be considered "false". * be considered "false".
*/ */
public BooleanField(String name, String title, String truthValue) { public BooleanField(String name, String truthValue) {
super(name, title, Field.Type.BOOLEAN, Collections.singletonList( super(name, Field.Type.BOOLEAN, Collections.singletonList(truthValue));
new FieldOption(truthValue, truthValue)
));
} }
} }

View File

@@ -33,19 +33,16 @@ import java.util.Collection;
public class EnumField extends Field { public class EnumField extends Field {
/** /**
* Creates a new EnumField with the given name, title, and possible values. * Creates a new EnumField with the given name and possible values.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
* *
* @param title
* The human-readable title to associate with this field.
*
* @param options * @param options
* All possible legal options for this field. * All possible legal options for this field.
*/ */
public EnumField(String name, String title, Collection<FieldOption> options) { public EnumField(String name, Collection<String> options) {
super(name, title, Field.Type.ENUM, options); super(name, Field.Type.ENUM, options);
} }
} }

View File

@@ -91,11 +91,6 @@ public class Field {
*/ */
private String name; private String name;
/**
* A human-readable name to be presented to the user.
*/
private String title;
/** /**
* The type of this field. * The type of this field.
*/ */
@@ -104,52 +99,42 @@ public class Field {
/** /**
* A collection of all legal values of this field. * A collection of all legal values of this field.
*/ */
private Collection<FieldOption> options; private Collection<String> options;
/** /**
* Creates a new Parameter with no associated name, title, or type. * Creates a new Parameter with no associated name or type.
*/ */
public Field() { public Field() {
} }
/** /**
* Creates a new Field with the given name, title, and type. * Creates a new Field with the given name and type.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
* *
* @param title
* The human-readable title to associate with this field.
*
* @param type * @param type
* The type of this field. * The type of this field.
*/ */
public Field(String name, String title, String type) { public Field(String name, String type) {
this.name = name; this.name = name;
this.title = title;
this.type = type; this.type = type;
} }
/** /**
* Creates a new Field with the given name, title, type, and possible * Creates a new Field with the given name, type, and possible values.
* values.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
* *
* @param title
* The human-readable title to associate with this field.
*
* @param type * @param type
* The type of this field. * The type of this field.
* *
* @param options * @param options
* A collection of all possible valid options for this field. * A collection of all possible valid options for this field.
*/ */
public Field(String name, String title, String type, public Field(String name, String type, Collection<String> options) {
Collection<FieldOption> options) {
this.name = name; this.name = name;
this.title = title;
this.type = type; this.type = type;
this.options = options; this.options = options;
} }
@@ -174,27 +159,6 @@ public class Field {
this.name = name; this.name = name;
} }
/**
* Returns the human-readable title associated with this field.
*
* @return
* The human-readable title associated with this field.
*/
public String getTitle() {
return title;
}
/**
* Sets the title associated with this field. The title must be a human-
* readable string which describes accurately this field.
*
* @param title
* A human-readable string describing this field.
*/
public void setTitle(String title) {
this.title = title;
}
/** /**
* Returns the type of this field. * Returns the type of this field.
* *
@@ -223,7 +187,7 @@ public class Field {
* A mutable collection of field options, or null if the field has no * A mutable collection of field options, or null if the field has no
* options. * options.
*/ */
public Collection<FieldOption> getOptions() { public Collection<String> getOptions() {
return options; return options;
} }
@@ -233,7 +197,7 @@ public class Field {
* @param options * @param options
* The options to associate with this field. * The options to associate with this field.
*/ */
public void setOptions(Collection<FieldOption> options) { public void setOptions(Collection<String> options) {
this.options = options; this.options = options;
} }

View File

@@ -40,41 +40,32 @@ public class Form {
*/ */
private String name; private String name;
/**
* The a human-readable title describing this form.
*/
private String title;
/** /**
* All fields associated with this form. * All fields associated with this form.
*/ */
private Collection<Field> fields; private Collection<Field> fields;
/** /**
* Creates a new Form object with no associated fields. The name and title * Creates a new Form object with no associated fields. The name is left
* of the form are left unset as null. If no form name is provided, this * unset as null. If no form name is provided, this form must not be used
* form must not be used in the same context as another unnamed form. * in the same context as another unnamed form.
*/ */
public Form() { public Form() {
fields = new ArrayList<Field>(); fields = new ArrayList<Field>();
} }
/** /**
* Creates a new Form object having the given name and title, and * Creates a new Form object having the given name and containing the given
* containing the given fields. * fields.
* *
* @param name * @param name
* A name which uniquely identifies this form. * A name which uniquely identifies this form.
* *
* @param title
* A human-readable title describing this form.
*
* @param fields * @param fields
* The fields to provided within the new Form. * The fields to provided within the new Form.
*/ */
public Form(String name, String title, Collection<Field> fields) { public Form(String name, Collection<Field> fields) {
this.name = name; this.name = name;
this.title = title;
this.fields = fields; this.fields = fields;
} }
@@ -120,26 +111,4 @@ public class Form {
this.name = name; this.name = name;
} }
/**
* Returns the human-readable title associated with this form. A form's
* title describes the form, but need not be unique.
*
* @return
* A human-readable title describing this form.
*/
public String getTitle() {
return title;
}
/**
* Sets the human-readable title associated with this form. A form's title
* describes the form, but need not be unique.
*
* @param title
* A human-readable title describing this form.
*/
public void setTitle(String title) {
this.title = title;
}
} }

View File

@@ -30,16 +30,13 @@ package org.glyptodon.guacamole.form;
public class MultilineField extends Field { public class MultilineField extends Field {
/** /**
* Creates a new MultilineField with the given name and title. * Creates a new MultilineField with the given name.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/ */
public MultilineField(String name, String title) { public MultilineField(String name) {
super(name, title, Field.Type.MULTILINE); super(name, Field.Type.MULTILINE);
} }
} }

View File

@@ -30,16 +30,13 @@ package org.glyptodon.guacamole.form;
public class NumericField extends Field { public class NumericField extends Field {
/** /**
* Creates a new NumericField with the given name and title. * Creates a new NumericField with the given name.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/ */
public NumericField(String name, String title) { public NumericField(String name) {
super(name, title, Field.Type.NUMERIC); super(name, Field.Type.NUMERIC);
} }
} }

View File

@@ -31,16 +31,13 @@ package org.glyptodon.guacamole.form;
public class PasswordField extends Field { public class PasswordField extends Field {
/** /**
* Creates a new PasswordField with the given name and title. * Creates a new PasswordField with the given name.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/ */
public PasswordField(String name, String title) { public PasswordField(String name) {
super(name, title, Field.Type.PASSWORD); super(name, Field.Type.PASSWORD);
} }
} }

View File

@@ -31,16 +31,13 @@ package org.glyptodon.guacamole.form;
public class TextField extends Field { public class TextField extends Field {
/** /**
* Creates a new TextField with the given name and title. * Creates a new TextField with the given name.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/ */
public TextField(String name, String title) { public TextField(String name) {
super(name, title, Field.Type.TEXT); super(name, Field.Type.TEXT);
} }
} }

View File

@@ -31,16 +31,13 @@ package org.glyptodon.guacamole.form;
public class UsernameField extends Field { public class UsernameField extends Field {
/** /**
* Creates a new UsernameField with the given name and title. * Creates a new UsernameField with the given name.
* *
* @param name * @param name
* The unique name to associate with this field. * The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/ */
public UsernameField(String name, String title) { public UsernameField(String name) {
super(name, title, Field.Type.USERNAME); super(name, Field.Type.USERNAME);
} }
} }

View File

@@ -73,13 +73,13 @@ public class CredentialsInfo {
* A field describing the username HTTP parameter expected by Guacamole * A field describing the username HTTP parameter expected by Guacamole
* during login, if usernames are being used. * during login, if usernames are being used.
*/ */
public static final Field USERNAME = new UsernameField("username", "username"); public static final Field USERNAME = new UsernameField("username");
/** /**
* A field describing the password HTTP parameter expected by Guacamole * A field describing the password HTTP parameter expected by Guacamole
* during login, if passwords are being used. * during login, if passwords are being used.
*/ */
public static final Field PASSWORD = new PasswordField("password", "password"); public static final Field PASSWORD = new PasswordField("password");
/** /**
* CredentialsInfo object which describes standard username/password * CredentialsInfo object which describes standard username/password

View File

@@ -35,11 +35,6 @@ import org.glyptodon.guacamole.form.Form;
*/ */
public class ProtocolInfo { public class ProtocolInfo {
/**
* The human-readable title associated with this protocol.
*/
private String title;
/** /**
* The unique name associated with this protocol. * The unique name associated with this protocol.
*/ */
@@ -51,65 +46,37 @@ public class ProtocolInfo {
private Collection<Form> forms; private Collection<Form> forms;
/** /**
* Creates a new ProtocolInfo with no associated name, title, or * Creates a new ProtocolInfo with no associated name or forms.
* forms.
*/ */
public ProtocolInfo() { public ProtocolInfo() {
this.forms = new ArrayList<Form>(); this.forms = new ArrayList<Form>();
} }
/** /**
* Creates a new ProtocolInfo having the given name and title, but without * Creates a new ProtocolInfo having the given name, but without any forms.
* any forms.
* *
* @param name * @param name
* The unique name associated with the protocol. * The unique name associated with the protocol.
*
* @param title
* The human-readable title to associate with the protocol.
*/ */
public ProtocolInfo(String name, String title) { public ProtocolInfo(String name) {
this.name = name; this.name = name;
this.title = title;
this.forms = new ArrayList<Form>(); this.forms = new ArrayList<Form>();
} }
/** /**
* Creates a new ProtocolInfo having the given name, title, and forms. * Creates a new ProtocolInfo having the given name and forms.
* *
* @param name * @param name
* The unique name associated with the protocol. * The unique name associated with the protocol.
* *
* @param title
* The human-readable title to associate with the protocol.
*
* @param forms * @param forms
* The forms to associate with the protocol. * The forms to associate with the protocol.
*/ */
public ProtocolInfo(String name, String title, Collection<Form> forms) { public ProtocolInfo(String name, Collection<Form> forms) {
this.name = name; this.name = name;
this.title = title;
this.forms = forms; this.forms = forms;
} }
/**
* Returns the human-readable title associated with this protocol.
*
* @return The human-readable title associated with this protocol.
*/
public String getTitle() {
return title;
}
/**
* Sets the human-readable title associated with this protocol.
*
* @param title The human-readable title to associate with this protocol.
*/
public void setTitle(String title) {
this.title = title;
}
/** /**
* Returns the unique name of this protocol. The protocol name is the * Returns the unique name of this protocol. The protocol name is the
* value required by the corresponding protocol plugin for guacd. * value required by the corresponding protocol plugin for guacd.

View File

@@ -1,272 +1,156 @@
{ {
"title" : "RDP",
"name" : "rdp", "name" : "rdp",
"forms" : [ "forms" : [
{ {
"title" : "Network",
"name" : "network", "name" : "network",
"fields" : [ "fields" : [
{ {
"name" : "hostname", "name" : "hostname",
"title" : "Hostname",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "port", "name" : "port",
"title" : "Port",
"type" : "NUMERIC" "type" : "NUMERIC"
} }
] ]
}, },
{ {
"title" : "Authentication",
"name" : "authentication", "name" : "authentication",
"fields" : [ "fields" : [
{ {
"name" : "username", "name" : "username",
"title" : "Username",
"type" : "USERNAME" "type" : "USERNAME"
}, },
{ {
"name" : "password", "name" : "password",
"title" : "Password",
"type" : "PASSWORD" "type" : "PASSWORD"
}, },
{ {
"name" : "domain", "name" : "domain",
"title" : "Domain",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "security", "name" : "security",
"title" : "Security mode",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [ "", "rdp", "tls", "nla", "any" ]
{
"value" : "",
"title" : ""
},
{
"value" : "rdp",
"title" : "RDP encryption"
},
{
"value" : "tls",
"title" : "TLS encryption"
},
{
"value" : "nla",
"title" : "NLA (Network Level Authentication)"
},
{
"value" : "any",
"title" : "Any"
}
]
}, },
{ {
"name" : "disable-auth", "name" : "disable-auth",
"title" : "Disable authentication",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "ignore-cert", "name" : "ignore-cert",
"title" : "Ignore server certificate",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
} }
] ]
}, },
{ {
"title" : "Basic Parameters",
"name" : "basic-parameters", "name" : "basic-parameters",
"fields" : [ "fields" : [
{ {
"name" : "initial-program", "name" : "initial-program",
"title" : "Initial program",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "client-name", "name" : "client-name",
"title" : "Client name",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "server-layout", "name" : "server-layout",
"title" : "Keyboard layout",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [
{ "",
"value" : "", "en-us-qwerty",
"title" : "" "fr-fr-azerty",
}, "de-de-qwertz",
{ "it-it-qwerty",
"value" : "en-us-qwerty", "sv-se-qwerty",
"title" : "US English (Qwerty)" "failsafe"
},
{
"value" : "fr-fr-azerty",
"title" : "French (Azerty)"
},
{
"value" : "de-de-qwertz",
"title" : "German (Qwertz)"
},
{
"value" : "it-it-qwerty",
"title" : "Italian (Qwerty)"
},
{
"value" : "sv-se-qwerty",
"title" : "Swedish (Qwerty)"
},
{
"value" : "failsafe",
"title" : "Unicode"
}
] ]
}, },
{ {
"name" : "console", "name" : "console",
"title" : "Administrator console",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
} }
] ]
}, },
{ {
"title" : "Display",
"name" : "display", "name" : "display",
"fields" : [ "fields" : [
{ {
"name" : "width", "name" : "width",
"title" : "Display width",
"type" : "NUMERIC" "type" : "NUMERIC"
}, },
{ {
"name" : "height", "name" : "height",
"title" : "Display height",
"type" : "NUMERIC" "type" : "NUMERIC"
}, },
{ {
"name" : "dpi", "name" : "dpi",
"title" : "Display resolution (DPI)",
"type" : "NUMERIC" "type" : "NUMERIC"
}, },
{ {
"name" : "color-depth", "name" : "color-depth",
"title" : "Color depth",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [ "", "8", "16", "24", "32" ]
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "256 color"
},
{
"value" : "16",
"title" : "Low color (16-bit)"
},
{
"value" : "24",
"title" : "True color (24-bit)"
},
{
"value" : "32",
"title" : "True color (32-bit)"
}
]
} }
] ]
}, },
{ {
"title" : "Device Redirection",
"name" : "device-redirection", "name" : "device-redirection",
"fields" : [ "fields" : [
{ {
"name" : "console-audio", "name" : "console-audio",
"title" : "Support audio in console",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "disable-audio", "name" : "disable-audio",
"title" : "Disable audio",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "enable-printing", "name" : "enable-printing",
"title" : "Enable printing",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "enable-drive", "name" : "enable-drive",
"title" : "Enable drive",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "drive-path", "name" : "drive-path",
"title" : "Drive path",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "static-channels", "name" : "static-channels",
"title" : "Static channel names",
"type" : "TEXT" "type" : "TEXT"
} }
] ]
}, },
{ {
"title" : "RemoteApp",
"name" : "remoteapp", "name" : "remoteapp",
"fields" : [ "fields" : [
{ {
"name" : "remote-app", "name" : "remote-app",
"title" : "RemoteApp program",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "remote-app-dir", "name" : "remote-app-dir",
"title" : "RemoteApp working directory",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "remote-app-args", "name" : "remote-app-args",
"title" : "RemoteApp parameters",
"type" : "TEXT" "type" : "TEXT"
} }
] ]

View File

@@ -1,143 +1,65 @@
{ {
"title" : "SSH",
"name" : "ssh", "name" : "ssh",
"forms" : [ "forms" : [
{ {
"title" : "Network",
"name" : "network", "name" : "network",
"fields" : [ "fields" : [
{ {
"name" : "hostname", "name" : "hostname",
"title" : "Hostname",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "port", "name" : "port",
"title" : "Port",
"type" : "NUMERIC" "type" : "NUMERIC"
} }
] ]
}, },
{ {
"title" : "Authentication",
"name" : "authentication", "name" : "authentication",
"fields" : [ "fields" : [
{ {
"name" : "username", "name" : "username",
"title" : "Username",
"type" : "USERNAME" "type" : "USERNAME"
}, },
{ {
"name" : "password", "name" : "password",
"title" : "Password",
"type" : "PASSWORD" "type" : "PASSWORD"
}, },
{ {
"name" : "private-key", "name" : "private-key",
"title" : "Private key",
"type" : "MULTILINE" "type" : "MULTILINE"
}, },
{ {
"name" : "passphrase", "name" : "passphrase",
"title" : "Passphrase",
"type" : "PASSWORD" "type" : "PASSWORD"
} }
] ]
}, },
{ {
"title" : "Display",
"name" : "display", "name" : "display",
"fields" : [ "fields" : [
{ {
"name" : "font-name", "name" : "font-name",
"title" : "Font name",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "font-size", "name" : "font-size",
"title" : "Font size",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [ "", "8", "9", "10", "11", "12", "14", "18", "24", "30", "36", "48", "60", "72", "96" ]
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "8"
},
{
"value" : "9",
"title" : "9"
},
{
"value" : "10",
"title" : "10"
},
{
"value" : "11",
"title" : "11"
},
{
"value" : "12",
"title" : "12"
},
{
"value" : "14",
"title" : "14"
},
{
"value" : "18",
"title" : "18"
},
{
"value" : "24",
"title" : "24"
},
{
"value" : "30",
"title" : "30"
},
{
"value" : "36",
"title" : "36"
},
{
"value" : "48",
"title" : "48"
},
{
"value" : "60",
"title" : "60"
},
{
"value" : "72",
"title" : "72"
},
{
"value" : "96",
"title" : "96"
}
]
} }
] ]
}, },
{ {
"title" : "SFTP",
"name" : "sftp", "name" : "sftp",
"fields" : [ "fields" : [
{ {
"name" : "enable-sftp", "name" : "enable-sftp",
"title" : "Enable SFTP",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
} }
] ]
} }

View File

@@ -1,122 +1,50 @@
{ {
"title" : "Telnet",
"name" : "telnet", "name" : "telnet",
"forms" : [ "forms" : [
{ {
"title" : "Network",
"name" : "network", "name" : "network",
"fields" : [ "fields" : [
{ {
"name" : "hostname", "name" : "hostname",
"title" : "Hostname",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "port", "name" : "port",
"title" : "Port",
"type" : "NUMERIC" "type" : "NUMERIC"
} }
] ]
}, },
{ {
"title" : "Authentication",
"name" : "authentication", "name" : "authentication",
"fields" : [ "fields" : [
{ {
"name" : "username", "name" : "username",
"title" : "Username",
"type" : "USERNAME" "type" : "USERNAME"
}, },
{ {
"name" : "password", "name" : "password",
"title" : "Password",
"type" : "PASSWORD" "type" : "PASSWORD"
}, },
{ {
"name" : "password-regex", "name" : "password-regex",
"title" : "Password regular expression",
"type" : "TEXT" "type" : "TEXT"
} }
] ]
}, },
{ {
"title" : "Display",
"name" : "display", "name" : "display",
"fields" : [ "fields" : [
{ {
"name" : "font-name", "name" : "font-name",
"title" : "Font name",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "font-size", "name" : "font-size",
"title" : "Font size",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [ "", "8", "9", "10", "11", "12", "14", "18", "24", "30", "36", "48", "60", "72", "96" ]
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "8"
},
{
"value" : "9",
"title" : "9"
},
{
"value" : "10",
"title" : "10"
},
{
"value" : "11",
"title" : "11"
},
{
"value" : "12",
"title" : "12"
},
{
"value" : "14",
"title" : "14"
},
{
"value" : "18",
"title" : "18"
},
{
"value" : "24",
"title" : "24"
},
{
"value" : "30",
"title" : "30"
},
{
"value" : "36",
"title" : "36"
},
{
"value" : "48",
"title" : "48"
},
{
"value" : "60",
"title" : "60"
},
{
"value" : "72",
"title" : "72"
},
{
"value" : "96",
"title" : "96"
}
]
} }
] ]
} }

View File

@@ -1,141 +1,81 @@
{ {
"title" : "VNC",
"name" : "vnc", "name" : "vnc",
"forms" : [ "forms" : [
{ {
"title" : "Network",
"name" : "network", "name" : "network",
"fields" : [ "fields" : [
{ {
"name" : "hostname", "name" : "hostname",
"title" : "Hostname",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "port", "name" : "port",
"title" : "Port",
"type" : "NUMERIC" "type" : "NUMERIC"
} }
] ]
}, },
{ {
"title" : "Authentication",
"name" : "authentication", "name" : "authentication",
"fields" : [ "fields" : [
{ {
"name" : "password", "name" : "password",
"title" : "Password",
"type" : "PASSWORD" "type" : "PASSWORD"
} }
] ]
}, },
{ {
"title" : "Display",
"name" : "display", "name" : "display",
"fields" : [ "fields" : [
{ {
"name" : "read-only", "name" : "read-only",
"title" : "Read-only",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "swap-red-blue", "name" : "swap-red-blue",
"title" : "Swap red/blue components",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "cursor", "name" : "cursor",
"title" : "Cursor",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [ "", "local", "remote" ]
{
"value" : "",
"title" : ""
},
{
"value" : "local",
"title" : "Local"
},
{
"value" : "remote",
"title" : "Remote"
}
]
}, },
{ {
"name" : "color-depth", "name" : "color-depth",
"title" : "Color depth",
"type" : "ENUM", "type" : "ENUM",
"options" : [ "options" : [ "", "8", "16", "24", "32" ]
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "256 color"
},
{
"value" : "16",
"title" : "Low color (16-bit)"
},
{
"value" : "24",
"title" : "True color (24-bit)"
},
{
"value" : "32",
"title" : "True color (32-bit)"
}
]
} }
] ]
}, },
{ {
"title" : "Repeater",
"name" : "repeater", "name" : "repeater",
"fields" : [ "fields" : [
{ {
"name" : "dest-host", "name" : "dest-host",
"title" : "Repeater destination host",
"type" : "TEXT" "type" : "TEXT"
}, },
{ {
"name" : "dest-port", "name" : "dest-port",
"title" : "Repeater destination port",
"type" : "NUMERIC" "type" : "NUMERIC"
} }
] ]
}, },
{ {
"title" : "Audio",
"name" : "audio", "name" : "audio",
"fields" : [ "fields" : [
{ {
"name" : "enable-audio", "name" : "enable-audio",
"title" : "Enable audio",
"type" : "BOOLEAN", "type" : "BOOLEAN",
"options" : [{ "options" : [ "true" ]
"value" : "true",
"title" : "true"
}]
}, },
{ {
"name" : "audio-servername", "name" : "audio-servername",
"title" : "Audio server name",
"type" : "TEXT" "type" : "TEXT"
} }
] ]

View File

@@ -29,12 +29,12 @@ angular.module('form').controller('checkboxFieldController', ['$scope',
// Update typed value when model is changed // Update typed value when model is changed
$scope.$watch('model', function modelChanged(model) { $scope.$watch('model', function modelChanged(model) {
$scope.typedValue = (model === $scope.field.options[0].value); $scope.typedValue = (model === $scope.field.options[0]);
}); });
// Update string value in model when typed value is changed // Update string value in model when typed value is changed
$scope.$watch('typedValue', function typedValueChanged(typedValue) { $scope.$watch('typedValue', function typedValueChanged(typedValue) {
$scope.model = (typedValue ? $scope.field.options[0].value : ''); $scope.model = (typedValue ? $scope.field.options[0] : '');
}); });
}]); }]);

View File

@@ -1 +1 @@
<select ng-model="model" ng-options="option.value as getFieldOption(option.value) | translate for option in field.options | orderBy: value"></select> <select ng-model="model" ng-options="option as getFieldOption(option) | translate for option in field.options | orderBy: value"></select>

View File

@@ -46,13 +46,6 @@ angular.module('rest').factory('Field', [function defineField() {
*/ */
this.name = template.name; this.name = template.name;
/**
* A human-readable name for this parameter.
*
* @type String
*/
this.title = template.title;
/** /**
* The type string defining which values this parameter may contain, * The type string defining which values this parameter may contain,
* as well as what properties are applicable. Valid types are listed * as well as what properties are applicable. Valid types are listed
@@ -66,7 +59,7 @@ angular.module('rest').factory('Field', [function defineField() {
/** /**
* All possible legal values for this parameter. * All possible legal values for this parameter.
* *
* @type FieldOption[] * @type String[]
*/ */
this.options = template.options; this.options = template.options;

View File

@@ -1,61 +0,0 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Service which defines the FieldOption class.
*/
angular.module('rest').factory('FieldOption', [function defineFieldOption() {
/**
* The object returned by REST API calls when representing a single possible
* legal value of a field.
*
* @constructor
* @param {FieldOption|Object} [template={}]
* The object whose properties should be copied within the new
* FieldOption.
*/
var FieldOption = function FieldOption(template) {
// Use empty object by default
template = template || {};
/**
* A human-readable name for this parameter value.
*
* @type String
*/
this.title = template.title;
/**
* The actual value to set the parameter to, if this option is
* selected.
*
* @type String
*/
this.value = template.value;
};
return FieldOption;
}]);

View File

@@ -40,21 +40,13 @@ angular.module('rest').factory('Form', [function defineForm() {
template = template || {}; template = template || {};
/** /**
* The name which uniquely identifies this parameter, or null if this * The name which uniquely identifies this form, or null if this form
* field has no name. * has no name.
* *
* @type String * @type String
*/ */
this.name = template.name; this.name = template.name;
/**
* A human-readable name for this form, or null if this form has no
* name.
*
* @type String
*/
this.title = template.title;
/** /**
* All fields contained within this form. * All fields contained within this form.
* *

View File

@@ -46,13 +46,6 @@ angular.module('rest').factory('Protocol', [function defineProtocol() {
*/ */
this.name = template.name; this.name = template.name;
/**
* A human-readable name for this protocol.
*
* @type String
*/
this.title = template.title;
/** /**
* An array of forms containing all known parameters for this protocol, * An array of forms containing all known parameters for this protocol,
* their types, and other information. * their types, and other information.