support: allow input of additional email

This commit is contained in:
Girish Ramakrishnan
2019-10-18 18:23:49 -07:00
parent f393f58bce
commit c1ba1014c3
2 changed files with 24 additions and 8 deletions
+12 -8
View File
@@ -15,6 +15,7 @@
<div ng-bind-html="config.uiSpec.support.ticketFormBody | markdown2html"></div>
<form ng-show="config.uiSpec.support.submitTickets" name="feedbackForm" ng-submit="submitFeedback()">
<div class="form-group">
<label>Type</label>
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.type" required>
<option value="app_error">App Error</option>
<option value="ticket">Bug Report</option>
@@ -22,20 +23,23 @@
</select>
</div>
<div class="form-group" ng-show="feedback.type === 'app_error'">
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.appId" ng-required="feedback.type === 'app_error'">
<option value="" disabled selected>Select App</option>
<option ng-repeat="app in apps" value="{{ app.id }}">{{ app.fqdn }}</option>
</select>
</div>
<div class="form-group" ng-show="feedback.type === 'email_error'" ng-class="{ 'has-error': (feedbackForm.email.$dirty && feedbackForm.email.$invalid) }">
<input type="text" class="form-control" name="email" placeholder="Provide an alternate email address to reach you" ng-model="feedback.altEmail" ng-maxlength="512" ng-minlength="1" ng-required="feedback.type === 'email_error'">
</div>
<label>Select App</label>
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.appId" ng-required="feedback.type === 'app_error'">
<option ng-repeat="app in apps" value="{{ app.id }}">{{ app.fqdn }}</option>
</select>
</div>
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.subject.$dirty && feedbackForm.subject.$invalid) }">
<label>Topic</label>
<input type="text" class="form-control" name="subject" placeholder="Topic" ng-model="feedback.subject" ng-maxlength="512" ng-minlength="1" required>
</div>
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.description.$dirty && feedbackForm.description.$invalid) }">
<label>Report</label>
<textarea class="form-control" name="description" rows="3" placeholder="Describe your issue" ng-model="feedback.description" ng-minlength="1" required></textarea>
</div>
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.email.$dirty && feedbackForm.email.$invalid) }">
<label>Email</label> <small> (Subscription email is {{ subscription.email }}) </small>
<input type="text" class="form-control" name="email" placeholder="If needed, provide an email address different from above to reach you" ng-model="feedback.altEmail" ng-maxlength="512" ng-minlength="1" ng-required="feedback.type === 'email_error'">
</div>
<button type="submit" class="btn btn-primary" ng-disabled="feedbackForm.$invalid || feedback.busy"><i class="fa fa-circle-notch fa-spin" ng-show="feedback.busy"></i> Submit</button>
<span ng-show="feedback.error" class="text-danger text-bold">{{feedback.error}}</span>
<span ng-show="feedback.result" class="text-success text-bold">{{feedback.result.message}}</span>
+12
View File
@@ -22,6 +22,7 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
};
$scope.sshSupportEnabled = false;
$scope.subscription = null;
function resetFeedback() {
$scope.feedback.subject = '';
@@ -59,11 +60,22 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
});
};
function getSubscription() {
Client.getSubscription(function (error, result) {
if (error && error.statusCode === 412) return; // not yet registered
if (error) return console.error(error);
$scope.subscription = result;
});
}
Client.onReady(function () {
Client.getRemoteSupport(function (error, enabled) {
if (error) return console.error(error);
$scope.sshSupportEnabled = enabled;
getSubscription();
});
});