Merge pull request #1668 from jaredevantabor/inv_sources

Sat6, CloudForms, Network, and Azure_rm to the UI
This commit is contained in:
Jared Tabor 2016-04-25 11:25:33 -07:00
commit b59f8fd421
6 changed files with 112 additions and 35 deletions

View File

@ -519,8 +519,8 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
$scope.project = data.project;
break;
case 'azure':
$scope.subscription_id = data.username;
$scope.subscription = data.username;
break;
}
$scope.credential_obj = data;

View File

@ -141,7 +141,7 @@ export default
"host": {
labelBind: 'hostLabel',
type: 'text',
ngShow: "kind.value == 'vmware' || kind.value == 'openstack'",
ngShow: "kind.value == 'vmware' || kind.value == 'openstack' || kind.value === 'foreman' || kind.value === 'cloudforms'",
awPopOverWatch: "hostPopOver",
awPopOver: "set in helpers/credentials",
dataTitle: 'Host',
@ -154,6 +154,23 @@ export default
},
subForm: 'credentialSubForm'
},
"subscription": {
label: "Subscription ID",
type: 'text',
ngShow: "kind.value == 'azure' || kind.value == 'azure_rm'",
awRequiredWhen: {
reqExpression: 'subscription_required',
init: false
},
addRequired: false,
editRequired: false,
autocomplete: false,
awPopOver: '<p>Subscription ID is an Azure construct, which is mapped to a username.</p>',
dataTitle: 'Subscription ID',
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm'
},
"username": {
labelBind: 'usernameLabel',
type: 'text',
@ -181,23 +198,6 @@ export default
dataContainer: "body",
subForm: 'credentialSubForm'
},
"subscription_id": {
labelBind: "usernameLabel",
type: 'text',
ngShow: "kind.value == 'azure'",
awRequiredWhen: {
reqExpression: 'subscription_required',
init: false
},
addRequired: false,
editRequired: false,
autocomplete: false,
awPopOver: '<p>Subscription ID is an Azure construct, which is mapped to a username.</p>',
dataTitle: 'Subscription ID',
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm'
},
"api_key": {
label: 'API Key',
type: 'sensitive',
@ -215,9 +215,7 @@ export default
"password": {
labelBind: 'passwordLabel',
type: 'sensitive',
ngShow: "kind.value == 'scm' || kind.value == 'vmware' || kind.value == 'openstack'",
addRequired: false,
editRequired: false,
ngShow: "kind.value == 'scm' || kind.value == 'vmware' || kind.value == 'openstack'|| kind.value == 'foreman'|| kind.value == 'cloudforms'|| kind.value == 'net' || kind.value == 'azure_rm'",
ask: false,
clear: false,
autocomplete: false,
@ -229,7 +227,7 @@ export default
subForm: "credentialSubForm"
},
"ssh_password": {
label: 'Password', // formally 'SSH Password'
label: 'Password',
type: 'sensitive',
ngShow: "kind.value == 'ssh'",
addRequired: false,
@ -243,7 +241,7 @@ export default
labelBind: 'sshKeyDataLabel',
type: 'textarea',
ngShow: "kind.value == 'ssh' || kind.value == 'scm' || " +
"kind.value == 'gce' || kind.value == 'azure'",
"kind.value == 'gce' || kind.value == 'azure' || kind.value == 'net'",
awRequiredWhen: {
reqExpression: 'key_required',
init: true
@ -288,18 +286,18 @@ export default
subForm: 'credentialSubForm'
},
"become_username": {
label: 'Privilege Escalation Username',
labelBind: 'becomeUsernameLabel',
type: 'text',
ngShow: "kind.value == 'ssh' && (become_method && become_method.value)",
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
addRequired: false,
editRequired: false,
autocomplete: false,
subForm: 'credentialSubForm'
},
"become_password": {
label: 'Privilege Escalation Password',
labelBind: 'becomePasswordLabel',
type: 'sensitive',
ngShow: "kind.value == 'ssh' && (become_method && become_method.value)",
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
addRequired: false,
editRequired: false,
ask: true,
@ -307,6 +305,53 @@ export default
autocomplete: false,
subForm: 'credentialSubForm'
},
client:{
type: 'text',
label: 'Client ID',
awRequiredWhen: {
reqExpression: "azure_rm_required",
init: false
},
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'"
},
secret:{
type: 'sensitive',
hasShowInputButton: true,
autocomplete: false,
label: 'Client Secret',
awRequiredWhen: {
reqExpression: "azure_rm_required",
init: false
},
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'"
},
tenant: {
type: 'text',
label: 'Tenent ID',
awRequiredWhen: {
reqExpression: "azure_rm_required",
init: false
},
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'"
},
authorize: {
label: 'Authorize',
type: 'checkbox',
ngChange: "toggleCallback('host_config_key')",
subForm: 'credentialSubForm',
ngShow: "kind.value === 'net'"
},
authorize_password: {
label: 'Authorize Password',
type: 'sensitive',
hasShowInputButton: true,
autocomplete: false,
subForm: 'credentialSubForm',
ngShow: "authorize && authorize !== 'false'",
},
"project": {
labelBind: 'projectLabel',
type: 'text',

View File

@ -91,7 +91,7 @@ export default
type: 'select',
ngOptions: 'source.label for source in source_region_choices track by source.value',
multiSelect: true,
ngShow: "source && (source.value == 'rax' || source.value == 'ec2' || source.value == 'gce' || source.value == 'azure')",
ngShow: "source && (source.value == 'rax' || source.value == 'ec2' || source.value == 'gce' || source.value == 'azure' || source.value == 'azure_rm')",
addRequired: false,
editRequired: false,
dataTitle: 'Source Regions',

View File

@ -88,6 +88,8 @@ angular.module('CredentialsHelper', ['Utilities'])
break;
case 'ssh':
scope.usernameLabel = 'Username'; //formally 'SSH Username'
scope.becomeUsernameLabel = 'Privilege Escalation Username';
scope.becomePasswordLabel = 'Privilege Escalation Password';
break;
case 'scm':
scope.sshKeyDataLabel = 'SCM Private Key';
@ -109,13 +111,20 @@ angular.module('CredentialsHelper', ['Utilities'])
"as: </p><p>adjective-noun-000</p>";
break;
case 'azure':
scope.usernameLabel = "Subscription ID";
scope.sshKeyDataLabel = 'Management Certificate';
scope.subscription_required = true;
scope.key_required = true;
scope.key_description = "Paste the contents of the PEM file that corresponds to the certificate you uploaded in the Microsoft Azure console.";
scope.key_hint= "drag and drop a management certificate file on the field below";
break;
case 'azure_rm':
scope.usernameLabel = "Username";
scope.subscription_required = true;
scope.username_required = true;
scope.password_required = true;
scope.passwordLabel = 'Password';
scope.azure_rm_required = true;
break;
case 'vmware':
scope.username_required = true;
scope.host_required = true;
@ -137,6 +146,26 @@ angular.module('CredentialsHelper', ['Utilities'])
scope.hostPopOver = "<p>The host to authenticate with." +
"<br />For example, https://openstack.business.com/v2.0/";
break;
case 'foreman':
scope.username_required = true;
scope.password_required = true;
scope.passwordLabel = 'Password';
scope.host_required = true;
scope.hostLabel = "Satellite 6 Host";
break;
case 'cloudforms':
scope.username_required = true;
scope.password_required = true;
scope.passwordLabel = 'Password';
scope.host_required = true;
scope.hostLabel = "CloudForms Host";
break;
case 'net':
scope.username_required = true;
scope.password_required = true;
scope.passwordLabel = 'Password';
scope.sshKeyDataLabel = 'SSH Key';
break;
}
}
@ -238,7 +267,7 @@ angular.module('CredentialsHelper', ['Utilities'])
data.project = scope.project;
break;
case 'azure':
data.username = scope.subscription_id;
data.username = scope.subscription;
}
Wait('start');

