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

Feature/go 368 filters #249

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

Feature/go 368 filters #249

wants to merge 44 commits into from

Conversation

alhafoudh
Copy link
Collaborator

No description provided.

@@ -0,0 +1,6 @@
class Icons::GripComponent < ViewComponent::Base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ukazalo sa, ze lepsi sposob je cez Common::IconComponent. kukni tam.

<% end %>
<%= @name %>
<% end %>
<%= link_to \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooo toto nepoznam \ naucil som sa.

if @filter.save
flash[:notice] = 'Filter bol úspešne vytvorený'
if params[:to] == 'search'
redirect_to message_threads_path(q: @filter.query)
redirect_to helpers.filtered_message_threads_path(filter: @filter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toto nejde bez helpers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bez hanby by som to dal include do controllera

end

Filter.transaction do
filters.map.with_index do |filter, i|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each_with_index mozes tiez ak nepotrbujes vysledok

end
end

redirect_back fallback_location: filters_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto je turbovina a vieme to lepsie, dnes sme @mirrec hutali 15 sposobov ako a asi mame ako treba. Pozri ako je v threadscontroller spraveny rename.

})

this.sortable.on('drag:stopped', async (e) => {
// As of now, this is the only way to submit a PATCH request with Rails so Turbo updates the pages without a full reload
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

myslim, ze ked mu posles format: :turbo_stream tak pojde aj inak.

app/models/fulltext_filter.rb Show resolved Hide resolved
app/models/searchable/query_builder.rb Show resolved Hide resolved
config/routes.rb Outdated
end

collection do
patch :sort
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ak je jeden davam to onliner patch :sort, on: :collection

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

# tag_id :bigint
# tenant_id :bigint not null
#
class FulltextFilter < Filter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fulltext mi evokuje, ze to je ten text ale asi prezijem. Ak by sme mali ist konvenciou zo stitkov tak je to SimpleFilter ale to asi nie je :)

app/models/tag_filter.rb Show resolved Hide resolved
alhafoudh and others added 18 commits January 4, 2024 09:22
# Conflicts:
#	app/components/message_threads_bulk_actions_component.html.erb
#	app/components/message_threads_bulk_actions_component.rb
#	app/components/message_threads_table_component.html.erb
#	app/components/message_threads_table_component.rb
#	app/lib/sidebar_menu.rb
#	app/views/message_threads/index.html.erb
#	config/routes.rb
#	db/schema.rb
# Conflicts:
#	app/components/message_threads_bulk_actions_component.html.erb
#	app/components/message_threads_bulk_actions_component.rb
#	app/components/message_threads_table_component.html.erb
#	app/components/t_w/top_navigation_component.rb
#	app/controllers/application_controller.rb
#	app/views/message_threads/index.html.erb
…368-filters

# Conflicts:
#	app/components/common/icon_component.rb
#	app/controllers/application_controller.rb
#	app/lib/sidebar_menu.rb
#	db/schema.rb
# Conflicts:
#	app/components/common/icon_component.rb
@@ -35,7 +35,9 @@ def index
if params[:filter_id].present?
@filter = policy_scope(Filter, policy_scope_class: FilterPolicy::ScopeShowable).find_by(id: params[:filter_id])
else
@filter = Current.user.visible_filters.first
if Current.user.visible_filters.any?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto sa mi uplne nepozdava, ze tu davame redirect. v podstate sa nebude dat linkovat root (vzdy to spravi redirect). Nedava skor zmysel nastavit ten filter a nerobit redirect?

Copy link
Collaborator Author

@alhafoudh alhafoudh Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, prerobim

@jsuchal
Copy link
Member

jsuchal commented Jul 8, 2024

@alhafoudh mas tu nejake konflikty este

@jsuchal
Copy link
Member

jsuchal commented Sep 23, 2024

Dal som tu aj @luciajanikova na review, pozriem aj ja.

@luciajanikova
Copy link
Member

Asi je nieco zle, vo vsetkych filtroch vidim rovnake vlakna. Skusala som spustit migracie na uz predtym existujucej DB a takto to vyzera. Na cistonovej DB sa zda, ze to funguje podla ocakavani. Predpokladam teda, ze migracia existujucich tagov na filtre nebude ok. @durcak

Screen.Recording.2024-09-24.at.16.38.45.mov

Copy link
Member

@luciajanikova luciajanikova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zatial len nejake drobnosti, co som si vsimla. Pre mna je blocker, ze mi filtrovanie pri lokalnom testovani nefunguje. Az potom budem vediet este hlbsie pozriet.

@@ -0,0 +1,5 @@
class ChangeAuthorIdNullOnFilters < ActiveRecord::Migration[7.1]
def change
change_column_null :filters, :author_id, true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tato migracia by mala byt asi skor ako db/migrate/20240624114024_create_tag_filters_from_tags.rb?
Lokalne som skusala a spominana migracia mi vyfailovala na tom, ze author_id bol nil (ActiveRecord::NotNullViolation).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixnute.

scope :not_pinned, -> { where(is_pinned: false) }
scope :visible_for, -> (user) { joins(:user_filter_visibilities)
.where(user_filter_visibilities: { visible: true, user: user})
.where(is_pinned: false) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aky vyznam ma tento atribut is_pinned? Ak spravne pozeram, tak defaultne je false, ale nevidim, ze by sa niekedy tato hodnota menila.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto som dal prec, s Ahmedom sme sa dohodli, ze to netreba, bol to len nejaky povodny pokus o nieco.

@durcak
Copy link
Collaborator

durcak commented Sep 25, 2024

@luciajanikova fixol som to filtrovanie, sorry netestoval som to dobre na starsich datach a zdalo sa mi, ze to funguje. Uz by to malo byt ok.

@luciajanikova
Copy link
Member

Ked si vytvorim novy Tag, tak TagFilter k nemu je defaultne schovany, takze ho nevidim v lavom menu. Ocakavala by som opak, ked si vytvorim nejaky novy Tag, defaultne by som chcela aby sa mi pridal do menu a schovam si ho iba v pripade potreby. Co myslis @jsuchal?

@durcak
Copy link
Collaborator

durcak commented Sep 26, 2024

On prave pisal v chate v threade k tomuto, ze novy tag filter nema byt hned viditelny. Viditelne maju byt hned len novo vytvorene fulltext filtre.

@luciajanikova
Copy link
Member

On prave pisal v chate v threade k tomuto, ze novy tag filter nema byt hned viditelny. Viditelne maju byt hned len novo vytvorene fulltext filtre.

Okay, dakujem za rychle info.

@durcak
Copy link
Collaborator

durcak commented Sep 26, 2024

Mne este napadlo, ci nechcem aj FulltextTagFilter, tzn. ze ked mam zakliknuty nejaky tag filter a k nemu pridam query filter a dam ulozit ako novy filter tak sa bude filtrovat aj query a tag.

Copy link
Member

@luciajanikova luciajanikova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Za mna inak asi ok, preklikala som sa cez to, vyzera to byt v poriadku. Trochu iba bojujem s tym, ze novy TagFilter nie je defaultne viditelny v lavom menu. Z mojho pohladu, ked si idem vytvarat Tag, tak chcem pomocou neho filtrovat spravy, rychlo najst tie, ktore su tagom oznacene. Takze chcem aby bol viditelny. Ak ho by default neuvidim, asi by ma to zmiatlo. Aky mas na to ty pohlad @jsuchal, ked preferujes default schovany?

app/components/filters/filter_form_component.html.erb Outdated Show resolved Hide resolved
app/components/icons/grip_component.rb Outdated Show resolved Hide resolved
app/components/icons/star_component.rb Outdated Show resolved Hide resolved
app/components/admin/tags/tag_form_component.html.erb Outdated Show resolved Hide resolved
Copy link
Member

@jsuchal jsuchal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luciajanikova toto bude mozno potrebovat tvoje pozretie tiez a skusenie lokalne, ze ako sa to sprava. Po FS mergi.

@@ -0,0 +1,3 @@
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white border border-gray-300 hover:bg-gray-100">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu sme sa dohodli, ze uz pouzivame IconComponent a nevyrabame komponenty per-ikona.

@@ -0,0 +1,4 @@
module Common
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detto

def icon_for(filter)
return Common::IconComponent.new(filter.icon) if filter.icon.present?

if filter.tag_id.present?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if filter.tag_id.present?
if filter.tag.present?

@@ -1,6 +1,6 @@
<div class="flex flex-col justify-stretch items-stretch gap-4 sm:p-4">
<div class="flex flex-col justify-stretch items-stretch sm:rounded-md bg-white sm:border sm:border-gray-200" data-controller="form all-checkboxes">
<%= render MessageThreadsBulkActionsComponent.new(ids: [], filter: @filter, filter_subscription: @filter_subscription, signable: Current.user.signer?) %>
<%= render MessageThreadsBulkActionsComponent.new(ids: [], filter:, query:, filter_subscription:, signable: Current.user.signer?) %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ak su toto nepovinne parametre tak ich tam neposielajme, ale zvlastne ze to nepotrebujeme.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niesu nepovinne, ale ide zase o Shorthand Hash Syntax

<%= form_with model: [:settings, Current.user.user_filter_visibilities.new(filter: @filter)], method: :post do |form| %>
<%= form.hidden_field :filter_id, value: @filter.id %>
<%= form.hidden_field :visible, value: [email protected] %>
<%= form.button class: "#{@visibility.hidden ? "bg-gray-200" : "bg-indigo-600"} relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2", role: :switch, aria: { checked: @visibility.hidden.to_s } do %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<% end %>
<%= form_with model: [:move_higher, :settings, @visibility], method: :post do |form| %>
<%= form.button do %>
<%= render Common::UpButtonComponent.new %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pouzit genericky komponent

<% end %>
<%= form_with model: [:move_lower, :settings, @visibility], method: :post do |form| %>
<%= form.button do %>
<%= render Common::DownButtonComponent.new %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pouzit genericky komponent

Comment on lines 63 to 69
def pin?
is_author_current_user?
end

def unpin?
pin?
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto sa niekde pouziva?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asi nie, davam prec

Gemfile Outdated
@@ -39,6 +39,7 @@ gem 'jwt'
gem 'stimulus-rails'
gem 'jsbundling-rails'
gem 'pdf-reader'
gem "acts_as_list", "~> 1.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pin na verziu nerobime pokym naozaj nie je treba

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@luciajanikova
Copy link
Member

Toto uz asi len mergnut s mainom a pretestovat? @jsuchal

@jsuchal
Copy link
Member

jsuchal commented Nov 16, 2024

@luciajanikova ano

@durcak
Copy link
Collaborator

durcak commented Nov 17, 2024

Main mergnuty, konflikty vyriesene, ale netestoval som to uz.

@luciajanikova
Copy link
Member

Pretestujem, keby na nieco narazim, pisem sem @durcak

@luciajanikova
Copy link
Member

Za mna inak asi ok, preklikala som sa cez to, vyzera to byt v poriadku. Trochu iba bojujem s tym, ze novy TagFilter nie je defaultne viditelny v lavom menu. Z mojho pohladu, ked si idem vytvarat Tag, tak chcem pomocou neho filtrovat spravy, rychlo najst tie, ktore su tagom oznacene. Takze chcem aby bol viditelny. Ak ho by default neuvidim, asi by ma to zmiatlo. Aky mas na to ty pohlad @jsuchal, ked preferujes default schovany?

Tuto asi este zostalal moja pripomienka zabudnuta + pride mi pre bezneho pouzivatela trochu matuce, ze k tagu existuje aj (duplicitny) filter a pri oboch je mozne nastavovat viditelnost, ale znamena to nieco ine. Potrebujeme to mat takto dvojmo, s tou viditelnostou, neznamena to to iste?
Inak som si to preklikala, skusila najdolezitejsie scenare a vyzera to byt v poriadku. @jsuchal

@jsuchal
Copy link
Member

jsuchal commented Dec 3, 2024

@luciajanikova neznamena to to iste myslim, jedno je viditelnost v lavom menu druhe je viditelnost na vlaknach. ale asi stoji za to zvazit to premenovat. kuknem to dnes vecer/zajtra.

@luciajanikova
Copy link
Member

@luciajanikova neznamena to to iste myslim, jedno je viditelnost v lavom menu druhe je viditelnost na vlaknach. ale asi stoji za to zvazit to premenovat. kuknem to dnes vecer/zajtra.

Ano, to je pravda, ale z pouzivatelskeho hladiska mi to uplne nedava zmysel, aby to boli dve rozne veci.

  • ked si napr. stitok NASES zvolim aby nebol viditelny, tak to pre mna znamena, ze ho nepouzivam, nechcem ho vidiet
  • filter ale zostava viditelny a teda vidim vlavo filter NASES, ktory ked rozkliknem, su tam thready, pri ktorych NASES stitok nie je zobrazeny, kedze nie je viditelny. z toho mi vychadza, ze bez viditelnosti stitka nema viditelnost filtra zmysel

Za mna: ak nejaky stitok chcem pouzivat, tak chcem aby bol viditelny (nech ho viem pridavat na vlakna) a zaroven chcem vidiet aj filter, nech si viem spravy s danym stitkom vyfiltrovat.
Naopak plati rovnako, ked nechcem pouzivat stitok, nechcem vidiet ani filter. Myslim si, ze viditelnost by sa mala nastavovat iba pri jednej z tychto veci.

@jsuchal
Copy link
Member

jsuchal commented Dec 3, 2024

@luciajanikova nepovedal by som, lebo minimalne to lave menu je personalizovane per-user a viditelnost stitkov je per-tenant ak si spravne spominam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants