diff --git a/frontend/app/components/shared/SessionItem/Counter.tsx b/frontend/app/components/shared/SessionItem/Counter.tsx
index 5303974ae..9656ae753 100644
--- a/frontend/app/components/shared/SessionItem/Counter.tsx
+++ b/frontend/app/components/shared/SessionItem/Counter.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import { Duration } from 'luxon';
-import { durationFormatted, formatTimeOrDate } from 'App/date';
+import { durationFormatted, convertTimestampToUtcTimestamp } from 'App/date';
interface Props {
startTime: any,
@@ -9,7 +9,7 @@ interface Props {
function Counter({ startTime, className }: Props) {
let intervalId;
- const [duration, setDuration] = useState(new Date().getTime() - startTime)
+ const [duration, setDuration] = useState(new Date().getTime() - convertTimestampToUtcTimestamp(startTime));
const formattedDuration = durationFormatted(Duration.fromMillis(duration));
useEffect(() => {
diff --git a/frontend/app/components/shared/SessionSearch/SessionSearch.tsx b/frontend/app/components/shared/SessionSearch/SessionSearch.tsx
index 46bdd845e..a3f799ed7 100644
--- a/frontend/app/components/shared/SessionSearch/SessionSearch.tsx
+++ b/frontend/app/components/shared/SessionSearch/SessionSearch.tsx
@@ -1,5 +1,4 @@
import React from 'react';
-import { List } from 'immutable';
import FilterList from 'Shared/Filters/FilterList';
import FilterSelection from 'Shared/Filters/FilterSelection';
import SaveFilterButton from 'Shared/SaveFilterButton';
@@ -13,7 +12,7 @@ interface Props {
edit: typeof edit;
addFilter: typeof addFilter;
}
-function SessionSearch(props) {
+function SessionSearch(props: Props) {
const { appliedFilter } = props;
const hasEvents = appliedFilter.filters.filter(i => i.isEvent).size > 0;
const hasFilters = appliedFilter.filters.filter(i => !i.isEvent).size > 0;
@@ -82,7 +81,6 @@ function SessionSearch(props) {
- {/* */}
diff --git a/frontend/app/date.js b/frontend/app/date.js
index 783da4428..089c48362 100644
--- a/frontend/app/date.js
+++ b/frontend/app/date.js
@@ -111,3 +111,6 @@ export const checkRecentTime = (date, format) => {
export const formatMs = (ms: number): string => ms < 1000 ? `${ Math.trunc(ms) }ms` : `${ Math.trunc(ms/100) / 10 }s`;
+export const convertTimestampToUtcTimestamp = (timestamp: number): number => {
+ return DateTime.fromMillis(timestamp).toUTC().toMillis();
+}
\ No newline at end of file
diff --git a/frontend/app/duck/search.js b/frontend/app/duck/search.js
index 4bce0e618..8b4ab8e12 100644
--- a/frontend/app/duck/search.js
+++ b/frontend/app/duck/search.js
@@ -38,7 +38,7 @@ function chartWrapper(chart = []) {
const savedSearchIdKey = 'searchId'
const updateItemInList = createListUpdater(savedSearchIdKey);
const updateInstance = (state, instance) => state.getIn([ "savedSearch", savedSearchIdKey ]) === instance[savedSearchIdKey]
- ? state.mergeIn([ "savedSearch" ], instance)
+ ? state.mergeIn([ "savedSearch" ], SavedFilter(instance))
: state;
const initialState = Map({
@@ -63,10 +63,6 @@ function reducer(state = initialState, action = {}) {
return action.fromUrl
? state.set('instance', Filter(action.filter))
: state.mergeIn(['instance'], action.filter);
- case success(SAVE):
- return updateItemInList(updateInstance(state, action.data), action.data);
- case success(REMOVE):
- return state.update('list', list => list.filter(item => item.searchId !== action.id));
case success(FETCH):
return state.set("instance", action.data);
case success(FETCH_LIST):
@@ -136,7 +132,18 @@ export const edit = reduceThenFetchResource((instance) => ({
instance,
}));
-export const remove = createRemove(name, (id) => `/saved_search/${id}`);
+export const remove = (id) => (dispatch, getState) => {
+ return dispatch({
+ types: REMOVE.array,
+ call: client => client.delete(`/saved_search/${id}`),
+ id,
+ }).then(() => {
+ dispatch(applySavedSearch(new SavedFilter({})));
+ dispatch(fetchList());
+ });
+};
+
+// export const remove = createRemove(name, (id) => `/saved_search/${id}`);
export const applyFilter = reduceThenFetchResource((filter, fromUrl=false) => ({
type: APPLY,
@@ -172,15 +179,21 @@ export function fetch(id) {
}
export const save = (id) => (dispatch, getState) => {
-// export function save(id) {
const filter = getState().getIn([ 'search', 'instance']).toData();
filter.filters = filter.filters.map(filterMap);
+ const isNew = !id;
const instance = getState().getIn([ 'search', 'savedSearch']).toData();
- // instance = instance instanceof SavedFilter ? instance : new SavedFilter(instance);
return dispatch({
types: SAVE.array,
- call: client => client.post(!id ? '/saved_search' : `/saved_search/${id}`, { ...instance, filter })
+ call: client => client.post(isNew ? '/saved_search' : `/saved_search/${id}`, { ...instance, filter })
+ }).then(() => {
+ dispatch(fetchList()).then(() => {
+ if (isNew) {
+ const lastSavedSearch = getState().getIn([ 'search', 'list']).last();
+ dispatch(applySavedSearch(lastSavedSearch));
+ }
+ });
});
}
diff --git a/scripts/helmcharts/openreplay/files/dbops.sh b/scripts/helmcharts/openreplay/files/dbops.sh
index f856ae40b..b77fd61ff 100644
--- a/scripts/helmcharts/openreplay/files/dbops.sh
+++ b/scripts/helmcharts/openreplay/files/dbops.sh
@@ -1,11 +1,13 @@
#!/bin/bash
+set -x
cd $(dirname $0)
is_migrate=$1
# Converting alphaneumeric to number.
PREVIOUS_APP_VERSION=`echo $PREVIOUS_APP_VERSION | cut -d "v" -f2`
+CHART_APP_VERSION=`echo $CHART_APP_VERSION | cut -d "v" -f2`
function migration() {
ls -la /opt/openreplay/openreplay