mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
177 lines
5.5 KiB
JavaScript
177 lines
5.5 KiB
JavaScript
/*********************************************
|
|
* Copyright (c) 2013 AnsibleWorks, Inc.
|
|
*
|
|
* Users.js
|
|
* Form definition for User model
|
|
*
|
|
*
|
|
*/
|
|
angular.module('UserFormDefinition', [])
|
|
.value(
|
|
'UserForm', {
|
|
|
|
addTitle: 'Create User', //Legend in add mode
|
|
editTitle: '{{ username }}', //Legend in edit mode
|
|
name: 'user', //Form name attribute
|
|
well: true, //Wrap the form with TB well
|
|
|
|
fields: {
|
|
username: {
|
|
label: 'Username',
|
|
type: 'text',
|
|
addRequired: true,
|
|
editRequired: true
|
|
},
|
|
first_name: {
|
|
label: 'First Name',
|
|
type: 'text',
|
|
addRequired: true,
|
|
editRequired: true,
|
|
capitalize: true
|
|
},
|
|
last_name: {
|
|
label: 'Last Name',
|
|
type: 'text',
|
|
addRequired: true,
|
|
editRequired: true,
|
|
capitalize: true
|
|
},
|
|
email: {
|
|
label: 'Email',
|
|
type: 'email',
|
|
addRequired: true,
|
|
editRequired: true
|
|
},
|
|
password: {
|
|
label: 'Password',
|
|
type: 'password',
|
|
addRequired: true,
|
|
editRequired: false,
|
|
ngChange: "clearPWConfirm('password_confirm')"
|
|
},
|
|
password_confirm: {
|
|
label: 'Confirm Password',
|
|
type: 'password',
|
|
addRequired: false,
|
|
editRequired: false,
|
|
awPassMatch: true,
|
|
associated: 'password'
|
|
},
|
|
is_superuser: {
|
|
label: 'Superuser?',
|
|
type: 'checkbox',
|
|
trueValue: 'true',
|
|
falseValue: 'false',
|
|
default: 'false',
|
|
ngShow: "current_user['is_superuser'] == true"
|
|
}
|
|
},
|
|
|
|
buttons: { //for now always generates <button> tags
|
|
save: {
|
|
label: 'Save',
|
|
icon: 'icon-ok',
|
|
class: 'btn btn-success',
|
|
ngClick: 'formSave()', //$scope.function to call on click, optional
|
|
ngDisabled: true //Disable when $pristine or $invalid, optional
|
|
},
|
|
reset: {
|
|
ngClick: 'formReset()',
|
|
label: 'Reset',
|
|
icon: 'icon-remove',
|
|
class: 'btn',
|
|
ngDisabled: true //Disabled when $pristine
|
|
}
|
|
},
|
|
|
|
related: { //related colletions (and maybe items?)
|
|
admin_of_organizations: { // Assumes a plural name (e.g. things)
|
|
type: 'collection',
|
|
title: 'Admin of Organizations',
|
|
iterator: 'adminof', // Singular form of name (e.g. thing)
|
|
open: false, // Open accordion on load?
|
|
|
|
fields: {
|
|
name: {
|
|
key: true,
|
|
label: 'Name'
|
|
},
|
|
description: {
|
|
label: 'Description'
|
|
},
|
|
}
|
|
},
|
|
|
|
organizations: {
|
|
type: 'collection',
|
|
title: 'Organizations',
|
|
iterator: 'organization',
|
|
open: false,
|
|
|
|
fields: {
|
|
name: {
|
|
key: true,
|
|
label: 'Name'
|
|
},
|
|
description: {
|
|
label: 'Description'
|
|
}
|
|
}
|
|
},
|
|
|
|
teams: {
|
|
type: 'collection',
|
|
title: 'Teams',
|
|
iterator: 'team',
|
|
open: false,
|
|
|
|
fields: {
|
|
name: {
|
|
key: true,
|
|
label: 'Name'
|
|
},
|
|
description: {
|
|
label: 'Description'
|
|
}
|
|
}
|
|
},
|
|
|
|
projects: {
|
|
type: 'collection',
|
|
title: 'Projects',
|
|
iterator: 'project',
|
|
open: false,
|
|
|
|
fields: {
|
|
name: {
|
|
key: true,
|
|
label: 'Name'
|
|
},
|
|
description: {
|
|
label: 'Description'
|
|
}
|
|
}
|
|
},
|
|
|
|
credentials: {
|
|
type: 'collection',
|
|
title: 'Credentials',
|
|
iterator: 'credential',
|
|
open: false,
|
|
|
|
fields: {
|
|
name: {
|
|
key: true,
|
|
label: 'Name'
|
|
},
|
|
description: {
|
|
label: 'Description'
|
|
}
|
|
}
|
|
},
|
|
|
|
}
|
|
|
|
}); //UserForm
|
|
|