GUACAMOLE-221: Extend the guacNotification service to support generic parameter prompting.

This commit is contained in:
Michael Jumper
2020-11-01 20:22:22 -08:00
parent 688ff5310c
commit 718145ce24
3 changed files with 88 additions and 2 deletions

View File

@@ -100,4 +100,45 @@
.notification .progress .text {
position: relative;
}
}
.notification .parameters {
width: 100%;
}
.notification .parameters .fields {
display: table;
width: 100%;
}
.notification .parameters .fields .labeled-field {
display: table-row;
}
.notification .parameters .fields .field-header,
.notification .parameters .fields .form-field {
text-align: left;
display: table-cell;
padding: .125em;
vertical-align: top;
}
.notification .parameters .fields .field-header {
padding-right: 1em;
}
.notification .parameters .fields .field-header {
width: 0;
}
.notification .parameters .fields .form-field {
width: 100%;
}
.notification .parameters input[type=text],
.notification .parameters input[type=email],
.notification .parameters input[type=number],
.notification .parameters input[type=password],
.notification .parameters textarea {
max-width: 100%;
}

View File

@@ -1,4 +1,5 @@
<div class="notification" ng-class="notification.className">
<form class="notification" ng-class="notification.className"
ng-submit="notification.formSubmitCallback()">
<!-- Notification title -->
<div ng-show="notification.title" class="title-bar">
@@ -12,6 +13,15 @@
translate="{{notification.text.key}}"
translate-values="{{notification.text.variables}}"></p>
<!-- Arbitrary parameters -->
<div class="parameters" ng-show="notification.forms">
<guac-form
namespace="notification.formNamespace"
content="notification.forms"
model="notification.formModel"
model-only="true"></guac-form>
</div>
<!-- Current progress -->
<div class="progress" ng-show="notification.progress"><div class="bar" ng-show="progressPercent" ng-style="{'width': progressPercent + '%'}"></div><div
ng-show="notification.progress.text"

View File

@@ -57,6 +57,41 @@ angular.module('notification').factory('Notification', [function defineNotificat
*/
this.text = template.text;
/**
* The translation namespace of the translation strings that will
* be generated for all fields within the notification. This namespace
* is absolutely required if form fields will be included in the
* notification.
*
* @type String
*/
this.formNamespace = template.formNamespace;
/**
* Optional form content to display. This may be a form, an array of
* forms, or a simple array of fields.
*
* @type Form[]|Form|Field[]|Field
*/
this.forms = template.forms;
/**
* The object which will receive all field values. Each field value
* will be assigned to the property of this object having the same
* name.
*
* @type Object.<String, String>
*/
this.formModel = template.model;
/**
* The function to invoke when the form is submitted, if form fields
* are present within the notification.
*
* @type Function
*/
this.formSubmitCallback = template.formSubmitCallback;
/**
* An array of all actions available to the user in response to this
* notification.