forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
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: add graphs count admin page #914
Draft
syphax-bouazzouni
wants to merge
7
commits into
development
Choose a base branch
from
feature/add-graphs-count-admin-page
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c5c613a
add graph admin page section
syphax-bouazzouni 16764d6
remove graph delete and generate actions
syphax-bouazzouni 04a131a
add admin logs page
syphax-bouazzouni b921d17
add user API usage graph in the admin analytics section
syphax-bouazzouni f682b18
add again the graph count generation button
syphax-bouazzouni d46f0a2
fix an issue with user count when not logged
syphax-bouazzouni dee7aca
handle the case where user counts is not enabled
syphax-bouazzouni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions
4
app/components/text_area_field_component/text_area_field_component.html.haml
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
%div{data:{controller:"text-truncate", 'text-truncate-more-text-value': @see_more_text , 'text-truncate-less-text-value': @see_less_text}} | ||
%span.text-content{'data-text-truncate-target': 'content'} | ||
= @value | ||
= @value || content | ||
%span.see_more_text{data:{'text-truncate-target': 'button', 'action':"click->text-truncate#toggle"}} | ||
= @see_more_text | ||
= @see_more_text |
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,27 @@ | ||
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".freeze | ||
|
||
def index | ||
@graphs = LinkedData::Client::HTTP.get(GRAPHS_URL.dup, { raw: true }, { raw: true }) | ||
@graphs = MultiJson.load(@graphs) | ||
@zombie_graphs = @graphs.select { |_, v| v[1] } | ||
all_onts = LinkedData::Client::Models::Ontology.all | ||
@empty_ontologies = all_onts.select { |ont| [email protected]? { |k, _| k.include?(ont.acronym) } } | ||
end | ||
|
||
def create | ||
message = 'Graphs counts created successfully' | ||
# response = LinkedData::Client::HTTP.post(GRAPHS_URL, {}) | ||
# message = response.status == 200 ? response.message : 'Error creating graphs counts' | ||
redirect_to admin_index_path(section: 'graphs'), notice: message | ||
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,19 @@ | ||
require 'multi_json' | ||
|
||
class Admin::LogsController < ApplicationController | ||
|
||
include TurboHelper | ||
|
||
layout :determine_layout | ||
before_action :authorize_admin | ||
|
||
ALL_LOGS = "#{LinkedData::Client.settings.rest_url}/admin/latest_day_query_logs".freeze | ||
LATEST_LOGS = "#{LinkedData::Client.settings.rest_url}/admin/last_n_s_query_logs?seconds=10".freeze | ||
USERS_QUERY_COUNT = "#{LinkedData::Client.settings.rest_url}/admin/user_query_count".freeze | ||
def index | ||
page = (params[:page] || 1).to_i | ||
page_size = (params[:page_size] || 100).to_i | ||
@logs = LinkedData::Client::HTTP.get(ALL_LOGS.dup, { page: page, pagesize: page_size }) | ||
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
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
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,38 @@ | ||
= turbo_frame_tag 'graphs-admin' do | ||
= render_alerts_container | ||
%div#site-admin-clear-caches.my-2 | ||
%div | ||
%div | ||
|
||
- unless @zombie_graphs.empty? | ||
%div.my-1 | ||
= render Display::AlertComponent.new(id: 'graphs-admin-zombie', type: 'danger') do | ||
There are #{@zombie_graphs.size} zombie graphs in the system. Please check the list below and take action. | ||
|
||
- unless @empty_ontologies.empty? | ||
%div.my-1 | ||
= render Display::AlertComponent.new(id: 'graphs-admin-empty-ontologies', type: 'danger') do | ||
There are #{@empty_ontologies.size} ontologies with no graphs in the system: #{@empty_ontologies.map{|o| o[:acronym]}.join(", ")} | ||
|
||
|
||
%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]}} | ||
%div | ||
= form_with url: '/admin/graphs/', method: 'post', data:{turbo: true, turbo_frame: '_top', turbo_confirm: 'This may take a while, are you sure you want to run this?'} do | ||
= regular_button('graphs-generate', 'Generate Graphs count report', type: 'submit') | ||
%div | ||
= render TableComponent.new(id: 'graphs_table', 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?" } | ||
- @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} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty helper, delete it