mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 23:16:01 -03:30
Add relaunch component to Job Results panel
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user