From 44795a691ad49638ac25db49be07430b2d69aa35 Mon Sep 17 00:00:00 2001 From: Vlad Nouski Date: Thu, 25 Jan 2024 12:28:05 +0100 Subject: [PATCH 1/4] [DSC-983] feature: added internal routing for counters component --- src/app/core/core.module.ts | 2 + .../counters-section.component.html | 39 ++++++++++--------- .../counters-section.component.scss | 8 ++++ .../counters-section.component.ts | 16 ++++---- 4 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 src/app/shared/explore/section-component/counters-section/counters-section.component.scss diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 88a8861eb6e..bab4d48346d 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -237,6 +237,7 @@ import { } from './metadata/schema-json-ld/schema-types/product/product-creative-work-schema-type'; import { ProductDatasetSchemaType } from './metadata/schema-json-ld/schema-types/product/product-dataset-schema-type'; import { PersonSchemaType } from './metadata/schema-json-ld/schema-types/Person/person-schema-type'; +import { InternalLinkService } from './services/internal-link.service'; /** * When not in production, endpoint responses can be mocked for testing purposes @@ -270,6 +271,7 @@ const PROVIDERS = [ { provide: DspaceRestService, useFactory: restServiceFactory, deps: [MOCK_RESPONSE_MAP, HttpClient] }, EPersonDataService, LinkHeadService, + InternalLinkService, HALEndpointService, HostWindowService, ItemDataService, diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.html b/src/app/shared/explore/section-component/counters-section/counters-section.component.html index ac433476d86..2b981d1ac05 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.html +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.html @@ -1,27 +1,28 @@
-
-
+
+
-
-
- + + + + + + + + +
+ +
+ {{ 'explore.counters-section.' + counter.label | translate }} +
+
+ {{ counter.count }} +
-
- {{'explore.counters-section.' + counter.label | translate}} -
-
- {{counter.count}} -
-
+ +
diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.scss b/src/app/shared/explore/section-component/counters-section/counters-section.component.scss new file mode 100644 index 00000000000..b3c1d8de172 --- /dev/null +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.scss @@ -0,0 +1,8 @@ +.counters-section { + width: 120px; + max-width: 120px; +} + +.counters-label { + line-height: 1.25; +} diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.ts b/src/app/shared/explore/section-component/counters-section/counters-section.component.ts index 3d7860d5e38..3c7ce6606ef 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.ts +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.ts @@ -12,11 +12,12 @@ import { PaginationComponentOptions } from '../../../pagination/pagination-compo import { SectionComponent } from '../../../../core/layout/models/section.model'; import { SearchService } from '../../../../core/shared/search/search.service'; import { PaginatedSearchOptions } from '../../../search/models/paginated-search-options.model'; -import { hasValue } from '../../../empty.util'; import { UUIDService } from '../../../../core/shared/uuid.service'; +import { InternalLinkService } from 'src/app/core/services/internal-link.service'; @Component({ selector: 'ds-counters-section', + styleUrls: ['./counters-section.component.scss'], templateUrl: './counters-section.component.html' }) export class CountersSectionComponent implements OnInit { @@ -38,10 +39,13 @@ export class CountersSectionComponent implements OnInit { }); - constructor(private searchService: SearchService, + constructor( + public internalLinkService: InternalLinkService, + private searchService: SearchService, private uuidService: UUIDService, @Inject(PLATFORM_ID) private platformId: Object, - @Inject(NativeWindowService) protected _window: NativeWindowRef,) { + @Inject(NativeWindowService) protected _window: NativeWindowRef, + ) { } @@ -69,12 +73,6 @@ export class CountersSectionComponent implements OnInit { ))); this.counterData$.subscribe(() => this.isLoading$.next(false)); } - - goToLink(link: string) { - if (hasValue(link)) { - this._window.nativeWindow.location.href = link; - } - } } From 29775ee0c66135614299d5b5195c7ff94fb5dab6 Mon Sep 17 00:00:00 2001 From: Vlad Nouski Date: Thu, 25 Jan 2024 14:21:32 +0100 Subject: [PATCH 2/4] [DSC-983] fix: styles --- .../counters-section.component.html | 14 ++++++++------ .../counters-section.component.scss | 9 +++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.html b/src/app/shared/explore/section-component/counters-section/counters-section.component.html index 2b981d1ac05..5db1d8b1a43 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.html +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.html @@ -5,12 +5,14 @@
- - - - - - + + + + + + + +
diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.scss b/src/app/shared/explore/section-component/counters-section/counters-section.component.scss index b3c1d8de172..c08f994bbe7 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.scss +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.scss @@ -1,6 +1,11 @@ .counters-section { - width: 120px; - max-width: 120px; + min-width: 120px; + max-width: 140px; + color: var(--bs-gray-800); + + &:hover { + color: #{darken($gray-800, 20%)}; + } } .counters-label { From 57edba556086400e136b9b01a03db43848cf56a6 Mon Sep 17 00:00:00 2001 From: Vlad Nouski Date: Fri, 26 Jan 2024 11:33:08 +0100 Subject: [PATCH 3/4] [DSC-983] refactor: code --- .../counters-section/counters-section.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.ts b/src/app/shared/explore/section-component/counters-section/counters-section.component.ts index 3c7ce6606ef..19273bbb627 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.ts +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.ts @@ -4,7 +4,6 @@ import { isPlatformServer } from '@angular/common'; import { BehaviorSubject, forkJoin, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { NativeWindowRef, NativeWindowService } from '../../../../core/services/window.service'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { SearchObjects } from '../../../search/models/search-objects.model'; import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; @@ -44,7 +43,6 @@ export class CountersSectionComponent implements OnInit { private searchService: SearchService, private uuidService: UUIDService, @Inject(PLATFORM_ID) private platformId: Object, - @Inject(NativeWindowService) protected _window: NativeWindowRef, ) { } From 29838234be7ff55f57667b05acf9bde0e7032cdd Mon Sep 17 00:00:00 2001 From: Francesco Pio Scognamiglio Date: Tue, 23 Jan 2024 14:46:24 +0100 Subject: [PATCH 4/4] [GLAM-640] hide download link for non-downloadable bitstreams on full view --- .../file-section/full-file-section.component.html | 2 +- .../file-section/full-file-section.component.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/item-page/full/field-components/file-section/full-file-section.component.html b/src/app/item-page/full/field-components/file-section/full-file-section.component.html index bb32bf609b2..50d84fe22df 100644 --- a/src/app/item-page/full/field-components/file-section/full-file-section.component.html +++ b/src/app/item-page/full/field-components/file-section/full-file-section.component.html @@ -33,7 +33,7 @@
{{"item.page.filesection.original.bundle"
-
+
{{"item.page.filesection.download" | translate}} diff --git a/src/app/item-page/full/field-components/file-section/full-file-section.component.ts b/src/app/item-page/full/field-components/file-section/full-file-section.component.ts index d92b3f06b12..6b66b48a8c6 100644 --- a/src/app/item-page/full/field-components/file-section/full-file-section.component.ts +++ b/src/app/item-page/full/field-components/file-section/full-file-section.component.ts @@ -108,6 +108,10 @@ export class FullFileSectionComponent extends FileSectionComponent implements On return hasValue(bundle) && !isEmpty(bundle.page); } + hasNoDownload(bitstream: Bitstream) { + return bitstream?.allMetadataValues('bitstream.viewer.provider').includes('nodownload'); + } + ngOnDestroy(): void { this.paginationService.clearPagination(this.originalOptions.id); this.paginationService.clearPagination(this.licenseOptions.id);