fix: metadata fix for content_hash diffs
This commit is contained in:
@@ -119,7 +119,7 @@ defmodule BDS.Desktop.ShellCommands do
|
||||
|
||||
defp dispatch("rebuild_posts_from_files", project, _params) do
|
||||
queue_task(project, "rebuild_posts_from_files", "Rebuild Posts From Files", "Maintenance", fn report ->
|
||||
{:ok, posts} = Maintenance.rebuild_from_filesystem(project.id, "post", on_progress: report, rebuild_embeddings: false)
|
||||
{:ok, posts} = Maintenance.rebuild_from_filesystem(project.id, "post", on_progress: report)
|
||||
report.(1.0, "Post rebuild complete")
|
||||
%{project_id: project.id, counts: %{posts: length(posts)}}
|
||||
end)
|
||||
|
||||
@@ -17,7 +17,11 @@ defmodule BDS.Desktop.ShellLive.MiscEditor do
|
||||
def rerun(socket) do
|
||||
case meta(socket.assigns) do
|
||||
%{action: action} when is_binary(action) -> {:command, action}
|
||||
_other -> {:noop, socket}
|
||||
_other ->
|
||||
case misc_route_action(socket.assigns.current_tab.type) do
|
||||
nil -> {:noop, socket}
|
||||
action -> {:command, action}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -464,7 +468,13 @@ defmodule BDS.Desktop.ShellLive.MiscEditor do
|
||||
end
|
||||
end
|
||||
|
||||
defp metadata_diff_repairable_tab?(tab_id), do: tab_id in ["posts", "media", "scripts", "templates", "project"]
|
||||
defp metadata_diff_repairable_tab?(tab_id), do: tab_id in ["posts", "media", "scripts", "templates", "project", "embeddings"]
|
||||
|
||||
defp misc_route_action(:site_validation), do: "validate_site"
|
||||
defp misc_route_action(:metadata_diff), do: "metadata_diff"
|
||||
defp misc_route_action(:translation_validation), do: "validate_translations"
|
||||
defp misc_route_action(:find_duplicates), do: "find_duplicates"
|
||||
defp misc_route_action(_route), do: nil
|
||||
|
||||
defp format_metadata_diff_value(nil), do: "-"
|
||||
defp format_metadata_diff_value(""), do: "-"
|
||||
|
||||
@@ -20,6 +20,14 @@ defmodule BDS.Embeddings do
|
||||
def index_path(project_id), do: Index.path(project_id)
|
||||
def reindex_all(project_id), do: rebuild_project(project_id)
|
||||
|
||||
def refresh_snapshot(project_id) when is_binary(project_id) do
|
||||
if enabled_for_project?(project_id) do
|
||||
:ok = rebuild_snapshot(project_id)
|
||||
end
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
def get_indexing_progress(project_id) when is_binary(project_id) do
|
||||
indexed =
|
||||
Repo.one(
|
||||
@@ -105,7 +113,15 @@ defmodule BDS.Embeddings do
|
||||
if differences == [] do
|
||||
[]
|
||||
else
|
||||
[%{entity_type: "embedding", entity_id: post.id, differences: differences}]
|
||||
[
|
||||
%{
|
||||
entity_type: "embedding",
|
||||
entity_id: post.id,
|
||||
label: post.title || post.slug || post.id,
|
||||
meta_label: Persistence.timestamp_to_iso8601(post.created_at),
|
||||
differences: differences
|
||||
}
|
||||
]
|
||||
end
|
||||
end)
|
||||
else
|
||||
|
||||
@@ -664,6 +664,8 @@ defmodule BDS.Maintenance do
|
||||
{:db_to_file, "script"} -> BDS.Scripts.sync_published_script_file(entity_id)
|
||||
{:file_to_db, "template"} -> BDS.Templates.sync_template_from_file(entity_id)
|
||||
{:db_to_file, "template"} -> BDS.Templates.sync_published_template_file(entity_id)
|
||||
{:file_to_db, "embedding"} -> BDS.Embeddings.sync_post(entity_id)
|
||||
{:db_to_file, "embedding"} -> BDS.Embeddings.refresh_snapshot(project_id)
|
||||
_other -> {:error, :unsupported}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user