diff --git a/awx/ui/client/lib/components/components.strings.js b/awx/ui/client/lib/components/components.strings.js index 52ffdb1f1c..03ac4085a3 100644 --- a/awx/ui/client/lib/components/components.strings.js +++ b/awx/ui/client/lib/components/components.strings.js @@ -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') }; } diff --git a/awx/ui/client/lib/components/index.js b/awx/ui/client/lib/components/index.js index c82d8dc77e..e2608b2866 100644 --- a/awx/ui/client/lib/components/index.js +++ b/awx/ui/client/lib/components/index.js @@ -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'; diff --git a/awx/ui/client/lib/components/relaunchButton/relaunchButton.directive.js b/awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js similarity index 74% rename from awx/ui/client/lib/components/relaunchButton/relaunchButton.directive.js rename to awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js index 0d50f02d90..089abf8625 100644 --- a/awx/ui/client/lib/components/relaunchButton/relaunchButton.directive.js +++ b/awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js @@ -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 { diff --git a/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html b/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html index eca5f42fc4..5ce4c45c17 100644 --- a/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html +++ b/awx/ui/client/lib/components/relaunchButton/relaunchButton.partial.html @@ -8,14 +8,14 @@ data-toggle="dropdown" aria-expanded="false" id="relaunchDropdown"> - +