Add relaunch component to Job Results panel

This commit is contained in:
Marliana Lara
2017-11-14 11:51:53 -05:00
parent ee6beae50a
commit 69ada03b7b
9 changed files with 38 additions and 35 deletions

View File

@@ -79,7 +79,10 @@ function ComponentsStrings (BaseString) {
ns.relaunch = { ns.relaunch = {
DEFAULT: t.s('Relaunch using the same parameters'), 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')
}; };
} }

View File

@@ -26,7 +26,7 @@ import tab from '~components/tabs/tab.directive';
import tabGroup from '~components/tabs/group.directive'; import tabGroup from '~components/tabs/group.directive';
import topNavItem from '~components/layout/top-nav-item.directive'; import topNavItem from '~components/layout/top-nav-item.directive';
import truncate from '~components/truncate/truncate.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 BaseInputController from '~components/input/base.controller';
import ComponentsStrings from '~components/components.strings'; import ComponentsStrings from '~components/components.strings';

View File

@@ -6,8 +6,7 @@ const atRelaunch = {
state: '<' state: '<'
}, },
controller: ['RelaunchJob', 'InitiatePlaybookRun', 'ComponentsStrings', '$scope', atRelaunchCtrl], controller: ['RelaunchJob', 'InitiatePlaybookRun', 'ComponentsStrings', '$scope', atRelaunchCtrl],
controllerAs: 'vm', controllerAs: 'vm'
replace: true
}; };
function atRelaunchCtrl (RelaunchJob, InitiatePlaybookRun, strings, $scope) { 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.showRelaunch = !(job.type === 'system_job') && job.summary_fields.user_capabilities.start;
vm.showDropdown = job.type === 'job' && job.failed === true; 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) { if (vm.showDropdown) {
vm.tooltip = strings.get('relaunch.HOSTS'); vm.tooltip = strings.get('relaunch.HOSTS');
} else { } else {

View File

@@ -8,14 +8,14 @@
data-toggle="dropdown" data-toggle="dropdown"
aria-expanded="false" aria-expanded="false"
id="relaunchDropdown"> id="relaunchDropdown">
<i class="{{ vm.state.icon }}"></i> <i class="{{ vm.icon }}"></i>
</button> </button>
<ul class="dropdown-menu pull-right" aria-labelledby="relaunchDropdown"> <ul class="dropdown-menu pull-right" aria-labelledby="relaunchDropdown">
<li class="at-Relaunch--dropdownTitle"> <li class="at-Relaunch--dropdownTitle">
<span>{{ vm.state.dropdownTitle }}</span> <span>{{ vm.dropdownTitle }}</span>
</li> </li>
<li ng-repeat="option in vm.state.dropdownOptions" <li ng-repeat="option in vm.dropdownOptions"
class="at-Relaunch--dropdownOptions"> class="at-Relaunch--dropdownOptions">
<a ng-click="vm.relaunchOn(option)"> <a ng-click="vm.relaunchOn(option)">
<i class="fa {{ option.icon }}"></i> <i class="fa {{ option.icon }}"></i>
@@ -28,6 +28,6 @@
<button class="at-Relaunch--button" <button class="at-Relaunch--button"
ng-click="vm.relaunchJob()" ng-click="vm.relaunchJob()"
ng-if="!vm.showDropdown"> ng-if="!vm.showDropdown">
<i class="{{ vm.state.icon }}"></i> <i class="{{ vm.icon }}"></i>
</button> </button>
</div> </div>

View File

@@ -55,6 +55,10 @@
text-transform: uppercase; text-transform: uppercase;
} }
.JobResults-panelHeaderButtonActions {
display: flex;
}
.JobResults-resultRow { .JobResults-resultRow {
width: 100%; width: 100%;
display: flex; display: flex;

View File

@@ -19,18 +19,10 @@
</div> </div>
<!-- LEFT PANE HEADER ACTIONS --> <!-- LEFT PANE HEADER ACTIONS -->
<div> <div class="JobResults-panelHeaderButtonActions">
<!-- RELAUNCH ACTION --> <!-- RELAUNCH ACTION -->
<button class="List-actionButton" <at-relaunch state="job"></at-relaunch>
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>
<!-- CANCEL ACTION --> <!-- CANCEL ACTION -->
<button class="List-actionButton <button class="List-actionButton

View File

@@ -133,13 +133,9 @@ export default
job_launch_data.diff_mode = scope.other_prompt_data.diff_mode; job_launch_data.diff_mode = scope.other_prompt_data.diff_mode;
} }
if(scope.relaunchHostType) { if(!Empty(scope.relaunchHostType)) {
job_launch_data.hosts = 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 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){ if(jQuery.isEmptyObject(job_launch_data.extra_vars)===true && scope.prompt_for_vars===false){

View File

@@ -99,17 +99,6 @@ export default ['i18n', function(i18n) {
dataPlacement: 'top', dataPlacement: 'top',
ngShow: "!(job.type == 'system_job') && job.summary_fields.user_capabilities.start", ngShow: "!(job.type == 'system_job') && job.summary_fields.user_capabilities.start",
relaunch: true, relaunch: true,
dropdownTitle: 'Relaunch On',
dropdownOptions: [
{
name: 'All',
icon: 'icon-host-all'
},
{
name: 'Failed',
icon: 'icon-host-failed'
}
],
}, },
cancel: { cancel: {
mode: 'all', mode: 'all',

View File

@@ -398,7 +398,7 @@ export default ['$compile', 'Attr', 'Icon',
} }
// Plug in Dropdown Component // Plug in Dropdown Component
if (field_action === 'submit' && list.fieldActions[field_action].relaunch === true) { 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 { } else {
fAction = list.fieldActions[field_action]; fAction = list.fieldActions[field_action];
innerTable += "<button id=\""; innerTable += "<button id=\"";