diff --git a/.travis/prepare-test-env.sh b/.travis/prepare-test-env.sh index 2757bed3d..47dfb3d80 100755 --- a/.travis/prepare-test-env.sh +++ b/.travis/prepare-test-env.sh @@ -3,7 +3,7 @@ set -e if [[ -z "${APIGEE_EDGE_ENDPOINT}" ]] || [[ -z "${APIGEE_EDGE_USERNAME}" ]] || [[ -z "${APIGEE_EDGE_PASSWORD}" ]] || [[ -z "${APIGEE_EDGE_ORGANIZATION}" ]]; then - echo "Incomplete configuration. Please make sure the following environment variables exist and not empty: APIGEE_EDGE_ENDPOINT, APIGEE_EDGE_USERNAME, APIGEE_EDGE_PASSWORD, APIGEE_EDGE_ORGANIZATION." + echo "Incomplete configuration. Make sure the following environment variables exist and not empty: APIGEE_EDGE_ENDPOINT, APIGEE_EDGE_USERNAME, APIGEE_EDGE_PASSWORD, APIGEE_EDGE_ORGANIZATION." exit 1 fi diff --git a/.travis/push-logs.sh b/.travis/push-logs.sh index b6d1d0ec1..c95a269f1 100755 --- a/.travis/push-logs.sh +++ b/.travis/push-logs.sh @@ -3,7 +3,7 @@ set -e if [[ -z "${LOGS_REPO_USER}" ]] || [[ -z "${LOGS_REPO_PASSWORD}" ]] || [[ -z "${LOGS_REPO_HOST}" ]] || [[ -z "${LOGS_REPO_NAME}" ]]; then - echo "There is at least one missing information about the destination repo. Please make sure the following environment variables exist and not empty: LOGS_REPO_USER, LOGS_REPO_PASSWORD, LOGS_REPO_HOST, LOGS_REPO_NAME." + echo "There is at least one missing information about the destination repo. Make sure the following environment variables exist and not empty: LOGS_REPO_USER, LOGS_REPO_PASSWORD, LOGS_REPO_HOST, LOGS_REPO_NAME." exit 0 fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 165344615..8193f62b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,9 +28,9 @@ This project follows [Google's Open Source Community Guidelines](https://opensou # Suggested contributing workflow -## For a start +## To start * Fork this project on Github. -* If you do not have an Apigee Edge trial organization please create a new one +* If you do not have an Apigee Edge trial organization, create a new one [here](https://login.apigee.com/login). * Register on https://travis-ci.org. * Open https://travis-ci.org/[YOUR-GITHUB-USERNAME]/apigee-edge-drupal and click @@ -42,10 +42,12 @@ required environment variables in the [Testing](#testing) section.) ## For daily work * Create a new branch in your fork repository, ex.: patch-1. -* Add changes to the code. If you implement new features please always add new -tests to cover the implemented functionality. If you modify existing features please always update related tests if needed. +* Add changes to the code. If you implement new features, add new +tests to cover the implemented functionality. If you modify existing features, update related tests. * Push your changes to your repo's patch-1 branch. -* Wait until all Travis CI test jobs finish and _pass_. +* Wait until all Travis CI test jobs finish and _pass_. (If any of them fails +restart them once or twice. They may have failed due to an API communication error. You can +identify these type of issues from logs.) * Create [new pull request](https://github.com/apigee/apigee-edge-drupal/pull/new/8.x-1.x) and do not forget to add a link to Travis CI build that can confirm your code is working. @@ -117,8 +119,8 @@ PHPUnit tests with the following commands: ```bash cd [DRUPAL_ROOT]/modules/contrib/apigee_edge/.travis docker-compose up --build # Build is important because recent changes on module files have to be copied from the host to the container. -docker-compose run php /opt/drupal-module/run-test.sh # to run all tests of this module. This command performs some initial setup tasks if test environment has not been configured yet. -docker-compose run php /opt/drupal-module/run-test.sh --filter testAppSettingsForm AppSettingsFormTest build/modules/contrib/apigee_edge/tests/src/FunctionalJavascript/AppSettingsFormTest.php # to run one specific test. If you pass any arguments to run-test.sh those get passed directly to PHPUnit. See [.travis/run-test.sh](run-test.sh). +docker-compose run php /opt/drupal-module/.travis/run-test.sh # to run all tests of this module. This command performs some initial setup tasks if test environment has not been configured yet. +docker-compose run php /opt/drupal-module/.travis/run-test.sh --filter testAppSettingsForm AppSettingsFormTest build/modules/contrib/apigee_edge/tests/src/FunctionalJavascript/AppSettingsFormTest.php # to run one specific test. If you pass any arguments to run-test.sh those get passed directly to PHPUnit. See [.travis/run-test.sh](run-test.sh). docker-compose down --remove-orphans -v # Intermediate data (like module files) must be cleared from the shared volumes otherwise recent changes won't be visible in the container. ``` @@ -146,7 +148,7 @@ repository URL: `https://${LOGS_REPO_USER}:${LOGS_REPO_PASSWORD}@${LOGS_REPO_HOST}/${LOGS_REPO_USER}/${LOGS_REPO_NAME}.git` ### If your pull request relies on changes that are not yet available in Apigee Edge Client Library for PHP's latest stable release -Please *temporary* add required changes as patches to module's composer.json. +You should *temporarily* add required changes as patches to module's composer.json. This way this module's tests could pass on Travis CI. #### Example: diff --git a/README.md b/README.md index 04b24fb91..36b496e31 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ The Apigee Edge module enables you to integrate Drupal 8 with Apigee Edge. ### Requirements * Drupal 8's minimum requirement is phpdocumentor/reflection-docblock:2.0.4 but at least 3.0 is required by this module. If you get the error "Your requirements could not be resolved to an installable set of packages" it may be because you are running reflection-docblock version 2. You can update `phpdocumentor/reflection-docblock` with the following command: `composer update phpdocumentor/reflection-docblock --with-dependencies`. -* **Please check [composer.json](https://github.com/apigee/apigee-edge-drupal/blob/8.x-1.x/composer.json) for required patches.** Patches prefixed with "(For testing)" are only required for running tests. Those are not necessary for using this module. Patches can be applied with the [cweagans/composer-patches](https://packagist.org/packages/cweagans/composer-patches) the plugin automatically or manually. -* (For developers) The locked commit from `behat/mink` library is required otherwise tests may fail. This caused by a Drupal core [bug](https://www.drupal.org/project/drupal/issues/2956279). Please see the related pull request for behat/mink [here](https://github.com/minkphp/Mink/pull/760). +* **Check [composer.json](https://github.com/apigee/apigee-edge-drupal/blob/8.x-1.x/composer.json) for required patches.** Patches prefixed with "(For testing)" are only required for running tests. Those are not necessary for using this module. Patches can be applied with the [cweagans/composer-patches](https://packagist.org/packages/cweagans/composer-patches) the plugin automatically or manually. +* (For developers) The locked commit from `behat/mink` library is required otherwise tests may fail. This caused by a Drupal core [bug](https://www.drupal.org/project/drupal/issues/2956279). See the related pull request for behat/mink [here](https://github.com/minkphp/Mink/pull/760). ### Troubleshooting diff --git a/apigee_edge.install b/apigee_edge.install index 6d75a712b..8e3f1c140 100644 --- a/apigee_edge.install +++ b/apigee_edge.install @@ -56,7 +56,7 @@ function apigee_edge_requirements($phase) { $requirements['apigee_edge_connection_error'] = [ 'title' => t('Apigee Edge'), 'value' => $exception->getMessage(), - 'description' => t('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge Configuration page to get more information.', [ + 'description' => t('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge general configuration page to get more information.', [ ':url' => Url::fromRoute('apigee_edge.settings', ['destination' => 'admin/reports/status'])->toString(), ]), 'severity' => REQUIREMENT_WARNING, diff --git a/apigee_edge.routing.yml b/apigee_edge.routing.yml index ac4703d58..09ffa27a2 100644 --- a/apigee_edge.routing.yml +++ b/apigee_edge.routing.yml @@ -19,7 +19,7 @@ apigee_edge.settings: path: '/admin/config/apigee-edge/settings' defaults: _form: '\Drupal\apigee_edge\Form\AuthenticationForm' - _title: 'Apigee Edge Configuration' + _title: 'Apigee Edge general configuration' requirements: _permission: 'administer apigee edge' @@ -27,7 +27,7 @@ apigee_edge.settings.connection_config: path: '/admin/config/apigee-edge/connection-config' defaults: _form: '\Drupal\apigee_edge\Form\ConnectionConfigForm' - _title: 'Connection Config' + _title: 'Connection config' requirements: _permission: 'administer apigee edge' @@ -35,7 +35,7 @@ apigee_edge.settings.error_page: path: '/admin/config/apigee-edge/error-page-settings' defaults: _form: '\Drupal\apigee_edge\Form\ErrorPageSettingsForm' - _title: 'Error Page Settings' + _title: 'Error page settings' requirements: _permission: 'administer apigee edge' @@ -43,7 +43,7 @@ apigee_edge.settings.developer: path: '/admin/config/apigee-edge/developer-settings' defaults: _form: '\Drupal\apigee_edge\Form\DeveloperSettingsForm' - _title: 'Developer Settings' + _title: 'Developer settings' requirements: _permission: 'administer apigee edge' @@ -51,7 +51,7 @@ apigee_edge.settings.developer.email_validation: path: '/admin/config/apigee-edge/developer-settings/attributes' defaults: _form: '\Drupal\apigee_edge\Form\DeveloperAttributesSettingsForm' - _title: 'Custom Attributes' + _title: 'Custom attributes' requirements: _permission: 'administer apigee edge' @@ -75,7 +75,7 @@ apigee_edge.settings.product.alias: path: '/admin/config/apigee-edge/product-settings/alias' defaults: _form: '\Drupal\apigee_edge\Form\ProductAliasForm' - _title: 'API Product Settings' + _title: 'API product settings' requirements: _permission: 'administer apigee edge' @@ -83,14 +83,14 @@ apigee_edge.settings.product.caching: path: '/admin/config/apigee-edge/product-settings/caching' defaults: _form: '\Drupal\apigee_edge\Form\ProductCachingForm' - _title: 'API Product caching' + _title: 'API product caching' requirements: _permission: 'administer apigee edge' apigee_edge.settings.product.access_control: path: '/admin/config/apigee-edge/product-settings/access-control' defaults: _form: '\Drupal\apigee_edge\Form\ProductAccessControlForm' - _title: 'API Product access control' + _title: 'API product access control' requirements: _permission: 'administer apigee edge' @@ -98,7 +98,7 @@ apigee_edge.settings.app: path: '/admin/config/apigee-edge/app-settings' defaults: _form: '\Drupal\apigee_edge\Form\AppSettingsForm' - _title: 'App Settings' + _title: 'App settings' requirements: _permission: 'administer apigee edge' diff --git a/config/install/apigee_edge.developer_app_settings.yml b/config/install/apigee_edge.developer_app_settings.yml index abe191fc1..2a33d398a 100644 --- a/config/install/apigee_edge.developer_app_settings.yml +++ b/config/install/apigee_edge.developer_app_settings.yml @@ -1,6 +1,6 @@ langcode: en -entity_label_singular: '' -entity_label_plural: '' +entity_label_singular: 'App' +entity_label_plural: 'Apps' cache_expiration: 900 credential_lifetime: 0 locked_base_fields: diff --git a/config/install/apigee_edge.error_page.yml b/config/install/apigee_edge.error_page.yml index 6896684e5..1f4d4ac88 100644 --- a/config/install/apigee_edge.error_page.yml +++ b/config/install/apigee_edge.error_page.yml @@ -1,5 +1,5 @@ langcode: en -error_page_title: 'Connection Error' +error_page_title: 'Connection error' error_page_content: - value: 'There is a problem with the connection to the API server. Please contact the Developer Portal support for further assistance.' + value: 'Cannot reach management server. An administrator should check the configuration of this site.' format: 'plain_text' diff --git a/css/apigee_edge.admin.css b/css/apigee_edge.admin.css index 7d656b8c7..f04270235 100644 --- a/css/apigee_edge.admin.css +++ b/css/apigee_edge.admin.css @@ -23,15 +23,6 @@ margin-top: 10px; } -.info-circle { - border-radius: 50%; - color: white; - width: 16px; - height: 16px; - background: #5c5c5b; - display: inline-block; - text-align: center; -} .table--developer-attributes { margin-top: 20px; diff --git a/src/Form/DeveloperSyncForm.php b/src/Form/DeveloperSyncForm.php index 046a3ad96..d6c010a77 100644 --- a/src/Form/DeveloperSyncForm.php +++ b/src/Form/DeveloperSyncForm.php @@ -46,8 +46,17 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Sync developers'), '#open' => TRUE, ]; + + $form['sync']['description'] = [ + '#type' => 'html_tag', + '#tag' => 'p', + '#value' => $this->t('Developer synchronization will run through all users in this portal, adding them as developers in the Apigee Edge org, and making sure all developers on the Apigee Edge org are added to this portal. The "Run Developer Sync" button will sync the developers, displaying a progress bar. The "Background Developer Sync" button will run the developer sync process in batches each time cron runs.', [ + ':cron_url' => Url::fromRoute('system.cron_settings')->toString(), + ]), + ]; + $form['sync']['sync_submit'] = [ - '#title' => $this->t('Now'), + '#title' => $this->t('Run Developer Sync'), '#type' => 'link', '#url' => $this->buildUrl('apigee_edge.user_sync.run'), '#attributes' => [ @@ -58,7 +67,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ], ]; $form['sync']['background_sync_submit'] = [ - '#title' => $this->t('Background'), + '#title' => $this->t('Background Developer Sync'), '#type' => 'link', '#url' => $this->buildUrl('apigee_edge.user_sync.schedule'), '#attributes' => [ @@ -67,15 +76,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { ], ], ]; - $form['sync']['sync_info'] = [ - '#type' => 'html_tag', - '#tag' => 'span', - '#value' => '?', - '#attributes' => [ - 'class' => 'info-circle', - 'title' => $this->t('A background sync is recommended for large numbers of developers.'), - ], - ]; return $form; } diff --git a/src/Form/ErrorPageSettingsForm.php b/src/Form/ErrorPageSettingsForm.php index 09e69bfab..1b664aa6e 100644 --- a/src/Form/ErrorPageSettingsForm.php +++ b/src/Form/ErrorPageSettingsForm.php @@ -51,7 +51,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['error_page'] = [ '#type' => 'fieldset', - '#title' => $this->t('The displayed title and content on the error page.'), + '#title' => $this->t('Displayed title and content on error page'), '#collapsible' => FALSE, ]; diff --git a/src/Plugin/KeyInput/BasicAuthKeyInput.php b/src/Plugin/KeyInput/BasicAuthKeyInput.php index 413b7f5c3..cf864f249 100644 --- a/src/Plugin/KeyInput/BasicAuthKeyInput.php +++ b/src/Plugin/KeyInput/BasicAuthKeyInput.php @@ -48,7 +48,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $form['organization'] = [ '#type' => 'textfield', '#title' => $this->t('Organization'), - '#description' => $this->t('Name of the organization on Edge. Changing this value could make your site stop working.'), + '#description' => $this->t('Name of the Apigee Edge organization. Changing this value could make your site stop working.'), '#required' => $key->getKeyType()->getPluginDefinition()['multivalue']['fields']['organization']['required'], '#default_value' => $values['organization'], '#attributes' => ['autocomplete' => 'off'], @@ -71,7 +71,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $form['endpoint'] = [ '#type' => 'textfield', '#title' => $this->t('Apigee Edge endpoint'), - '#description' => $this->t('Apigee Edge endpoint where the API calls are being sent. Leave empty to use the default https://api.enterprise.apigee.com/v1 endpoint.'), + '#description' => $this->t('Apigee Edge endpoint where the API calls are being sent. Leave empty to use the public cloud endpoint https://api.enterprise.apigee.com/v1.'), '#required' => $key->getKeyType()->getPluginDefinition()['multivalue']['fields']['endpoint']['required'], '#default_value' => $values['endpoint'], '#attributes' => ['autocomplete' => 'off'], diff --git a/src/Plugin/KeyProvider/PrivateFileKeyProvider.php b/src/Plugin/KeyProvider/PrivateFileKeyProvider.php index d7ea18bd9..7565110c7 100644 --- a/src/Plugin/KeyProvider/PrivateFileKeyProvider.php +++ b/src/Plugin/KeyProvider/PrivateFileKeyProvider.php @@ -35,7 +35,7 @@ * @KeyProvider( * id = "apigee_edge_private_file", * label = @Translation("Apigee Edge: Private File"), - * description = @Translation("Stores Apigee Edge authentication credentials in a private file.

Warning! Private file storage is suitable only for testing environments. In production environments, use the Apigee Edge: Environment Variables key provider.

"), + * description = @Translation("Stores Apigee Edge authentication credentials in a private file.

"), * storage_method = "apigee_edge", * key_value = { * "accepted" = TRUE, diff --git a/tests/src/Functional/RequirementsTest.php b/tests/src/Functional/RequirementsTest.php index 6510fd0bd..ca8ee3594 100644 --- a/tests/src/Functional/RequirementsTest.php +++ b/tests/src/Functional/RequirementsTest.php @@ -52,7 +52,7 @@ public function testInvalidCredentials() { $this->invalidateKey(); $this->drupalGet('/admin/reports/status'); $this->assertSession()->pageTextContains('Apigee Edge API authentication key not found.'); - $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge Configuration page to get more information.'); + $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge general configuration page to get more information.'); // Create new Apigee Edge basic auth key with private file provider. $key = Key::create([ @@ -86,14 +86,14 @@ public function testInvalidCredentials() { $this->drupalGet('/admin/reports/status'); $this->assertSession()->pageTextContains('Unauthorized'); - $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge Configuration page to get more information.'); + $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge general configuration page to get more information.'); // Delete authentication key. Key::load('private_file')->delete(); $this->drupalGet('/admin/reports/status'); $this->assertSession()->pageTextContains('Apigee Edge API authentication key not found.'); - $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge Configuration page to get more information.'); + $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge general configuration page to get more information.'); // Create new Apigee Edge OAuth key with private file provider. $key = Key::create([ @@ -137,7 +137,7 @@ public function testInvalidCredentials() { $this->drupalGet('/admin/reports/status'); $this->assertSession()->pageTextContains('Forbidden'); - $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge Configuration page to get more information.'); + $this->assertSession()->pageTextContains('Cannot connect to Apigee Edge server. You have either given wrong credential details or the Edge server is unreachable. Visit the Apigee Edge general configuration page to get more information.'); // Unset private file path. $settings['settings']['file_private_path'] = (object) [