mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 18:37:36 -02:30
Added auditor notification bar within CTinT, restrict updates, removed License field
This commit is contained in:
@@ -136,7 +136,6 @@ export default [
|
|||||||
}, ];
|
}, ];
|
||||||
|
|
||||||
var forms = _.pluck(authForms, 'formDef');
|
var forms = _.pluck(authForms, 'formDef');
|
||||||
|
|
||||||
_.each(forms, function(form) {
|
_.each(forms, function(form) {
|
||||||
var keys = _.keys(form.fields);
|
var keys = _.keys(form.fields);
|
||||||
_.each(keys, function(key) {
|
_.each(keys, function(key) {
|
||||||
@@ -154,6 +153,8 @@ export default [
|
|||||||
}
|
}
|
||||||
addFieldInfo(form, key);
|
addFieldInfo(form, key);
|
||||||
});
|
});
|
||||||
|
// Disable the save button for non-superusers
|
||||||
|
form.buttons.save.disabled = 'vm.updateProhibited';
|
||||||
});
|
});
|
||||||
|
|
||||||
function addFieldInfo(form, key) {
|
function addFieldInfo(form, key) {
|
||||||
@@ -165,7 +166,7 @@ export default [
|
|||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
placeholder: ConfigurationUtils.formatPlaceholder($scope.$parent.configDataResolve[key].placeholder, key) || null,
|
placeholder: ConfigurationUtils.formatPlaceholder($scope.$parent.configDataResolve[key].placeholder, key) || null,
|
||||||
dataTitle: $scope.$parent.configDataResolve[key].label,
|
dataTitle: $scope.$parent.configDataResolve[key].label,
|
||||||
required: $scope.$parent.configDataResolve[key].required
|
required: $scope.$parent.configDataResolve[key].required,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@import "./client/src/shared/branding/colors.default.less";
|
@import "./client/src/shared/branding/colors.default.less";
|
||||||
|
@import "../shared/branding/colors.less";
|
||||||
|
|
||||||
.Form-resetValue, .Form-resetFile {
|
.Form-resetValue, .Form-resetFile {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -49,3 +50,24 @@ input#filePickerText {
|
|||||||
border-radius: 0 5px 5px 0;
|
border-radius: 0 5px 5px 0;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Messagebar for system auditor role notifications
|
||||||
|
.Section-messageBar {
|
||||||
|
width: 120%;
|
||||||
|
margin-left: -20px;
|
||||||
|
padding: 10px;
|
||||||
|
color: @white;
|
||||||
|
background-color: @default-link;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Section-messageBar--close {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: @info-close;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Section-messageBar--close:hover {
|
||||||
|
color: @white;
|
||||||
|
}
|
||||||
|
|||||||
@@ -425,16 +425,58 @@ export default [
|
|||||||
triggerModal(msg, title, buttons);
|
triggerModal(msg, title, buttons);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var show_auditor_bar;
|
||||||
|
if($rootScope.user_is_system_auditor && Store('show_auditor_bar') !== false) {
|
||||||
|
show_auditor_bar = true;
|
||||||
|
} else {
|
||||||
|
show_auditor_bar = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var updateMessageBarPrefs = function() {
|
||||||
|
vm.show_auditor_bar = false;
|
||||||
|
Store('show_auditor_bar', vm.show_auditor_bar);
|
||||||
|
};
|
||||||
|
|
||||||
|
var closeMessageBar = function() {
|
||||||
|
var msg = 'Are you sure you want to hide the notification bar?';
|
||||||
|
var title = 'Warning: Closing notification bar';
|
||||||
|
var buttons = [{
|
||||||
|
label: "Cancel",
|
||||||
|
"class": "btn Form-cancelButton",
|
||||||
|
"id": "formmodal-cancel-button",
|
||||||
|
onClick: function() {
|
||||||
|
$('#FormModal-dialog').dialog('close');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
label: "OK",
|
||||||
|
onClick: function() {
|
||||||
|
$('#FormModal-dialog').dialog('close');
|
||||||
|
updateMessageBarPrefs();
|
||||||
|
},
|
||||||
|
"class": "btn btn-primary",
|
||||||
|
"id": "formmodal-save-button"
|
||||||
|
}];
|
||||||
|
triggerModal(msg, title, buttons);
|
||||||
|
};
|
||||||
|
|
||||||
|
var updateProhibited = true;
|
||||||
|
if($rootScope.user_is_superuser) {
|
||||||
|
updateProhibited = false;
|
||||||
|
}
|
||||||
|
|
||||||
angular.extend(vm, {
|
angular.extend(vm, {
|
||||||
activeTab: activeTab,
|
activeTab: activeTab,
|
||||||
activeTabCheck: activeTabCheck,
|
activeTabCheck: activeTabCheck,
|
||||||
|
closeMessageBar: closeMessageBar,
|
||||||
currentForm: currentForm,
|
currentForm: currentForm,
|
||||||
formCancel: formCancel,
|
formCancel: formCancel,
|
||||||
formTracker: formTracker,
|
formTracker: formTracker,
|
||||||
formSave: formSave,
|
formSave: formSave,
|
||||||
populateFromApi: populateFromApi,
|
populateFromApi: populateFromApi,
|
||||||
resetAllConfirm: resetAllConfirm,
|
resetAllConfirm: resetAllConfirm,
|
||||||
triggerModal: triggerModal
|
show_auditor_bar: show_auditor_bar,
|
||||||
|
triggerModal: triggerModal,
|
||||||
|
updateProhibited: updateProhibited
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
<div class="Section-messageBar" ng-if="vm.show_auditor_bar">
|
||||||
|
<i class="fa fa-warning"></i>
|
||||||
|
System auditors have read-only permissions in this section.
|
||||||
|
<button class="Section-messageBar--close" ng-click="vm.closeMessageBar()"><i class="fa fa-times-circle"></i></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane" id="configuration-panel">
|
<div class="tab-pane" id="configuration-panel">
|
||||||
<div ng-cloak id="htmlTemplate" class="Panel">
|
<div ng-cloak id="htmlTemplate" class="Panel">
|
||||||
<div class="Form-header">
|
<div class="Form-header">
|
||||||
|
|||||||
@@ -4,19 +4,27 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default ['GetBasePath', 'ProcessErrors', '$q', '$http', 'Rest',
|
export default ['$rootScope', 'GetBasePath', 'ProcessErrors', '$q', '$http', 'Rest',
|
||||||
function(GetBasePath, ProcessErrors, $q, $http, Rest) {
|
function($rootScope, GetBasePath, ProcessErrors, $q, $http, Rest) {
|
||||||
var url = GetBasePath('settings');
|
var url = GetBasePath('settings');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getConfigurationOptions: function() {
|
getConfigurationOptions: function() {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
var returnData;
|
||||||
|
|
||||||
Rest.setUrl(url + '/all');
|
Rest.setUrl(url + '/all');
|
||||||
Rest.options()
|
Rest.options()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
var returnData = data.actions.PUT;
|
if($rootScope.is_superuser) {
|
||||||
|
returnData = data.actions.PUT;
|
||||||
|
} else {
|
||||||
|
returnData = data.actions.GET;
|
||||||
|
}
|
||||||
|
|
||||||
//LICENSE is read only, returning here explicitly for display
|
//LICENSE is read only, returning here explicitly for display
|
||||||
returnData.LICENSE = data.actions.GET.LICENSE;
|
// Removing LICENSE display until 3.2 or later
|
||||||
|
//returnData.LICENSE = data.actions.GET.LICENSE;
|
||||||
deferred.resolve(returnData);
|
deferred.resolve(returnData);
|
||||||
})
|
})
|
||||||
.error(function(error) {
|
.error(function(error) {
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ export default [
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Disable the save button for non-superusers
|
||||||
|
form.buttons.save.disabled = 'vm.updateProhibited';
|
||||||
|
|
||||||
var keys = _.keys(form.fields);
|
var keys = _.keys(form.fields);
|
||||||
_.each(keys, function(key) {
|
_.each(keys, function(key) {
|
||||||
addFieldInfo(form, key);
|
addFieldInfo(form, key);
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ export default [
|
|||||||
addFieldInfo(form, key);
|
addFieldInfo(form, key);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Disable the save button for non-superusers
|
||||||
|
form.buttons.save.disabled = 'vm.updateProhibited';
|
||||||
|
|
||||||
function addFieldInfo(form, key) {
|
function addFieldInfo(form, key) {
|
||||||
_.extend(form.fields[key], {
|
_.extend(form.fields[key], {
|
||||||
awPopOver: $scope.$parent.configDataResolve[key].help_text,
|
awPopOver: $scope.$parent.configDataResolve[key].help_text,
|
||||||
@@ -39,27 +42,14 @@ export default [
|
|||||||
|
|
||||||
|
|
||||||
$scope.$on('populated', function() {
|
$scope.$on('populated', function() {
|
||||||
|
// $scope.$parent.parseType = 'json';
|
||||||
// var fld = 'LICENSE';
|
// ParseTypeChange({
|
||||||
// var readOnly = true;
|
|
||||||
// $scope.$parent[fld + 'codeMirror'] = AngularCodeMirror(readOnly);
|
|
||||||
// $scope.$parent[fld + 'codeMirror'].addModes($AnsibleConfig.variable_edit_modes);
|
|
||||||
// $scope.$parent[fld + 'codeMirror'].showTextArea({
|
|
||||||
// scope: $scope.$parent,
|
// scope: $scope.$parent,
|
||||||
// model: fld,
|
// variable: 'LICENSE',
|
||||||
// element: "configuration_system_template_LICENSE",
|
// parse_variable: 'parseType',
|
||||||
// lineNumbers: true,
|
// field_id: 'configuration_system_template_LICENSE',
|
||||||
// mode: 'json',
|
// readOnly: true
|
||||||
// });
|
// });
|
||||||
|
|
||||||
$scope.$parent.parseType = 'json';
|
|
||||||
ParseTypeChange({
|
|
||||||
scope: $scope.$parent,
|
|
||||||
variable: 'LICENSE',
|
|
||||||
parse_variable: 'parseType',
|
|
||||||
field_id: 'configuration_system_template_LICENSE',
|
|
||||||
readOnly: true
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
angular.extend(systemVm, {
|
angular.extend(systemVm, {
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ export default function() {
|
|||||||
ORG_ADMINS_CAN_SEE_ALL_USERS: {
|
ORG_ADMINS_CAN_SEE_ALL_USERS: {
|
||||||
type: 'toggleSwitch',
|
type: 'toggleSwitch',
|
||||||
},
|
},
|
||||||
LICENSE: {
|
// LICENSE: {
|
||||||
type: 'textarea',
|
// type: 'textarea',
|
||||||
rows: 6,
|
// rows: 6,
|
||||||
codeMirror: true,
|
// codeMirror: true,
|
||||||
class: 'Form-textAreaLabel Form-formGroup--fullWidth'
|
// class: 'Form-textAreaLabel Form-formGroup--fullWidth'
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
buttons: {
|
buttons: {
|
||||||
|
|||||||
@@ -43,6 +43,9 @@
|
|||||||
addFieldInfo(form, key);
|
addFieldInfo(form, key);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Disable the save button for non-superusers
|
||||||
|
form.buttons.save.disabled = 'vm.updateProhibited';
|
||||||
|
|
||||||
function addFieldInfo(form, key) {
|
function addFieldInfo(form, key) {
|
||||||
_.extend(form.fields[key], {
|
_.extend(form.fields[key], {
|
||||||
awPopOver: $scope.$parent.configDataResolve[key].help_text,
|
awPopOver: $scope.$parent.configDataResolve[key].help_text,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
View and edit your license information.
|
View and edit your license information.
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<a ui-sref="configuration" class="SetupItem">
|
<a ui-sref="configuration" class="SetupItem" ng-if="user_is_superuser || user_is_system_auditor">
|
||||||
<h4 class="SetupItem-title">Configure Tower</h4>
|
<h4 class="SetupItem-title">Configure Tower</h4>
|
||||||
<p class="SetupItem-description">
|
<p class="SetupItem-description">
|
||||||
Edit Tower's configuration.
|
Edit Tower's configuration.
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
@info: #d9edf7; /* alert info background color */
|
@info: #d9edf7; /* alert info background color */
|
||||||
@info-border: #bce8f1; /* alert info border color */
|
@info-border: #bce8f1; /* alert info border color */
|
||||||
@info-color: #3a87ad;
|
@info-color: #3a87ad;
|
||||||
|
@info-close: #ccdeed;
|
||||||
@unreachable: #FF0000;
|
@unreachable: #FF0000;
|
||||||
@changed: #FF9900; // Ansible Changed
|
@changed: #FF9900; // Ansible Changed
|
||||||
@skipped: #2dbaba; // Ansible Skipped
|
@skipped: #2dbaba; // Ansible Skipped
|
||||||
|
|||||||
@@ -1733,15 +1733,26 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if (btn !== 'reset') {
|
if (btn !== 'reset') {
|
||||||
//html += "ng-disabled=\"" + this.form.name + "_form.$pristine || " + this.form.name + "_form.$invalid";
|
//html += "ng-disabled=\"" + this.form.name + "_form.$pristine || " + this.form.name + "_form.$invalid";
|
||||||
|
|
||||||
html += "ng-disabled=\"" + ngDisabled;
|
if (button.disabled && button.disable !== true) {
|
||||||
//html += (this.form.allowReadonly) ? " || " + this.form.name + "ReadOnly == true" : "";
|
// Allow disabled to overrule ng-disabled. Used for permissions.
|
||||||
html += "\" ";
|
// Example: system auditor can view but not update. Form validity
|
||||||
|
// is no longer a concern but ng-disabled will update disabled
|
||||||
|
// status on render so we stop applying it here.
|
||||||
|
} else {
|
||||||
|
html += "ng-disabled=\"" + ngDisabled;
|
||||||
|
//html += (this.form.allowReadonly) ? " || " + this.form.name + "ReadOnly == true" : "";
|
||||||
|
html += "\" ";
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//html += "ng-disabled=\"" + this.form.name + "_form.$pristine";
|
//html += "ng-disabled=\"" + this.form.name + "_form.$pristine";
|
||||||
//html += (this.form.allowReadonly) ? " || " + this.form.name + "ReadOnly == true" : "";
|
//html += (this.form.allowReadonly) ? " || " + this.form.name + "ReadOnly == true" : "";
|
||||||
//html += "\" ";
|
//html += "\" ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (button.disabled && button.disable !== true) {
|
||||||
|
html += ` disabled="disabled" `;
|
||||||
|
}
|
||||||
if(button.awToolTip) {
|
if(button.awToolTip) {
|
||||||
html += " aw-tool-tip='" + button.awToolTip + "' data-placement='" + button.dataPlacement + "' data-tip-watch='" + button.dataTipWatch + "'";
|
html += " aw-tool-tip='" + button.awToolTip + "' data-placement='" + button.dataPlacement + "' data-tip-watch='" + button.dataTipWatch + "'";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user