mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 17:37:30 -02:30
Add dropdown inputs for Job Template, Project, and Organization virtual
envs
This commit is contained in:
@@ -6,26 +6,32 @@
|
|||||||
|
|
||||||
export default ['$scope', '$rootScope', '$location', '$stateParams',
|
export default ['$scope', '$rootScope', '$location', '$stateParams',
|
||||||
'OrganizationForm', 'GenerateForm', 'Rest', 'Alert',
|
'OrganizationForm', 'GenerateForm', 'Rest', 'Alert',
|
||||||
'ProcessErrors', 'GetBasePath', 'Wait', 'CreateSelect2', '$state','InstanceGroupsService',
|
'ProcessErrors', 'GetBasePath', 'Wait', 'CreateSelect2', '$state','InstanceGroupsService', 'ConfigData',
|
||||||
function($scope, $rootScope, $location, $stateParams, OrganizationForm,
|
function($scope, $rootScope, $location, $stateParams, OrganizationForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, GetBasePath, Wait, CreateSelect2, $state, InstanceGroupsService) {
|
GenerateForm, Rest, Alert, ProcessErrors, GetBasePath, Wait, CreateSelect2, $state, InstanceGroupsService, ConfigData) {
|
||||||
|
|
||||||
Rest.setUrl(GetBasePath('organizations'));
|
Rest.setUrl(GetBasePath('organizations'));
|
||||||
Rest.options()
|
Rest.options()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
if (!data.actions.POST) {
|
if (!data.actions.POST) {
|
||||||
$state.go("^");
|
$state.go("^");
|
||||||
Alert('Permission Error', 'You do not have permission to add an organization.', 'alert-info');
|
Alert('Permission Error', 'You do not have permission to add an organization.', 'alert-info');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var form = OrganizationForm(),
|
var form = OrganizationForm(),
|
||||||
base = $location.path().replace(/^\//, '').split('/')[0];
|
base = $location.path().replace(/^\//, '').split('/')[0];
|
||||||
init();
|
init();
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
// @issue What is this doing, why
|
// @issue What is this doing, why
|
||||||
$scope.$emit("HideOrgListHeader");
|
$scope.$emit("HideOrgListHeader");
|
||||||
|
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#organization_custom_virtualenv',
|
||||||
|
multiple: false,
|
||||||
|
opts: $scope.custom_virtualenvs_options
|
||||||
|
});
|
||||||
|
|
||||||
// apply form definition's default field values
|
// apply form definition's default field values
|
||||||
GenerateForm.applyDefaults(form, $scope);
|
GenerateForm.applyDefaults(form, $scope);
|
||||||
@@ -39,7 +45,8 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
|
|||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post({
|
Rest.post({
|
||||||
name: $scope.name,
|
name: $scope.name,
|
||||||
description: $scope.description
|
description: $scope.description,
|
||||||
|
custom_virtualenv: $scope.custom_virtualenv
|
||||||
})
|
})
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
const organization_id = data.id,
|
const organization_id = data.id,
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
export default ['$scope', '$location', '$stateParams',
|
export default ['$scope', '$location', '$stateParams',
|
||||||
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt',
|
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt',
|
||||||
'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData',
|
'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', 'ConfigData',
|
||||||
function($scope, $location, $stateParams,
|
function($scope, $location, $stateParams,
|
||||||
OrganizationForm, Rest, ProcessErrors, Prompt,
|
OrganizationForm, Rest, ProcessErrors, Prompt,
|
||||||
GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData) {
|
GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData, ConfigData) {
|
||||||
|
|
||||||
let form = OrganizationForm(),
|
let form = OrganizationForm(),
|
||||||
defaultUrl = GetBasePath('organizations'),
|
defaultUrl = GetBasePath('organizations'),
|
||||||
@@ -29,6 +29,7 @@ export default ['$scope', '$location', '$stateParams',
|
|||||||
|
|
||||||
$scope.$emit("HideOrgListHeader");
|
$scope.$emit("HideOrgListHeader");
|
||||||
$scope.instance_groups = InstanceGroupsData;
|
$scope.instance_groups = InstanceGroupsData;
|
||||||
|
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -36,20 +37,26 @@ export default ['$scope', '$location', '$stateParams',
|
|||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(defaultUrl + id + '/');
|
Rest.setUrl(defaultUrl + id + '/');
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
let fld;
|
let fld;
|
||||||
|
|
||||||
$scope.organization_name = data.name;
|
$scope.organization_name = data.name;
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (data[fld]) {
|
if (data[fld]) {
|
||||||
$scope[fld] = data[fld];
|
$scope[fld] = data[fld];
|
||||||
master[fld] = data[fld];
|
master[fld] = data[fld];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.organization_obj = data;
|
CreateSelect2({
|
||||||
$scope.$emit('organizationLoaded');
|
element: '#organization_custom_virtualenv',
|
||||||
Wait('stop');
|
multiple: false,
|
||||||
|
opts: $scope.custom_virtualenvs_options
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.organization_obj = data;
|
||||||
|
$scope.$emit('organizationLoaded');
|
||||||
|
Wait('stop');
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.toggleNotification = function(event, id, column) {
|
$scope.toggleNotification = function(event, id, column) {
|
||||||
|
|||||||
@@ -55,7 +55,15 @@ angular.module('Organizations', [
|
|||||||
activityStreamTarget: 'organization'
|
activityStreamTarget: 'organization'
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
add: {
|
||||||
|
ConfigData: ['ConfigService', (ConfigService) => {
|
||||||
|
return ConfigService.getConfig().then(response => response);
|
||||||
|
}]
|
||||||
|
},
|
||||||
edit: {
|
edit: {
|
||||||
|
ConfigData: ['ConfigService', (ConfigService) => {
|
||||||
|
return ConfigService.getConfig().then(response => response);
|
||||||
|
}],
|
||||||
InstanceGroupsData: ['$stateParams', 'Rest', 'GetBasePath', 'ProcessErrors',
|
InstanceGroupsData: ['$stateParams', 'Rest', 'GetBasePath', 'ProcessErrors',
|
||||||
function($stateParams, Rest, GetBasePath, ProcessErrors){
|
function($stateParams, Rest, GetBasePath, ProcessErrors){
|
||||||
let path = `${GetBasePath('organizations')}${$stateParams.organization_id}/instance_groups/`;
|
let path = `${GetBasePath('organizations')}${$stateParams.organization_id}/instance_groups/`;
|
||||||
|
|||||||
@@ -42,6 +42,17 @@ export default ['NotificationsList', 'i18n',
|
|||||||
dataContainer: 'body',
|
dataContainer: 'body',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
control: '<instance-groups-multiselect instance-groups="instance_groups" field-is-disabled="!(organization_obj.summary_fields.user_capabilities.edit || canAdd)"></instance-groups-multiselect>',
|
control: '<instance-groups-multiselect instance-groups="instance_groups" field-is-disabled="!(organization_obj.summary_fields.user_capabilities.edit || canAdd)"></instance-groups-multiselect>',
|
||||||
|
},
|
||||||
|
custom_virtualenv: {
|
||||||
|
label: i18n._('Ansible Environment'),
|
||||||
|
defaultText: i18n._('Select Ansible Environment'),
|
||||||
|
type: 'select',
|
||||||
|
ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
|
||||||
|
awPopOver: "<p>" + i18n._("Select the custom Python virtual environment for this organization to run on.") + "</p>",
|
||||||
|
dataTitle: i18n._('Ansible Environment'),
|
||||||
|
dataContainer: 'body',
|
||||||
|
dataPlacement: 'right',
|
||||||
|
ngDisabled: '!(organization_obj.summary_fields.user_capabilities.edit || canAdd)'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
export default ['$scope', '$location', '$stateParams', 'GenerateForm',
|
export default ['$scope', '$location', '$stateParams', 'GenerateForm',
|
||||||
'ProjectsForm', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath',
|
'ProjectsForm', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath',
|
||||||
'GetProjectPath', 'GetChoices', 'Wait', '$state', 'CreateSelect2', 'i18n',
|
'GetProjectPath', 'GetChoices', 'Wait', '$state', 'CreateSelect2', 'i18n',
|
||||||
'CredentialTypes',
|
'CredentialTypes', 'ConfigData',
|
||||||
function($scope, $location, $stateParams, GenerateForm, ProjectsForm, Rest,
|
function($scope, $location, $stateParams, GenerateForm, ProjectsForm, Rest,
|
||||||
Alert, ProcessErrors, GetBasePath, GetProjectPath, GetChoices, Wait, $state,
|
Alert, ProcessErrors, GetBasePath, GetProjectPath, GetChoices, Wait, $state,
|
||||||
CreateSelect2, i18n, CredentialTypes) {
|
CreateSelect2, i18n, CredentialTypes, ConfigData) {
|
||||||
|
|
||||||
var form = ProjectsForm(),
|
let form = ProjectsForm(),
|
||||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||||
defaultUrl = GetBasePath('projects'),
|
defaultUrl = GetBasePath('projects'),
|
||||||
master = {};
|
master = {};
|
||||||
@@ -21,13 +21,21 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm',
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
$scope.canEditOrg = true;
|
$scope.canEditOrg = true;
|
||||||
|
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||||
|
|
||||||
Rest.setUrl(GetBasePath('projects'));
|
Rest.setUrl(GetBasePath('projects'));
|
||||||
Rest.options()
|
Rest.options()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
if (!data.actions.POST) {
|
if (!data.actions.POST) {
|
||||||
$state.go("^");
|
$state.go("^");
|
||||||
Alert(i18n._('Permission Error'), i18n._('You do not have permission to add a project.'), 'alert-info');
|
Alert(i18n._('Permission Error'), i18n._('You do not have permission to add a project.'), 'alert-info');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#project_custom_virtualenv',
|
||||||
|
multiple: false,
|
||||||
|
opts: $scope.custom_virtualenvs_options
|
||||||
});
|
});
|
||||||
|
|
||||||
// apply form definition's default field values
|
// apply form definition's default field values
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
|
|||||||
'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt',
|
'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt',
|
||||||
'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty',
|
'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty',
|
||||||
'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification',
|
'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification',
|
||||||
'i18n', 'CredentialTypes', 'OrgAdminLookup',
|
'i18n', 'CredentialTypes', 'OrgAdminLookup', 'ConfigData',
|
||||||
function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert,
|
function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert,
|
||||||
ProcessErrors, GenerateForm, Prompt, GetBasePath,
|
ProcessErrors, GenerateForm, Prompt, GetBasePath,
|
||||||
GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate,
|
GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate,
|
||||||
$state, CreateSelect2, ToggleNotification, i18n, CredentialTypes,
|
$state, CreateSelect2, ToggleNotification, i18n, CredentialTypes,
|
||||||
OrgAdminLookup) {
|
OrgAdminLookup, ConfigData) {
|
||||||
|
|
||||||
var form = ProjectsForm(),
|
let form = ProjectsForm(),
|
||||||
defaultUrl = GetBasePath('projects') + $stateParams.project_id + '/',
|
defaultUrl = GetBasePath('projects') + $stateParams.project_id + '/',
|
||||||
master = {},
|
master = {},
|
||||||
id = $stateParams.project_id;
|
id = $stateParams.project_id;
|
||||||
@@ -25,6 +25,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
|
|||||||
function init() {
|
function init() {
|
||||||
$scope.project_local_paths = [];
|
$scope.project_local_paths = [];
|
||||||
$scope.base_dir = '';
|
$scope.base_dir = '';
|
||||||
|
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$watch('project_obj.summary_fields.user_capabilities.edit', function(val) {
|
$scope.$watch('project_obj.summary_fields.user_capabilities.edit', function(val) {
|
||||||
@@ -147,6 +148,12 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
|
|||||||
$scope.canEditOrg = canEditOrg;
|
$scope.canEditOrg = canEditOrg;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#project_custom_virtualenv',
|
||||||
|
multiple: false,
|
||||||
|
opts: $scope.custom_virtualenvs_options
|
||||||
|
});
|
||||||
|
|
||||||
$scope.project_obj = data;
|
$scope.project_obj = data;
|
||||||
$scope.name = data.name;
|
$scope.name = data.name;
|
||||||
$scope.$emit('projectLoaded');
|
$scope.$emit('projectLoaded');
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ angular.module('Projects', [])
|
|||||||
let stateDefinitions = stateDefinitionsProvider.$get();
|
let stateDefinitions = stateDefinitionsProvider.$get();
|
||||||
let stateExtender = $stateExtenderProvider.$get();
|
let stateExtender = $stateExtenderProvider.$get();
|
||||||
var projectResolve = {
|
var projectResolve = {
|
||||||
CredentialTypes: ['Rest', '$stateParams', 'GetBasePath', 'ProcessErrors',
|
CredentialTypes: ['Rest', '$stateParams', 'GetBasePath', 'ProcessErrors',
|
||||||
(Rest, $stateParams, GetBasePath, ProcessErrors) => {
|
(Rest, $stateParams, GetBasePath, ProcessErrors) => {
|
||||||
var path = GetBasePath('credential_types');
|
var path = GetBasePath('credential_types');
|
||||||
Rest.setUrl(path);
|
Rest.setUrl(path);
|
||||||
@@ -47,7 +47,10 @@ angular.module('Projects', [])
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
ConfigData: ['ConfigService', (ConfigService) => {
|
||||||
|
return ConfigService.getConfig().then(response => response);
|
||||||
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
function generateStateTree() {
|
function generateStateTree() {
|
||||||
|
|||||||
@@ -52,6 +52,17 @@ export default ['i18n', 'NotificationsList', 'TemplateList',
|
|||||||
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
|
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
|
||||||
awLookupWhen: '(project_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg'
|
awLookupWhen: '(project_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg'
|
||||||
},
|
},
|
||||||
|
custom_virtualenv: {
|
||||||
|
label: i18n._('Ansible Environment'),
|
||||||
|
type: 'select',
|
||||||
|
defaultText: i18n._('Select Ansible Environment'),
|
||||||
|
ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
|
||||||
|
awPopOver: "<p>" + i18n._("Select the custom Python virtual environment for this project to run on.") + "</p>",
|
||||||
|
dataTitle: i18n._('Ansible Environment'),
|
||||||
|
dataContainer: 'body',
|
||||||
|
dataPlacement: 'right',
|
||||||
|
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)'
|
||||||
|
},
|
||||||
scm_type: {
|
scm_type: {
|
||||||
label: i18n._('SCM Type'),
|
label: i18n._('SCM Type'),
|
||||||
type: 'select',
|
type: 'select',
|
||||||
|
|||||||
@@ -9,13 +9,15 @@
|
|||||||
'$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert',
|
'$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert',
|
||||||
'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait',
|
'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait',
|
||||||
'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'availableLabels',
|
'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'availableLabels',
|
||||||
'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService', 'MultiCredentialService',
|
'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService',
|
||||||
|
'MultiCredentialService', 'ConfigData',
|
||||||
function(
|
function(
|
||||||
$filter, $scope,
|
$filter, $scope,
|
||||||
$stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
$stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
||||||
ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait,
|
ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait,
|
||||||
Empty, ToJSON, CallbackHelpInit, GetChoices,
|
Empty, ToJSON, CallbackHelpInit, GetChoices,
|
||||||
$state, availableLabels, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService, MultiCredentialService
|
$state, availableLabels, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService,
|
||||||
|
MultiCredentialService, ConfigData
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
@@ -50,12 +52,12 @@
|
|||||||
$scope.surveyTooltip = i18n._('Please save before adding a survey to this job template.');
|
$scope.surveyTooltip = i18n._('Please save before adding a survey to this job template.');
|
||||||
|
|
||||||
MultiCredentialService.getCredentialTypes()
|
MultiCredentialService.getCredentialTypes()
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
$scope.multiCredential = {
|
$scope.multiCredential = {
|
||||||
credentialTypes: data.results,
|
credentialTypes: data.results,
|
||||||
selectedCredentials: []
|
selectedCredentials: []
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
callback = function() {
|
callback = function() {
|
||||||
@@ -80,6 +82,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$scope.job_type = $scope.job_type_options[form.fields.job_type.default];
|
$scope.job_type = $scope.job_type_options[form.fields.job_type.default];
|
||||||
|
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||||
|
|
||||||
CreateSelect2({
|
CreateSelect2({
|
||||||
element:'#job_template_job_type',
|
element:'#job_template_job_type',
|
||||||
@@ -109,6 +112,12 @@
|
|||||||
multiple: true,
|
multiple: true,
|
||||||
addNew: true
|
addNew: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#job_template_custom_virtualenv',
|
||||||
|
multiple: false,
|
||||||
|
opts: $scope.custom_virtualenvs_options
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -259,7 +268,7 @@
|
|||||||
try {
|
try {
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (form.fields[fld].type === 'select' &&
|
if (form.fields[fld].type === 'select' &&
|
||||||
fld !== 'playbook' && $scope[fld]) {
|
fld !== 'playbook' && fld !== 'custom_virtualenv' && $scope[fld]) {
|
||||||
data[fld] = $scope[fld].value;
|
data[fld] = $scope[fld].value;
|
||||||
}
|
}
|
||||||
else if(form.fields[fld].type === 'checkbox_group') {
|
else if(form.fields[fld].type === 'checkbox_group') {
|
||||||
|
|||||||
@@ -17,16 +17,19 @@ export default
|
|||||||
'ParseTypeChange', 'Wait', 'selectedLabels', 'i18n',
|
'ParseTypeChange', 'Wait', 'selectedLabels', 'i18n',
|
||||||
'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit',
|
'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit',
|
||||||
'InitiatePlaybookRun' , 'initSurvey', '$state', 'CreateSelect2',
|
'InitiatePlaybookRun' , 'initSurvey', '$state', 'CreateSelect2',
|
||||||
'ToggleNotification','$q', 'InstanceGroupsService', 'InstanceGroupsData', 'MultiCredentialService', 'availableLabels',
|
'ToggleNotification','$q', 'InstanceGroupsService', 'InstanceGroupsData',
|
||||||
'projectGetPermissionDenied', 'inventoryGetPermissionDenied', 'jobTemplateData', 'ParseVariableString',
|
'MultiCredentialService', 'availableLabels', 'projectGetPermissionDenied',
|
||||||
|
'inventoryGetPermissionDenied', 'jobTemplateData', 'ParseVariableString', 'ConfigData',
|
||||||
function(
|
function(
|
||||||
$filter, $scope, $rootScope,
|
$filter, $scope, $rootScope,
|
||||||
$location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
$location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
|
||||||
ProcessErrors, GetBasePath, md5Setup,
|
ProcessErrors, GetBasePath, md5Setup,
|
||||||
ParseTypeChange, Wait, selectedLabels, i18n,
|
ParseTypeChange, Wait, selectedLabels, i18n,
|
||||||
Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit, InitiatePlaybookRun, SurveyControllerInit, $state,
|
Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit,
|
||||||
CreateSelect2, ToggleNotification, $q, InstanceGroupsService, InstanceGroupsData, MultiCredentialService, availableLabels,
|
InitiatePlaybookRun, SurveyControllerInit, $state, CreateSelect2,
|
||||||
projectGetPermissionDenied, inventoryGetPermissionDenied, jobTemplateData, ParseVariableString
|
ToggleNotification, $q, InstanceGroupsService, InstanceGroupsData,
|
||||||
|
MultiCredentialService, availableLabels, projectGetPermissionDenied,
|
||||||
|
inventoryGetPermissionDenied, jobTemplateData, ParseVariableString, ConfigData
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$scope.$watch('job_template_obj.summary_fields.user_capabilities.edit', function(val) {
|
$scope.$watch('job_template_obj.summary_fields.user_capabilities.edit', function(val) {
|
||||||
@@ -60,6 +63,7 @@ export default
|
|||||||
$scope.surveyTooltip = i18n._('Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.');
|
$scope.surveyTooltip = i18n._('Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.');
|
||||||
$scope.job_tag_options = [];
|
$scope.job_tag_options = [];
|
||||||
$scope.skip_tag_options = [];
|
$scope.skip_tag_options = [];
|
||||||
|
$scope.custom_virtualenvs_options = ConfigData.custom_virtualenvs;
|
||||||
|
|
||||||
SurveyControllerInit({
|
SurveyControllerInit({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -198,6 +202,12 @@ export default
|
|||||||
multiple: true,
|
multiple: true,
|
||||||
addNew: true
|
addNew: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#job_template_custom_virtualenv',
|
||||||
|
multiple: false,
|
||||||
|
opts: $scope.custom_virtualenvs_options
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.toggleForm = function(key) {
|
$scope.toggleForm = function(key) {
|
||||||
@@ -598,7 +608,7 @@ export default
|
|||||||
try {
|
try {
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (form.fields[fld].type === 'select' &&
|
if (form.fields[fld].type === 'select' &&
|
||||||
fld !== 'playbook' && $scope[fld]) {
|
fld !== 'playbook' && fld !== 'custom_virtualenv' && $scope[fld]) {
|
||||||
data[fld] = $scope[fld].value;
|
data[fld] = $scope[fld].value;
|
||||||
}
|
}
|
||||||
else if(form.fields[fld].type === 'checkbox_group') {
|
else if(form.fields[fld].type === 'checkbox_group') {
|
||||||
|
|||||||
@@ -103,6 +103,17 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || !canGetAllRelatedResources',
|
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || !canGetAllRelatedResources',
|
||||||
awLookupWhen: 'canGetAllRelatedResources'
|
awLookupWhen: 'canGetAllRelatedResources'
|
||||||
},
|
},
|
||||||
|
custom_virtualenv: {
|
||||||
|
label: i18n._('Ansible Environment'),
|
||||||
|
type: 'select',
|
||||||
|
defaultText: i18n._('Select Ansible Environment'),
|
||||||
|
ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
|
||||||
|
awPopOver: "<p>" + i18n._("Select the custom Python virtual environment for this job template to run on.") + "</p>",
|
||||||
|
dataTitle: i18n._('Ansible Environment'),
|
||||||
|
dataContainer: 'body',
|
||||||
|
dataPlacement: 'right',
|
||||||
|
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAdd)'
|
||||||
|
},
|
||||||
playbook: {
|
playbook: {
|
||||||
label: i18n._('Playbook'),
|
label: i18n._('Playbook'),
|
||||||
type:'select',
|
type:'select',
|
||||||
|
|||||||
@@ -129,7 +129,10 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p
|
|||||||
response.status
|
response.status
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}]
|
}],
|
||||||
|
ConfigData: ['ConfigService', (ConfigService) => {
|
||||||
|
return ConfigService.getConfig().then(response => response);
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -260,6 +263,9 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p
|
|||||||
response.status
|
response.status
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}],
|
||||||
|
ConfigData: ['ConfigService', (ConfigService) => {
|
||||||
|
return ConfigService.getConfig().then(response => response);
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user