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

revert serach streams and debug 2 #1792

Closed
wants to merge 92 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
fb3bb31
Revert "Always be closing"
lukaszreszke Jul 24, 2024
39fad7d
Revert "Improve naming to better reveal the intention"
lukaszreszke Jul 24, 2024
0225eb3
Revert "Kosher way to communicate via subscriptions"
lukaszreszke Jul 24, 2024
1504613
Revert "Move functions and helpers before place of use"
lukaszreszke Jul 24, 2024
af8adf6
Revert "Close search modal on Escape keypress"
lukaszreszke Jul 24, 2024
df4eaf6
Revert "Close modal after clicking on stream from dropdown"
lukaszreszke Jul 24, 2024
3a099c4
Revert "Do not assert specific adapter being used"
lukaszreszke Jul 24, 2024
bae7d77
Revert "specification -> inspect, repository_specification -> inspect…
lukaszreszke Jul 24, 2024
c96755c
Revert "Hide conditionals from the Search view"
lukaszreszke Jul 24, 2024
a526955
Revert "Only streams matter after refactoring"
lukaszreszke Jul 24, 2024
debd4a5
Revert "value always sounded odd to me"
lukaszreszke Jul 24, 2024
aa9eef7
Revert "Utility function for empty streams list"
lukaszreszke Jul 24, 2024
c92200a
Revert "Filter visible streams early in the view"
lukaszreszke Jul 24, 2024
e4578fb
Revert "Clientside filtering is case insensitive now"
lukaszreszke Jul 24, 2024
bd070ea
Revert "Improved non–matching stream names clearing"
lukaszreszke Jul 24, 2024
b27668f
Revert "Extract list item to view"
lukaszreszke Jul 24, 2024
46badcc
Revert "Clear streams when deleting last 3 characters"
lukaszreszke Jul 24, 2024
3197f92
Revert "More specific naming"
lukaszreszke Jul 24, 2024
5f6c47d
Revert "Break lines, not bones"
lukaszreszke Jul 24, 2024
b097db1
Revert "Move helper functions to bottom of the module"
lukaszreszke Jul 24, 2024
e3e3c30
Revert "Replace use of datalist with ul"
lukaszreszke Jul 24, 2024
45a5177
Revert "Doh"
lukaszreszke Jul 24, 2024
1764691
Revert "Refactor"
lukaszreszke Jul 24, 2024
5eca162
Revert "Prefer same variable"
lukaszreszke Jul 24, 2024
b3a192e
Revert "One more formatter round"
lukaszreszke Jul 24, 2024
4c17d12
Revert "Remove autosubmit of matching stream name"
lukaszreszke Jul 24, 2024
091c1cd
Revert "Dead code"
lukaszreszke Jul 24, 2024
b5272d5
Revert "formatting"
lukaszreszke Jul 24, 2024
6df184e
Revert "Add total events counter to the debug page"
lukaszreszke Jul 24, 2024
0b42fb3
Revert "Format Page.Debug"
lukaszreszke Jul 24, 2024
7391a7f
Revert "Format Main"
lukaszreszke Jul 24, 2024
487eb1a
Revert "Format Route"
lukaszreszke Jul 24, 2024
9e4a12a
Revert "Format Search"
lukaszreszke Jul 24, 2024
7c6c28a
Revert "add order to rom"
lukaszreszke Jul 24, 2024
5b651f0
Revert "Search streams for sequel"
lukaszreszke Jul 24, 2024
c18c9a1
Revert "Implement search_streams in ROM"
lukaszreszke Jul 24, 2024
c866447
Revert "Don't add "all" stream to search results"
lukaszreszke Jul 24, 2024
a885721
Revert "Refactor"
lukaszreszke Jul 24, 2024
b2b53c5
Revert "Stream is our domain–specific type"
lukaszreszke Jul 24, 2024
29a6035
Revert "Require at lest 3 chars before fetching streams"
lukaszreszke Jul 24, 2024
0e2e52c
Revert "Refactor"
lukaszreszke Jul 24, 2024
10693da
Revert "Add debug url to the browser layout"
lukaszreszke Jul 24, 2024
7b9fa50
Revert "Search module communicates important state changes to upper m…
lukaszreszke Jul 24, 2024
be3bf9b
Revert "Adjust test"
lukaszreszke Jul 24, 2024
e6914da
Revert "We don't mind the order"
lukaszreszke Jul 24, 2024
05e4a59
Revert "adjust tests"
lukaszreszke Jul 24, 2024
eafe327
Revert "Optimize querys performance"
lukaszreszke Jul 24, 2024
02a607c
Revert "Move navigation out of Stream"
lukaszreszke Jul 24, 2024
d1cf5c1
Revert "One more intermediate, dummy message to handle in Layout"
lukaszreszke Jul 24, 2024
6576278
Revert "test if InstrumentedRepository presents which repository is i…
lukaszreszke Jul 24, 2024
9026c88
Revert "present which exactly repository is instrumented"
lukaszreszke Jul 24, 2024
c9344df
Revert "prettier"
lukaszreszke Jul 24, 2024
9538406
Revert "test if /debug page is served"
lukaszreszke Jul 24, 2024
d82f8f1
Revert "test if repositoryAdapter flag is set"
lukaszreszke Jul 24, 2024
17ccddc
Revert "move `repository_specification` method to the proper class"
lukaszreszke Jul 24, 2024
a22e38a
Revert "Clear input on exact match too"
lukaszreszke Jul 24, 2024
e786de3
Revert "Rely on special internal OnSelect message to close modal"
lukaszreszke Jul 24, 2024
67e21f1
Revert "Forgotten signature"
lukaszreszke Jul 24, 2024
bd4b47a
Revert "Clear selected value when submitting stream"
lukaszreszke Jul 24, 2024
e22eead
Revert "kill mutants"
lukaszreszke Jul 24, 2024
e66f79a
Revert "Hide dialog when stream is selected"
lukaszreszke Jul 24, 2024
b9c6c11
Revert "Kill mutants"
lukaszreszke Jul 24, 2024
b2d8dfe
Revert "Limit number of searched streams to 10"
lukaszreszke Jul 24, 2024
fe6a5bb
Revert "Make global stream available on top of the search"
lukaszreszke Jul 24, 2024
adde5f1
Revert "Add repositoryAdapter eml flag"
lukaszreszke Jul 24, 2024
0a2d6f2
Revert "Debug module with its own model"
lukaszreszke Jul 24, 2024
9ecd557
Revert "Set value when is exact stream"
lukaszreszke Jul 24, 2024
59f8fbe
Revert "refactor"
lukaszreszke Jul 24, 2024
20b62fd
Revert "Redirect to stream on exact match"
lukaszreszke Jul 24, 2024
e066ff0
Revert "move Debug page to separate module"
lukaszreszke Jul 24, 2024
63e26d2
Revert "Autocomplete stream names"
lukaszreszke Jul 24, 2024
5d90be9
Revert "Revert "Use WrappedModel in search""
lukaszreszke Jul 24, 2024
93daea2
Revert "Use WrappedModel in search"
lukaszreszke Jul 24, 2024
fd824e5
Revert "initiate /debug browser page"
lukaszreszke Jul 24, 2024
7c17c76
Revert "No need those gymnastics with Maybe"
lukaszreszke Jul 24, 2024
eca4678
Revert "Don't render search streams here"
lukaszreszke Jul 24, 2024
e85e710
Revert "Use function"
lukaszreszke Jul 24, 2024
048a84c
Revert "Extract function"
lukaszreszke Jul 24, 2024
0b53bf4
Revert "Kill mutant"
lukaszreszke Jul 24, 2024
dede467
Revert "lowercase"
lukaszreszke Jul 24, 2024
30ca059
Revert "render search streams"
lukaszreszke Jul 24, 2024
3f3883f
Revert "hardcoded api call"
lukaszreszke Jul 24, 2024
8f102d7
Revert "Add searchStreamsDecoder"
lukaszreszke Jul 24, 2024
1f61050
Revert "search streams endpoint for browser"
lukaszreszke Jul 24, 2024
41c2d86
Revert "Add search_streams in RubyEventStore::Client"
lukaszreszke Jul 24, 2024
6e12ec3
Revert "Add search_streams to InMemoryRepository"
lukaszreszke Jul 24, 2024
0271272
Revert "Add search_streams test into event_repository_lint"
lukaszreszke Jul 24, 2024
835b27a
Revert "Reverse results order"
lukaszreszke Jul 24, 2024
5da01b3
Revert "Return stream object instead of name"
lukaszreszke Jul 24, 2024
96e34e2
Revert "Introduce search_streams in EventRepository"
lukaszreszke Jul 24, 2024
31928ac
Revert "Introduce Search module"
lukaszreszke Jul 24, 2024
c9167ef
Revert "Show real repository adapter on Debug page"
lukaszreszke Jul 24, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ def streams_of(event_id)
@stream_entries.streams_of(event_id).map { |name| Stream.new(name) }
end

