-
+
diff --git a/frontend/app/constants/index.js b/frontend/app/constants/index.js
index ba6f53cf0..8ba18841a 100644
--- a/frontend/app/constants/index.js
+++ b/frontend/app/constants/index.js
@@ -10,6 +10,7 @@ export { default as alertConditions } from './alertConditions';
export { default as alertMetrics } from './alertMetrics';
export { default as regions } from './regions';
export { default as links } from './links';
+export { default as platformOptions } from './platformOptions';
export {
DAYS as SCHEDULE_DAYS,
HOURS as SCHEDULE_HOURS,
diff --git a/frontend/app/constants/platformOptions.js b/frontend/app/constants/platformOptions.js
new file mode 100644
index 000000000..46747ea2e
--- /dev/null
+++ b/frontend/app/constants/platformOptions.js
@@ -0,0 +1,5 @@
+export default [
+ { value: 'desktop', text: 'Desktop' },
+ { value: 'mobile', text: 'Mobile' },
+ { value: 'tablet', text: 'Tablet' },
+]
\ No newline at end of file
diff --git a/frontend/app/duck/search.js b/frontend/app/duck/search.js
index fee81b122..0aa2afe78 100644
--- a/frontend/app/duck/search.js
+++ b/frontend/app/duck/search.js
@@ -26,6 +26,7 @@ const SAVE = saveType(name);
const EDIT = editType(name);
const REMOVE = removeType(name);
const UPDATE = `${name}/UPDATE`;
+const APPLY = `${name}/APPLY`;
const SET_ALERT_METRIC_ID = `${name}/SET_ALERT_METRIC_ID`;
function chartWrapper(chart = []) {
@@ -49,6 +50,13 @@ function reducer(state = initialState, action = {}) {
switch (action.type) {
case EDIT:
return state.set('instance', FilterSeries(action.instance));
+ case APPLY:
+ return action.fromUrl
+ ? state.set('instance',
+ Filter(action.filter)
+ // .set('events', state.getIn([ 'instance', 'events' ]))
+ )
+ : state.mergeIn([ 'instance', 'filter' ], action.filter);
case success(SAVE):
return state.set([ 'instance' ], CustomMetric(action.data));
case success(REMOVE):
@@ -85,13 +93,7 @@ const reduceThenFetchResource = actionCreator => (...args) => (dispatch, getStat
dispatch(actionCreator(...args));
const filter = getState().getIn([ 'search', 'instance', 'filter' ]).toData();
filter.filters = filter.filters.map(filterMap);
- // console.log('filter', filter)
-
- // let filter = appliedFilter
- // .update('filters', list => list.map(f => f.set('value', f.value || '*'))
- // .map(filterMap));
-
- // const filter.filters = getState().getIn([ 'instance', 'filter' ]).get('filters').map(filterMap).toJS();
+ filter.isNew = true // TODO remove this line
return isRoute(ERRORS_ROUTE, window.location.pathname)
? dispatch(fetchErrorsList(filter))
@@ -105,11 +107,11 @@ export const edit = reduceThenFetchResource((instance) => ({
export const remove = createRemove(name);
-// export const applyFilter = reduceThenFetchResource((filter, fromUrl=false) => ({
-// type: APPLY,
-// filter,
-// fromUrl,
-// }));
+export const applyFilter = reduceThenFetchResource((filter, fromUrl=false) => ({
+ type: APPLY,
+ filter,
+ fromUrl,
+}));
export const updateSeries = (index, series) => ({
type: UPDATE,
diff --git a/frontend/app/types/filter/filterType.ts b/frontend/app/types/filter/filterType.ts
index 03722fc09..f1e2c33a9 100644
--- a/frontend/app/types/filter/filterType.ts
+++ b/frontend/app/types/filter/filterType.ts
@@ -6,6 +6,7 @@ export enum FilterType {
MULTIPLE = "MULTIPLE",
COUNTRY = "COUNTRY",
DROPDOWN = "DROPDOWN",
+ MULTIPLE_DROPDOWN = "MULTIPLE_DROPDOWN",
};
export enum FilterKey {
diff --git a/frontend/app/types/filter/newFilter.js b/frontend/app/types/filter/newFilter.js
index bc706668f..1e27ab5b5 100644
--- a/frontend/app/types/filter/newFilter.js
+++ b/frontend/app/types/filter/newFilter.js
@@ -1,6 +1,6 @@
import Record from 'Types/Record';
import { FilterType, FilterKey } from './filterType'
-import { countries } from 'App/constants';
+import { countries, platformOptions } from 'App/constants';
const countryOptions = Object.keys(countries).map(i => ({ text: countries[i], value: i }));
@@ -194,11 +194,11 @@ export const filtersMap = {
[FilterKey.USER_OS]: { key: FilterKey.USER_OS, type: FilterType.MULTIPLE, category: 'gear', label: 'User OS', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/os' },
[FilterKey.USER_BROWSER]: { key: FilterKey.USER_BROWSER, type: FilterType.MULTIPLE, category: 'gear', label: 'User Browser', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/browser' },
[FilterKey.USER_DEVICE]: { key: FilterKey.USER_DEVICE, type: FilterType.MULTIPLE, category: 'gear', label: 'User Device', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/device' },
- [FilterKey.PLATFORM]: { key: FilterKey.PLATFORM, type: FilterType.MULTIPLE, category: 'gear', label: 'Platform', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/platform' },
+ [FilterKey.PLATFORM]: { key: FilterKey.PLATFORM, type: FilterType.MULTIPLE_DROPDOWN, category: 'gear', label: 'Platform', operator: 'is', operatorOptions: filterOptions, icon: 'filters/platform', options: platformOptions },
[FilterKey.REVID]: { key: FilterKey.REVID, type: FilterType.MULTIPLE, category: 'gear', label: 'RevId', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/rev-id' },
[FilterKey.REFERRER]: { key: FilterKey.REFERRER, type: FilterType.MULTIPLE, category: 'recording_attributes', label: 'Referrer', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/referrer' },
- [FilterKey.DURATION]: { key: FilterKey.DURATION, type: FilterType.NUMBER, category: 'recording_attributes', label: 'Duration', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/duration' },
+ [FilterKey.DURATION]: { key: FilterKey.DURATION, type: FilterType.DURATION, category: 'recording_attributes', label: 'Duration', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/duration' },
[FilterKey.USER_COUNTRY]: { key: FilterKey.USER_COUNTRY, type: FilterType.DROPDOWN, category: 'recording_attributes', label: 'User Country', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/country', options: countryOptions },
[FilterKey.CONSOLE]: { key: FilterKey.CONSOLE, type: FilterType.MULTIPLE, category: 'javascript', label: 'Console', operator: 'is', operatorOptions: stringFilterOptions, icon: 'filters/console' },