Skip to content

Commit

Permalink
Adjust params for template search, change menu text, initial order di…
Browse files Browse the repository at this point in the history
…r on reducer

Signed-off-by: Tomás Castillo <[email protected]>
  • Loading branch information
tomrndom committed Jul 8, 2024
1 parent 23df79c commit 1181741
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/actions/email-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from 'openstack-uicore-foundation/lib/utils/actions';
import {checkOrFilter,getAccessTokenSafely} from '../utils/methods';
import { saveMarketingSetting } from "./marketing-actions";
import URI from "urijs";


export const REQUEST_TEMPLATES = 'REQUEST_TEMPLATES';
Expand Down Expand Up @@ -234,10 +235,19 @@ const normalizeEntity = (entity) => {
export const queryTemplates = _.debounce(async (input, callback) => {

const accessToken = await getAccessTokenSafely();


let endpoint = URI(`${window.EMAIL_API_BASE_URL}/api/v1/mail-templates`);

input = escapeFilterValue(input);

fetch(`${window.EMAIL_API_BASE_URL}/api/v1/mail-templates?identifier__contains=${input}&access_token=${accessToken}`)
endpoint.addQuery('access_token', accessToken);
endpoint.addQuery('order','-id')

if(input) {
endpoint.addQuery('identifier__contains', input);
}

fetch(endpoint)
.then(fetchResponseHandler)
.then((json) => {
const options = [...json.data];
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"emails": "Emails",
"email_templates": "Templates",
"sent_email": "Sent Emails",
"email_logs": "Email Logs",
"email_logs": "Logs",
"summitdocs": "Event Docs",
"email_flow_events": "Email Events",
"email_flow_overrides": "Overrides",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/emails/email-log-list-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const SentEmailListPage = ({
...props
}) => {
useEffect(() => {
props.getSentEmails(term, currentPage, perPage, order, 0, filters);
props.getSentEmails(term, currentPage, perPage, order, orderDir, filters);
}, []);

const defaultFilters = {
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/emails/email-log-list-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DEFAULT_STATE = {
emails : [],
term : '',
order : 'id',
orderDir : 1,
orderDir : 0,
currentPage : 1,
lastPage : 1,
perPage : 10,
Expand Down

0 comments on commit 1181741

Please sign in to comment.