View File

@ -281,7 +281,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
CreateSelect2({
element: '#source_source_regions'
});
} else if (scope.source.value === 'azure') {
} else if (scope.source.value === 'azure' || scope.source.value === 'azure_rm') {
scope.source_region_choices = scope.azure_regions;
$('#source_form').addClass('squeeze');
CreateSelect2({
@ -312,8 +312,11 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
}
if (scope.source.value === 'rax' ||
scope.source.value === 'ec2' ||
scope.source.value==='gce' ||
scope.source.value ==='gce' ||
scope.source.value === 'foreman' ||
scope.source.value ==='cloudforms' ||
scope.source.value === 'azure' ||
scope.source.value === 'azure_rm' ||
scope.source.value === 'vmware' ||
scope.source.value === 'openstack') {
if (scope.source.value === 'ec2') {

View File

@ -37,7 +37,6 @@ function manageGroupsDirectiveController($filter, $location, $log,
Rest.get()
.success(function(data) {
group = data;
$scope.source_id = data.related.inventory_source.split('/')[4];
for (var fld in form.fields) {
if (data[fld]) {
$scope[fld] = data[fld];
@ -47,6 +46,7 @@ function manageGroupsDirectiveController($filter, $location, $log,
if(mode === 'edit') {
$scope.variable_url = data.related.variable_data;
$scope.source_url = data.related.inventory_source;
$scope.source_id = data.related.inventory_source.split('/')[4];
$scope.$emit('LoadSourceData');
}
})