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

@@ -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 {

View File

@@ -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>