Skip to content

Commit

Permalink
EPMRPP-90383 || Error on redirection to project monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
maria-hambardzumian committed Apr 29, 2024
1 parent c241e3d commit 320bc75
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/src/common/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export const URLS = {
githubAuthSettings: () => `${uatBase}settings/oauth/github`,
analyticsServerSettings: () => `${urlBase}settings/analytics`,
events: (projectKey) => `${urlBase}${projectKey}/activity`,
eventsController: () => `${urlBase}activities/searches`,
searchEventsBySubjectName: (projectName) => (searchTerm = '') =>
`${urlBase}activities/${projectName}/subjectName?filter.cnt.subjectName=${searchTerm}`,
allUsers: () => `${urlCommonBase}users/all`,
Expand Down
7 changes: 4 additions & 3 deletions app/src/controllers/administrate/sagas.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 EPAM Systems
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,13 +19,14 @@ import { MONITORING, MEMBERS } from 'common/constants/projectSections';
import { projectSectionSelector } from 'controllers/pages';
import { projectKeySelector, fetchProjectAction } from 'controllers/project';
import { fetchMembersAction } from 'controllers/members';
import { eventsSagas, fetchEventsAction } from './events';
import { fetchMonitoringAction } from 'controllers/monitoring/actionCreators';
import { eventsSagas } from './events';
import { allUsersSagas } from './allUsers';
import { projectsSagas } from './projects';
import { FETCH_PROJECT_DATA } from './constants';

const pageDataActions = {
[MONITORING]: fetchEventsAction,
[MONITORING]: fetchMonitoringAction,
[MEMBERS]: fetchMembersAction,
};
function* fetchProjectData() {
Expand Down
23 changes: 23 additions & 0 deletions app/src/controllers/monitoring/actionCreators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { FETCH_MONITORING } from './constants';

export const fetchMonitoringAction = () => {
return {
type: FETCH_MONITORING,
};
};
23 changes: 23 additions & 0 deletions app/src/controllers/monitoring/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { formatSortingString, SORTING_DESC } from 'controllers/sorting';
import { ENTITY_CREATED_AT } from 'components/filterEntities/constants';

export const FETCH_MONITORING = 'fetchMonitoring';
export const NAMESPACE = 'events';

export const DEFAULT_SORTING = formatSortingString([ENTITY_CREATED_AT], SORTING_DESC);
18 changes: 18 additions & 0 deletions app/src/controllers/monitoring/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export { fetchMonitoringAction } from './actionCreators';
export { monitoringSagas } from './sagas';
43 changes: 43 additions & 0 deletions app/src/controllers/monitoring/sagas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { takeEvery, all, put, select } from 'redux-saga/effects';
import { fetchDataAction } from 'controllers/fetch';
import { URLS } from 'common/urls';
import { projectKeySelector } from 'controllers/project';
import { NAMESPACE, FETCH_MONITORING } from './constants';
import { querySelector } from './selectors';

function* fetchMonitoring() {
const { appliedFilters, alternativePaginationAndSortParams } = yield select(querySelector);
const projectKey = yield select(projectKeySelector);

yield put(
fetchDataAction(NAMESPACE)(URLS.eventsController(projectKey), {
method: 'POST',
params: alternativePaginationAndSortParams,
data: appliedFilters,
}),
);
}

function* watchFetchMonitoring() {
yield takeEvery(FETCH_MONITORING, fetchMonitoring);
}

export function* monitoringSagas() {
yield all([watchFetchMonitoring()]);
}
24 changes: 24 additions & 0 deletions app/src/controllers/monitoring/selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { DEFAULT_PAGINATION } from 'controllers/pagination';
import { createEventsPageQueryParametersSelector } from 'controllers/administrate/events/selectors';
import { DEFAULT_SORTING } from './constants';

export const querySelector = createEventsPageQueryParametersSelector({
defaultPagination: DEFAULT_PAGINATION,
defaultSorting: DEFAULT_SORTING,
});
4 changes: 3 additions & 1 deletion app/src/store/rootSaga.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 EPAM Systems
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,6 +25,7 @@ import { dashboardSagas } from 'controllers/dashboard';
import { filterSagas } from 'controllers/filter';
import { testSagas } from 'controllers/test';
import { membersSagas } from 'controllers/members';
import { monitoringSagas } from 'controllers/monitoring';
import { testItemsSagas } from 'controllers/testItem';
import { historySagas } from 'controllers/itemsHistory';
import { logSagas } from 'controllers/log';
Expand All @@ -47,6 +48,7 @@ const sagas = [
filterSagas,
testSagas,
membersSagas,
monitoringSagas,
testItemsSagas,
logSagas,
historySagas,
Expand Down

0 comments on commit 320bc75

Please sign in to comment.