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: Adding the instances views #185

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ce7af42
fix #16, add instances table component (instances by ontolgy and clas…
syphax-bouazzouni Feb 9, 2022
0950b3d
fix#20 , ontology badges text overflow fix
syphax-bouazzouni Feb 9, 2022
65c08f0
fix #17 , add current page range and count to the instances table com…
syphax-bouazzouni Dec 27, 2021
f9631d5
fix #18; disable Previous and Next link if first or last
syphax-bouazzouni Dec 27, 2021
9440749
bug fix for instances concepts ids with parenthesis
syphax-bouazzouni Dec 27, 2021
a74d890
added a function to get the concpetId in the classes content section
syphax-bouazzouni Feb 9, 2022
839c79b
fix #19, added a function to get the concpetId in the instances section
syphax-bouazzouni Dec 27, 2021
0498bca
instances js files refactor
syphax-bouazzouni Dec 27, 2021
f42fb6a
bug fix; reset conceptId when go to the classes tab from the instance…
syphax-bouazzouni Dec 28, 2021
f6f4c95
catch instance detail promise error
syphax-bouazzouni Dec 28, 2021
4a76641
change instances tab positon
syphax-bouazzouni Dec 28, 2021
081bfe4
prevent instances details to show when concept_id equals root
syphax-bouazzouni Dec 28, 2021
de8fbb3
prevent instances details to show when concept_id equals root
syphax-bouazzouni Dec 28, 2021
4379b96
added uri helper
syphax-bouazzouni Dec 28, 2021
7ff1fc6
clean the InstancesHelper code
syphax-bouazzouni Dec 28, 2021
42a2437
add concept label links components
syphax-bouazzouni Dec 28, 2021
101641e
fix #25 ; update instances components to use ConceptLabelLink
syphax-bouazzouni Dec 28, 2021
e4c3dc1
add instance interface (model)
syphax-bouazzouni Dec 29, 2021
c3a01cb
clean unused function
syphax-bouazzouni Dec 29, 2021
b43e1e8
add instance label link component
syphax-bouazzouni Dec 29, 2021
b3fee58
add a helper for choosing which propertyLabel of an instance print
syphax-bouazzouni Dec 29, 2021
e1c7f21
update code to use InstaneLabelLink
syphax-bouazzouni Dec 29, 2021
f35da89
add search and order by instances by labels
syphax-bouazzouni Feb 9, 2022
d9ae18f
instance details popup style fixes
syphax-bouazzouni Jan 1, 2022
c4e5a66
bug fix in instances table when clicking types it was opening the det…
syphax-bouazzouni Jan 12, 2022
ff86cd8
add instances helper and use it in instances controller
syphax-bouazzouni Jan 13, 2022
96cc988
clean a console log from uri.js
syphax-bouazzouni Jan 13, 2022
fe7154f
bug fix, to change instance_count only if concept id exist
syphax-bouazzouni Jan 13, 2022
46772d3
fix #35, show instance detail popup in classes tab
syphax-bouazzouni Feb 9, 2022
eb6ec90
fix #36, show a custom label for not found classes (external ones)
syphax-bouazzouni Feb 9, 2022
a75d347
use api client unstead of raw http get for instances
syphax-bouazzouni Feb 9, 2022
c8885f5
fix bug instances count that is not updating on class change
syphax-bouazzouni Jan 16, 2022
1d59714
clean unwanted changes in the instances branch
syphax-bouazzouni Feb 9, 2022
0975540
fix bug instances count that is not updating on class change
syphax-bouazzouni Jan 16, 2022
bcd77fe
update bootstrap for geting work the instandes table spinnner
syphax-bouazzouni Feb 9, 2022
9f87c3c
fix #53, fix instances details popup width
syphax-bouazzouni Jan 24, 2022
cba3c00
refactor code to use web components
syphax-bouazzouni Feb 9, 2022
df49b19
add instance detail show action
syphax-bouazzouni Feb 9, 2022
2477293
remove and update unused code
syphax-bouazzouni Feb 9, 2022
b5299f6
update and clean instances routes
syphax-bouazzouni Feb 9, 2022
6802987
reset browse style
syphax-bouazzouni Feb 9, 2022
3c43b5c
fix bug of event dispatcher at each update
syphax-bouazzouni Feb 9, 2022
45ac6e7
fix extract label from uri if uri not contain #
syphax-bouazzouni Feb 9, 2022
6b07bd0
fix instance_property_value for not found instances
syphax-bouazzouni Feb 10, 2022
099ec95
fix a miss writing in a function name
syphax-bouazzouni Feb 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem 'uglifier', '>= 1.0.3'
# gem 'therubyracer', platforms: :ruby
# gem 'duktape'

