Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the option to turn off server side filtering #182

Merged
merged 1 commit into from
Jul 17, 2023
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
26 changes: 1 addition & 25 deletions src/components/SettingsModal/SettingsModalComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import {
toggleSettingsModal as toggleSettingsModalConnected,
setDefaultSinceDateTenor as setDefaultSinceDateTenorConnected,
setMaxRateLimit as setMaxRateLimitConnected,
setServerSideFiltering as setServerSideFilteringConnected,
setSearchAllCustomDetails as setSearchAllCustomDetailsConnected,
setRespondersInEpFilter as setRespondersInEpFilterConnected,
setRelativeDates as setRelativeDatesConnected,
Expand All @@ -72,7 +71,6 @@ const SettingsModalComponent = () => {
displaySettingsModal,
defaultSinceDateTenor,
maxRateLimit,
serverSideFiltering,
searchAllCustomDetails,
respondersInEpFilter,
relativeDates,
Expand All @@ -88,9 +86,6 @@ const SettingsModalComponent = () => {
const setMaxRateLimit = (newMaxRateLimit) => {
dispatch(setMaxRateLimitConnected(newMaxRateLimit));
};
const setServerSideFiltering = (newServerSideFiltering) => {
dispatch(setServerSideFilteringConnected(newServerSideFiltering));
};
const setSearchAllCustomDetails = (newSearchAllCustomDetails) => {
dispatch(setSearchAllCustomDetailsConnected(newSearchAllCustomDetails));
};
Expand All @@ -110,7 +105,6 @@ const SettingsModalComponent = () => {

const [tempMaxRateLimit, setTempMaxRateLimit] = useState(maxRateLimit);

const [tempServerSideFiltering, setTempServerSideFiltering] = useState(serverSideFiltering);
const [tempSearchAllCustomDetails, setTempSearchAllCustomDetails] = useState(searchAllCustomDetails);
const [tempRespondersInEpFilter, setTempRespondersInEpFilter] = useState(respondersInEpFilter);
const [tempRelativeDates, setTempRelativeDates] = useState(relativeDates);
Expand All @@ -125,9 +119,6 @@ const SettingsModalComponent = () => {
if (tempMaxRateLimit !== maxRateLimit) {
setMaxRateLimit(tempMaxRateLimit);
}
if (tempServerSideFiltering !== serverSideFiltering) {
setServerSideFiltering(tempServerSideFiltering);
}
if (tempSearchAllCustomDetails !== searchAllCustomDetails) {
setSearchAllCustomDetails(tempSearchAllCustomDetails);
}
Expand Down Expand Up @@ -210,27 +201,12 @@ const SettingsModalComponent = () => {
</InputGroup>
</Box>
</FormControl>
<FormControl>
<FormLabel htmlFor="server-side-filtering-switch">
{t('Server Side Filtering')}
</FormLabel>
<Switch
id="server-side-filtering-switch"
isChecked={tempServerSideFiltering}
aria-label={t('Server Side Filtering')}
onChange={(e) => {
setTempServerSideFiltering(e.target.checked);
}}
>
{t('Server Side Filtering')}
</Switch>
</FormControl>
<FormControl>
<FormLabel htmlFor="search-all-custom-details-switch">{t('Global Search')}</FormLabel>
<Switch
id="search-all-custom-details-switch"
isChecked={tempSearchAllCustomDetails}
aria-label={t('Server Side Filtering')}
aria-label={t('Search all alert custom details in global search')}
onChange={(e) => {
setTempSearchAllCustomDetails(e.target.checked);
}}
Expand Down
2 changes: 0 additions & 2 deletions src/components/SettingsModal/SettingsModalComponent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('SettingsModalComponent', () => {
displaySettingsModal: true,
defaultSinceDateTenor: '1 Day',
maxRateLimit: MAX_RATE_LIMIT_LOWER,
serverSideFiltering: true,
searchAllCustomDetails: true,
respondersInEpFilter: true,
relativeDates: true,
Expand All @@ -47,7 +46,6 @@ describe('SettingsModalComponent', () => {
MAX_RATE_LIMIT_LOWER,
);

expect(wrapper.find('input#server-side-filtering-switch').prop('checked')).toBeTruthy();
expect(wrapper.find('input#search-all-custom-details-switch').prop('checked')).toBeTruthy();
expect(wrapper.find('input#responders-in-ep-filter-switch').prop('checked')).toBeTruthy();
expect(wrapper.find('input#relative-dates-switch').prop('checked')).toBeTruthy();
Expand Down
1 change: 0 additions & 1 deletion src/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Auswählen...",
"Selected": "Ausgewählt",
"Selected Incidents": "Ausgewählte Vorfälle",
"Server Side Filtering": "Serverseitige Filterung",
"Service": "Service",
"Services": "Services",
"Settings": "Einstellungen",
Expand Down
1 change: 0 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Select...",
"Selected": "Selected",
"Selected Incidents": "Selected Incidents",
"Server Side Filtering": "Server Side Filtering",
"Service": "Service",
"Services": "Services",
"Settings": "Settings",
Expand Down
1 change: 0 additions & 1 deletion src/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Seleccione...",
"Selected": "Seleccionado",
"Selected Incidents": "Incidentes seleccionados",
"Server Side Filtering": "Filtrado del lado del servidor",
"Service": "Servicio",
"Services": "Servicios",
"Settings": "Configuración",
Expand Down
1 change: 0 additions & 1 deletion src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Sélectionner...",
"Selected": "Sélectionné",
"Selected Incidents": "Incidents sélectionnés",
"Server Side Filtering": "Filtrage côté serveur",
"Service": "Service",
"Services": "Services",
"Settings": "Paramètres",
Expand Down
1 change: 0 additions & 1 deletion src/locales/id/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Pilih...",
"Selected": "Terpilih",
"Selected Incidents": "Insiden Terpilih",
"Server Side Filtering": "Filtering Sisi Server",
"Service": "Layanan",
"Services": "Layanan",
"Settings": "Pengaturan",
Expand Down
1 change: 0 additions & 1 deletion src/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "...を選択",
"Selected": "選択中",
"Selected Incidents": "選択したインシデント",
"Server Side Filtering": "サーバーサイドフィルタリング",
"Service": "サービス",
"Services": "サービス",
"Settings": "設定",
Expand Down
1 change: 0 additions & 1 deletion src/locales/pt-br/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Selecione...",
"Selected": "Selecionado",
"Selected Incidents": "Incidentes Selecionados",
"Server Side Filtering": "Filtragem do Lado do Servidor",
"Service": "Serviço",
"Services": "Serviços",
"Settings": "Configurações",
Expand Down
1 change: 0 additions & 1 deletion src/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
"Select dotdotdot": "Selecione...",
"Selected": "Selecionado",
"Selected Incidents": "Incidentes Selecionados",
"Server Side Filtering": "Filtragem do Lado do Servidor",
"Service": "Serviço",
"Services": "Serviços",
"Settings": "Configurações",
Expand Down
15 changes: 5 additions & 10 deletions src/redux/incidents/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ export function* getIncidentsImpl() {
const {
sinceDate, incidentStatus, incidentUrgency, teamIds, serviceIds, userIds,
} = yield select(selectQuerySettings);
const {
serverSideFiltering,
} = yield select(selectSettings);

const baseParams = {
since: DEBUG_SINCE_DATE ? new Date(DEBUG_SINCE_DATE).toISOString() : sinceDate.toISOString(),
Expand All @@ -125,13 +122,11 @@ export function* getIncidentsImpl() {
sort_by: 'created_at:desc',
};

if (serverSideFiltering) {
if (incidentStatus) baseParams.statuses = incidentStatus;
if (incidentUrgency) baseParams.urgencies = incidentUrgency;
if (teamIds.length) baseParams.team_ids = teamIds;
if (serviceIds.length) baseParams.service_ids = serviceIds;
if (userIds.length) baseParams.user_ids = userIds;
}
if (incidentStatus) baseParams.statuses = incidentStatus;
if (incidentUrgency) baseParams.urgencies = incidentUrgency;
if (teamIds.length) baseParams.team_ids = teamIds;
if (serviceIds.length) baseParams.service_ids = serviceIds;
if (userIds.length) baseParams.user_ids = userIds;

incidents = yield call(pdParallelFetch, 'incidents', baseParams, null, {
priority: 5,
Expand Down
62 changes: 15 additions & 47 deletions src/redux/query_settings/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import i18next from 'i18n';
// throttledPdAxiosRequest,
// } from 'util/pd-api-wrapper';

import selectSettings from 'redux/settings/selectors';

import {
UPDATE_CONNECTION_STATUS_REQUESTED,
} from 'redux/connection/actions';
Expand Down Expand Up @@ -112,20 +110,14 @@ export function* updateQuerySettingsIncidentStatusImpl(action) {
incidentStatus,
} = action;

const {
serverSideFiltering,
} = yield select(selectSettings);

yield put({
type: UPDATE_QUERY_SETTING_INCIDENT_STATUS_COMPLETED,
incidentStatus,
});

if (serverSideFiltering) {
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});
}
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});

yield put({
type: FILTER_INCIDENTS_LIST,
Expand All @@ -145,20 +137,14 @@ export function* updateQuerySettingsIncidentUrgencyImpl(action) {
incidentUrgency,
} = action;

const {
serverSideFiltering,
} = yield select(selectSettings);

yield put({
type: UPDATE_QUERY_SETTING_INCIDENT_URGENCY_COMPLETED,
incidentUrgency,
});

if (serverSideFiltering) {
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});
}
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});

yield put({
type: FILTER_INCIDENTS_LIST,
Expand Down Expand Up @@ -197,19 +183,13 @@ export function* updateQuerySettingsTeamsImpl(action) {
teamIds,
} = action;

const {
serverSideFiltering,
} = yield select(selectSettings);

// yield put({ type: FETCH_SERVICES_REQUESTED, teamIds });
// yield put({ type: GET_USERS_REQUESTED, teamIds });
yield put({ type: UPDATE_QUERY_SETTINGS_TEAMS_COMPLETED, teamIds });

if (serverSideFiltering) {
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});
}
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});

yield put({
type: FILTER_INCIDENTS_LIST,
Expand Down Expand Up @@ -246,17 +226,11 @@ export function* updateQuerySettingsServicesImpl(action) {
serviceIds,
} = action;

const {
serverSideFiltering,
} = yield select(selectSettings);

yield put({ type: UPDATE_QUERY_SETTINGS_SERVICES_COMPLETED, serviceIds });

if (serverSideFiltering) {
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});
}
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});

yield put({
type: FILTER_INCIDENTS_LIST,
Expand All @@ -274,17 +248,11 @@ export function* updateQuerySettingsUsersImpl(action) {
userIds,
} = action;

const {
serverSideFiltering,
} = yield select(selectSettings);

yield put({ type: UPDATE_QUERY_SETTINGS_USERS_COMPLETED, userIds });

if (serverSideFiltering) {
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});
}
yield put({
type: FETCH_INCIDENTS_REQUESTED,
});

yield put({
type: FILTER_INCIDENTS_LIST,
Expand Down
1 change: 0 additions & 1 deletion src/redux/query_settings/sagas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ describe('Sagas: Query Settings', () => {
};
const mockSettings = {
autoAcceptIncidentsQuery: true,
serverSideFiltering: true,
};

xit('validateIncidentQueryImpl: API Error', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/redux/rootSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ import {
setAutoAcceptIncidentsQuery,
setAutoRefreshInterval,
setDarkMode,
setServerSideFiltering,
setRelativeDates,
clearLocalCache,
} from './settings/sagas';
Expand Down Expand Up @@ -244,7 +243,6 @@ export default function* rootSaga() {
setAutoAcceptIncidentsQuery(),
setAutoRefreshInterval(),
setDarkMode(),
setServerSideFiltering(),
setRelativeDates(),
clearLocalCache(),

Expand Down
8 changes: 0 additions & 8 deletions src/redux/settings/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export const CLEAR_LOCAL_CACHE_COMPLETED = 'CLEAR_LOCAL_CACHE_COMPLETED';
export const SET_DARK_MODE_REQUESTED = 'SET_DARK_MODE_REQUESTED';
export const SET_DARK_MODE_COMPLETED = 'SET_DARK_MODE_COMPLETED';

export const SET_SERVER_SIDE_FILTERING_REQUESTED = 'SET_SERVER_SIDE_FILTERING_REQUESTED';
export const SET_SERVER_SIDE_FILTERING_COMPLETED = 'SET_SERVER_SIDE_FILTERING_COMPLETED';

export const SET_RELATIVE_DATES_REQUESTED = 'SET_RELATIVE_DATES_REQUESTED';
export const SET_RELATIVE_DATES_COMPLETED = 'SET_RELATIVE_DATES_COMPLETED';

Expand Down Expand Up @@ -92,11 +89,6 @@ export const setDarkMode = (darkMode) => ({
darkMode,
});

export const setServerSideFiltering = (serverSideFiltering) => ({
type: SET_SERVER_SIDE_FILTERING_REQUESTED,
serverSideFiltering,
});

export const setRelativeDates = (relativeDates) => ({
type: SET_RELATIVE_DATES_REQUESTED,
relativeDates,
Expand Down
12 changes: 0 additions & 12 deletions src/redux/settings/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import {
CLEAR_LOCAL_CACHE_COMPLETED,
SET_DARK_MODE_REQUESTED,
SET_DARK_MODE_COMPLETED,
SET_SERVER_SIDE_FILTERING_REQUESTED,
SET_SERVER_SIDE_FILTERING_COMPLETED,
SET_RELATIVE_DATES_REQUESTED,
SET_RELATIVE_DATES_COMPLETED,
} from './actions';
Expand Down Expand Up @@ -132,15 +130,6 @@ const settings = produce(
draft.status = SET_DARK_MODE_COMPLETED;
break;

case SET_SERVER_SIDE_FILTERING_REQUESTED:
draft.status = SET_SERVER_SIDE_FILTERING_REQUESTED;
break;

case SET_SERVER_SIDE_FILTERING_COMPLETED:
draft.serverSideFiltering = action.serverSideFiltering;
draft.status = SET_SERVER_SIDE_FILTERING_COMPLETED;
break;

case SET_RELATIVE_DATES_REQUESTED:
draft.status = SET_RELATIVE_DATES_REQUESTED;
break;
Expand All @@ -161,7 +150,6 @@ const settings = produce(
maxRateLimit: 200,
autoAcceptIncidentsQuery: true,
autoRefreshInterval: 5,
serverSideFiltering: true,
searchAllCustomDetails: false,
respondersInEpFilter: false,
alertCustomDetailFields: [
Expand Down
Loading
Loading