def search_streams(stream_name)
@stream_entries.search_streams(stream_name)
end

private

def validate_event_ids(event_ids)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ def position_in_stream(event_id, stream)
def event_in_stream?(event_id, stream)
stream_entries.by_stream(stream).by_event_id(event_id).exist?
end

def search_streams(stream_name)
stream_entries
.where { stream.like("#{stream_name}%") }
.distinct
.limit(10)
.order(:stream)
.pluck(:stream)
.map { |name| Stream.new(name) }
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,6 @@ def streams_of(event_id)
@db[:event_store_events_in_streams].where(event_id: event_id).map { |h| Stream.new(h[:stream]) }
end

def search_streams(stream_name)
@db[:event_store_events_in_streams]
.where(::Sequel.like(:stream, "#{stream_name}%"))
.select(:stream)
.limit(10)
.map { |h| Stream.new(h[:stream]) }
end

private

def optimize_timestamp(valid_at, created_at)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def count(specification)
@repo_reader.count(specification)
end

def search_streams(stream_name)
@repo_reader.search_streams(stream_name)
end

def update_messages(records)
hashes = records.map { |record| upsert_hash(record, record.serialize(serializer)) }
for_update = records.map(&:event_id)
Expand Down Expand Up @@ -85,10 +81,6 @@ def event_in_stream?(event_id, stream)
@repo_reader.event_in_stream?(event_id, stream)
end

