Skip to content

Commit

Permalink
SDPA-3154 Fixed performance issue (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Sep 5, 2019
1 parent a0d81cb commit 1ceddb2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
39 changes: 19 additions & 20 deletions config/install/views.view.summary_contents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- taxonomy
- user
id: summary_contents
label: 'Content'
label: Content
module: views
description: 'Find and moderate content.'
tag: ''
Expand Down Expand Up @@ -216,11 +216,11 @@ display:
entity_type: node
entity_field: title
plugin_id: field
field_node_primary_site-revision_id:
id: field_node_primary_site-revision_id
table: node_revision__field_node_primary_site
field: field_node_primary_site-revision_id
relationship: none
field_node_primary_site:
id: field_node_primary_site
table: node__field_node_primary_site
field: field_node_primary_site
relationship: nid
group_type: group
admin_label: ''
label: Site
Expand Down Expand Up @@ -279,11 +279,11 @@ display:
separator: ', '
field_api_classes: false
plugin_id: field
field_node_site-revision_id:
id: field_node_site-revision_id
table: node_revision__field_node_site
field: field_node_site-revision_id
relationship: none
field_node_site:
id: field_node_site
table: node__field_node_site
field: field_node_site
relationship: nid
group_type: group
admin_label: ''
label: Sub-Site
Expand Down Expand Up @@ -733,9 +733,9 @@ display:
plugin_id: string
field_node_primary_site_target_id:
id: field_node_primary_site_target_id
table: node_revision__field_node_primary_site
table: node__field_node_primary_site
field: field_node_primary_site_target_id
relationship: none
relationship: nid
group_type: group
admin_label: ''
operator: or
Expand Down Expand Up @@ -784,9 +784,9 @@ display:
plugin_id: taxonomy_index_tid
field_node_site_target_id:
id: field_node_site_target_id
table: node_revision__field_node_site
table: node__field_node_site
field: field_node_site_target_id
relationship: none
relationship: nid
group_type: group
admin_label: ''
operator: or
Expand All @@ -795,7 +795,7 @@ display:
exposed: true
expose:
operator_id: field_node_site_target_id_op
label: Sub-site
label: Sub-Site
description: ''
use_operator: false
operator: field_node_site_target_id_op
Expand Down Expand Up @@ -837,7 +837,7 @@ display:
id: uid
table: users_field_data
field: uid
relationship: uid
relationship: revision_uid
group_type: group
admin_label: ''
operator: in
Expand Down Expand Up @@ -932,7 +932,6 @@ display:
value:
editorial-draft: editorial-draft
editorial-needs_review: editorial-needs_review
editorial-published: editorial-published
editorial-archived: editorial-archived
group: 1
exposed: true
Expand Down Expand Up @@ -1018,7 +1017,7 @@ display:
entity_field: status
plugin_id: boolean
sorts: { }
title: 'Content'
title: Content
header: { }
footer: { }
empty:
Expand Down Expand Up @@ -1091,7 +1090,7 @@ display:
page:
display_plugin: page
id: page
display_title: 'Content'
display_title: Content
position: 1
display_options:
display_extenders: { }
Expand Down
6 changes: 1 addition & 5 deletions src/EventSubscriber/TideSiteRouteAlter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ class TideSiteRouteAlter extends RouteSubscriberBase {
* {@inheritDoc}.
*/
protected function alterRoutes(RouteCollection $collection) {
// Comment it out temporarily for debugging why does
// the view.summary_contents.page load pretty slow.
/*
$route = $collection->get('system.admin_content');
$summary_contents_route = $collection->get('view.summary_contents.page');
if ($route && $summary_contents_route) {
$collection->add('system.admin_content', clone $summary_contents_route);
$collection->add('system.admin_content', clone $summary_contents_route);
}
*/
}

}
8 changes: 8 additions & 0 deletions tide_site.module
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ function tide_site_views_pre_view(ViewExecutable $view, $display_id, array &$arg
'alter' => [],
];
$view->addHandler($display_id, 'field', 'media__field_media_site', 'field_media_site', $site_field, 'field_media_site');

// Access to node_bulk_form should be restricted to the site_admin role.
if ($view->id() === 'summary_contents') {
$current_user = \Drupal::currentUser();
if (!in_array('site_admin', $current_user->getRoles())) {
$view->removeHandler('page', 'field', 'node_bulk_form');
}
}
}
}

Expand Down

0 comments on commit 1ceddb2

Please sign in to comment.