mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
129694: PoC #4099 solution with resolvers
This commit is contained in:
@@ -41,6 +41,8 @@ import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.
|
|||||||
import { PROCESS_MODULE_PATH } from './process-page/process-page-routing.paths';
|
import { PROCESS_MODULE_PATH } from './process-page/process-page-routing.paths';
|
||||||
import { provideSubmissionState } from './submission/provide-submission-state';
|
import { provideSubmissionState } from './submission/provide-submission-state';
|
||||||
import { SUGGESTION_MODULE_PATH } from './suggestions-page/suggestions-page-routing-paths';
|
import { SUGGESTION_MODULE_PATH } from './suggestions-page/suggestions-page-routing-paths';
|
||||||
|
import { homePageResolver } from './home-page/home-page.resolver';
|
||||||
|
import { viewTrackerResolver } from './statistics/angulartics/dspace/view-tracker.resolver';
|
||||||
|
|
||||||
export const APP_ROUTES: Route[] = [
|
export const APP_ROUTES: Route[] = [
|
||||||
{ path: INTERNAL_SERVER_ERROR, component: ThemedPageInternalServerErrorComponent },
|
{ path: INTERNAL_SERVER_ERROR, component: ThemedPageInternalServerErrorComponent },
|
||||||
@@ -61,9 +63,17 @@ export const APP_ROUTES: Route[] = [
|
|||||||
path: 'home',
|
path: 'home',
|
||||||
loadChildren: () => import('./home-page/home-page-routes')
|
loadChildren: () => import('./home-page/home-page-routes')
|
||||||
.then((m) => m.ROUTES),
|
.then((m) => m.ROUTES),
|
||||||
data: { showBreadcrumbs: false, enableRSS: true },
|
data: {
|
||||||
|
showBreadcrumbs: false,
|
||||||
|
enableRSS: true,
|
||||||
|
dsoPath: 'site'
|
||||||
|
},
|
||||||
providers: [provideSuggestionNotificationsState()],
|
providers: [provideSuggestionNotificationsState()],
|
||||||
canActivate: [endUserAgreementCurrentUserGuard],
|
canActivate: [endUserAgreementCurrentUserGuard],
|
||||||
|
resolve: {
|
||||||
|
site: homePageResolver,
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'community-list',
|
path: 'community-list',
|
||||||
|
@@ -22,6 +22,7 @@ import { DeleteCollectionPageComponent } from './delete-collection-page/delete-c
|
|||||||
import { itemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver';
|
import { itemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver';
|
||||||
import { ThemedEditItemTemplatePageComponent } from './edit-item-template-page/themed-edit-item-template-page.component';
|
import { ThemedEditItemTemplatePageComponent } from './edit-item-template-page/themed-edit-item-template-page.component';
|
||||||
import { ThemedCollectionPageComponent } from './themed-collection-page.component';
|
import { ThemedCollectionPageComponent } from './themed-collection-page.component';
|
||||||
|
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
@@ -115,6 +116,9 @@ export const ROUTES: Route[] = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
resolve: {
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
<div @fadeInOut>
|
<div @fadeInOut>
|
||||||
@if (collectionRD?.payload; as collection) {
|
@if (collectionRD?.payload; as collection) {
|
||||||
<div>
|
<div>
|
||||||
<ds-view-tracker [object]="collection"></ds-view-tracker>
|
|
||||||
<div class="d-flex flex-row border-bottom mb-4 pb-4">
|
<div class="d-flex flex-row border-bottom mb-4 pb-4">
|
||||||
<header class="comcol-header me-auto">
|
<header class="comcol-header me-auto">
|
||||||
<!-- Collection Name -->
|
<!-- Collection Name -->
|
||||||
|
@@ -47,7 +47,6 @@ import { ThemedLoadingComponent } from '../shared/loading/themed-loading.compone
|
|||||||
import { ObjectCollectionComponent } from '../shared/object-collection/object-collection.component';
|
import { ObjectCollectionComponent } from '../shared/object-collection/object-collection.component';
|
||||||
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
||||||
import { VarDirective } from '../shared/utils/var.directive';
|
import { VarDirective } from '../shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { getCollectionPageRoute } from './collection-page-routing-paths';
|
import { getCollectionPageRoute } from './collection-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -64,7 +63,6 @@ import { getCollectionPageRoute } from './collection-page-routing-paths';
|
|||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
|
@@ -19,6 +19,7 @@ import { createCommunityPageGuard } from './create-community-page/create-communi
|
|||||||
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
||||||
import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-com-col-section.component';
|
import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-com-col-section.component';
|
||||||
import { ThemedCommunityPageComponent } from './themed-community-page.component';
|
import { ThemedCommunityPageComponent } from './themed-community-page.component';
|
||||||
|
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
@@ -70,6 +71,9 @@ export const ROUTES: Route[] = [
|
|||||||
data: {
|
data: {
|
||||||
menuRoute: MenuRoute.COMMUNITY_PAGE,
|
menuRoute: MenuRoute.COMMUNITY_PAGE,
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
<div class="community-page" @fadeInOut>
|
<div class="community-page" @fadeInOut>
|
||||||
@if (communityRD?.payload; as communityPayload) {
|
@if (communityRD?.payload; as communityPayload) {
|
||||||
<div>
|
<div>
|
||||||
<ds-view-tracker [object]="communityPayload"></ds-view-tracker>
|
|
||||||
<div class="d-flex flex-row border-bottom mb-4 pb-4">
|
<div class="d-flex flex-row border-bottom mb-4 pb-4">
|
||||||
<header class="comcol-header me-auto">
|
<header class="comcol-header me-auto">
|
||||||
<!-- Community name -->
|
<!-- Community name -->
|
||||||
|
@@ -38,7 +38,6 @@ import { hasValue } from '../shared/empty.util';
|
|||||||
import { ErrorComponent } from '../shared/error/error.component';
|
import { ErrorComponent } from '../shared/error/error.component';
|
||||||
import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component';
|
||||||
import { VarDirective } from '../shared/utils/var.directive';
|
import { VarDirective } from '../shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { getCommunityPageRoute } from './community-page-routing-paths';
|
import { getCommunityPageRoute } from './community-page-routing-paths';
|
||||||
import { ThemedCollectionPageSubCollectionListComponent } from './sections/sub-com-col-section/sub-collection-list/themed-community-page-sub-collection-list.component';
|
import { ThemedCollectionPageSubCollectionListComponent } from './sections/sub-com-col-section/sub-collection-list/themed-community-page-sub-collection-list.component';
|
||||||
import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com-col-section/sub-community-list/themed-community-page-sub-community-list.component';
|
import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com-col-section/sub-community-list/themed-community-page-sub-community-list.component';
|
||||||
@@ -62,7 +61,6 @@ import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com
|
|||||||
ComcolPageLogoComponent,
|
ComcolPageLogoComponent,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
@@ -2,7 +2,6 @@ import { Route } from '@angular/router';
|
|||||||
|
|
||||||
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
||||||
import { MenuItemType } from '../shared/menu/menu-item-type.model';
|
import { MenuItemType } from '../shared/menu/menu-item-type.model';
|
||||||
import { homePageResolver } from './home-page.resolver';
|
|
||||||
import { ThemedHomePageComponent } from './themed-home-page.component';
|
import { ThemedHomePageComponent } from './themed-home-page.component';
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
@@ -24,10 +23,7 @@ export const ROUTES: Route[] = [
|
|||||||
link: 'statistics',
|
link: 'statistics',
|
||||||
} as LinkMenuItemModel,
|
} as LinkMenuItemModel,
|
||||||
}],
|
}],
|
||||||
},
|
}
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
site: homePageResolver,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@@ -18,9 +18,6 @@
|
|||||||
<ds-suggestions-popup></ds-suggestions-popup>
|
<ds-suggestions-popup></ds-suggestions-popup>
|
||||||
|
|
||||||
<ng-template #homeContent>
|
<ng-template #homeContent>
|
||||||
@if ((site$ | async); as site) {
|
|
||||||
<ds-view-tracker [object]="site"></ds-view-tracker>
|
|
||||||
}
|
|
||||||
<ds-search-form [inPlaceSearch]="false"
|
<ds-search-form [inPlaceSearch]="false"
|
||||||
[searchPlaceholder]="'home.search-form.placeholder' | translate">
|
[searchPlaceholder]="'home.search-form.placeholder' | translate">
|
||||||
</ds-search-form>
|
</ds-search-form>
|
||||||
|
@@ -22,7 +22,6 @@ import { SuggestionsPopupComponent } from '../notifications/suggestions/popup/su
|
|||||||
import { ThemedConfigurationSearchPageComponent } from '../search-page/themed-configuration-search-page.component';
|
import { ThemedConfigurationSearchPageComponent } from '../search-page/themed-configuration-search-page.component';
|
||||||
import { ThemedSearchFormComponent } from '../shared/search-form/themed-search-form.component';
|
import { ThemedSearchFormComponent } from '../shared/search-form/themed-search-form.component';
|
||||||
import { PageWithSidebarComponent } from '../shared/sidebar/page-with-sidebar.component';
|
import { PageWithSidebarComponent } from '../shared/sidebar/page-with-sidebar.component';
|
||||||
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { HomeCoarComponent } from './home-coar/home-coar.component';
|
import { HomeCoarComponent } from './home-coar/home-coar.component';
|
||||||
import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component';
|
import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component';
|
||||||
import { RecentItemListComponent } from './recent-item-list/recent-item-list.component';
|
import { RecentItemListComponent } from './recent-item-list/recent-item-list.component';
|
||||||
@@ -33,7 +32,7 @@ import { ThemedTopLevelCommunityListComponent } from './top-level-community-list
|
|||||||
styleUrls: ['./home-page.component.scss'],
|
styleUrls: ['./home-page.component.scss'],
|
||||||
templateUrl: './home-page.component.html',
|
templateUrl: './home-page.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, ViewTrackerComponent, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
||||||
})
|
})
|
||||||
export class HomePageComponent implements OnInit {
|
export class HomePageComponent implements OnInit {
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
<div>
|
<div>
|
||||||
<ds-item-alerts [item]="item"></ds-item-alerts>
|
<ds-item-alerts [item]="item"></ds-item-alerts>
|
||||||
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
|
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
|
||||||
<ds-view-tracker [object]="item"></ds-view-tracker>
|
|
||||||
@if (!item.isWithdrawn || (isAdmin$|async)) {
|
@if (!item.isWithdrawn || (isAdmin$|async)) {
|
||||||
<div class="full-item-info">
|
<div class="full-item-info">
|
||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
|
@@ -45,7 +45,6 @@ import { createPaginatedList } from '../../shared/testing/utils.test';
|
|||||||
import { ThemeService } from '../../shared/theme-support/theme.service';
|
import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||||
import { TruncatePipe } from '../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../shared/utils/truncate.pipe';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
||||||
import { CollectionsComponent } from '../field-components/collections/collections.component';
|
import { CollectionsComponent } from '../field-components/collections/collections.component';
|
||||||
import { ThemedItemPageTitleFieldComponent } from '../simple/field-components/specific-field/title/themed-item-page-field.component';
|
import { ThemedItemPageTitleFieldComponent } from '../simple/field-components/specific-field/title/themed-item-page-field.component';
|
||||||
@@ -162,7 +161,6 @@ describe('FullItemPageComponent', () => {
|
|||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
ThemedItemPageTitleFieldComponent,
|
ThemedItemPageTitleFieldComponent,
|
||||||
DsoEditMenuComponent,
|
DsoEditMenuComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
CollectionsComponent,
|
CollectionsComponent,
|
||||||
ThemedFullFileSectionComponent,
|
ThemedFullFileSectionComponent,
|
||||||
|
@@ -42,7 +42,6 @@ import { hasValue } from '../../shared/empty.util';
|
|||||||
import { ErrorComponent } from '../../shared/error/error.component';
|
import { ErrorComponent } from '../../shared/error/error.component';
|
||||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
||||||
import { CollectionsComponent } from '../field-components/collections/collections.component';
|
import { CollectionsComponent } from '../field-components/collections/collections.component';
|
||||||
import { ThemedItemPageTitleFieldComponent } from '../simple/field-components/specific-field/title/themed-item-page-field.component';
|
import { ThemedItemPageTitleFieldComponent } from '../simple/field-components/specific-field/title/themed-item-page-field.component';
|
||||||
@@ -75,7 +74,6 @@ import { ThemedFullFileSectionComponent } from './field-components/file-section/
|
|||||||
ThemedItemPageTitleFieldComponent,
|
ThemedItemPageTitleFieldComponent,
|
||||||
DsoEditMenuComponent,
|
DsoEditMenuComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
VarDirective,
|
VarDirective,
|
||||||
],
|
],
|
||||||
|
@@ -20,6 +20,7 @@ import { orcidPageGuard } from './orcid-page/orcid-page.guard';
|
|||||||
import { ThemedItemPageComponent } from './simple/themed-item-page.component';
|
import { ThemedItemPageComponent } from './simple/themed-item-page.component';
|
||||||
import { versionResolver } from './version-page/version.resolver';
|
import { versionResolver } from './version-page/version.resolver';
|
||||||
import { VersionPageComponent } from './version-page/version-page/version-page.component';
|
import { VersionPageComponent } from './version-page/version-page/version-page.component';
|
||||||
|
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
@@ -38,7 +39,9 @@ export const ROUTES: Route[] = [
|
|||||||
data: {
|
data: {
|
||||||
menuRoute: MenuRoute.ITEM_PAGE,
|
menuRoute: MenuRoute.ITEM_PAGE,
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'full',
|
path: 'full',
|
||||||
@@ -46,7 +49,9 @@ export const ROUTES: Route[] = [
|
|||||||
data: {
|
data: {
|
||||||
menuRoute: MenuRoute.ITEM_PAGE,
|
menuRoute: MenuRoute.ITEM_PAGE,
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ITEM_EDIT_PATH,
|
path: ITEM_EDIT_PATH,
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
<ds-qa-event-notification [item]="item"></ds-qa-event-notification>
|
<ds-qa-event-notification [item]="item"></ds-qa-event-notification>
|
||||||
<ds-notify-requests-status [itemUuid]="item.uuid"></ds-notify-requests-status>
|
<ds-notify-requests-status [itemUuid]="item.uuid"></ds-notify-requests-status>
|
||||||
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
|
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
|
||||||
<ds-view-tracker [object]="item"></ds-view-tracker>
|
|
||||||
@if (!item.isWithdrawn || (isAdmin$|async)) {
|
@if (!item.isWithdrawn || (isAdmin$|async)) {
|
||||||
<ds-listable-object-component-loader [object]="item" [viewMode]="viewMode"></ds-listable-object-component-loader>
|
<ds-listable-object-component-loader [object]="item" [viewMode]="viewMode"></ds-listable-object-component-loader>
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,6 @@ import {
|
|||||||
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import { createPaginatedList } from '../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../shared/testing/utils.test';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
||||||
import { ItemVersionsComponent } from '../versions/item-versions.component';
|
import { ItemVersionsComponent } from '../versions/item-versions.component';
|
||||||
import { ItemVersionsNoticeComponent } from '../versions/notice/item-versions-notice.component';
|
import { ItemVersionsNoticeComponent } from '../versions/notice/item-versions-notice.component';
|
||||||
@@ -142,7 +141,6 @@ describe('ItemPageComponent', () => {
|
|||||||
remove: { imports: [
|
remove: { imports: [
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ListableObjectComponentLoaderComponent,
|
ListableObjectComponentLoaderComponent,
|
||||||
ItemVersionsComponent,
|
ItemVersionsComponent,
|
||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
|
@@ -51,7 +51,6 @@ import { ErrorComponent } from '../../shared/error/error.component';
|
|||||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { ListableObjectComponentLoaderComponent } from '../../shared/object-collection/shared/listable-object/listable-object-component-loader.component';
|
import { ListableObjectComponentLoaderComponent } from '../../shared/object-collection/shared/listable-object/listable-object-component-loader.component';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
import { ThemedItemAlertsComponent } from '../alerts/themed-item-alerts.component';
|
||||||
import { getItemPageRoute } from '../item-page-routing-paths';
|
import { getItemPageRoute } from '../item-page-routing-paths';
|
||||||
import { ItemVersionsComponent } from '../versions/item-versions.component';
|
import { ItemVersionsComponent } from '../versions/item-versions.component';
|
||||||
@@ -76,7 +75,6 @@ import { QaEventNotificationComponent } from './qa-event-notification/qa-event-n
|
|||||||
VarDirective,
|
VarDirective,
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ListableObjectComponentLoaderComponent,
|
ListableObjectComponentLoaderComponent,
|
||||||
ItemVersionsComponent,
|
ItemVersionsComponent,
|
||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
|
@@ -0,0 +1,58 @@
|
|||||||
|
import {
|
||||||
|
Injectable,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { Angulartics2 } from 'angulartics2';
|
||||||
|
import { switchMap } from 'rxjs';
|
||||||
|
import { filter, take } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { ReferrerService } from '../../../core/services/referrer.service';
|
||||||
|
import { ActivatedRouteSnapshot, ResolveEnd, Router, RouterStateSnapshot } from '@angular/router';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component triggers a page view statistic
|
||||||
|
*/
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ViewTrackerResolverService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public angulartics2: Angulartics2,
|
||||||
|
public referrerService: ReferrerService,
|
||||||
|
public router: Router,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(routeSnapshot: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
const dsoPath = routeSnapshot.data['dsoPath'] || 'dso.payload'; // Fetch the resolvers passed via the route data
|
||||||
|
this.router.events.pipe(
|
||||||
|
filter(event => event instanceof ResolveEnd),
|
||||||
|
take(1),
|
||||||
|
switchMap(() =>
|
||||||
|
this.referrerService.getReferrer().pipe(take(1))))
|
||||||
|
.subscribe((referrer: string) => {
|
||||||
|
this.angulartics2.eventTrack.next({
|
||||||
|
action: 'page_view',
|
||||||
|
properties: {
|
||||||
|
object: this.getNestedProperty(routeSnapshot.data, dsoPath),
|
||||||
|
referrer,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getNestedProperty(obj: any, path: string) {
|
||||||
|
const keys = path.split('.');
|
||||||
|
let result = obj;
|
||||||
|
|
||||||
|
for (const key of keys) {
|
||||||
|
if (result && result.hasOwnProperty(key)) {
|
||||||
|
result = result[key];
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -1 +0,0 @@
|
|||||||
|
|
@@ -1,3 +0,0 @@
|
|||||||
:host {
|
|
||||||
display: none
|
|
||||||
}
|
|
@@ -1,63 +0,0 @@
|
|||||||
import {
|
|
||||||
Component,
|
|
||||||
Input,
|
|
||||||
OnDestroy,
|
|
||||||
OnInit,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { Angulartics2 } from 'angulartics2';
|
|
||||||
import { Subscription } from 'rxjs';
|
|
||||||
import { take } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { ReferrerService } from '../../../core/services/referrer.service';
|
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This component triggers a page view statistic
|
|
||||||
*/
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-view-tracker',
|
|
||||||
styleUrls: ['./view-tracker.component.scss'],
|
|
||||||
templateUrl: './view-tracker.component.html',
|
|
||||||
standalone: true,
|
|
||||||
})
|
|
||||||
export class ViewTrackerComponent implements OnInit, OnDestroy {
|
|
||||||
/**
|
|
||||||
* The DSpaceObject to track a view event about
|
|
||||||
*/
|
|
||||||
@Input() object: DSpaceObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The subscription on this.referrerService.getReferrer()
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
protected sub: Subscription;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public angulartics2: Angulartics2,
|
|
||||||
public referrerService: ReferrerService,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.sub = this.referrerService.getReferrer()
|
|
||||||
.pipe(take(1))
|
|
||||||
.subscribe((referrer: string) => {
|
|
||||||
this.angulartics2.eventTrack.next({
|
|
||||||
action: 'page_view',
|
|
||||||
properties: {
|
|
||||||
object: this.object,
|
|
||||||
referrer,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
// unsubscribe in the case that this component is destroyed before
|
|
||||||
// this.referrerService.getReferrer() has emitted
|
|
||||||
if (hasValue(this.sub)) {
|
|
||||||
this.sub.unsubscribe();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,11 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { ActivatedRouteSnapshot, ResolveFn, RouterStateSnapshot, } from '@angular/router';
|
||||||
|
import { ViewTrackerResolverService } from './view-tracker-resolver.service';
|
||||||
|
|
||||||
|
export const viewTrackerResolver: ResolveFn<boolean> = (
|
||||||
|
route: ActivatedRouteSnapshot,
|
||||||
|
state: RouterStateSnapshot,
|
||||||
|
viewTrackerResolverService: ViewTrackerResolverService = inject(ViewTrackerResolverService),
|
||||||
|
): boolean => {
|
||||||
|
return viewTrackerResolverService.resolve(route, state);
|
||||||
|
};
|
@@ -21,7 +21,6 @@ import { ErrorComponent } from '../../../../app/shared/error/error.component';
|
|||||||
import { ThemedLoadingComponent } from '../../../../app/shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../../../app/shared/loading/themed-loading.component';
|
||||||
import { ObjectCollectionComponent } from '../../../../app/shared/object-collection/object-collection.component';
|
import { ObjectCollectionComponent } from '../../../../app/shared/object-collection/object-collection.component';
|
||||||
import { VarDirective } from '../../../../app/shared/utils/var.directive';
|
import { VarDirective } from '../../../../app/shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-collection-page',
|
selector: 'ds-themed-collection-page',
|
||||||
@@ -40,7 +39,6 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
|
|||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
|
@@ -22,7 +22,6 @@ import { DsoEditMenuComponent } from '../../../../app/shared/dso-page/dso-edit-m
|
|||||||
import { ErrorComponent } from '../../../../app/shared/error/error.component';
|
import { ErrorComponent } from '../../../../app/shared/error/error.component';
|
||||||
import { ThemedLoadingComponent } from '../../../../app/shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../../../app/shared/loading/themed-loading.component';
|
||||||
import { VarDirective } from '../../../../app/shared/utils/var.directive';
|
import { VarDirective } from '../../../../app/shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-community-page',
|
selector: 'ds-themed-community-page',
|
||||||
@@ -46,7 +45,6 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
|
|||||||
ComcolPageLogoComponent,
|
ComcolPageLogoComponent,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
@@ -15,7 +15,6 @@ import { SuggestionsPopupComponent } from '../../../../app/notifications/suggest
|
|||||||
import { ThemedConfigurationSearchPageComponent } from '../../../../app/search-page/themed-configuration-search-page.component';
|
import { ThemedConfigurationSearchPageComponent } from '../../../../app/search-page/themed-configuration-search-page.component';
|
||||||
import { ThemedSearchFormComponent } from '../../../../app/shared/search-form/themed-search-form.component';
|
import { ThemedSearchFormComponent } from '../../../../app/shared/search-form/themed-search-form.component';
|
||||||
import { PageWithSidebarComponent } from '../../../../app/shared/sidebar/page-with-sidebar.component';
|
import { PageWithSidebarComponent } from '../../../../app/shared/sidebar/page-with-sidebar.component';
|
||||||
import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-home-page',
|
selector: 'ds-themed-home-page',
|
||||||
@@ -24,7 +23,7 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
|
|||||||
// templateUrl: './home-page.component.html'
|
// templateUrl: './home-page.component.html'
|
||||||
templateUrl: '../../../../app/home-page/home-page.component.html',
|
templateUrl: '../../../../app/home-page/home-page.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, ViewTrackerComponent, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
||||||
})
|
})
|
||||||
export class HomePageComponent extends BaseComponent {
|
export class HomePageComponent extends BaseComponent {
|
||||||
|
|
||||||
|
@@ -21,7 +21,6 @@ import { DsoEditMenuComponent } from '../../../../../app/shared/dso-page/dso-edi
|
|||||||
import { ErrorComponent } from '../../../../../app/shared/error/error.component';
|
import { ErrorComponent } from '../../../../../app/shared/error/error.component';
|
||||||
import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component';
|
||||||
import { VarDirective } from '../../../../../app/shared/utils/var.directive';
|
import { VarDirective } from '../../../../../app/shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../../../../app/statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders a full item page.
|
* This component renders a full item page.
|
||||||
@@ -50,7 +49,6 @@ import { ViewTrackerComponent } from '../../../../../app/statistics/angulartics/
|
|||||||
ThemedItemPageTitleFieldComponent,
|
ThemedItemPageTitleFieldComponent,
|
||||||
DsoEditMenuComponent,
|
DsoEditMenuComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
VarDirective,
|
VarDirective,
|
||||||
],
|
],
|
||||||
|
@@ -17,7 +17,6 @@ import { ErrorComponent } from '../../../../../app/shared/error/error.component'
|
|||||||
import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component';
|
||||||
import { ListableObjectComponentLoaderComponent } from '../../../../../app/shared/object-collection/shared/listable-object/listable-object-component-loader.component';
|
import { ListableObjectComponentLoaderComponent } from '../../../../../app/shared/object-collection/shared/listable-object/listable-object-component-loader.component';
|
||||||
import { VarDirective } from '../../../../../app/shared/utils/var.directive';
|
import { VarDirective } from '../../../../../app/shared/utils/var.directive';
|
||||||
import { ViewTrackerComponent } from '../../../../../app/statistics/angulartics/dspace/view-tracker.component';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders a simple item page.
|
* This component renders a simple item page.
|
||||||
@@ -37,7 +36,6 @@ import { ViewTrackerComponent } from '../../../../../app/statistics/angulartics/
|
|||||||
VarDirective,
|
VarDirective,
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ListableObjectComponentLoaderComponent,
|
ListableObjectComponentLoaderComponent,
|
||||||
ItemVersionsComponent,
|
ItemVersionsComponent,
|
||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
|
Reference in New Issue
Block a user