mirror of
https://github.com/ansible/awx.git
synced 2026-04-06 18:49:21 -02:30
Merge pull request #3457 from AlexSCorey/3300-JTCreationPermissionOnDashboard
Shows the button the add a JT to users with permissions to make JTs. Reviewed-by: Alex Corey <Alex.swansboro@gmail.com> https://github.com/AlexSCorey
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
/* jshint unused: vars */
|
/* jshint unused: vars */
|
||||||
export default
|
export default
|
||||||
[ 'templateUrl',
|
['templateUrl', '$state', 'Rest', 'GetBasePath',
|
||||||
'$state',
|
function JobTemplatesList(templateUrl, $state, Rest, GetBasePath) {
|
||||||
function JobTemplatesList(templateUrl, $state) {
|
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
link: link,
|
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) {
|
function createList(list) {
|
||||||
// smartStatus?, launchUrl, editUrl, name
|
// smartStatus?, launchUrl, editUrl, name
|
||||||
scope.templates = _.map(list, function(template){ return {
|
scope.templates = _.map(list, function(template){ return {
|
||||||
|
|||||||
@@ -53,7 +53,9 @@
|
|||||||
<div class="DashboardList-container">
|
<div class="DashboardList-container">
|
||||||
<p class="DashboardList-noJobs"><translate>No job templates were recently used.</translate><br />
|
<p class="DashboardList-noJobs"><translate>No job templates were recently used.</translate><br />
|
||||||
<!-- TODO: Seems $sce.trustAsHtml() does not work here. -->
|
<!-- 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>
|
||||||
</div>
|
</div>
|
||||||
<prompt prompt-data="promptData" on-finish="launchJob()"></prompt>
|
<prompt prompt-data="promptData" on-finish="launchJob()"></prompt>
|
||||||
|
|||||||
Reference in New Issue
Block a user