Various UX audit fixes

This commit is contained in:
Michael Abashian
2016-06-21 17:29:08 -04:00
parent 06c74ced76
commit d3d7cf20a2
10 changed files with 148 additions and 47 deletions

View File

@@ -187,7 +187,7 @@
.Form-formGroup--checkbox{ .Form-formGroup--checkbox{
display: flex; display: flex;
align-items: flex-end; margin-top: 10px;
} }
.Form-checkbox--stacked { .Form-checkbox--stacked {

View File

@@ -46,7 +46,6 @@ export default function() {
script: { script: {
label: 'Custom Script', label: 'Custom Script',
type: 'textarea', type: 'textarea',
hintText: "Drag and drop an inventory script on the field below",
class: 'Form-formGroup--fullWidth', class: 'Form-formGroup--fullWidth',
elementClass: 'Form-monospace', elementClass: 'Form-monospace',
addRequired: true, addRequired: true,

View File

@@ -12,10 +12,10 @@
</div> </div>
<div class="HostEvent-nav"> <div class="HostEvent-nav">
<!-- view navigation buttons --> <!-- view navigation buttons -->
<button ui-sref="jobDetail.host-event.details" type="button" class="btn btn-sm btn-default" ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.details')}">Details</button> <button ui-sref="jobDetail.host-event.details" type="button" class="btn btn-sm btn-default HostEvent-tab" ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.details')}">Details</button>
<button ui-sref="jobDetail.host-event.json" type="button" class="btn btn-sm btn-default " ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.json')}">JSON</button> <button ui-sref="jobDetail.host-event.json" type="button" class="btn btn-sm btn-default HostEvent-tab" ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.json')}">JSON</button>
<button ng-if="stdout" ui-sref="jobDetail.host-event.stdout" type="button" class="btn btn-sm btn-default " ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stdout')}">Standard Out</button> <button ng-if="stdout" ui-sref="jobDetail.host-event.stdout" type="button" class="btn btn-sm btn-default HostEvent-tab" ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stdout')}">Standard Out</button>
<button ng-if="stderr" ui-sref="jobDetail.host-event.stderr" type="button" class="btn btn-sm btn-default " ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stderr')}">Standard Error</button> <button ng-if="stderr" ui-sref="jobDetail.host-event.stderr" type="button" class="btn btn-sm btn-default HostEvent-tab" ng-class="{'HostEvent-tab--selected' : isActiveState('jobDetail.host-event.stderr')}">Standard Error</button>
</div> </div>
<div class="HostEvent-body"> <div class="HostEvent-body">
@@ -26,9 +26,9 @@
<!-- controls --> <!-- controls -->
<div class="HostEvent-controls"> <div class="HostEvent-controls">
<button ng-disabled="!showPrev()" ng-click="goPrev()" <button ng-disabled="!showPrev()" ng-click="goPrev()"
class="btn btn-sm btn-default">Prev Host</button> class="btn btn-sm btn-default HostEvent-button">Prev Host</button>
<button ng-disabled="!showNext()"ng-click="goNext()" class="btn btn-sm btn-default">Next Host</button> <button ng-disabled="!showNext()"ng-click="goNext()" class="btn btn-sm btn-default HostEvent-button">Next Host</button>
<button ui-sref="jobDetail" class="btn btn-sm btn-default HostEvent-close" ng-show="true" >Close</button> <button ui-sref="jobDetail" class="btn btn-sm btn-default HostEvent-close HostEvent-button" ng-show="true" >Close</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -2,6 +2,16 @@
@import "awx/ui/client/src/shared/branding/colors.default.less"; @import "awx/ui/client/src/shared/branding/colors.default.less";
@import "awx/ui/client/src/shared/layouts/one-plus-two.less"; @import "awx/ui/client/src/shared/layouts/one-plus-two.less";
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Chrome/Safari/Opera */
-khtml-user-select: none; /* Konqueror */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
not supported by any browser */
}
@media screen and (min-width: 768px){ @media screen and (min-width: 768px){
.HostEvent .modal-dialog{ .HostEvent .modal-dialog{
width: 700px; width: 700px;
@@ -16,16 +26,42 @@
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;
background-color: @default-link; background-color: @default-link;
border-color: @default-link;
&:hover{ &:hover{
background-color: @default-link-hov; background-color: @default-link-hov;
border-color: @default-link-hov;
} }
} }
.HostEvent-body{ .HostEvent-body{
margin-bottom: 10px; margin-bottom: 10px;
} }
.HostEvent-tab {
color: @btn-txt;
background-color: @btn-bg;
font-size: 12px;
border: 1px solid @btn-bord;
height: 30px;
border-radius: 5px;
margin-right: 20px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 5px;
padding-top: 5px;
transition: background-color 0.2s;
text-transform: uppercase;
text-align: center;
white-space: nowrap;
.noselect;
}
.HostEvent-tab:hover {
color: @btn-txt;
background-color: @btn-bg-hov;
cursor: pointer;
}
.HostEvent-tab--selected{ .HostEvent-tab--selected{
background-color: #D7D7D7 !important; color: @btn-txt-sel!important;
border-color: #D7D7D7 !important; background-color: @default-icon!important;
border-color: @default-icon!important;
} }
.HostEvent-view--container{ .HostEvent-view--container{
width: 100%; width: 100%;
@@ -106,3 +142,6 @@
align-self: flex-end; align-self: flex-end;
} }
} }
.HostEvent-button:disabled {
pointer-events: all!important;
}

