-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRUD for embedded Ansible credentials #641
CRUD for embedded Ansible credentials #641
Conversation
b3d5461
to
15bdb7d
Compare
fa021e2
to
fa3b691
Compare
.then(getCredentialOptions) | ||
.catch(miqService.handleFailure); | ||
|
||
if (credentialId != 'new') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be if (credentialId !== 'new') {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
.catch(miqService.handleFailure); | ||
} | ||
else { | ||
vm.select_options.push({'label':__('<Choose>'), 'value': ''}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semicolon missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
}; | ||
|
||
vm.cancelClicked = function(angularForm) { | ||
if (credentialId == 'new') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, ===
is recommended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
function getCredentialOptions(response) { | ||
Object.assign(vm.credential_options, response.data.credential_types.embedded_ansible_credential_types); | ||
|
||
for (opt in vm.credential_options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be
for (var opt in vm.credential_options)
(define opt
, that is)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
var item = vm.credential_options[vm.credentialModel.type]['attributes'][opt] | ||
|
||
// void the password fields first | ||
if (item.hasOwnProperty('type') && item['type'] == 'password') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
===
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
if (warning) { | ||
url += '&flash_warning=true&flash_error=false'; | ||
} | ||
else if (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else
/else if
need to be on the same line as the closing brace for if
(Per style guide)
Please fix this here and other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
// get credential specific options for all supported credential types | ||
API.options('/api/authentications') | ||
.then(getCredentialOptions) | ||
.catch(miqService.handleFailure); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
173deed
to
2d4d444
Compare
I'm aware of the problem with breadcrumb pointing to invalid url and yes, it needs to be fixed. But that problem is not specific for nor caused by this PR and will be addressed as a bug |
'ng-show' => "vm.afterGet", | ||
"miq-form" => true, | ||
"model" => "vm.credentialModel", | ||
"model-copy" => 'vm.modelCopy', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend using ng-clock
here in order to address flickering that is seen sometimes.
ng-cloak => ""
(I just tried it in this form and it seems to have fixed it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
'</div>', | ||
// select | ||
'<div ng-switch-when="choice" class="col-md-8">', | ||
'<select ng-options="opt as opt for opt in attr.choices" class="form-control pf-select" ng-model="vm.model[name]" />', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pf-select
is not quite doing what it's supposed to do.
It's a directive, so try this --
'<div ng-switch-when="choice" class="col-md-8">',
'<select pf-select ng-options="opt as opt for opt in attr.choices" class="form-control" ng-model="vm.model[name]" />',
'</div>',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
.then(getCredentialFormData) | ||
.catch(miqService.handleFailure); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move else
up.
Please do a sweep of the whole JS file for all the else
's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. And I also did this sweep of the whole JS file .
|
||
// we need to merge options and vm.credentialModel | ||
for (var opt in response.options) { | ||
var item = vm.credential_options[vm.credentialModel.type]['attributes'][opt] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another missing semicolon... sorry, didn't catch that before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Oh, almost forgot... |
2d4d444
to
e92273f
Compare
@AparnaKarve I can work on the specs, but if the PR is meant to be merged soon, I'd rather do them in a separate PR. |
e92273f
to
e74101c
Compare
Checked commit mzazrivec@e74101c with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/helpers/application_helper/toolbar/ansible_credential_center.rb
app/helpers/application_helper/toolbar/ansible_credentials_center.rb
|
yeah, works for me. |
@h-kataria I've listed all known issues here: Unfortunately, due to lack of a working backend, from a reviewer/tester and I suppose even from a developer's point of view, there hasn't really been a "gratification" to see something working completely, in it's entire cycle. |
@mzazrivec can you remove WIP labels if this is ready for merging |
Removing WIP label from PR and merging, remaining issues and jasmine spec tests will be addressed in follow up PR. |
Implemented:
The actual Credential edit / create form is implemented as an angular component.
Pending backend PRs:
ManageIQ/manageiq#14217
ManageIQ/manageiq#14483
Outstanding issues:
ManageIQ/manageiq#14459