gem 'bootstrap', '~> 4.1.0'
gem 'bootstrap', '~> 4.2.0'
gem 'chart-js-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
Expand Down
105 changes: 56 additions & 49 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GIT
ontologies_api_client (2.0.2)
activesupport (~> 5.2.6)
excon
faraday
faraday (= 1.4.3)
lz4-ruby
multi_json
oj
Expand Down Expand Up @@ -62,13 +62,13 @@ GEM
sshkit (>= 1.6.1, != 1.7.0)
arel (9.0.0)
ast (2.4.2)
autoprefixer-rails (10.3.3.0)
autoprefixer-rails (10.4.2.0)
execjs (~> 2)
bootstrap (4.1.3)
autoprefixer-rails (>= 6.0.3)
popper_js (>= 1.12.9, < 2)
sass (>= 3.5.2)
brakeman (5.1.1)
bootstrap (4.2.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
brakeman (5.2.1)
builder (3.2.4)
capistrano (3.16.0)
airbrussh (>= 1.0.0)
Expand All @@ -86,8 +86,9 @@ GEM
capistrano-bundler (>= 1.1, < 3)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
capybara (3.35.3)
capybara (3.36.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
Expand All @@ -101,35 +102,29 @@ GEM
crass (1.0.6)
cube-ruby (0.0.3)
daemons (1.4.1)
dalli (2.7.11)
diff-lcs (1.4.4)
dalli (3.2.0)
diff-lcs (1.5.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
erubi (1.10.0)
erubis (2.7.0)
eventmachine (1.2.7)
excon (0.85.0)
excon (0.91.0)
execjs (2.8.1)
faraday (1.8.0)
faraday (1.4.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
ffi (1.15.4)
ffi (1.15.5)
flamegraph (0.9.5)
globalid (0.5.2)
activesupport (>= 5.0)
Expand All @@ -144,7 +139,7 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.4)
domain_name (~> 0.5)
i18n (1.8.10)
i18n (1.9.1)
concurrent-ruby (~> 1.0)
iconv (1.0.8)
jquery-rails (4.4.0)
Expand All @@ -153,8 +148,8 @@ GEM
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.5.1)
listen (3.7.0)
json (2.6.1)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.12.0)
Expand All @@ -164,24 +159,23 @@ GEM
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0901)
mini_mime (1.1.1)
mini_portile2 (2.6.1)
minitest (5.14.4)
mime-types-data (3.2022.0105)
mini_mime (1.1.2)
minitest (5.15.0)
multi_json (1.15.0)
multipart-post (2.1.1)
mysql2 (0.5.2)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
netrc (0.11.0)
newrelic_rpm (8.0.0)
newrelic_rpm (8.4.0)
nio4r (2.5.8)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
nokogiri (1.13.1-x86_64-darwin)
racc (~> 1.4)
oj (3.13.8)
open_uri_redirections (0.2.1)
Expand All @@ -192,6 +186,8 @@ GEM
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
psych (4.0.3)
stringio
public_suffix (4.0.6)
racc (1.5.2)
rack (2.2.3)
Expand Down Expand Up @@ -225,12 +221,13 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.0)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.3.2)
rdoc (6.4.0)
psych (>= 4.0.0)
recaptcha (5.8.1)
json
regexp_parser (2.1.1)
Expand All @@ -240,33 +237,33 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (5.0.2)
rspec-support (~> 3.11.0)
rspec-rails (5.1.0)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
rubocop (1.22.0)
rspec-support (3.11.0)
rubocop (1.25.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.12.0, < 2.0)
rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.12.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
Expand All @@ -283,6 +280,14 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
select2-rails (4.0.13)
sexp_processor (4.15.3)
spawnling (2.1.5)
Expand All @@ -297,12 +302,13 @@ GEM
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.17)
stringio (3.0.1)
temple (0.8.2)
thin (1.8.1)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.1.0)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (1.2.9)
Expand All @@ -321,10 +327,10 @@ GEM
nokogiri (~> 1.8)

