mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Merge branch 'w2p-129694_4099-PoC-solution-with-resolvers' into 4099-duplicate-view-events_contibute-8.x
This commit is contained in:
@@ -42,6 +42,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 },
|
||||||
@@ -63,9 +65,16 @@ 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 },
|
data: {
|
||||||
|
showBreadcrumbs: false,
|
||||||
|
dsoPath: 'site'
|
||||||
|
},
|
||||||
providers: [provideSuggestionNotificationsState()],
|
providers: [provideSuggestionNotificationsState()],
|
||||||
canActivate: [endUserAgreementCurrentUserGuard],
|
canActivate: [endUserAgreementCurrentUserGuard],
|
||||||
|
resolve: {
|
||||||
|
site: homePageResolver,
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'community-list',
|
path: 'community-list',
|
||||||
|
@@ -24,6 +24,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[] = [
|
||||||
{
|
{
|
||||||
@@ -102,6 +103,9 @@ export const ROUTES: Route[] = [
|
|||||||
data: { breadcrumbKey: 'browse.metadata' },
|
data: { breadcrumbKey: 'browse.metadata' },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
resolve: {
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
data: {
|
data: {
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
*ngVar="(collectionRD$ | async) as collectionRD">
|
*ngVar="(collectionRD$ | async) as collectionRD">
|
||||||
<div *ngIf="collectionRD?.hasSucceeded" @fadeInOut>
|
<div *ngIf="collectionRD?.hasSucceeded" @fadeInOut>
|
||||||
<div *ngIf="collectionRD?.payload as collection">
|
<div *ngIf="collectionRD?.payload as collection">
|
||||||
<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 mr-auto">
|
<header class="comcol-header mr-auto">
|
||||||
<!-- Collection Name -->
|
<!-- Collection Name -->
|
||||||
|
@@ -50,7 +50,7 @@ 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 { ViewTrackerResolverService } from '../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
import { getCollectionPageRoute } from './collection-page-routing-paths';
|
import { getCollectionPageRoute } from './collection-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -68,7 +68,6 @@ import { getCollectionPageRoute } from './collection-page-routing-paths';
|
|||||||
NgIf,
|
NgIf,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
|
@@ -21,6 +21,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[] = [
|
||||||
{
|
{
|
||||||
@@ -71,6 +72,7 @@ export const ROUTES: Route[] = [
|
|||||||
component: ThemedCommunityPageComponent,
|
component: ThemedCommunityPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
menu: dsoEditMenuResolver,
|
menu: dsoEditMenuResolver,
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="container" *ngVar="(communityRD$ | async) as communityRD">
|
<div class="container" *ngVar="(communityRD$ | async) as communityRD">
|
||||||
<div class="community-page" *ngIf="communityRD?.hasSucceeded" @fadeInOut>
|
<div class="community-page" *ngIf="communityRD?.hasSucceeded" @fadeInOut>
|
||||||
<div *ngIf="communityRD?.payload; let communityPayload">
|
<div *ngIf="communityRD?.payload; let communityPayload">
|
||||||
<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 mr-auto">
|
<header class="comcol-header mr-auto">
|
||||||
<!-- Community name -->
|
<!-- Community name -->
|
||||||
|
@@ -41,7 +41,7 @@ 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 { ViewTrackerResolverService } from '../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
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';
|
||||||
@@ -66,7 +66,6 @@ import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com
|
|||||||
ComcolPageLogoComponent,
|
ComcolPageLogoComponent,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
@@ -4,6 +4,7 @@ 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 { homePageResolver } from './home-page.resolver';
|
||||||
import { ThemedHomePageComponent } from './themed-home-page.component';
|
import { ThemedHomePageComponent } from './themed-home-page.component';
|
||||||
|
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
@@ -24,10 +25,7 @@ export const ROUTES: Route[] = [
|
|||||||
link: 'statistics',
|
link: 'statistics',
|
||||||
} as LinkMenuItemModel,
|
} as LinkMenuItemModel,
|
||||||
}],
|
}],
|
||||||
},
|
}
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
site: homePageResolver,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@@ -14,9 +14,6 @@
|
|||||||
<ds-suggestions-popup></ds-suggestions-popup>
|
<ds-suggestions-popup></ds-suggestions-popup>
|
||||||
|
|
||||||
<ng-template #homeContent>
|
<ng-template #homeContent>
|
||||||
<ng-container *ngIf="(site$ | async) as site">
|
|
||||||
<ds-view-tracker [object]="site"></ds-view-tracker>
|
|
||||||
</ng-container>
|
|
||||||
<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>
|
||||||
|
@@ -23,7 +23,7 @@ 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 { ViewTrackerResolverService } from '../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
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';
|
||||||
@@ -34,7 +34,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, NgIf, ViewTrackerComponent, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, NgIf, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
||||||
})
|
})
|
||||||
export class HomePageComponent implements OnInit {
|
export class HomePageComponent implements OnInit {
|
||||||
|
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
<div *ngIf="itemRD?.payload as item">
|
<div *ngIf="itemRD?.payload as item">
|
||||||
<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>
|
|
||||||
<div *ngIf="!item.isWithdrawn || (isAdmin$|async)" class="full-item-info">
|
<div *ngIf="!item.isWithdrawn || (isAdmin$|async)" class="full-item-info">
|
||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<ds-item-page-title-field class="mr-auto" [item]="item"></ds-item-page-title-field>
|
<ds-item-page-title-field class="mr-auto" [item]="item"></ds-item-page-title-field>
|
||||||
|
@@ -45,7 +45,7 @@ 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 { ViewTrackerResolverService } from '../../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
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 +162,7 @@ describe('FullItemPageComponent', () => {
|
|||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
ThemedItemPageTitleFieldComponent,
|
ThemedItemPageTitleFieldComponent,
|
||||||
DsoEditMenuComponent,
|
DsoEditMenuComponent,
|
||||||
ViewTrackerComponent,
|
ViewTrackerResolverService,
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
CollectionsComponent,
|
CollectionsComponent,
|
||||||
ThemedFullFileSectionComponent,
|
ThemedFullFileSectionComponent,
|
||||||
|
@@ -44,7 +44,7 @@ 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 { ViewTrackerResolverService } from '../../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
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';
|
||||||
@@ -79,7 +79,6 @@ import { ThemedFullFileSectionComponent } from './field-components/file-section/
|
|||||||
ThemedItemPageTitleFieldComponent,
|
ThemedItemPageTitleFieldComponent,
|
||||||
DsoEditMenuComponent,
|
DsoEditMenuComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
VarDirective,
|
VarDirective,
|
||||||
],
|
],
|
||||||
|
@@ -20,6 +20,8 @@ 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 { ViewTrackerResolverService } from '../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
|
import { viewTrackerResolver } from '../statistics/angulartics/dspace/view-tracker.resolver';
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
@@ -36,6 +38,7 @@ export const ROUTES: Route[] = [
|
|||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
menu: dsoEditMenuResolver,
|
menu: dsoEditMenuResolver,
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -43,6 +46,7 @@ export const ROUTES: Route[] = [
|
|||||||
component: ThemedFullItemPageComponent,
|
component: ThemedFullItemPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
menu: dsoEditMenuResolver,
|
menu: dsoEditMenuResolver,
|
||||||
|
tracking: viewTrackerResolver,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -5,7 +5,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>
|
|
||||||
<ds-listable-object-component-loader *ngIf="!item.isWithdrawn || (isAdmin$|async)" [object]="item" [viewMode]="viewMode"></ds-listable-object-component-loader>
|
<ds-listable-object-component-loader *ngIf="!item.isWithdrawn || (isAdmin$|async)" [object]="item" [viewMode]="viewMode"></ds-listable-object-component-loader>
|
||||||
<ds-item-versions class="mt-2" [item]="item" [displayActions]="false"></ds-item-versions>
|
<ds-item-versions class="mt-2" [item]="item" [displayActions]="false"></ds-item-versions>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -44,7 +44,7 @@ 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 { ViewTrackerResolverService } from '../../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
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 +142,7 @@ describe('ItemPageComponent', () => {
|
|||||||
remove: { imports: [
|
remove: { imports: [
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
ViewTrackerResolverService,
|
||||||
ListableObjectComponentLoaderComponent,
|
ListableObjectComponentLoaderComponent,
|
||||||
ItemVersionsComponent,
|
ItemVersionsComponent,
|
||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
|
@@ -48,7 +48,7 @@ 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 { ViewTrackerResolverService } from '../../statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
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';
|
||||||
@@ -72,7 +72,6 @@ import { QaEventNotificationComponent } from './qa-event-notification/qa-event-n
|
|||||||
VarDirective,
|
VarDirective,
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ListableObjectComponentLoaderComponent,
|
ListableObjectComponentLoaderComponent,
|
||||||
ItemVersionsComponent,
|
ItemVersionsComponent,
|
||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
|
@@ -5,7 +5,7 @@ import {
|
|||||||
Injector,
|
Injector,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ActivatedRouteSnapshot,
|
ActivatedRouteSnapshot, NavigationStart,
|
||||||
ResolveEnd,
|
ResolveEnd,
|
||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
@@ -0,0 +1,66 @@
|
|||||||
|
import {
|
||||||
|
AfterViewChecked, AfterViewInit,
|
||||||
|
Component, Injectable,
|
||||||
|
Input,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { Angulartics2 } from 'angulartics2';
|
||||||
|
import { Observable, Subscription, switchMap } from 'rxjs';
|
||||||
|
import { filter, 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';
|
||||||
|
import { ActivatedRoute, ActivatedRouteSnapshot, Resolve, ResolveEnd, Router, RouterStateSnapshot } from '@angular/router';
|
||||||
|
import { BreadcrumbConfig } from '../../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||||
|
import { SubmissionObject } from '../../../core/submission/models/submission-object.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
};
|
@@ -24,7 +24,7 @@ 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';
|
import { ViewTrackerResolverService } from '../../../../app/statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-collection-page',
|
selector: 'ds-themed-collection-page',
|
||||||
@@ -44,7 +44,6 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
|
|||||||
NgIf,
|
NgIf,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
|
@@ -25,7 +25,7 @@ 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';
|
import { ViewTrackerResolverService } from '../../../../app/statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-community-page',
|
selector: 'ds-themed-community-page',
|
||||||
@@ -50,7 +50,6 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
|
|||||||
ComcolPageLogoComponent,
|
ComcolPageLogoComponent,
|
||||||
ComcolPageHeaderComponent,
|
ComcolPageHeaderComponent,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ViewTrackerComponent,
|
|
||||||
VarDirective,
|
VarDirective,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
@@ -16,7 +16,7 @@ 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';
|
import { ViewTrackerResolverService } from '../../../../app/statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-home-page',
|
selector: 'ds-themed-home-page',
|
||||||
@@ -25,7 +25,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, NgIf, ViewTrackerComponent, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
imports: [ThemedHomeNewsComponent, NgTemplateOutlet, NgIf, ThemedSearchFormComponent, ThemedTopLevelCommunityListComponent, RecentItemListComponent, AsyncPipe, TranslateModule, NgClass, SuggestionsPopupComponent, ThemedConfigurationSearchPageComponent, PageWithSidebarComponent, HomeCoarComponent],
|
||||||
})
|
})
|
||||||
export class HomePageComponent extends BaseComponent {
|
export class HomePageComponent extends BaseComponent {
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ 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';
|
import { ViewTrackerResolverService } from '../../../../../app/statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders a full item page.
|
* This component renders a full item page.
|
||||||
@@ -54,7 +54,6 @@ import { ViewTrackerComponent } from '../../../../../app/statistics/angulartics/
|
|||||||
ThemedItemPageTitleFieldComponent,
|
ThemedItemPageTitleFieldComponent,
|
||||||
DsoEditMenuComponent,
|
DsoEditMenuComponent,
|
||||||
ItemVersionsNoticeComponent,
|
ItemVersionsNoticeComponent,
|
||||||
ViewTrackerComponent,
|
|
||||||
ThemedItemAlertsComponent,
|
ThemedItemAlertsComponent,
|
||||||
VarDirective,
|
VarDirective,
|
||||||
],
|
],
|
||||||
|
@@ -19,7 +19,7 @@ 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';
|
import { ViewTrackerResolverService } from '../../../../../app/statistics/angulartics/dspace/view-tracker-resolver.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders a simple item page.
|
* This component renders a simple item page.
|
||||||
@@ -39,7 +39,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