1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Shows the button the add a JT to users with permissions to make JTs.

This commit is contained in:
Alex Corey 2019-03-20 14:55:28 -04:00
parent 14d86ef5d3
commit be507dbefb
2 changed files with 17 additions and 4 deletions

View File

@ -1,8 +1,7 @@
/* jshint unused: vars */
export default
[ 'templateUrl',
'$state',
function JobTemplatesList(templateUrl, $state) {
['templateUrl', '$state', 'Rest', 'GetBasePath',
function JobTemplatesList(templateUrl, $state, Rest, GetBasePath) {
return {
restrict: 'E',
link: link,
@ -25,6 +24,18 @@ export default
}
});
scope.canAddJobTemplate = false;
let url = GetBasePath('job_templates');
Rest.setUrl(url);
Rest.options()
.then(({ data }) => {
if (!data.actions.POST) {
scope.canAddJobTemplate = false;
} else {
scope.canAddJobTemplate = true;
}
});
function createList(list) {
// smartStatus?, launchUrl, editUrl, name
scope.templates = _.map(list, function(template){ return {

View File

@ -53,7 +53,9 @@
<div class="DashboardList-container">
<p class="DashboardList-noJobs"><translate>No job templates were recently used.</translate><br />
<!-- TODO: Seems $sce.trustAsHtml() does not work here. -->
<translate>You can create a job template <a href="#/templates/add_job_template">here</a>.</translate></p>
<div ng-show="canAddJobTemplate">
<translate>You can create a job template <a href="#/templates/add_job_template">here</a>.</translate></p>
</div>
</div>
</div>
<prompt prompt-data="promptData" on-finish="launchJob()"></prompt>