Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"moment-timezone": "^0.5.33",
"openstack-uicore-foundation": "5.0.36-beta.1",
"openstack-uicore-foundation": "5.0.36-beta.2",
"p-limit": "^6.1.0",
"path-browserify": "^1.0.1",
"postcss-loader": "^6.2.1",
Expand Down
120 changes: 59 additions & 61 deletions src/actions/event-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
FIVE_PER_PAGE,
HOUR_AND_HALF
} from "../utils/constants";
import { getIdValue } from "../utils/summitUtils";

URI.escapeQuerySpace = false;

Expand Down Expand Up @@ -195,12 +194,12 @@ export const normalizeBulkEvents = (entity) => {
const normalizedEvent = {
id: e.id,
title: e.title,
selection_plan_id: getIdValue(e.selection_plan) || e.selection_plan_id,
selection_plan_id: e.selection_plan?.id || e.selection_plan_id,
location_id: e.location?.id || e.location_id,
start_date: e.start_date,
end_date: e.end_date,
type_id: getIdValue(e.type) || e.type_id,
track_id: getIdValue(e.track) || e.track_id,
type_id: e.type?.id || e.type_id,
track_id: e.track?.id || e.track_id,
duration: e.duration,
streaming_url: e.streaming_url,
streaming_type: e.streaming_type,
Expand Down Expand Up @@ -299,66 +298,65 @@ export const getEvents =
});
};

export const bulkUpdateEvents =
(summitId, events) => async (dispatch, getState) => {
const { currentSummitState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;
dispatch(startLoading());
export const bulkUpdateEvents = (events) => async (dispatch, getState) => {
const { currentSummitState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;
dispatch(startLoading());

const normalizedEvents = normalizeBulkEvents(
events.map((event) =>
normalizeEvent(
event,
currentSummit.event_types.find((et) => et.id === event.type_id)
)
const normalizedEvents = normalizeBulkEvents(
events.map((event) =>
normalizeEvent(
event,
currentSummit.event_types.find((et) => et.id === event.type_id)
)
);
)
);

return putRequest(
null,
createAction(UPDATED_REMOTE_EVENTS)({}),
`${window.API_BASE_URL}/api/v1/summits/${summitId}/events/?access_token=${accessToken}`,
{
events: normalizedEvents
},
authErrorHandler
)({})(dispatch)
.then(() => {
dispatch(stopLoading());
dispatch(
showSuccessMessage(
T.translate("bulk_actions_page.messages.update_success"),
() => history.push(`/app/summits/${currentSummit.id}/events/`)
)
);
const {
currentEventListState: {
term,
currentPage,
perPage,
order,
orderDir,
filters,
extraColumns
}
} = getState();
dispatch(
getEvents(
term,
currentPage,
perPage,
order,
orderDir,
filters,
extraColumns
)
);
})
.catch(() => {
console.log("ERROR");
});
};
return putRequest(
null,
createAction(UPDATED_REMOTE_EVENTS)({}),
`${window.API_BASE_URL}/api/v1/summits/${currentSummit.id}/events/?access_token=${accessToken}`,
{
events: normalizedEvents
},
authErrorHandler
)({})(dispatch)
.then(() => {
dispatch(stopLoading());
dispatch(
showSuccessMessage(
T.translate("bulk_actions_page.messages.update_success"),
() => history.push(`/app/summits/${currentSummit.id}/events/`)
)
);
const {
currentEventListState: {
term,
currentPage,
perPage,
order,
orderDir,
filters,
extraColumns
}
} = getState();
dispatch(
getEvents(
term,
currentPage,
perPage,
order,
orderDir,
filters,
extraColumns
)
);
})
.catch(() => {
console.log("ERROR");
});
};

export const getActionTypes =
(selectionPlanId) => async (dispatch, getState) => {
Expand Down
Loading
Loading