From d12310bdb6f8f85f5fab4a9ee08c0eb86538ac3b Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Tue, 13 Aug 2024 13:57:01 +0200 Subject: [PATCH 1/5] remove beta notice --- app/views/stash_engine/admin_dashboard/index.html.erb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/stash_engine/admin_dashboard/index.html.erb b/app/views/stash_engine/admin_dashboard/index.html.erb index bdb398b790..18640195ec 100644 --- a/app/views/stash_engine/admin_dashboard/index.html.erb +++ b/app/views/stash_engine/admin_dashboard/index.html.erb @@ -1,8 +1,5 @@ <% @page_title = "Admin dashboard" %> <% unaltered = @saved_search&.filters == @filters && @saved_search&.fields == @fields && (@saved_search&.search_string == @search_string || (@saved_search&.search_string.blank? && @search_string.blank?)) %> -
-

Welcome to the beta version of the new Admin dashboard! Please send your feedback to community@datadryad.org.

-

Admin dashboard

<%= render partial: 'role_select' %> @@ -23,6 +20,10 @@
+
+

Please send your Admin dashboard feedback to community@datadryad.org.

+
+ diff --git a/app/views/stash_engine/admin_datasets/_search.html.erb b/app/views/stash_engine/admin_datasets/_search.html.erb deleted file mode 100644 index 3a3adf6b7c..0000000000 --- a/app/views/stash_engine/admin_datasets/_search.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<%= form_with(url: stash_url_helpers.url_for(controller: '/stash_engine/admin_datasets', action: 'index', only_path: true), - method: 'get', id: 'search_form') do %> -
-
- - <%= search_field_tag(:q, params[:q], class: 'c-input__text', id: 'search-terms' ) %> - <%= hidden_field_tag(:sort, 'relevance') %> -
-
- <%= check_box_tag(:all_advanced, value = "1", checked = (params[:all_advanced] == '1')) %> - <%= label_tag(:all_advanced, 'All terms') %> -
- <%= submit_tag('Search', name: nil, class: 'o-button__submit' ) %> - Clear terms - <% params.except(:controller, :action, :q, :commit, :page, :page_size, :show_all, :sort, :direction, :all_advanced).each_pair do |k,v| %> - <%= hidden_field_tag k, v, id: "search_#{k}" %> - <% end %> -
-<% end %> - - diff --git a/app/views/stash_engine/admin_datasets/_stats_popup_display.html.erb b/app/views/stash_engine/admin_datasets/_stats_popup_display.html.erb deleted file mode 100644 index eff8e48cc6..0000000000 --- a/app/views/stash_engine/admin_datasets/_stats_popup_display.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Dataset statistics

-<%= render partial: 'stash_engine/landing/metrics', locals: {identifier: @identifier, no_link: true} %> - -<% if @resource&.identifier&.cached_citations.count > 0 %> -
- <%= render partial: 'stash_engine/landing/citations', locals: {identifier: @identifier} %> -<% end %> \ No newline at end of file diff --git a/app/views/stash_engine/admin_datasets/curation_activity_error.js.erb b/app/views/stash_engine/admin_datasets/curation_activity_error.js.erb deleted file mode 100644 index 9650690961..0000000000 --- a/app/views/stash_engine/admin_datasets/curation_activity_error.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -// replace dialog div with contents of dialog text from partial -document.getElementById('genericModalContent').innerHTML = '

Update error!

<%= escape_javascript(@error_message) %>'; diff --git a/app/views/stash_engine/admin_datasets/edit.js.erb b/app/views/stash_engine/admin_datasets/edit.js.erb index 602bf42827..2dcfa04a86 100644 --- a/app/views/stash_engine/admin_datasets/edit.js.erb +++ b/app/views/stash_engine/admin_datasets/edit.js.erb @@ -1,7 +1,3 @@ -<% if @field == 'waiver' %> document.getElementById("payment_info_table").outerHTML = "<%= escape_javascript(render partial: 'payment_info_table', locals: { identifier: @identifier }) %>"; document.getElementById("apply_fee_waiver").outerHTML = "
" -<% else %> -document.getElementById("js-dataset-row-id-<%= @resource.identifier.id %>").outerHTML = "<%= escape_javascript(render partial: 'stash_engine/admin_datasets/datasets_row', locals: { dataset: @curation_row }) %>" -<% end %> document.getElementById('genericModalDialog').close(); \ No newline at end of file diff --git a/app/views/stash_engine/admin_datasets/index.csv.erb b/app/views/stash_engine/admin_datasets/index.csv.erb deleted file mode 100644 index 6063509256..0000000000 --- a/app/views/stash_engine/admin_datasets/index.csv.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%= "Title,DOI,Status,Author,Last modified,Last modified by,Size,Submitted,Published,Journal name,Views,Downloads,Citations,Submitting author institution,Created" %> -<% @datasets.each do |resource| -%> -<% - row = [ resource&.title || '[no title set]', - resource.identifier, - resource&.status, - resource&.author_names, - resource&.updated_at, - resource&.editor_name, - resource.resource_size, - resource&.submission_date, - resource&.publication_date, - resource&.publication_name, - resource.views, - resource.downloads, - resource.citations, - StashEngine::Tenant.exists?(resource.tenant_id) ? StashEngine::Tenant.find(resource.tenant_id)&.long_name : '', - resource&.created_date - ] --%><%= row.to_csv(row_sep: nil).html_safe %> -<% end -%> diff --git a/app/views/stash_engine/admin_datasets/index.html.erb b/app/views/stash_engine/admin_datasets/index.html.erb deleted file mode 100644 index 0a01fff87f..0000000000 --- a/app/views/stash_engine/admin_datasets/index.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<% @page_title = "Admin dashboard" %> -

