From 05a7fd38ee6cfee1fbb4ae14bd473fbfd66fca56 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Fri, 11 Feb 2022 17:17:03 +0100 Subject: [PATCH 1/2] fix(migration): migrate all versions Signed-off-by: Rajesh Rajendran --- scripts/helmcharts/openreplay/files/clickhouse.sh | 6 +++--- scripts/helmcharts/openreplay/files/dbops.sh | 12 +++++++----- scripts/helmcharts/openreplay/files/postgresql.sh | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/helmcharts/openreplay/files/clickhouse.sh b/scripts/helmcharts/openreplay/files/clickhouse.sh index 503fd97bf..3f9c2954e 100644 --- a/scripts/helmcharts/openreplay/files/clickhouse.sh +++ b/scripts/helmcharts/openreplay/files/clickhouse.sh @@ -1,13 +1,13 @@ #!/bin/bash -set -e +set -ex clickhousedir=/opt/openreplay/openreplay/scripts/helm/db/init_dbs/clickhouse function migrate() { echo "Starting clickhouse migration" - migration_versions=$1 - for version in $migration_versions; do + IFS=',' read -r -a migration_versions <<< "$1" + for version in ${migration_versions[*]}; do echo "Migrating clickhouse version $version" # For now, we can ignore the clickhouse db inject errors. # TODO: Better error handling in script diff --git a/scripts/helmcharts/openreplay/files/dbops.sh b/scripts/helmcharts/openreplay/files/dbops.sh index fddde5b84..f856ae40b 100644 --- a/scripts/helmcharts/openreplay/files/dbops.sh +++ b/scripts/helmcharts/openreplay/files/dbops.sh @@ -27,22 +27,24 @@ function migration() { # Checking migration versions cd /opt/openreplay/openreplay/scripts/helm migration_versions=(`ls -l db/init_dbs/$db | grep -E ^d | awk -v number=${PREVIOUS_APP_VERSION} '$NF > number {print $NF}' | grep -v create`) - echo "Migration version: $migration_versions" + echo "Migration version: ${migration_versions[*]}" + # Can't pass the space seperated array to ansible for migration. So joining them with , + joined_migration_versions=$(IFS=, ; echo "${migration_versions[*]}") cd - case "$1" in postgresql) - /bin/bash postgresql.sh migrate $migration_versions + /bin/bash postgresql.sh migrate $joined_migration_versions ;; minio) - /bin/bash minio.sh migrate $migration_versions + /bin/bash minio.sh migrate $joined_migration_versions ;; clickhouse) - /bin/bash clickhouse.sh migrate $migration_versions + /bin/bash clickhouse.sh migrate $joined_migration_versions ;; kafka) - /bin/bash kafka.sh migrate $migration_versions + /bin/bash kafka.sh migrate $joined_migration_versions ;; *) echo "Unknown operation for db migration; exiting." diff --git a/scripts/helmcharts/openreplay/files/postgresql.sh b/scripts/helmcharts/openreplay/files/postgresql.sh index a12a65c44..cea47a73e 100644 --- a/scripts/helmcharts/openreplay/files/postgresql.sh +++ b/scripts/helmcharts/openreplay/files/postgresql.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -ex pgdir=/opt/openreplay/openreplay/scripts/helm/db/init_dbs/postgresql @@ -14,8 +14,8 @@ pgdir=/opt/openreplay/openreplay/scripts/helm/db/init_dbs/postgresql function migrate() { echo "Starting postgresql migration" - migration_versions=$1 - for version in $migration_versions; do + IFS=',' read -r -a migration_versions <<< "$1" + for version in ${migration_versions[*]}; do echo "Migrating postgresql version $version" psql -f ${pgdir}/${version}/${version}.sql done From baab184597805eeda345924d5eb4bc448b790940 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 11 Feb 2022 18:11:25 +0100 Subject: [PATCH 2/2] fix(ui) - error search for sessions, and default session load --- frontend/app/components/BugFinder/BugFinder.js | 4 +++- .../components/BugFinder/SessionList/SessionList.js | 2 -- .../BugFinder/SessionList/SessionListHeader.js | 2 +- frontend/app/components/Errors/Error/MainSection.js | 12 +++++------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/frontend/app/components/BugFinder/BugFinder.js b/frontend/app/components/BugFinder/BugFinder.js index 201bb9935..80f819ecd 100644 --- a/frontend/app/components/BugFinder/BugFinder.js +++ b/frontend/app/components/BugFinder/BugFinder.js @@ -28,7 +28,7 @@ import SessionSearch from 'Shared/SessionSearch'; import MainSearchBar from 'Shared/MainSearchBar'; import LiveSearchBar from 'Shared/LiveSearchBar'; import LiveSessionSearch from 'Shared/LiveSessionSearch'; -import { clearSearch } from 'Duck/search'; +import { clearSearch, fetchSessions } from 'Duck/search'; const weakEqual = (val1, val2) => { if (!!val1 === false && !!val2 === false) return true; @@ -79,6 +79,7 @@ const allowedQueryKeys = [ resetFunnelFilters, setFunnelPage, clearSearch, + fetchSessions, }) @withPageTitle("Sessions - OpenReplay") export default class BugFinder extends React.PureComponent { @@ -109,6 +110,7 @@ export default class BugFinder extends React.PureComponent { }; }); + props.fetchSessions(); props.resetFunnel(); props.resetFunnelFilters(); props.fetchFunnelsList(LAST_7_DAYS) diff --git a/frontend/app/components/BugFinder/SessionList/SessionList.js b/frontend/app/components/BugFinder/SessionList/SessionList.js index e4e14b580..b2267e908 100644 --- a/frontend/app/components/BugFinder/SessionList/SessionList.js +++ b/frontend/app/components/BugFinder/SessionList/SessionList.js @@ -154,8 +154,6 @@ export default class SessionList extends React.PureComponent { return (
-
-
{ this.renderActiveTabContent(filteredList) }
diff --git a/frontend/app/components/BugFinder/SessionList/SessionListHeader.js b/frontend/app/components/BugFinder/SessionList/SessionListHeader.js index 9417449af..f0b82e367 100644 --- a/frontend/app/components/BugFinder/SessionList/SessionListHeader.js +++ b/frontend/app/components/BugFinder/SessionList/SessionListHeader.js @@ -24,7 +24,7 @@ function SessionListHeader({ applyFilter, ...props }) { - useEffect(() => { applyFilter({ sort: DEFAULT_SORT, order: DEFAULT_ORDER }) }, []) + // useEffect(() => { applyFilter({ sort: DEFAULT_SORT, order: DEFAULT_ORDER }) }, []) return (
diff --git a/frontend/app/components/Errors/Error/MainSection.js b/frontend/app/components/Errors/Error/MainSection.js index 5930bc8ce..25412437e 100644 --- a/frontend/app/components/Errors/Error/MainSection.js +++ b/frontend/app/components/Errors/Error/MainSection.js @@ -5,13 +5,14 @@ import { ErrorDetails, IconButton, Icon, Loader } from 'UI'; import { sessions as sessionsRoute } from 'App/routes'; import { TYPES as EV_FILER_TYPES } from 'Types/filter/event'; import { UNRESOLVED, RESOLVED, IGNORED } from "Types/errorInfo"; -import { addEvent } from 'Duck/filters'; +import { addFilterByKeyAndValue } from 'Duck/search'; import { resolve,unresolve,ignore, toggleFavorite } from "Duck/errors"; import { resentOrDate } from 'App/date'; import Divider from 'Components/Errors/ui/Divider'; import ErrorName from 'Components/Errors/ui/ErrorName'; import Label from 'Components/Errors/ui/Label'; import SharePopup from 'Shared/SharePopup' +import { FilterKey } from 'Types/filter/filterType'; import SessionBar from './SessionBar'; @@ -30,7 +31,7 @@ import SessionBar from './SessionBar'; unresolve, ignore, toggleFavorite, - addEvent, + addFilterByKeyAndValue, }) export default class MainSection extends React.PureComponent { resolve = () => { @@ -53,11 +54,8 @@ export default class MainSection extends React.PureComponent { } findSessions = () => { - this.props.addEvent({ - type: EV_FILER_TYPES.CONSOLE, - value: this.props.error.message, - }, true); - this.props.history.push(sessionsRoute()); + this.props.addFilterByKeyAndValue(FilterKey.ERROR, this.props.error.message); + this.props.history.push(sessionsRoute()); } render() {