View File

@@ -7,18 +7,20 @@
.HostEvents .modal-footer{ .HostEvents .modal-footer{
border: 0; border: 0;
margin-top: 0px; margin-top: 0px;
padding-top: 5px; padding: 0px 20px 20px 20px;
} }
button.HostEvents-close{ button.HostEvents-close{
width: 70px; width: 70px;
color: #FFFFFF; color: #FFFFFF!important;
text-transform: uppercase; text-transform: uppercase;
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;
background-color: @default-link; background-color: @default-link;
&:hover{ border-color: @default-link;
background-color: @default-link-hov; &:hover{
} background-color: @default-link-hov;
border-color: @default-link-hov;
}
} }
.HostEvents-status--ok{ .HostEvents-status--ok{
color: @green; color: @green;

View File

@@ -88,8 +88,19 @@ export default
$scope.typeChange = function () { $scope.typeChange = function () {
for(var fld in form.fields){ for(var fld in form.fields){
if(form.fields[fld] && form.fields[fld].subForm){ if(form.fields[fld] && form.fields[fld].subForm){
$scope[fld] = null; if(form.fields[fld].type === 'checkbox_group' && form.fields[fld].fields) {
$scope.notification_template_form[fld].$setPristine(); // Need to loop across the groups fields to null them out
for(var i=0; i<form.fields[fld].fields.length; i++) {
// Pull the name out of the object (array of objects)
var subFldName = form.fields[fld].fields[i].name;
$scope[subFldName] = null;
$scope.notification_template_form[subFldName].$setPristine();
}
}
else {
$scope[fld] = null;
$scope.notification_template_form[fld].$setPristine();
}
} }
} }
@@ -145,6 +156,14 @@ export default
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1)) .filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
.map(i => [i, processValue($scope[i], i , form.fields[i])])); .map(i => [i, processValue($scope[i], i , form.fields[i])]));
delete params.notification_configuration.checkbox_group;
for(var j = 0; j < form.fields.checkbox_group.fields.length; j++) {
if(form.fields.checkbox_group.fields[j].ngShow && form.fields.checkbox_group.fields[j].ngShow.indexOf(v) > -1) {
params.notification_configuration[form.fields.checkbox_group.fields[j].name] = Boolean($scope[form.fields.checkbox_group.fields[j].name]);
}
}
Wait('start'); Wait('start');
Rest.setUrl(url); Rest.setUrl(url);
Rest.post(params) Rest.post(params)

View File

