When the cloud module is installed and click Cloud Service Provider menu on the top (by using bootstrap_cloud), if there are no the Cloud Service Providers it should show the menu Add Cloud Service Provider menu.

Comments

jigish.addweb created an issue. See original summary.

jigish.addweb’s picture

Status: Active » Needs review
StatusFileSize
new5.07 KB
baldwinlouie’s picture

@jigish,

I reviewed the patch and have the following comments.

  1. +++ b/src/EventSubscriber/CloudSubscriber.php
    @@ -97,14 +98,17 @@ class CloudSubscriber implements EventSubscriberInterface {
    +      if (empty($ids) && empty($cloud_config_type)) {
    +        $url = Url::fromRoute('system.modules_list');
    +        $this->messenger->addWarning(
    +          $this->t('There is no cloud service provider. Please add cloud service provider(s) (AWS, K8s and/or OpenStack)'));
             $response = new RedirectResponse($url->toString());
             $event->setResponse($response);
    

    This message should show up on all pages a user visits. Not just these routes

        $route_names = [
          'view.cloud_config.list',
          'view.cloud_server_template.list',
          'entity.cloud_server_template.collection',
          'entity.cloud_config.add_page',
        ];
    
  2. +++ b/src/EventSubscriber/CloudSubscriber.php
    @@ -97,14 +98,17 @@ class CloudSubscriber implements EventSubscriberInterface {
    +          $this->t('There is no cloud service provider. Please add cloud service provider(s) (AWS, K8s and/or OpenStack)'));
    

    Please link this to admin/modules page.

baldwinlouie’s picture

Status: Needs review » Needs work
jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new5.27 KB

@baldwinlouie

Thank you for reviewing the patch.

I have done changes as per your comment.

Please test new patch.

Thanks

baldwinlouie’s picture

Status: Needs review » Needs work

@jigish, Thank you for the updated patch. I have two comments.

+++ b/src/EventSubscriber/CloudSubscriber.php
@@ -92,23 +104,25 @@ class CloudSubscriber implements EventSubscriberInterface {
+        $this->t('There is no cloud service provider. Please add @link (AWS, K8s and/or OpenStack).',

Can we modify the wording as follows:

There are no Cloud Service Provider modules enabled. Please enable AWS Cloud, Kubernetes and/or OpenStack.

where @link text is "AWS Cloud, Kubernetes and/or OpenStack"

+++ b/src/EventSubscriber/CloudSubscriber.php
@@ -92,23 +104,25 @@ class CloudSubscriber implements EventSubscriberInterface {
-      if (empty($ids)) {
-        $url = Url::fromRoute('entity.cloud_config.add_page');
-        $page_link = Link::fromTextAndUrl($this->t('cloud service provider'), $url)->toString();
-        $this->messenger->addMessage(
-          $this->t('There is no cloud service provider. Please create a new @link.', [
-            '@link' => $page_link,
-          ])
-        );

Please put this condition back. It throws up a message asking user to add a Cloud Config entity and should still be there.

yas’s picture

@jigishaddweb

Just a quick question --- Is the patch's code

+++ b/src/EventSubscriber/CloudSubscriber.php
@@ -79,7 +79,19 @@ class CloudSubscriber implements EventSubscriberInterface {

+    $ids = $this->entityTypeManager
+      ->getStorage('cloud_config')
+      ->getQuery()
+      ->execute();

equivalent to the code as follows?

  $ids = $this->entityTypeManager->getStorage('cloud_config')
    ->loadMultiple();
jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new5.27 KB

@baldwinlouie

Thank you for your suggestions.

I updated the patch.

Please test new patch.

Thanks

yas’s picture

StatusFileSize
new2.15 KB

@jigishaddweb

Thank you for the update. It looks good to me now.

@baldwinlouie

What do you think?

yas’s picture

Title: Add menu when I install the cloud module » Add a menu when the Cloud module is installed
yas’s picture

baldwinlouie’s picture

Status: Needs review » Reviewed & tested by the community

@jigishaddweb and @yas, The patch looks good now.

yas’s picture

@baldwinlouie

Thank you for your review. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

  • yas committed 2ee2a1f on 8.x-1.x authored by jigish.addweb
    Issue #3114300 by jigish.addweb, yas, baldwinlouie: Add a menu when the...

  • yas committed 5d53504 on 8.x-2.x authored by jigish.addweb
    Issue #3114300 by jigish.addweb, yas, baldwinlouie: Add a menu when the...
yas’s picture

Status: Reviewed & tested by the community » Fixed
yas’s picture

Status: Fixed » Needs work

@jigishaddweb

I found that testCloudConfigRedirect() fails. Could you please fix it?

jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new879 bytes

@yas

I fixed that testCloudConfigRedirect() error.

Please review new patch.

Thanks

yas’s picture

Status: Needs review » Reviewed & tested by the community

@jigishaddweb

Thank you for fixing the issue. I tested it and looks good to me. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

  • yas committed c9c1ca1 on 8.x-1.x authored by jigish.addweb
    Issue #3114300 by jigish.addweb, yas, baldwinlouie: Hotfix - Add a menu...

  • yas committed 17a8cac on 8.x-2.x authored by jigish.addweb
    Issue #3114300 by jigish.addweb, yas, baldwinlouie: Hotfix - Add a menu...
yas’s picture

Status: Reviewed & tested by the community » Fixed
yas’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.