Closed (fixed)
Project:
Cloud
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
21 Jan 2019 at 07:34 UTC
Updated:
6 Feb 2019 at 07:34 UTC
Jump to comment: Most recent, Most recent file
In an instance detail view page, add a tab named Tags to edit tags (See the attached as the reference of AWS Management Console)
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | 3027226-33.patch | 33.5 KB | xiaohua guan |
| #7 | screenshot3.png | 116.32 KB | yas |
| #4 | screenshot2.png | 43.05 KB | xiaohua guan |
| #4 | screenshot1.png | 24.75 KB | xiaohua guan |
Comments
Comment #2
xiaohua guan commentedComment #3
xiaohua guan commentedComment #4
xiaohua guan commentedComment #5
xiaohua guan commented@yas
I tried to implement the feature. Please have a look. Thanks.
BTW, the screen captures are attached as screenshot1.png and screenshot2.png.
Comment #6
xiaohua guan commentedComment #7
yas@xiaohua-guan
Thank you for the great patch!Overall, it looks good to me with the following comments:
1. In the comment line
Add Tags field to aws_cloud_instance., drop the last white space after the period (.)2. Could you please align the array like:
3. Could you please delete
Tagstitle in Tags fieldset? See the attached screenshot3.png (because I thought it looked redundant.)4. After running
update.phpordrush updb, please invoke/clouds/aws_cloud/{cloud_context}/instance/update(Because the tags are not updated just right after runningupdate.php)5. Could you please convert the value of
cloud_termination_timestampto the Drupal'sDefault short dateformat? (e.g.01/21/2019 - 03:12in my case)Comment #8
yasComment #9
xiaohua guan commentedComment #10
xiaohua guan commented@yas
I modified the code except No. 4.
> 4. After running update.php or drush updb, please invoke /clouds/aws_cloud/{cloud_context}/instance/update
> (Because the tags are not updated just right after running update.php)
I don't know how to call instance/update, because I can't get cloud_context if I do it in aws_cloud.install.
Could you give me any advices?
Comment #11
yas4. I think you can refer to a
AwsCloudMenuLinksclass inmodules/cloud_service_providers/aws_cloud/src/Plugin/Derivative/AwsCloudMenuLinks.php. I do believe that this is exactly what we want to see.5.
cloud_termination_timestampto the Drupal's Default short date format --- The view is fine (Thanks!), but could you please also display the formatted date and time inInstanceEditForm?6. Also, I got the following errors:
The instance launched by CloudFormation and it has some tags such as
aws:cloudformation:stack-name. Looksaws:is a reserved keyword in AWS tag.7. Here is another error. In this case, the instance is already launched before I install
cloud+aws_cloudmodule. Therefore I don't guess that the instance has much information such as owner. I tried to 1) edit that instance and 2) put terminate date and time (initially empty value), and 3) save. The following line requires to get a login user id ifgetOwner()->id()is NULL or anyhow it requires to check ifgetOwner()->id()is NULL or not:Here is the error message:
Comment #12
yasComment #13
xiaohua guan commentedComment #14
xiaohua guan commentedComment #15
xiaohua guan commented@yas
> 4. I think you can refer to a AwsCloudMenuLinks
Thanks for your advices. I've added the code to update instances.
> 5. cloud_termination_timestamp to the Drupal's Default short date format
I modified it.
> 6. Also, I got the following errors:
I fixed errors.
> 7. Here is another error.
I also fixed the error.
Please review the patch file. Thanks.
Comment #16
xiaohua guan commentedComment #17
xiaohua guan commentedComment #18
yas@xiaohua-guan
Thank you so much for the updated patch! Now everything looks perfect however I am sorry but I forgot to ask you to add the following:
8. When I save the
InstanceEditFrom, could you please make it return toInstantEditForm? Currently it will go to Instance list page, so I cannot confirm my modification inInstantEditForm.* CORRECTION: I changed the number from 6. to 7. at the bottom of my comment in #11. (Could you please correct your comment at #15?)
Comment #19
xiaohua guan commentedComment #20
xiaohua guan commented@yas
> 8. When I save the InstanceEditFrom, could you please make it ...
Yes, I make it to redirect to itself.
But if clicking edit link in list page, because there is query parameter destination, it will be redirected to list page after saving.
> CORRECTION: I changed the number from 6. to 7. at the bottom of my comment in #11. (Could you please correct your comment at #15?)
Yes, I corrected it.
Please review the latest patch file. Thanks.
Comment #21
yas@xiaohua-guan,
Thank you for the update! I tested and it looks fine to me.
@baldwinlouie
Do you have any idea regarding the following? Can we achieve my request by modifying some attribute such as
destinationinviews.view.aws_instances.yml?>> 8. When I save the InstanceEditFrom, could you please make it ...
> Yes, I make it to redirect to itself.
> But if clicking edit link in list page, because there is query parameter destination, it will be redirected to list page after saving.
Comment #22
baldwinlouie commented@yas and @xiaohua-guan, See this link: https://drupal.stackexchange.com/questions/250465/how-to-force-a-redirec... You can follow that to unset the destination query parameter. See the first answer. Let me know that works.
Comment #23
yas@baldwinlouie
Thank you for your advice
I found the following information:
@xiaohua-guan
How do you think?
Comment #24
baldwinlouie commented@yas, @xiaohua-guan
I think removing it via hook_entity_operation_alter() will be the cleanest. The other ways might confuse users because destination might still be in the url, but it redirects back to the edit form page.
I tried the following snippet of code out locally in aws_cloud_entity_operation_alter(), and it seemed to get rid of the destination.
Obviously that is experimental code, but it seemed to work.
Comment #25
xiaohua guan commentedComment #26
xiaohua guan commented@yas
> How do you think?
I agreed with baldwinlouie's way, using hook_entity_operation_alter to remove destination.
@baldwinlouie
Thanks for your idea and code.
@yas
Please review the latest patch file. Thanks.
Comment #28
xiaohua guan commentedComment #29
xiaohua guan commentedComment #30
yas@xiaohua-guan,
Thank you for the updated patch. I want to ask your opinion for the following change. I think your code is so beautiful, therefore I thought we should try to reduce hard-code as much as possible. The side effect is if we use
timestampas a part of the key name of the tag, then it always displays the formatted date/time; however it should be no problem.FROM:
TO:
FYI, I searched:
Comment #31
xiaohua guan commentedComment #33
xiaohua guan commentedComment #34
xiaohua guan commentedComment #35
xiaohua guan commented@yas
I modified the code as you said except that I changed timestamp to _timestamp because it would be better to use a underscore to identify the timestamp is not part of other word.
Please review the patch file. Thanks.
Comment #36
yas@xiaohua-guan,
Thank you for the update! It is perfect to me now.
@baldwinlouie,
What do you think?
Comment #37
baldwinlouie commented@yas and @xiaohua-guan, Nice looking patch! RTBC
Comment #39
yas@xiaohua-guan
Thank you for your great work! I merged the patch and close this issue w/
Fixedstate.Comment #40
yas