mirror of
https://github.com/ansible/awx.git
synced 2026-01-29 15:24:42 -03:30
Add Job Splitting feature to UI
This commit is contained in:
parent
c8d76dbe78
commit
ef4a2cbebb
@ -76,6 +76,22 @@ function ListJobsController (
|
|||||||
return { icon, link, value };
|
return { icon, link, value };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vm.getSplitJobDetails = (details) => {
|
||||||
|
const internalLimitDetails = Object.assign({}, details);
|
||||||
|
|
||||||
|
if (!internalLimitDetails) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const splitJobDetails = internalLimitDetails.shard;
|
||||||
|
|
||||||
|
if (!splitJobDetails) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `Split Job ${splitJobDetails.offset + 1}/${splitJobDetails.step}`;
|
||||||
|
};
|
||||||
|
|
||||||
vm.getSref = ({ type, id }) => {
|
vm.getSref = ({ type, id }) => {
|
||||||
let sref;
|
let sref;
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,8 @@
|
|||||||
status-tip="{{ vm.strings.get('list.STATUS_TOOLTIP', job.status) }}"
|
status-tip="{{ vm.strings.get('list.STATUS_TOOLTIP', job.status) }}"
|
||||||
header-value="{{ job.id }} - {{ job.name }}"
|
header-value="{{ job.id }} - {{ job.name }}"
|
||||||
header-state="{{ vm.getSref(job) }}"
|
header-state="{{ vm.getSref(job) }}"
|
||||||
header-tag="{{ vm.jobTypes[job.type] }}">
|
header-tag="{{ vm.jobTypes[job.type] }}"
|
||||||
|
secondary-tag="{{ vm.getSplitJobDetails(job.summary_fields.internal_limit) }}">
|
||||||
</at-row-item>
|
</at-row-item>
|
||||||
<div class="at-Row--inline">
|
<div class="at-Row--inline">
|
||||||
<at-row-item
|
<at-row-item
|
||||||
|
|||||||
@ -126,22 +126,22 @@ function getSourceWorkflowJobDetails () {
|
|||||||
return { link, tooltip };
|
return { link, tooltip };
|
||||||
}
|
}
|
||||||
|
|
||||||
function getShardDetails () {
|
function getSplitJobDetails () {
|
||||||
const internalLimitDetails = resource.model.get('summary_fields.internal_limit');
|
const internalLimitDetails = resource.model.get('summary_fields.internal_limit');
|
||||||
|
|
||||||
if (!internalLimitDetails) {
|
if (!internalLimitDetails) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const shardDetails = resource.model.get('summary_fields.internal_limit.shard');
|
const splitJobDetails = resource.model.get('summary_fields.internal_limit.shard');
|
||||||
|
|
||||||
if (!shardDetails) {
|
if (!splitJobDetails) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label = strings.get('labels.SHARD_DETAILS');
|
const label = strings.get('labels.SPLIT_JOB');
|
||||||
const offset = `${shardDetails.offset} of ${shardDetails.step} shards`;
|
const offset = `${splitJobDetails.offset + 1}/${splitJobDetails.step}`;
|
||||||
const tooltip = strings.get('tooltips.SHARD_DETAILS');
|
const tooltip = strings.get('tooltips.SPLIT_JOB_DETAILS');
|
||||||
|
|
||||||
return { label, offset, tooltip };
|
return { label, offset, tooltip };
|
||||||
}
|
}
|
||||||
@ -691,7 +691,7 @@ function JobDetailsController (
|
|||||||
vm.jobType = getJobTypeDetails();
|
vm.jobType = getJobTypeDetails();
|
||||||
vm.jobTemplate = getJobTemplateDetails();
|
vm.jobTemplate = getJobTemplateDetails();
|
||||||
vm.sourceWorkflowJob = getSourceWorkflowJobDetails();
|
vm.sourceWorkflowJob = getSourceWorkflowJobDetails();
|
||||||
vm.shardDetails = getShardDetails();
|
vm.splitJobDetails = getSplitJobDetails();
|
||||||
vm.inventory = getInventoryDetails();
|
vm.inventory = getInventoryDetails();
|
||||||
vm.project = getProjectDetails();
|
vm.project = getProjectDetails();
|
||||||
vm.projectUpdate = getProjectUpdateDetails();
|
vm.projectUpdate = getProjectUpdateDetails();
|
||||||
|
|||||||
@ -151,10 +151,10 @@
|
|||||||
<div class="JobResults-resultRowText">{{ vm.jobType.value }}</div>
|
<div class="JobResults-resultRowText">{{ vm.jobType.value }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- SHAAAAAARD -->
|
<!-- SPLIT JOB DETAIL -->
|
||||||
<div class="JobResults-resultRow" ng-if="vm.shardDetails">
|
<div class="JobResults-resultRow" ng-if="vm.splitJobDetails">
|
||||||
<label class="JobResults-resultRowLabel">{{ vm.shardDetails.label }}</label>
|
<label class="JobResults-resultRowLabel">{{ vm.splitJobDetails.label }}</label>
|
||||||
<div class="JobResults-resultRowText">{{ vm.shardDetails.offset }}</div>
|
<div class="JobResults-resultRowText">{{ vm.splitJobDetails.offset }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- LAUNCHED BY DETAIL -->
|
<!-- LAUNCHED BY DETAIL -->
|
||||||
|
|||||||
@ -23,7 +23,7 @@ function OutputStrings (BaseString) {
|
|||||||
EXTRA_VARS: t.s('Read-only view of extra variables added to the job template'),
|
EXTRA_VARS: t.s('Read-only view of extra variables added to the job template'),
|
||||||
INVENTORY: t.s('View the Inventory'),
|
INVENTORY: t.s('View the Inventory'),
|
||||||
JOB_TEMPLATE: t.s('View the Job Template'),
|
JOB_TEMPLATE: t.s('View the Job Template'),
|
||||||
SHARD_DETAILS: t.s('Job is one of several shards from a JT that splits on inventory'),
|
SPLIT_JOB_DETAILS: t.s('Job is one of several from a JT that splits on inventory'),
|
||||||
PROJECT: t.s('View the Project'),
|
PROJECT: t.s('View the Project'),
|
||||||
PROJECT_UPDATE: t.s('View Project checkout results'),
|
PROJECT_UPDATE: t.s('View Project checkout results'),
|
||||||
SCHEDULE: t.s('View the Schedule'),
|
SCHEDULE: t.s('View the Schedule'),
|
||||||
@ -56,7 +56,7 @@ function OutputStrings (BaseString) {
|
|||||||
JOB_EXPLANATION: t.s('Explanation'),
|
JOB_EXPLANATION: t.s('Explanation'),
|
||||||
JOB_TAGS: t.s('Job Tags'),
|
JOB_TAGS: t.s('Job Tags'),
|
||||||
JOB_TEMPLATE: t.s('Job Template'),
|
JOB_TEMPLATE: t.s('Job Template'),
|
||||||
SHARD_DETAILS: t.s('Shard Details'),
|
SPLIT_JOB: t.s('Split Job'),
|
||||||
JOB_TYPE: t.s('Job Type'),
|
JOB_TYPE: t.s('Job Type'),
|
||||||
LABELS: t.s('Labels'),
|
LABELS: t.s('Labels'),
|
||||||
LAUNCHED_BY: t.s('Launched By'),
|
LAUNCHED_BY: t.s('Launched By'),
|
||||||
|
|||||||
@ -197,7 +197,7 @@
|
|||||||
color: @at-color-list-row-item-tag-primary;
|
color: @at-color-list-row-item-tag-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.at-RowItem-tag--header {
|
.at-RowItem-tag--header, .at-RowItem-tag--secondary {
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ function atRowItem () {
|
|||||||
headerLink: '@',
|
headerLink: '@',
|
||||||
headerState: '@',
|
headerState: '@',
|
||||||
headerTag: '@',
|
headerTag: '@',
|
||||||
|
secondaryTag: '@',
|
||||||
status: '@',
|
status: '@',
|
||||||
statusTip: '@',
|
statusTip: '@',
|
||||||
statusClick: '&?',
|
statusClick: '&?',
|
||||||
|
|||||||
@ -29,6 +29,9 @@
|
|||||||
<div class="at-RowItem-tag at-RowItem-tag--header" ng-if="headerTag">
|
<div class="at-RowItem-tag at-RowItem-tag--header" ng-if="headerTag">
|
||||||
{{ headerTag }}
|
{{ headerTag }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="at-RowItem-tag at-RowItem-tag--secondary" ng-if="secondaryTag">
|
||||||
|
{{ secondaryTag }}
|
||||||
|
</div>
|
||||||
<div class="at-RowItem-label" ng-if="labelValue && labelLink">
|
<div class="at-RowItem-label" ng-if="labelValue && labelLink">
|
||||||
<a ng-href="{{ labelLink }}">{{ labelValue }}</a>
|
<a ng-href="{{ labelLink }}">{{ labelValue }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -257,6 +257,19 @@ function(NotificationsList, i18n) {
|
|||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
control: '<instance-groups-multiselect instance-groups="instance_groups" field-is-disabled="!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)"></instance-groups-multiselect>',
|
control: '<instance-groups-multiselect instance-groups="instance_groups" field-is-disabled="!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)"></instance-groups-multiselect>',
|
||||||
},
|
},
|
||||||
|
job_shard_count: {
|
||||||
|
label: i18n._('Job Splitting'),
|
||||||
|
type: 'number',
|
||||||
|
integer: true,
|
||||||
|
min: 1,
|
||||||
|
default: 1,
|
||||||
|
spinner: true,
|
||||||
|
dataTitle: i18n._('Split Job Count'),
|
||||||
|
dataPlacement: 'right',
|
||||||
|
dataContainer: 'body',
|
||||||
|
awPopOver: "<p>" + i18n._("The number of jobs to split into at runtime. Will cause the Job Template to launch a workflow if value is non-zero.") + "</p>",
|
||||||
|
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
||||||
|
},
|
||||||
diff_mode: {
|
diff_mode: {
|
||||||
label: i18n._('Show Changes'),
|
label: i18n._('Show Changes'),
|
||||||
type: 'toggleSwitch',
|
type: 'toggleSwitch',
|
||||||
@ -271,20 +284,6 @@ function(NotificationsList, i18n) {
|
|||||||
},
|
},
|
||||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
||||||
},
|
},
|
||||||
job_shard_count: {
|
|
||||||
label: i18n._('Number of job shards to use'),
|
|
||||||
type: 'number',
|
|
||||||
integer: true,
|
|
||||||
min: 0,
|
|
||||||
spinner: true,
|
|
||||||
// 'class': "input-small",
|
|
||||||
// toggleSource: 'diff_mode',
|
|
||||||
dataTitle: i18n._('Job Shard Count'),
|
|
||||||
dataPlacement: 'right',
|
|
||||||
dataContainer: 'body',
|
|
||||||
awPopOver: "<p>" + i18n._("If non-zero, split into multiple jobs that run on mutually exclusive slices of the inventory.") + "</p>",
|
|
||||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
|
||||||
},
|
|
||||||
checkbox_group: {
|
checkbox_group: {
|
||||||
label: i18n._('Options'),
|
label: i18n._('Options'),
|
||||||
type: 'checkbox_group',
|
type: 'checkbox_group',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user