mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
Add relaunch component to Job Results panel
This commit is contained in:
parent
ee6beae50a
commit
69ada03b7b
@ -79,7 +79,10 @@ function ComponentsStrings (BaseString) {
|
||||
|
||||
ns.relaunch = {
|
||||
DEFAULT: t.s('Relaunch using the same parameters'),
|
||||
HOSTS: t.s('Relaunch using host parameters')
|
||||
HOSTS: t.s('Relaunch using host parameters'),
|
||||
DROPDOWN_TITLE: t.s('Relaunch On'),
|
||||
ALL: t.s('All'),
|
||||
FAILED: t.s('Failed')
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ import tab from '~components/tabs/tab.directive';
|
||||
import tabGroup from '~components/tabs/group.directive';
|
||||
import topNavItem from '~components/layout/top-nav-item.directive';
|
||||
import truncate from '~components/truncate/truncate.directive';
|
||||
import relaunch from '~components/relaunchButton/relaunchButton.directive';
|
||||
import relaunch from '~components/relaunchButton/relaunchButton.component';
|
||||
|
||||
import BaseInputController from '~components/input/base.controller';
|
||||
import ComponentsStrings from '~components/components.strings';
|
||||
|
||||
@ -6,8 +6,7 @@ const atRelaunch = {
|
||||
state: '<'
|
||||
},
|
||||
controller: ['RelaunchJob', 'InitiatePlaybookRun', 'ComponentsStrings', '$scope', atRelaunchCtrl],
|
||||
controllerAs: 'vm',
|
||||
replace: true
|
||||
controllerAs: 'vm'
|
||||
};
|
||||
|
||||
function atRelaunchCtrl (RelaunchJob, InitiatePlaybookRun, strings, $scope) {
|
||||
@ -19,6 +18,26 @@ function atRelaunchCtrl (RelaunchJob, InitiatePlaybookRun, strings, $scope) {
|
||||
vm.showRelaunch = !(job.type === 'system_job') && job.summary_fields.user_capabilities.start;
|
||||
vm.showDropdown = job.type === 'job' && job.failed === true;
|
||||
|
||||
vm.createDropdown();
|
||||
vm.createTooltips();
|
||||
};
|
||||
|
||||
vm.createDropdown = () => {
|
||||
vm.icon = 'icon-launch';
|
||||
vm.dropdownTitle = strings.get('relaunch.DROPDOWN_TITLE');
|
||||
vm.dropdownOptions = [
|
||||
{
|
||||
name: strings.get('relaunch.ALL'),
|
||||
icon: 'icon-host-all'
|
||||
},
|
||||
{
|
||||
name: strings.get('relaunch.FAILED'),
|
||||
icon: 'icon-host-failed'
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
vm.createTooltips = () => {
|
||||
if (vm.showDropdown) {
|
||||
vm.tooltip = strings.get('relaunch.HOSTS');
|
||||
} else {
|
||||
@ -8,14 +8,14 @@
|
||||
data-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
id="relaunchDropdown">
|
||||
<i class="{{ vm.state.icon }}"></i>
|
||||
<i class="{{ vm.icon }}"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu pull-right" aria-labelledby="relaunchDropdown">
|
||||
<li class="at-Relaunch--dropdownTitle">
|
||||
<span>{{ vm.state.dropdownTitle }}</span>
|
||||
<span>{{ vm.dropdownTitle }}</span>
|
||||
</li>
|
||||
<li ng-repeat="option in vm.state.dropdownOptions"
|
||||
<li ng-repeat="option in vm.dropdownOptions"
|
||||
class="at-Relaunch--dropdownOptions">
|
||||
<a ng-click="vm.relaunchOn(option)">
|
||||
<i class="fa {{ option.icon }}"></i>
|
||||
@ -28,6 +28,6 @@
|
||||
<button class="at-Relaunch--button"
|
||||
ng-click="vm.relaunchJob()"
|
||||
ng-if="!vm.showDropdown">
|
||||
<i class="{{ vm.state.icon }}"></i>
|
||||
<i class="{{ vm.icon }}"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -55,6 +55,10 @@
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.JobResults-panelHeaderButtonActions {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.JobResults-resultRow {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@ -19,18 +19,10 @@
|
||||
</div>
|
||||
|
||||
<!-- LEFT PANE HEADER ACTIONS -->
|
||||
<div>
|
||||
<div class="JobResults-panelHeaderButtonActions">
|
||||
|
||||
<!-- RELAUNCH ACTION -->
|
||||
<button class="List-actionButton"
|
||||
data-placement="top"
|
||||
mode="all"
|
||||
ng-click="relaunchJob()"
|
||||
aw-tool-tip="{{'Relaunch using the same parameters' | translate}}"
|
||||
data-original-title=""
|
||||
title="">
|
||||
<i class="icon-launch"></i>
|
||||
</button>
|
||||
<at-relaunch state="job"></at-relaunch>
|
||||
|
||||
<!-- CANCEL ACTION -->
|
||||
<button class="List-actionButton
|
||||
|
||||
@ -133,13 +133,9 @@ export default
|
||||
job_launch_data.diff_mode = scope.other_prompt_data.diff_mode;
|
||||
}
|
||||
|
||||
if(scope.relaunchHostType) {
|
||||
if(!Empty(scope.relaunchHostType)) {
|
||||
job_launch_data.hosts = scope.relaunchHostType;
|
||||
}
|
||||
console.log(job_launch_data);
|
||||
// if(_.get(scope, 'retry_counts.failed') === true) {
|
||||
// job_launch_data.hosts = "failed";
|
||||
// }
|
||||
|
||||
// If the extra_vars dict is empty, we don't want to include it if we didn't prompt for anything.
|
||||
if(jQuery.isEmptyObject(job_launch_data.extra_vars)===true && scope.prompt_for_vars===false){
|
||||
|
||||
@ -99,17 +99,6 @@ export default ['i18n', function(i18n) {
|
||||
dataPlacement: 'top',
|
||||
ngShow: "!(job.type == 'system_job') && job.summary_fields.user_capabilities.start",
|
||||
relaunch: true,
|
||||
dropdownTitle: 'Relaunch On',
|
||||
dropdownOptions: [
|
||||
{
|
||||
name: 'All',
|
||||
icon: 'icon-host-all'
|
||||
},
|
||||
{
|
||||
name: 'Failed',
|
||||
icon: 'icon-host-failed'
|
||||
}
|
||||
],
|
||||
},
|
||||
cancel: {
|
||||
mode: 'all',
|
||||
|
||||
@ -398,7 +398,7 @@ export default ['$compile', 'Attr', 'Icon',
|
||||
}
|
||||
// Plug in Dropdown Component
|
||||
if (field_action === 'submit' && list.fieldActions[field_action].relaunch === true) {
|
||||
innerTable += `<at-relaunch scope='$scope' state='list.fieldActions.submit'></at-relaunch>`
|
||||
innerTable += `<at-relaunch></at-relaunch>`
|
||||
} else {
|
||||
fAction = list.fieldActions[field_action];
|
||||
innerTable += "<button id=\"";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user