@@ -54,25 +54,36 @@ export default
master[fld] = data[fld]; master[fld] = data[fld];
} }
if(data.notification_configuration[fld]){ if(form.fields[fld].type === 'checkbox_group') {
$scope[fld] = data.notification_configuration[fld]; // Loop across the group and put the child data on scope
master[fld] = data.notification_configuration[fld]; for(var j=0; j<form.fields[fld].fields.length; j++) {
if(data.notification_configuration[form.fields[fld].fields[j].name]) {
if(form.fields[fld].type === 'textarea'){ $scope[form.fields[fld].fields[j].name] = data.notification_configuration[form.fields[fld].fields[j].name];
if (form.fields[fld].name === 'headers') { master[form.fields[fld].fields[j].name] = data.notification_configuration[form.fields[fld].fields[j].name];
$scope[fld] = JSON.stringify($scope[fld], null, 2);
} else {
$scope[fld] = $scope[fld].toString().replace(',' , '\n');
} }
} }
} }
else {
if(data.notification_configuration[fld]){
$scope[fld] = data.notification_configuration[fld];
master[fld] = data.notification_configuration[fld];
if (form.fields[fld].sourceModel && data.summary_fields && if(form.fields[fld].type === 'textarea'){
data.summary_fields[form.fields[fld].sourceModel]) { if (form.fields[fld].name === 'headers') {
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = $scope[fld] = JSON.stringify($scope[fld], null, 2);
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField]; } else {
master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = $scope[fld] = $scope[fld].toString().replace(',' , '\n');
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField]; }
}
}
if (form.fields[fld].sourceModel && data.summary_fields &&
data.summary_fields[form.fields[fld].sourceModel]) {
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
}
} }
} }
data.notification_type = (Empty(data.notification_type)) ? '' : data.notification_type; data.notification_type = (Empty(data.notification_type)) ? '' : data.notification_type;
@@ -153,8 +164,19 @@ export default
$scope.typeChange = function () { $scope.typeChange = function () {
for(var fld in form.fields){ for(var fld in form.fields){
if(form.fields[fld] && form.fields[fld].subForm){ if(form.fields[fld] && form.fields[fld].subForm){
$scope[fld] = null; if(form.fields[fld].type === 'checkbox_group' && form.fields[fld].fields) {
$scope.notification_template_form[fld].$setPristine(); // Need to loop across the groups fields to null them out
for(var i=0; i<form.fields[fld].fields.length; i++) {
// Pull the name out of the object (array of objects)
var subFldName = form.fields[fld].fields[i].name;
$scope[subFldName] = null;
$scope.notification_template_form[subFldName].$setPristine();
}
}
else {
$scope[fld] = null;
$scope.notification_template_form[fld].$setPristine();
}
} }
} }
@@ -208,6 +230,14 @@ export default
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1)) .filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
.map(i => [i, processValue($scope[i], i , form.fields[i])])); .map(i => [i, processValue($scope[i], i , form.fields[i])]));
delete params.notification_configuration.checkbox_group;
for(var j = 0; j < form.fields.checkbox_group.fields.length; j++) {
if(form.fields.checkbox_group.fields[j].ngShow && form.fields.checkbox_group.fields[j].ngShow.indexOf(v) > -1) {
params.notification_configuration[form.fields.checkbox_group.fields[j].name] = Boolean($scope[form.fields.checkbox_group.fields[j].name]);
}
}
Wait('start'); Wait('start');
Rest.setUrl(url+ id+'/'); Rest.setUrl(url+ id+'/');
Rest.put(params) Rest.put(params)

View File

@@ -355,19 +355,31 @@ export default function() {
ngShow: "notification_type.value == 'irc' ", ngShow: "notification_type.value == 'irc' ",
subForm: 'typeSubForm' subForm: 'typeSubForm'
}, },
use_tls: {
label: 'Use TLS',
type: 'checkbox',
ngShow: "notification_type.value == 'email' ",
subForm: 'typeSubForm'
},
use_ssl: { use_ssl: {
labelBind: 'sslLabel', label: 'SSL Connection',
type: 'checkbox', type: 'checkbox',
ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' ", ngShow: "notification_type.value == 'irc'",
subForm: 'typeSubForm' subForm: 'typeSubForm'
}, },
checkbox_group: {
label: 'Options',
type: 'checkbox_group',
subForm: 'typeSubForm',
ngShow: "notification_type.value == 'email'",
fields: [{
name: 'use_tls',
label: 'Use TLS',
type: 'checkbox',
ngShow: "notification_type.value == 'email' ",
labelClass: 'checkbox-options stack-inline'
}, {
name: 'use_ssl',
label: 'Use SSL',
type: 'checkbox',
ngShow: "notification_type.value == 'email'",
labelClass: 'checkbox-options stack-inline'
}]
}
}, },
buttons: { //for now always generates <button> tags buttons: { //for now always generates <button> tags

View File

@@ -25,7 +25,6 @@ function () {
switch (type) { switch (type) {
case 'email': case 'email':
obj.portLabel = ' Port'; obj.portLabel = ' Port';
obj.sslLabel = ' Use SSL';
obj.passwordLabel = ' Password'; obj.passwordLabel = ' Password';
obj.email_required = true; obj.email_required = true;
obj.port_required = true; obj.port_required = true;
@@ -56,7 +55,6 @@ function () {
break; break;
case 'irc': case 'irc':
obj.portLabel = ' IRC Server Port'; obj.portLabel = ' IRC Server Port';
obj.sslLabel = ' SSL Connection';
obj.passwordLabel = ' IRC Server Password'; obj.passwordLabel = ' IRC Server Password';
obj.irc_required = true; obj.irc_required = true;
obj.password_required = true; obj.password_required = true;

View File

@@ -682,7 +682,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "<label class=\""; html += "<label class=\"";
html += (field.inline === undefined || field.inline === true) ? "checkbox-inline" : ""; html += (field.inline === undefined || field.inline === true) ? "checkbox-inline" : "";
html += (field.labelClass) ? " " + field.labelClass : ""; html += (field.labelClass) ? " " + field.labelClass : "";
html += "\">"; html += "\"";
html += (field.ngShow) ? " ng-show=\"" +field.ngShow + "\" " : "";
html += ">";
} }
html += "<input type=\"checkbox\" "; html += "<input type=\"checkbox\" ";