mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Merge pull request #1441 from marshmalien/feat/display_invalid_items
Denote invalid job templates and scheduled jobs
This commit is contained in:
commit
b970452950
@ -34,6 +34,15 @@ function ListTemplatesController(
|
|||||||
vm.strings = strings;
|
vm.strings = strings;
|
||||||
vm.templateTypes = mapChoices(choices);
|
vm.templateTypes = mapChoices(choices);
|
||||||
vm.activeId = parseInt($state.params.job_template_id || $state.params.workflow_template_id);
|
vm.activeId = parseInt($state.params.job_template_id || $state.params.workflow_template_id);
|
||||||
|
vm.invalidTooltip = {
|
||||||
|
popover: {
|
||||||
|
text: strings.get('error.INVALID'),
|
||||||
|
on: 'mouseenter',
|
||||||
|
icon: 'fa-exclamation',
|
||||||
|
position: 'right',
|
||||||
|
arrowHeight: 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.canAddJobTemplate = jobTemplate.options('actions.POST');
|
$scope.canAddJobTemplate = jobTemplate.options('actions.POST');
|
||||||
$scope.canAddWorkflowJobTemplate = workflowTemplate.options('actions.POST');
|
$scope.canAddWorkflowJobTemplate = workflowTemplate.options('actions.POST');
|
||||||
@ -53,6 +62,14 @@ function ListTemplatesController(
|
|||||||
$scope[name] = dataset.results;
|
$scope[name] = dataset.results;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vm.isInvalid = (template) => {
|
||||||
|
if(isJobTemplate(template)) {
|
||||||
|
return (template.inventory === null || template.project == null)
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
vm.runTemplate = template => {
|
vm.runTemplate = template => {
|
||||||
if (!template) {
|
if (!template) {
|
||||||
Alert(strings.get('error.LAUNCH'), strings.get('alert.MISSING_PARAMETER'));
|
Alert(strings.get('error.LAUNCH'), strings.get('alert.MISSING_PARAMETER'));
|
||||||
|
@ -50,6 +50,9 @@
|
|||||||
<at-row ng-repeat="template in templates"
|
<at-row ng-repeat="template in templates"
|
||||||
ng-class="{'at-Row--active': (template.id === vm.activeId)}"
|
ng-class="{'at-Row--active': (template.id === vm.activeId)}"
|
||||||
template-id="{{ template.id }}">
|
template-id="{{ template.id }}">
|
||||||
|
<div class="at-Row--invalid" ng-show="vm.isInvalid(template)">
|
||||||
|
<at-popover state="vm.invalidTooltip"></at-popover>
|
||||||
|
</div>
|
||||||
<div class="at-Row-items">
|
<div class="at-Row-items">
|
||||||
<at-row-item
|
<at-row-item
|
||||||
header-value="{{ template.name }}"
|
header-value="{{ template.name }}"
|
||||||
|
@ -55,7 +55,7 @@ function TemplatesStrings (BaseString) {
|
|||||||
VALID_DECIMAL: t.s('Please enter an answer that is a decimal number.'),
|
VALID_DECIMAL: t.s('Please enter an answer that is a decimal number.'),
|
||||||
PLAYBOOK_RUN: t.s('Playbook Run'),
|
PLAYBOOK_RUN: t.s('Playbook Run'),
|
||||||
CHECK: t.s('Check'),
|
CHECK: t.s('Check'),
|
||||||
NO_CREDS_MATCHING_TYPE: t.s('No Credentials Matching This Type Have Been Created'),
|
NO_CREDS_MATCHING_TYPE: t.s('No Credentials Matching This Type Have Been Created'),
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.alert = {
|
ns.alert = {
|
||||||
@ -81,6 +81,7 @@ function TemplatesStrings (BaseString) {
|
|||||||
UNKNOWN: t.s('Unable to determine template type.'),
|
UNKNOWN: t.s('Unable to determine template type.'),
|
||||||
SCHEDULE: t.s('Unable to schedule job.'),
|
SCHEDULE: t.s('Unable to schedule job.'),
|
||||||
COPY: t.s('Unable to copy template.'),
|
COPY: t.s('Unable to copy template.'),
|
||||||
|
INVALID: t.s('Resources are missing from this template.')
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.warnings = {
|
ns.warnings = {
|
||||||
|
@ -72,10 +72,6 @@ table, tbody {
|
|||||||
border-left: 5px solid @list-row-select-bord;
|
border-left: 5px solid @list-row-select-bord;
|
||||||
}
|
}
|
||||||
|
|
||||||
.List-tableRow--selected > :first-child {
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.List-tableRow--disabled {
|
.List-tableRow--disabled {
|
||||||
.List-tableCell, .List-tableCell * {
|
.List-tableCell, .List-tableCell * {
|
||||||
color: @b7grey;
|
color: @b7grey;
|
||||||
@ -98,6 +94,25 @@ table, tbody {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.List-tableRow--invalid {
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.List-tableRow--invalidBar {
|
||||||
|
align-items: center;
|
||||||
|
border-left: solid @at-space-2x @at-color-error;
|
||||||
|
color: @at-white;
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
i {
|
||||||
|
position: absolute;
|
||||||
|
left: -7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.List-tableCell {
|
.List-tableCell {
|
||||||
padding: 7px 15px;
|
padding: 7px 15px;
|
||||||
border-top:0px!important;
|
border-top:0px!important;
|
||||||
@ -387,6 +402,11 @@ table, tbody {
|
|||||||
max-width: 164px;
|
max-width: 164px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.List-staticColumn--invalidBar {
|
||||||
|
width: 10px;
|
||||||
|
padding-right: 0px!important;
|
||||||
|
}
|
||||||
|
|
||||||
.List-staticColumnAdjacent {
|
.List-staticColumnAdjacent {
|
||||||
padding-left: 10px!important;
|
padding-left: 10px!important;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: @at-padding-list-row;
|
padding: @at-padding-list-row;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.at-Row--active {
|
.at-Row--active {
|
||||||
@ -80,6 +81,29 @@
|
|||||||
border-top-right-radius: @at-border-radius;
|
border-top-right-radius: @at-border-radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.at-Row--invalid {
|
||||||
|
align-items: center;
|
||||||
|
background: @at-color-error;
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
left: 0;
|
||||||
|
position: absolute;
|
||||||
|
width: @at-space-2x;
|
||||||
|
|
||||||
|
.at-Popover {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
&-icon i {
|
||||||
|
color: @at-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-icon i:hover {
|
||||||
|
color: @at-white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.at-Row ~ .at-Row {
|
.at-Row ~ .at-Row {
|
||||||
border-top-left-radius: 0px;
|
border-top-left-radius: 0px;
|
||||||
border-top-right-radius: 0px;
|
border-top-right-radius: 0px;
|
||||||
|
@ -46,6 +46,20 @@ export default [
|
|||||||
// _.forEach($scope[list.name], buildTooltips);
|
// _.forEach($scope[list.name], buildTooltips);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.isValid = (schedule) => {
|
||||||
|
let type = schedule.summary_fields.unified_job_template.unified_job_type;
|
||||||
|
switch(type){
|
||||||
|
case 'job':
|
||||||
|
return _.every(['project', 'inventory'], _.partial(_.has, schedule.related));
|
||||||
|
case 'project_update':
|
||||||
|
return _.has(schedule, 'related.project');
|
||||||
|
case 'inventory_update':
|
||||||
|
return _.has(schedule, 'related.inventory');
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on(`${list.iterator}_options`, function(event, data){
|
$scope.$on(`${list.iterator}_options`, function(event, data){
|
||||||
$scope.options = data.data.actions.GET;
|
$scope.options = data.data.actions.GET;
|
||||||
optionsRequestDataProcessing();
|
optionsRequestDataProcessing();
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
|
|
||||||
export default ['i18n', function(i18n) {
|
export default ['i18n', function(i18n) {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
@ -17,6 +16,15 @@ export default ['i18n', function(i18n) {
|
|||||||
hover: true,
|
hover: true,
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
|
invalid: {
|
||||||
|
columnClass: "List-staticColumn--invalidBar",
|
||||||
|
label: '',
|
||||||
|
type: 'invalid',
|
||||||
|
nosort: true,
|
||||||
|
awToolTip: i18n._("Resources are missing from this template."),
|
||||||
|
dataPlacement: 'right',
|
||||||
|
ngShow: '!isValid(schedule)'
|
||||||
|
},
|
||||||
toggleSchedule: {
|
toggleSchedule: {
|
||||||
ngDisabled: "!schedule.summary_fields.user_capabilities.edit",
|
ngDisabled: "!schedule.summary_fields.user_capabilities.edit",
|
||||||
label: '',
|
label: '',
|
||||||
|
@ -549,6 +549,11 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
|||||||
html += "ng-show='!" + list.iterator + "." ;
|
html += "ng-show='!" + list.iterator + "." ;
|
||||||
html += (field.flag) ? field.flag : "enabled";
|
html += (field.flag) ? field.flag : "enabled";
|
||||||
html += "' class='ScheduleToggle-switch' ng-click='" + field.ngClick + "'>" + i18n._("OFF") + "</button></div></td>";
|
html += "' class='ScheduleToggle-switch' ng-click='" + field.ngClick + "'>" + i18n._("OFF") + "</button></div></td>";
|
||||||
|
} else if (field.type === 'invalid') {
|
||||||
|
html += `<td class='List-tableRow--invalid'><div class='List-tableRow--invalidBar' ng-show="${field.ngShow}"`;
|
||||||
|
html += `aw-tool-tip="${field.awToolTip}" data-placement=${field.dataPlacement}>`;
|
||||||
|
html += "<i class='fa fa-exclamation'></i>";
|
||||||
|
html += "</div></td>";
|
||||||
} else {
|
} else {
|
||||||
html += "<td class=\"List-tableCell " + fld + "-column";
|
html += "<td class=\"List-tableCell " + fld + "-column";
|
||||||
html += (field['class']) ? " " + field['class'] : "";
|
html += (field['class']) ? " " + field['class'] : "";
|
||||||
|
Loading…
Reference in New Issue
Block a user