-
Notifications
You must be signed in to change notification settings - Fork 358
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
Support operation create
on CloudObjectStoreContainer
#651
Conversation
This pull request is not mergeable. Please rebase and repush. |
d26acbc
to
02d2a65
Compare
2dcc51b
to
1dc6288
Compare
@h-kataria I would kindly ask for a review. This PR is very similar to the PR that @gberginc and yourself discussed in detail (and then merged) a week ago or so: #517. At the moment only Amazon provider supports this functionality ( /cc @gberginc |
1dc6288
to
41f0aee
Compare
@miha-plesko I was working on those PRs with @AparnaKarve. |
Huh, when you try to do something quick at the end of working day when your girlfriend's waiting at the door... @h-kataria, @AparnaKarve, ladies, my deepest apologies for the confusion. I'm all trembling now how rigorous your review might be 😄 |
@miha-plesko Relax, take a deep breath :) |
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.
Few comments in the code. Appologies for typos (working on phone).
"prefix" => "default", | ||
"reset-validation-status" => "default_auth_status") | ||
|
||
%table{:width => '100%'} |
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.
No other button here? Perhaps you could reuse the layout partial layouts/angular/x_edit_buttons_angular
, proposed in #676.
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.
That is correct...you'll need Cancel
button as well.
Please use the layouts/angular/x_edit_buttons_angular
partial
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.
nice one 👍
|
||
def disabled? | ||
# TODO: disable button if no active providers support create action | ||
false |
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.
Shouldn't you have a consition that would ensure you have at least one object storage manager supporting creation of buckets?
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.
Done.
@@ -32,8 +32,98 @@ def self.display_methods | |||
%w(cloud_object_store_objects) | |||
end | |||
|
|||
def new | |||
assert_privileges("cloud_object_store_container_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.
Out of curiosity, I wonder if the cloud
prefix is intentional in the name cloud_object_store_container
? To me, object storage is something that is not related to the "cloud" (contrary to, for example cloud volumes and cloud networks).
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.
Models app/models/cloud_object_store_container.rb
and app/models/cloud_object_store_object
existed in the miq core before and I never thought to change it. I understand what you're saying, but there is reasoning behing cloud
prefix as well: the storage is in cloud, not on local machine. I must admin, however, that the name really is rather long :D
# Depending on the storage manager type, collect required form params. | ||
case params[:emstype] | ||
when "ManageIQ::Providers::Amazon::StorageManager::S3" | ||
options[:bucket] = params[:name] if params[: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.
I understand that S3 API requires :bucket
in options, but I wonder if you could resolve this in the backend? You are setting the :name
above and the provider could perhaps check if only name is present and set the :bucket
on its own.
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.
Also, I understand that you need :name
to show proper flash messages; this is why I am asking to use name instead of bucket.
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.
Thanks for rising this question, let me argument my thinking. I had to decide where to perform mapping:
A. pass entire HTML form inputs to the backend (1 mapping)
frontend: no mapping
backend: HTML form fields -> options
B. slightly modified HTML form inputs to the backend (2 mappings)
frontend: HTML form fields -> slightly modified options
backend: slightly modified options-> options
C. pass fully-mapped options to backend (1 mapping)
frontend: HTML form fields -> options
backend: no mapping
My thinking here was that A should be avoided since backend shouldn't care much about how the HTML form inputs are named. Then B is not very reasonable since we only want to map once. So C is the way to go and is also employed in cloud_volume_controller.rb where we give each provider what it actually needs.
To sum up: I would prefer to perform all the mapping on frontend. This being said, please let me know of your opinion.
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.
Understood; the only concern was that name and bucket are duplicated. Name is used for flash messages, bucket for s3 provider. That's why I thought it may be worth considering that the name is checked in the backend if bucket is not provided.: so, if bucket is in options in the backend, use it, otherwise check if there is name and set it to bucket.
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.
Updating backend with ManageIQ/manageiq-providers-amazon#198
managers = ManageIQ::Providers::CloudManager.supported_subclasses.select(&:supports_regions?) | ||
managers.each_with_object({}) do |manager, provider_regions| | ||
regions = manager.parent::Regions.all.sort_by { |r| r[:description] } | ||
provider_regions[manager.name] = regions.map do |region| |
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.
Make in single line?
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.
Done, thanks.
"ng-model" => "cloudContainerModel.storage_manager_id", | ||
"ng-change" => "storageManagerChanged(cloudContainerModel.storage_manager_id)", | ||
"required" => "", | ||
:miqrequired => true, |
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 thibk :miqrequired
is no longer used.
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.
Correct. Please remove miqrequired
.
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.
Done.
@@ -0,0 +1,62 @@ | |||
%form#form_div{:name => "angularForm", 'ng-controller' => "cloudObjectStoreContainerFormController"} |
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.
Just checking: did you notice any flicker when you open this page? First, browser default controls are displayed for a short period, then proper controls used by miq. If you did, check ng-cloak
.
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.
Wasn't aware on ng-cloak, thanks!
"checkchange" => "", | ||
"selectpicker-for-select-tag" => "", | ||
"prefix" => "default", | ||
"reset-validation-status" => "default_auth_status") |
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.
What is prefix and reset-validation-status? Are they intentional?
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.
This is probably a copy-paste from the ems form.
reset-validation-status
is specific to the Validation portion of the ems form and not applicable here. Please remove it.
Remove prefix
as well.
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.
Whooops, busted, this is a copy-paste from ems form. Removed prefix and reset-validation-status.
= _('Storage Manager') | ||
.col-md-8 | ||
= select_tag("storage_manager_id", | ||
options_for_select([["<#{_('Choose')}>", nil]] + @storage_manager_choices.sort, disabled: ["<#{_('Choose')}>", nil]), |
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.
In an effort to make our angular forms that add new functionality (like this one) make use of REST API, could we populate this dropdown using a REST API call as well instead of using the instance variable @storage_manager_choices
?
Can you try out this API and let me know if it works well for this dropdown?
/api/providers?expand=resources&filter[]=type='*StorageManager::S3*'
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.
We need to list those storage managers that support :cloud_object_store_container_create
feature. Is it possible to filter them by supported feature using API? Unfortunately supports?
function is not a column in database nor virtual column so I'm not sure how to filter by this. Is it possible to filter based on utility functions at all?
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.
If you need to filter them by the supported feature, then I guess we'd have to create a PR in manageiq core to address this.
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.
@miha-plesko Can you try this API and LMK if it gets you the right storage managers :
/api/providers?expand=resources&filter[]=supports_block_storage?=true
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 need to get a list of those that support cloud_object_store_container_create
so I've inserted this in the link above. And viola, yes, the list is correct! 👍
/api/providers?expand=resources&filter[]=supports_cloud_object_store_container_create?=true
result:
{
"name":"providers",
"count":4,
"subcount":1,
"resources":[
{
"href":"http://172.16.117.115:3000/api/providers/4",
"id":4,
"name":"AWS S3 Storage Manager",
"created_on":"2017-03-20T14:30:59Z",
"updated_on":"2017-03-30T14:16:49Z",
"zone_id":1,
"type":"ManageIQ::Providers::Amazon::StorageManager::S3",
"provider_region":"us-west-2",
"last_refresh_date":"2017-03-30T14:16:49Z",
"tenant_id":1,
"parent_ems_id":1,
"actions":[
{
"name":"edit",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers/4"
},
{
"name":"refresh",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers/4"
},
{
"name":"delete",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers/4"
},
{
"name":"delete",
"method":"delete",
"href":"http://172.16.117.115:3000/api/providers/4"
}
]
}
],
"actions":[
{
"name":"query",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers"
},
{
"name":"create",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers"
},
{
"name":"edit",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers"
},
{
"name":"refresh",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers"
},
{
"name":"delete",
"method":"post",
"href":"http://172.16.117.115:3000/api/providers"
}
]
}
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.
Thanks for trying the API @miha-plesko
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.
@miha-plesko if you don't need all the attributes, I suggest you limit the list to those that are important, e.g. add &attributes=id,name
to the request to get just the name and id:
{
"name": "providers",
"count": 8,
"subcount": 2,
"resources": [
{
"href": "http://localhost:3000/api/providers/17",
"id": 17,
"name": "OS XLAB Cinder Manager"
},
{
"href": "http://localhost:3000/api/providers/23",
"id": 23,
"name": "AWS XLAB EBS Storage Manager"
}
],
"actions": [
{
"name": "query",
"method": "post",
"href": "http://localhost:3000/api/providers"
},
{
"name": "create",
"method": "post",
"href": "http://localhost:3000/api/providers"
},
{
"name": "edit",
"method": "post",
"href": "http://localhost:3000/api/providers"
},
{
"name": "refresh",
"method": "post",
"href": "http://localhost:3000/api/providers"
},
{
"name": "delete",
"method": "post",
"href": "http://localhost:3000/api/providers"
}
]
}
= _('Region') | ||
.col-md-8 | ||
- @provider_regions.each do |name, regions| | ||
= select_tag('provider_region', |
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 goes here... an API would be preferable.
Will get back to you on the exact API that you can use later.
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.
Here I'd need API to be able to access class constant. Currently, regions are obtained from here: https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/app/models/manageiq/providers/amazon/regions.rb#L8-L84
Is there a way to fetch them thru API?
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.
Let's leave this as is.
Would have to dig deeper into this to find out what is involved to get the Amazon Regions via the API.
@@ -1868,6 +1868,7 @@ def process_cloud_object_storage_buttons(pressed) | |||
task = pressed.sub("#{klass.name.underscore.to_sym}_", "") | |||
|
|||
return tag(klass) if task == "tag" | |||
return javascript_redirect(:controller => klass.name.underscore.to_sym, :action => "new") if task == "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.
This does not seem right.
This logic needs to be in the cloud_object_store_container
controller, not here.
Can you look up a few examples and fix this?
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.
I hope not; I think that creating a new bucket from the list of provider's buckets should be supported.
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 think the comment is more about the location of the change. We discussed why in ci_processing
some time ago, but I don't remember exactly.
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 the button be visible both from /cloud_object_store_container/show_list
and /ems_storage/ID?display=cloud_object_store_containers
, it would probably make more sense to have this logic in ci_processing (which is included by both controllers).
@AparnaKarve would you prefer me to copy line 1871 to above this line and to above this line?
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.
@miha-plesko All button handling for cloud_object_store_container
should be in that controller itself, not in ci_processing
Check this out for instance --
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/cloud_network_controller.rb#L38-#L41
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.
@miha-plesko I see that you have already added delete
code in ci_processing
and now you are about to add new
.
The delete
handling should have been added in cloud_object_store_container_controller.rb
The button handling for new
, edit
, delete
should all live in the acting controller code.
Let me give you another code example that was recently added --
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/ansible_credential_controller.rb#L27-L35
It's clear, concise and easy to follow. Could we implement something like that?
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.
If it needs to be accessible from ems_storage
as well, then you also add the button handling in ems_common.rb
. Something like this --
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/ems_common.rb#L455-L456
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.
Sounds reasonable. Let me try to do it this way. What confuses me still is this line in ems_storage
controller: https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/ems_common.rb#L285. It seems like delete for cloud_volume
is implemented in ci_processing while other operations are elsewhere. Let me try to refactor this, we shall see if any problem arises.
This error is legit, because bucket names must be globaly unique (across all users and all regions). S3 console would warn with a simple message that the bucket already exists. |
41f0aee
to
d1da355
Compare
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.
@AparnaKarve @gberginc thanks for initial pass. I've answered to your comments, please take a look.
@@ -32,8 +32,98 @@ def self.display_methods | |||
%w(cloud_object_store_objects) | |||
end | |||
|
|||
def new | |||
assert_privileges("cloud_object_store_container_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.
Models app/models/cloud_object_store_container.rb
and app/models/cloud_object_store_object
existed in the miq core before and I never thought to change it. I understand what you're saying, but there is reasoning behing cloud
prefix as well: the storage is in cloud, not on local machine. I must admin, however, that the name really is rather long :D
# Depending on the storage manager type, collect required form params. | ||
case params[:emstype] | ||
when "ManageIQ::Providers::Amazon::StorageManager::S3" | ||
options[:bucket] = params[:name] if params[: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.
Thanks for rising this question, let me argument my thinking. I had to decide where to perform mapping:
A. pass entire HTML form inputs to the backend (1 mapping)
frontend: no mapping
backend: HTML form fields -> options
B. slightly modified HTML form inputs to the backend (2 mappings)
frontend: HTML form fields -> slightly modified options
backend: slightly modified options-> options
C. pass fully-mapped options to backend (1 mapping)
frontend: HTML form fields -> options
backend: no mapping
My thinking here was that A should be avoided since backend shouldn't care much about how the HTML form inputs are named. Then B is not very reasonable since we only want to map once. So C is the way to go and is also employed in cloud_volume_controller.rb where we give each provider what it actually needs.
To sum up: I would prefer to perform all the mapping on frontend. This being said, please let me know of your opinion.
|
||
def disabled? | ||
# TODO: disable button if no active providers support create action | ||
false |
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.
Done.
@@ -0,0 +1,62 @@ | |||
%form#form_div{:name => "angularForm", 'ng-controller' => "cloudObjectStoreContainerFormController"} |
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.
Wasn't aware on ng-cloak, thanks!
= _('Storage Manager') | ||
.col-md-8 | ||
= select_tag("storage_manager_id", | ||
options_for_select([["<#{_('Choose')}>", nil]] + @storage_manager_choices.sort, disabled: ["<#{_('Choose')}>", nil]), |
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.
We need to list those storage managers that support :cloud_object_store_container_create
feature. Is it possible to filter them by supported feature using API? Unfortunately supports?
function is not a column in database nor virtual column so I'm not sure how to filter by this. Is it possible to filter based on utility functions at all?
= _('Region') | ||
.col-md-8 | ||
- @provider_regions.each do |name, regions| | ||
= select_tag('provider_region', |
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.
Here I'd need API to be able to access class constant. Currently, regions are obtained from here: https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/app/models/manageiq/providers/amazon/regions.rb#L8-L84
Is there a way to fetch them thru API?
"checkchange" => "", | ||
"selectpicker-for-select-tag" => "", | ||
"prefix" => "default", | ||
"reset-validation-status" => "default_auth_status") |
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.
Whooops, busted, this is a copy-paste from ems form. Removed prefix and reset-validation-status.
"prefix" => "default", | ||
"reset-validation-status" => "default_auth_status") | ||
|
||
%table{:width => '100%'} |
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.
nice one 👍
@@ -1868,6 +1868,7 @@ def process_cloud_object_storage_buttons(pressed) | |||
task = pressed.sub("#{klass.name.underscore.to_sym}_", "") | |||
|
|||
return tag(klass) if task == "tag" | |||
return javascript_redirect(:controller => klass.name.underscore.to_sym, :action => "new") if task == "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.
managers = ManageIQ::Providers::CloudManager.supported_subclasses.select(&:supports_regions?) | ||
managers.each_with_object({}) do |manager, provider_regions| | ||
regions = manager.parent::Regions.all.sort_by { |r| r[:description] } | ||
provider_regions[manager.name] = regions.map do |region| |
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.
Done, thanks.
47f8311
to
027ae2d
Compare
027ae2d
to
66dccb1
Compare
@AparnaKarve I apologize that it took me so long to apply your comments. I've added two commits to this PR: one of them modernizes JavaScript code so that Angular now makes use of fancy I was not able to fully satisfy your concerns regarding "moving all the logic out of So, there are two groups of operations that central button can trigger:
For group (1) there is no doubt what to do when user triggers them: just redirect to the controller that manages corresponding view. But for group (2) this is not possible since there is nothing to redirect to! So the current controller (either To put it simple: if /cc @gberginc |
66dccb1
to
71efe12
Compare
@miha-plesko If I test this PR now in it's current state, would I be able to see the issue that you have described in scenario2 for operations: |
@AparnaKarve no, the way it's implemented now everything works. The problem would arise only if I wanted to extract |
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.
@AparnaKarve thank you for another iteration. I've pushed an additional commit where I apply your suggestions. I'd argue with you only regarding storage_manager_id
topic since I think you've tested it on a wrong StorageManager, while the code is actually ok. See this comment.
I'm looking forward to any further suggestions that you might have.
}; | ||
|
||
// fetch StorageManager from querystring | ||
if (! isNaN(parseInt(storageManagerId, 10))) { |
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.
Nice one, thank you.
|
||
// If storage manager ID was provided, we need to refresh the form and show | ||
// corresponding form fields. | ||
if (storageManagerId) { |
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.
Ok.
"model-copy" => "vm.modelCopy"} | ||
= render :partial => "layouts/flash_msg" | ||
%h3 | ||
= _('Basic Information') |
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.
Done.
'ng-model' => "vm.cloudContainerModel.name", | ||
'ng-maxlength' => 255, | ||
:miqrequired => true, | ||
:checkchange => true} |
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.
Done. I've also fixed the same issue for other inputs.
This commit adds a new page /cloud_object_store_container/new where user can create new CloudObjectStoreContainer. Page is fully functional and extendable. Tested on Amazon S3 provider. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
Here we move the logic that redirects user to `cloud_object_store_container/new` from common place to each of the calling controllers. This way we are able to differentiate whether the button was cliked on a list of all Containers or on a list of Containers for specific StorageManager. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
There were some _("Required") missing on the form. With this commit I add them where needed. This commit also moves logic for parsing manager id obtained thru querystring to the haml by using angular filter. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
6d6f85c
to
3be5955
Compare
@breadcrumbs.pop if @breadcrumbs | ||
session[:flash_msgs] = @flash_array.dup if @flash_array | ||
|
||
javascript_redirect :action => "show_list" |
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.
Can you change this to :
javascript_redirect previous_breadcrumb_url
Useful while adding a New Cloud Object Store Container from the Storage Manager Summary page.
Once the Add is done, the page will redirected back to the Summary page.
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.
Good point, thanks.
"ng-model" => "vm.cloudContainerModel.provider_region", | ||
"ng-switch-when" => name, | ||
"required" => "", | ||
"checkchange" => "", |
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.
Adding a search capability in this dropdown would be a good idea since it could be a fairly long list.
All you need to do is add these 2 parameters to the Regions
select
:multiple => false,
"data-live-search" => true,
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.
Awesome, done.
@miha-plesko Just those couple minor things above...but otherwise, this is looking great. Question about |
@AparnaKarve just answering your question immediately (I shall apply other changes on Monday): |
Agree. Let's get
Ok, not a problem. |
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.
@AparnaKarve thank you for the two very useful comments, I've added one commit to address each.
Talking about :edit
operation, I've realized that at this point we allow user to input only information that is immutable (name and location). In other words, it is not possible* to rename any S3 bucket - to achieve such behavior you must create new bucket with new name, copy objects there, and delete the old one. So supporting an :edit
operation would result in all field greyed-out at the moment anyway 😄
*by not possible I mean it cannot be done due to limitations on S3 side, not MiQ side
@breadcrumbs.pop if @breadcrumbs | ||
session[:flash_msgs] = @flash_array.dup if @flash_array | ||
|
||
javascript_redirect :action => "show_list" |
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.
Good point, thanks.
"ng-model" => "vm.cloudContainerModel.provider_region", | ||
"ng-switch-when" => name, | ||
"required" => "", | ||
"checkchange" => "", |
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.
Awesome, done.
Currently we were redirecting to the list of all Cloud Containers when user created a new bucket. But that's not OK when user came from manager's page. This commit redirects user one step back in breadcrumb instead. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
There are 15 bucket regions to select from so it makes sense to offer user a search field as part of the drop-down. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
59309d2
to
731488e
Compare
Checked commits miha-plesko/manageiq-ui-classic@5a7a3ad~...731488e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/views/cloud_object_store_container/new.html.haml
|
@miq-bot remove_label blocker |
Removed the blocker label because S3 will be disabled by default in the Fine release (see: ManageIQ/manageiq-providers-amazon#213) |
Oh, that is good to know. Thanks for that vital piece of information. |
@miha-plesko Thank you for addressing all the feedback! @dclarizio @h-kataria This is good to merge. |
Support operation `create` on CloudObjectStoreContainer (cherry picked from commit ac62737)
Fine backport details:
|
This commit adds a new page /cloud_object_store_container/new where user can create new CloudObjectStoreContainer. Page is fully functional and extendable. Tested on Amazon S3 provider.
Button that redirects to /cloud_object_store_container/new appears in center toolbar:
And the /cloud_object_store_container/new page itself:
Depends on:
create
on CloudObjectStoreContainer manageiq#14269 (merged)create
for CloudObjectStoreContainer manageiq-providers-amazon#172 (merged)@miq-bot add_label enhancement
@miq-bot assign @h-kataria