AngyL75
AngyL75
AEAsh Elixir
Created by AngyL75 on 5/25/2025 in #support
AshArchival
How, thanks. I will try to implement it 🙂 and will let you know my progress 🙂
14 replies
AEAsh Elixir
Created by AngyL75 on 5/25/2025 in #support
AshArchival
To add to my previous post : should ai only duplicate the attributes and that is all ?
14 replies
AEAsh Elixir
Created by AngyL75 on 5/20/2025 in #support
Slow pages ... due to too many load of data...
OK, I will try 🙂
8 replies
AEAsh Elixir
Created by AngyL75 on 5/20/2025 in #support
Slow pages ... due to too many load of data...
Yes I will figure it out... I have done that in the past... I was just trying to find an efficient faster way to do it...it is just that having kind of a "dbg" every time a Ash is requested... would be nice... because then I can quickly find where each call is done..
8 replies
AEAsh Elixir
Created by aidalgol on 5/4/2025 in #support
Rendering AshPaperTrails
Hi @aidalgol the code related to the screenshot above is
<div :if={@membership_history != []} class="mt-2">
<h1>{gettext("History of membership")}</h1>
<ul class="list-disc pl-5">
<li :for={item <- @membership_history}>
<span>
{CauseBeacon.Cldr.DateTime.to_string!(
item.version_inserted_at,
format: :short
)}: <MemberBadgeStatus.badge_status status={item.status} />
{item.message}
</span>
</li>
</ul>
</div>
<div :if={@membership_history != []} class="mt-2">
<h1>{gettext("History of membership")}</h1>
<ul class="list-disc pl-5">
<li :for={item <- @membership_history}>
<span>
{CauseBeacon.Cldr.DateTime.to_string!(
item.version_inserted_at,
format: :short
)}: <MemberBadgeStatus.badge_status status={item.status} />
{item.message}
</span>
</li>
</ul>
</div>
13 replies
AEAsh Elixir
Created by aidalgol on 5/4/2025 in #support
Rendering AshPaperTrails
Hi @aidalgol does it reply to your question ?
13 replies
AEAsh Elixir
Created by aidalgol on 5/4/2025 in #support
Rendering AshPaperTrails
In my Member ressource, I have:
paper_trail do
primary_key_type :uuid
only_when_changed? true
change_tracking_mode :changes_only
store_action_name? true
store_action_inputs? true
ignore_attributes [:inserted_at, :updated_at]
ignore_actions [:destroy]
# for multitenancy
attributes_as_attributes [:organization_id]
belongs_to_actor :actor, CauseBeacon.Accounts.User, public?: false
end
paper_trail do
primary_key_type :uuid
only_when_changed? true
change_tracking_mode :changes_only
store_action_name? true
store_action_inputs? true
ignore_attributes [:inserted_at, :updated_at]
ignore_actions [:destroy]
# for multitenancy
attributes_as_attributes [:organization_id]
belongs_to_actor :actor, CauseBeacon.Accounts.User, public?: false
end
Note: - in :actor the person who modify the resource is stored - :store_action_name is very usefull to know which action has been called The status of my member is an Enum:
use Ash.Type.Enum,
values: [
invited: gettext("Invited"),
validated: gettext("Pending (Connection)"),
connected: gettext("Pending (Validation)"),
waiting_list: gettext("Waiting List"),
activated: gettext("Active"),
left: gettext("Left")
]
use Ash.Type.Enum,
values: [
invited: gettext("Invited"),
validated: gettext("Pending (Connection)"),
connected: gettext("Pending (Validation)"),
waiting_list: gettext("Waiting List"),
activated: gettext("Active"),
left: gettext("Left")
]
Now, when I load my member data in my liveview, I do:
member =
Ash.load!(
assigns.member,
[
:connections,
paper_trail_versions:
CauseBeacon.Organizations.Member.Version
|> Ash.Query.load(:actor)
],
actor: assigns.current_user
)
member =
Ash.load!(
assigns.member,
[
:connections,
paper_trail_versions:
CauseBeacon.Organizations.Member.Version
|> Ash.Query.load(:actor)
],
actor: assigns.current_user
)
and after I am doing the processing of the version like:
membership_history =
member.paper_trail_versions
|> Enum.filter(fn version -> Map.has_key?(version.changes, "status") end)
|> Enum.map(....)
membership_history =
member.paper_trail_versions
|> Enum.filter(fn version -> Map.has_key?(version.changes, "status") end)
|> Enum.map(....)
13 replies
AEAsh Elixir
Created by aidalgol on 5/4/2025 in #support
Rendering AshPaperTrails
No description
13 replies