def inspect
"#{self.class} with #{::ActiveRecord::Base.connection.adapter_name} db adapter"
end

private

attr_reader :serializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ def event_in_stream?(event_id, stream)
@stream_klass.where(event_id: event_id, stream: stream.name).exists?
end

def search_streams(stream)
@stream_klass
.where("stream LIKE ?", "#{stream}%")
.limit(10)
.pluck("distinct stream")
.map { |name| Stream.new(name) }
end

private

attr_reader :serializer
Expand Down
65 changes: 0 additions & 65 deletions ruby_event_store-active_record/spec/event_repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,65 +183,6 @@ module ActiveRecord
expect(event_record.valid_at).to eq(t2)
end

specify "finds streams that match the search phrase" do
repository.append_to_stream(
[SRecord.new(event_id: e1 = SecureRandom.uuid)],
s1 = Stream.new("Dummy$#{e1}"),
ExpectedVersion.any
)
repository.append_to_stream(
[SRecord.new(event_id: e2 = SecureRandom.uuid)],
s2 = Stream.new("Dummy$#{e2}"),
ExpectedVersion.any
)
repository.append_to_stream(
[SRecord.new(event_id: e3 = SecureRandom.uuid)],
s3 = Stream.new("Dummy$#{e3}"),
ExpectedVersion.any
)

expect(repository.search_streams("Du")).to contain_exactly(s3, s2, s1)
expect(repository.search_streams("Dummy")).to contain_exactly(s3, s2, s1)
end

specify "limits searched streams to 10" do
11.times do |index|
repository.append_to_stream(
[SRecord.new(event_id: e1 = SecureRandom.uuid)],
Stream.new("Dummy$#{e1}"),
ExpectedVersion.any
)
end

expect(repository.search_streams("Du").size).to eq 10
end

specify "finds no streams when search phrase doesn't match anything" do
repository.append_to_stream(
[SRecord.new(event_id: e1 = SecureRandom.uuid)],
Stream.new("Dummy$#{e1}"),
ExpectedVersion.any
)
repository.append_to_stream(
[SRecord.new(event_id: e2 = SecureRandom.uuid)],
Stream.new("Dummy$#{e2}"),
ExpectedVersion.any
)
repository.append_to_stream(
[SRecord.new(event_id: e3 = SecureRandom.uuid)],
Stream.new("Dummy$#{e3}"),
ExpectedVersion.any
)

expect(repository.search_streams("Da")).to eq([])
expect(repository.search_streams("da")).to eq([])
expect(repository.search_streams("dam")).to eq([])
expect(repository.search_streams("damm")).to eq([])
expect(repository.search_streams("dammy")).to eq([])
expect(repository.search_streams("Dammy")).to eq([])
end


specify "with batches and bi-temporal queries use offset + limit" do
repository.append_to_stream(
[
Expand Down Expand Up @@ -378,12 +319,6 @@ module ActiveRecord
}x
end

describe "#inspect" do
specify "returns string representation" do
expect(repository.inspect).to eq("RubyEventStore::ActiveRecord::EventRepository with #{::ActiveRecord::Base.connection.adapter_name} db adapter")
end
end

private

def with_precision(time)
Expand Down
64 changes: 2 additions & 62 deletions ruby_event_store-browser/elm/src/Api.elm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Api exposing (Event, PaginatedList, PaginationLink, PaginationLinks, RemoteResource(..), SearchStream, Stats, Stream, emptyPaginatedList, eventDecoder, eventsDecoder, getEvent, getEvents, getSearchStreams, getStats, getStream, searchStreamsDecoder)
module Api exposing (Event, PaginatedList, PaginationLink, PaginationLinks, RemoteResource(..), Stream, emptyPaginatedList, eventDecoder, eventsDecoder, getEvent, getEvents, getStream)

import Flags exposing (Flags)
import Http
import Iso8601
import Json.Decode exposing (Decoder, field, int, list, maybe, string, succeed, value)
import Json.Decode exposing (Decoder, field, list, maybe, string, succeed, value)
import Json.Decode.Pipeline exposing (optional, optionalAt, required, requiredAt)
import Json.Encode exposing (encode)
import Maybe.Extra
Expand Down Expand Up @@ -38,16 +38,6 @@ type alias Event =
}


type alias SearchStream =
{ streamId : String
}


type alias Stats =
{ eventsInTotal : Int
}


type alias PaginatedList a =
{ pagination : Pagination.Specification
, events : List a
Expand Down Expand Up @@ -94,16 +84,6 @@ streamUrl flags streamId =
buildUrl (Url.toString flags.apiUrl ++ "/streams") streamId


searchStreamsUrl : Flags -> String -> String
searchStreamsUrl flags query =
buildUrl (Url.toString flags.apiUrl ++ "/search_streams") query


getStatsUrl : Flags -> String
getStatsUrl flags =
Url.toString flags.apiUrl ++ "/stats"


getEvent : (Result Http.Error Event -> msg) -> Flags -> String -> Cmd msg
getEvent msgBuilder flags eventId =
Http.get
Expand All @@ -120,22 +100,6 @@ getStream msgBuilder flags streamId =
}


getSearchStreams : (Result Http.Error (List SearchStream) -> msg) -> Flags -> String -> Cmd msg
getSearchStreams msgBuilder flags query =
Http.get
{ url = searchStreamsUrl flags query
, expect = Http.expectJson msgBuilder searchStreamsDecoder
}


getStats : (Result Http.Error Stats -> msg) -> Flags -> Cmd msg
getStats msgBuilder flags =
Http.get
{ url = getStatsUrl flags
, expect = Http.expectJson msgBuilder statsDecoder
}


eventDecoder : Decoder Event
eventDecoder =
eventDecoder_
Expand Down Expand Up @@ -190,30 +154,6 @@ eventsDecoder pagination =
|> required "links" linksDecoder


searchStreamDecoder : Decoder SearchStream
searchStreamDecoder =
succeed SearchStream
|> required "id" string


searchStreamsDecoder : Decoder (List SearchStream)
searchStreamsDecoder =
list searchStreamDecoder
|> field "data"


statsDecoder : Decoder Stats
statsDecoder =
statsDecoder_
|> field "meta"


statsDecoder_ : Decoder Stats
statsDecoder_ =
succeed Stats
|> required "events_in_total" int


linksDecoder : Decoder PaginationLinks
linksDecoder =
succeed PaginationLinks
Expand Down
6 changes: 2 additions & 4 deletions ruby_event_store-browser/elm/src/Flags.elm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type alias RawFlags =
{ rootUrl : String
, apiUrl : String
, resVersion : String
, repositoryAdapter : String
, platform : String
}

Expand All @@ -16,11 +15,10 @@ type alias Flags =
{ rootUrl : Url.Url
, apiUrl : Url.Url
, resVersion : String
, repositoryAdapter : String
, platform : String
}


buildFlags : RawFlags -> Maybe Flags
buildFlags { rootUrl, apiUrl, resVersion, repositoryAdapter, platform } =
Maybe.map5 Flags (Url.fromString rootUrl) (Url.fromString apiUrl) (Just resVersion) (Just repositoryAdapter) (Just platform)
buildFlags { rootUrl, apiUrl, resVersion, platform } =
Maybe.map4 Flags (Url.fromString rootUrl) (Url.fromString apiUrl) (Just resVersion) (Just platform)
Loading