forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/add-graphs-count-admin-page' into stage
- Loading branch information
Showing
6 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'multi_json' | ||
class Admin::GraphsController < ApplicationController | ||
|
||
include TurboHelper | ||
|
||
layout :determine_layout | ||
before_action :authorize_admin | ||
|
||
GRAPHS_URL = "#{LinkedData::Client.settings.rest_url}/admin/graphs" | ||
|
||
def index | ||
@graphs = LinkedData::Client::HTTP.get("#{GRAPHS_URL}", { raw: true }, { raw: true }) | ||
@graphs = MultiJson.load(@graphs) | ||
end | ||
|
||
def create | ||
|
||
end | ||
|
||
def destroy | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Admin::GraphsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
= turbo_frame_tag 'graphs-admin' do | ||
= render_alerts_container | ||
%div#site-admin-clear-caches.my-2 | ||
%div | ||
%div.d-flex.justify-content-between.w-100 | ||
%div | ||
%p Total graphs: #{@graphs.size} | ||
%p Total triples: #{@graphs.reduce(0){|sum, (k,v)| sum + v[0]}} | ||
%p Total zombie graphs: #{@graphs.reduce(0){|sum, (k,v)| sum + (v[1] ? 1 : 0)}} | ||
%div | ||
= form_with url: admin_index_batch_path, method: 'post', data:{turbo: true, turbo_frame: '_top'} do | ||
= regular_button('graphs-genrate', 'Generate Graphs count report') | ||
%div | ||
= render TableComponent.new(id: 'search_collections', custom_class: 'border rounded', paging: true, searching: true, sort_column: 1) do |t| | ||
- t.header do |h| | ||
- h.th { "#" } | ||
- h.th { "Graph URI" } | ||
- h.th { "Triples count" } | ||
- h.th { "Zombie graph?" } | ||
- h.th { t('admin.search.index.actions') } | ||
- @graphs.each_with_index do |graph_count, i| | ||
- graph, values = graph_count | ||
- t.row do |r| | ||
- r.td{ i.to_s } | ||
- r.td{ graph } | ||
- r.td{ values[0].to_s} | ||
- r.td{ values[1].to_s} | ||
- r.td do | ||
.d-flex.align-items-center | ||
- if values[1] | ||
%span | ||
= action_button('Delete', "/admin/graphs/#{graph}", method: :delete) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters