Skip to content

Commit

Permalink
e2t: Add setting for filtering e2t datasets displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
torotil committed Feb 3, 2023
1 parent 9716454 commit 3f13594
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Expand Up @@ -16,5 +16,12 @@ function campaignion_email_to_target_variable_info($options) {
'default' => '',
'localize' => FALSE,
];
$v['campaignion_email_to_target_dataset_query'] = [
'title' => t('Dataset GET-query string'),
'description' => t('Default query parameters for the dataset listing including the leading question mark.'),
'type' => 'string',
'default' => '',
'localize' => FALSE,
];
return $v;
}
3 changes: 2 additions & 1 deletion campaignion_email_to_target/datasets_app/src/utils/api.js
@@ -1,6 +1,7 @@
import axios from 'axios'

const url = Drupal.settings.campaignion_email_to_target.endpoints['e2t-api'].url + '/'
const datasetQuery = Drupal.settings.campaignion_email_to_target.datasetQuery
const headers = {
Authorization: 'Bearer ' + Drupal.settings.campaignion_email_to_target.endpoints['e2t-api'].token
}
Expand All @@ -11,7 +12,7 @@ export default {
* @return {Promise} axios response.
*/
getDatasets () {
return axios.get(url, {headers})
return axios.get(url + datasetQuery, {headers})
},

/**
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions campaignion_email_to_target/src/Wizard/TargetStep.php
Expand Up @@ -109,6 +109,7 @@ public function stepForm($form, &$form_state) {
'url' => $this->api->getEndpoint(),
'token' => $this->api->getAccessToken(),
];
$settings['datasetQuery'] = variable_get_value('campaignion_email_to_target_dataset_query');

$settings = ['campaignion_email_to_target' => $settings];
$dir = drupal_get_path('module', 'campaignion_email_to_target');
Expand Down

0 comments on commit 3f13594

Please sign in to comment.