PLATFORMS
ruby
x86_64-darwin-21

DEPENDENCIES
bootstrap (~> 4.1.0)
bootstrap (~> 4.2.0)
brakeman
capistrano (~> 3.11)
capistrano-bundler
Expand Down Expand Up @@ -364,8 +370,9 @@ DEPENDENCIES
select2-rails
stackprof
thin
uglifier (>= 1.0.3)
turnout
uglifier (>= 4.2.0)
will_paginate (~> 3.0)

BUNDLED WITH
2.1.4
2.3.4
4 changes: 4 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
//= require bp_recommender
//= require bp_property_tree
//= require home
//= require_tree ./components
//= require ontologies
//= require projects
//= require submissions

customElements.define('data-table-loader', DataTableLoader );
customElements.define('data-table', DataTable );
customElements.define('instances-table', InstancesTable );
9 changes: 5 additions & 4 deletions app/assets/javascripts/bioportal.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,11 @@ jQuery(document).ready(function(){
function getAjaxContent() {
// Look for anchors with a get_via_ajax class and replace the parent with the resulting ajax call
$(".get_via_ajax").each(function(){
if (typeof $(this).attr("getting_content") === 'undefined') {
$(this).parent().load($(this).attr("href"));
$(this).attr("getting_content", true);
}
let elem = $(this)
let parent = elem.parent()
$.get(elem.attr("href"), (conceptLabel) => {
parent.html(conceptLabel)
})
});
setTimeout(getAjaxContent, 500);
}
Expand Down
30 changes: 27 additions & 3 deletions app/assets/javascripts/bp_class_tree.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function initClassTree() {
}
});

setConcept(jQuery(document).data().bp.ont_viewer.concept_id);
setConcept(getClassesConceptId());
setOntology(jQuery(document).data().bp.ont_viewer.ontology_id);
jQuery("#sd_content").scrollTo(jQuery('a.active'));

Expand Down Expand Up @@ -87,6 +87,7 @@ function initClassTree() {
};

function nodeClicked(node_id) {

// Get current html and store data in cache (to account for changes since the cache was retrieved)
setCacheCurrent();

Expand Down Expand Up @@ -130,7 +131,8 @@ function nodeClicked(node_id) {
insertNotesTable(tabData["notes_table_data"]);

wrapupTabChange(selectedTab);
} else {
}
else {
jQuery.blockUI({ message: '<h1>' + '<%= image_tag src="jquery.simple.tree/spinner.gif" %>' + ' Loading Class...</h1>', showOverlay: false });
jQuery.get('/ajax_concepts/'+jQuery(document).data().bp.ont_viewer.ontology_id+'/?conceptid='+node_id+'&callback=load',
function(data){
Expand All @@ -150,6 +152,18 @@ function nodeClicked(node_id) {
}
);
}

//TODO: think of if we can use the cache for instances
updateConceptInstances(getOntology() , node_id)

}

// Update instances table when a new concept in the tree view is clicked
function updateConceptInstances(ontology_acronym,node_id){
$("#class-instances-data-table").ready(function() {
const instanceTable = document.querySelector("#class-instances-data-table")
instanceTable.update(ontology_acronym, decodeURIComponent(node_id))
})
}

// Keep trying to put the tree view content in place (looks for #sd_content)
Expand Down Expand Up @@ -180,10 +194,20 @@ function placeTreeView(treeHTML) {
}
}


/**
* Return the conceptid from
* the section url if the section is "classes"
* @returns {*|string}
*/
function getClassesConceptId(default_concept_id = "root"){
const ont_viewer_data = jQuery(document).data().bp.ont_viewer
return ont_viewer_data.content_section === "classes" ? ont_viewer_data.concept_id : default_concept_id
}
// Retrieve the tree view using ajax
function getTreeView() {
jQuery.ajax({
url: "/ajax/classes/treeview?ontology="+jQuery(document).data().bp.ont_viewer.ontology_id+"&conceptid="+encodeURIComponent(jQuery(document).data().bp.ont_viewer.concept_id),
url: "/ajax/classes/treeview?ontology="+jQuery(document).data().bp.ont_viewer.ontology_id+"&conceptid="+encodeURIComponent(getClassesConceptId()),
success: function(data) {
placeTreeView(data);
},
Expand Down
Loading