Merge pull request #5159 from mabashian/4995-links

Fixed template link open in new tab regressions
This commit is contained in:
Michael Abashian 2017-02-03 09:06:22 -05:00 committed by GitHub
commit 01a9a5da41
4 changed files with 25 additions and 18 deletions

View File

@ -28,13 +28,13 @@ export default
function createList(list) {
// smartStatus?, launchUrl, editUrl, name
scope.job_templates = _.map(list, function(job_template){ return {
recent_jobs: job_template.summary_fields.recent_jobs,
launch_url: job_template.url,
edit_url: job_template.url.replace('api/v1', '#'),
name: job_template.name,
id: job_template.id,
type: job_template.type
scope.templates = _.map(list, function(template){ return {
recent_jobs: template.summary_fields.recent_jobs,
launch_url: template.url,
edit_url: template.url.replace('api/v1', '#'),
name: template.name,
id: template.id,
type: template.type
}; });
scope.snapRows = (list.length < 4);
@ -44,7 +44,7 @@ export default
return (status === "successful");
};
scope.launchJobTemplate = function(template){
scope.launchTemplate = function(template){
if(template) {
if(template.type && (template.type === 'Job Template' || template.type === 'job_template')) {
InitiatePlaybookRun({ scope: scope, id: template.id, job_type: 'job_template' });
@ -63,8 +63,15 @@ export default
}
};
scope.editJobTemplate = function (jobTemplateId) {
$state.go('templates.editJobTemplate', {job_template_id: jobTemplateId});
scope.editTemplate = function (template) {
if(template) {
if(template.type && (template.type === 'Job Template' || template.type === 'job_template')) {
$state.go('templates.editJobTemplate', {job_template_id: template.id});
}
else if(template.type && (template.type === 'Workflow Job Template' || template.type === 'workflow_job_template')) {
$state.go('templates.editWorkflowJobTemplate', {workflow_job_template_id: template.id});
}
}
};
}
}];

View File

@ -23,21 +23,21 @@
<tr class="List-tableRow"
ng-class-odd="'List-tableRow--oddRow'"
ng-class-even="'List-tableRow--evenRow'"
ng-repeat = "job_template in job_templates">
ng-repeat = "template in templates">
<td class="DashboardList-nameCell">
<a href="#/templates/{{ job_template.id }}" class="DashboardList-nameContainer">
{{ job_template.name }}
<a ng-href="#/templates/{{template.type}}/{{template.id}}" class="DashboardList-nameContainer">
{{ template.name }}
</a>
</td>
<td class="DashboardList-activityCell">
<aw-smart-status jobs="job_template.recent_jobs"></aw-smart-status>
<aw-smart-status jobs="template.recent_jobs"></aw-smart-status>
</td>
<td class="List-actionsContainer">
<div class="List-actionButtonCell">
<button class="List-actionButton" ng-click="launchJobTemplate(job_template)">
<button class="List-actionButton" ng-click="launchTemplate(template)">
<i class="icon-launch"></i>
</button>
<button class="List-actionButton" ng-click="editJobTemplate(job_template.id)">
<button class="List-actionButton" ng-click="editTemplate(template)">
<i class="fa fa-pencil"></i>
</button>
</div>

View File

@ -25,7 +25,7 @@ export default
key: true,
label: i18n._('Name'),
columnClass: 'col-lg-2 col-md-2 col-sm-4 col-xs-9',
ngClick: "editJobTemplate(template)"
ngHref: '#/templates/{{template.type}}/{{template.id}}'
},
type: {
label: i18n._('Type'),

View File

@ -46,7 +46,7 @@ export default ['workflowData',
$scope.workflow_template_link = '/#/templates/workflow_job_template/'+$scope.workflow.workflow_job_template;
$scope.created_by_link = getTowerLink('created_by');
$scope.scheduled_by_link = getTowerLink('schedule');console.log($scope.scheduled_by_link);
$scope.scheduled_by_link = getTowerLink('schedule');
$scope.cloud_credential_link = getTowerLink('cloud_credential');
$scope.network_credential_link = getTowerLink('network_credential');
};