From 9f2f8b82456278884be7f4251a745dccf1865fd8 Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Tue, 3 Sep 2024 08:02:09 -0700 Subject: [PATCH] feat!: moves search to backend for better experience. It does remove show search results in context. (#3245) --- assets/auto-imports.d.ts | 2 - assets/components.d.ts | 5 - .../components/LogViewer/ComplexLogItem.vue | 6 +- .../components/LogViewer/EventSource.spec.ts | 33 +---- assets/components/LogViewer/EventSource.vue | 2 +- assets/components/LogViewer/LogList.vue | 2 - .../LogViewer/LogMessageActions.vue | 18 +-- assets/components/LogViewer/LogViewer.vue | 43 +++--- assets/components/LogViewer/SimpleLogItem.vue | 3 +- .../__snapshots__/EventSource.spec.ts.snap | 49 +----- assets/components/Search.vue | 9 +- assets/composable/eventStreams.ts | 101 +++++-------- assets/composable/logContext.ts | 5 +- assets/composable/logSearchContext.ts | 16 -- assets/composable/search.ts | 100 +++---------- assets/composable/visible.ts | 24 ++- assets/models/LogEntry.ts | 4 +- go.sum | 8 +- internal/agent/client.go | 2 +- internal/agent/server.go | 2 +- internal/analytics/http_beacon.go | 2 +- internal/docker/escape.go | 51 +++++++ internal/docker/event_generator.go | 2 +- internal/docker/level_guesser.go | 8 +- internal/docker/level_guesser_test.go | 6 +- internal/docker/logfmt_test.go | 2 +- internal/profile/disk.go | 2 +- internal/releases/github.go | 2 +- internal/support/search/search.go | 140 ++++++++++++++++++ internal/web/auth_test.go | 1 - internal/web/logs.go | 41 ++++- internal/web/releases.go | 2 +- 32 files changed, 364 insertions(+), 329 deletions(-) delete mode 100644 assets/composable/logSearchContext.ts create mode 100644 internal/docker/escape.go create mode 100644 internal/support/search/search.go diff --git a/assets/auto-imports.d.ts b/assets/auto-imports.d.ts index a81ea7b3..aecad466 100644 --- a/assets/auto-imports.d.ts +++ b/assets/auto-imports.d.ts @@ -614,7 +614,6 @@ declare module 'vue' { readonly useLastChanged: UnwrapRef readonly useLocalStorage: UnwrapRef readonly useLogDetails: UnwrapRef - readonly useLogSearchContext: UnwrapRef readonly useLoggingContext: UnwrapRef readonly useMagicKeys: UnwrapRef readonly useManualRefHistory: UnwrapRef @@ -971,7 +970,6 @@ declare module '@vue/runtime-core' { readonly useLastChanged: UnwrapRef readonly useLocalStorage: UnwrapRef readonly useLogDetails: UnwrapRef - readonly useLogSearchContext: UnwrapRef readonly useLoggingContext: UnwrapRef readonly useMagicKeys: UnwrapRef readonly useManualRefHistory: UnwrapRef diff --git a/assets/components.d.ts b/assets/components.d.ts index e0487b12..6192f103 100644 --- a/assets/components.d.ts +++ b/assets/components.d.ts @@ -14,7 +14,6 @@ declare module 'vue' { 'Carbon:macShift': typeof import('~icons/carbon/mac-shift')['default'] 'Carbon:play': typeof import('~icons/carbon/play')['default'] 'Carbon:restart': typeof import('~icons/carbon/restart')['default'] - 'Carbon:searchLocate': typeof import('~icons/carbon/search-locate')['default'] 'Carbon:star': typeof import('~icons/carbon/star')['default'] 'Carbon:starFilled': typeof import('~icons/carbon/star-filled')['default'] 'Carbon:stopFilledAlt': typeof import('~icons/carbon/stop-filled-alt')['default'] @@ -37,7 +36,6 @@ declare module 'vue' { Dropdown: typeof import('./components/common/Dropdown.vue')['default'] DropdownMenu: typeof import('./components/common/DropdownMenu.vue')['default'] EventSource: typeof import('./components/LogViewer/EventSource.vue')['default'] - FieldList: typeof import('./components/LogViewer/FieldList.vue')['default'] FuzzySearchModal: typeof import('./components/FuzzySearchModal.vue')['default'] GroupedLog: typeof import('./components/GroupedViewer/GroupedLog.vue')['default'] HostIcon: typeof import('./components/common/HostIcon.vue')['default'] @@ -55,8 +53,6 @@ declare module 'vue' { LogMessageActions: typeof import('./components/LogViewer/LogMessageActions.vue')['default'] LogStd: typeof import('./components/LogViewer/LogStd.vue')['default'] LogViewer: typeof import('./components/LogViewer/LogViewer.vue')['default'] - 'MaterialSymbols:collapseAllRounded': typeof import('~icons/material-symbols/collapse-all-rounded')['default'] - 'MaterialSymbols:expandAllRounded': typeof import('~icons/material-symbols/expand-all-rounded')['default'] 'Mdi:announcement': typeof import('~icons/mdi/announcement')['default'] 'Mdi:arrowUp': typeof import('~icons/mdi/arrow-up')['default'] 'Mdi:check': typeof import('~icons/mdi/check')['default'] @@ -70,7 +66,6 @@ declare module 'vue' { 'Mdi:hexagonMultiple': typeof import('~icons/mdi/hexagon-multiple')['default'] 'Mdi:keyboardEsc': typeof import('~icons/mdi/keyboard-esc')['default'] 'Mdi:magnify': typeof import('~icons/mdi/magnify')['default'] - 'Mdi:mdi:close': typeof import('~icons/mdi/mdi')['default'] 'Mdi:satelliteVariant': typeof import('~icons/mdi/satellite-variant')['default'] MobileMenu: typeof import('./components/common/MobileMenu.vue')['default'] MultiContainerActionToolbar: typeof import('./components/LogViewer/MultiContainerActionToolbar.vue')['default'] diff --git a/assets/components/LogViewer/ComplexLogItem.vue b/assets/components/LogViewer/ComplexLogItem.vue index b4d020d3..bb40c3d5 100644 --- a/assets/components/LogViewer/ComplexLogItem.vue +++ b/assets/components/LogViewer/ComplexLogItem.vue @@ -17,9 +17,9 @@
  • {{ name }}=<null> - +
  • all values are hidden
  • @@ -34,8 +34,6 @@ diff --git a/assets/components/LogViewer/SimpleLogItem.vue b/assets/components/LogViewer/SimpleLogItem.vue index e7399881..01751f56 100644 --- a/assets/components/LogViewer/SimpleLogItem.vue +++ b/assets/components/LogViewer/SimpleLogItem.vue @@ -32,8 +32,7 @@ const { showContainerName = false } = defineProps<{ showContainerName?: boolean; }>(); -const { markSearch } = useSearchFilter(); -const colorize = (value: string) => markSearch(ansiConvertor.toHtml(value)); +const colorize = (value: string) => ansiConvertor.toHtml(value); const urlPattern = /(https?:\/\/[^\s]+)/g; const linkify = (text: string) => text.replace(urlPattern, (url) => `${url}`); diff --git a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap index 88396947..45f5cdd9 100644 --- a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap +++ b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap @@ -10,10 +10,9 @@ exports[` > render html correctly > should render dates
    -
    <test>foo bar</test>
    +
    foo bar
    -
    @@ -30,10 +29,9 @@ exports[` > render html correctly > should render dates
    -
    <test>foo bar</test>
    +
    foo bar
    -
    @@ -53,49 +51,6 @@ exports[` > render html correctly > should render messag
    This is a message.
    - -
    - - -" -`; - -exports[` > render html correctly > should render messages with filter 1`] = ` -"
      -
    • -
      - - -
      -
      -
      -
      -
      test bar
      -
      - - -
      -
      -
    • -
    " -`; - -exports[` > render html correctly > should render messages with html entities 1`] = ` -"
      -
    • -
      - - -
      -
      -
      -
      -
      <test>foo bar</test>
      -
      - -
    • diff --git a/assets/components/Search.vue b/assets/components/Search.vue index 1627bbc0..faecbdd8 100644 --- a/assets/components/Search.vue +++ b/assets/components/Search.vue @@ -7,14 +7,17 @@ ref="container" :style="style" > -
      +
      @@ -26,7 +29,7 @@