Admin dashboard

- -<%= render partial: 'admin_head', locals: { all_stats: @all_stats, seven_day_stats: @seven_day_stats } %> - -

Datasets

- -
- <%= render partial: 'search' %> - <%= render partial: 'filter' %> -
- -<%= render partial: 'datasets_table', locals: { datasets: @datasets } %> - - - -

- † By default the search uses relevance ranking and not all terms are required. Choosing the All terms - option requires all the terms in your query to be present in the results. If you prefer to do an advanced query - with more fine-grained options, select All terms - and add any of (~ + < > *) that are commonly part of - the boolean query syntax to use that - syntax. -

diff --git a/app/views/stash_engine/admin_datasets/popup.js.erb b/app/views/stash_engine/admin_datasets/popup.js.erb index cd2f821351..7663fec5e2 100644 --- a/app/views/stash_engine/admin_datasets/popup.js.erb +++ b/app/views/stash_engine/admin_datasets/popup.js.erb @@ -9,9 +9,6 @@ when 'publication' when 'note' partial = 'stash_engine/admin_datasets/curation_note_popup' locals = { identifier: @identifier, title: 'Add note' } -when 'stats' - partial = 'stash_engine/admin_datasets/stats_popup_display' - locals = {} else partial = 'popup_form' locals = {} @@ -33,15 +30,4 @@ document.getElementById('cancel_dialog').addEventListener('click', (e) => { else other.setAttribute('hidden', 'hidden') }) <% end %> -<% end %> - -<% if @field == 'curation_activity' %> - initDatePicker(); - document.getElementById('activity_status_select').addEventListener('change', (e) => { - if (e.currentTarget.value === 'published' || e.currentTarget.value === 'embargoed') { - document.getElementById('c-input_publication_date').removeAttribute('hidden'); - } else { - document.getElementById('c-input_publication_date').setAttribute('hidden', 'hidden'); - } - }) <% end %> \ No newline at end of file From 0a05ae5f0d0c37f9b0952bc2b3175053627ce4e4 Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Wed, 14 Aug 2024 14:18:04 +0200 Subject: [PATCH 5/5] remove unneeded policies and scope --- .../stash_engine/admin_datasets_policy.rb | 37 +------------------ 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/app/policies/stash_engine/admin_datasets_policy.rb b/app/policies/stash_engine/admin_datasets_policy.rb index 10f0853e9b..8b1e573c5b 100644 --- a/app/policies/stash_engine/admin_datasets_policy.rb +++ b/app/policies/stash_engine/admin_datasets_policy.rb @@ -1,20 +1,12 @@ module StashEngine class AdminDatasetsPolicy < ApplicationPolicy - def index? - @user.min_admin? - end - def activity_log? - index? - end - - def stats_popup? - index? + @user.min_admin? end def note_popup? - index? + @user.min_admin? end def data_popup? @@ -33,30 +25,5 @@ def waiver_add? @user.superuser? end - class Scope - def initialize(user, scope, params) - @user = user - @scope = scope - @params = params - end - - def resolve - if @user.tenant_limited? - @scope.where(**@params, tenant: @user.tenant) - elsif @user.min_app_admin? - @scope.where(**@params) - elsif @user.journals_as_admin.present? - @scope.where(**@params, journals: @user.journals_as_admin.map(&:title)) - elsif @user.funders.present? - @scope.where(**@params, funders: @user.funders.map(&:ror_id)) - else - false - end - end - - private - - attr_reader :user, :scope - end end end