From a8421de1ed7f0f7e5ac73de66bc9f8bcb134d685 Mon Sep 17 00:00:00 2001 From: FrancescoMolinaro Date: Thu, 28 Nov 2024 18:45:09 +0100 Subject: [PATCH 1/3] [DSC-2059] remove async functions calls from templates of cris item pages and context menus --- .../cris-layout-navbar.component.html | 2 +- .../cris-layout-navbar.component.spec.ts | 7 ++- .../cris-layout-navbar.component.ts | 4 ++ .../cris-layout-sidebar.component.html | 18 +++--- .../cris-layout-sidebar.component.ts | 4 +- .../cris-layout-vertical.component.html | 4 +- .../cris-layout-vertical.component.ts | 7 ++- .../metric-row/metric-row.component.html | 2 +- .../metric-row/metric-row.component.ts | 12 ++-- .../alerts/item-alerts.component.html | 2 +- .../alerts/item-alerts.component.spec.ts | 28 ++++----- .../item-page/alerts/item-alerts.component.ts | 4 +- .../item-authorizations.component.html | 2 +- .../item-authorizations.component.ts | 3 + .../item-relationships.component.ts | 5 +- .../collections/collections.component.html | 2 +- .../orcid-auth/orcid-auth.component.html | 20 +++--- .../orcid-auth/orcid-auth.component.ts | 62 +++++++------------ .../orcid-queue/orcid-queue.component.html | 8 +-- .../orcid-queue/orcid-queue.component.ts | 2 +- .../item-page-field.component.html | 2 +- .../item-page-field.component.ts | 23 +++---- ...item-versions-summary-modal.component.html | 2 +- .../versions/item-versions.component.html | 4 +- .../versions/item-versions.component.ts | 3 +- .../item-versions-notice.component.html | 2 +- .../notice/item-versions-notice.component.ts | 6 ++ .../comcol-page-handle.component.html | 2 +- .../comcol-page-handle.component.ts | 3 - .../audit-item/audit-item-menu.component.html | 2 +- .../audit-item/audit-item-menu.component.ts | 16 ++--- .../bulk-import-menu.component.html | 2 +- .../bulk-import/bulk-import-menu.component.ts | 6 +- .../claim-item/claim-item-menu.component.html | 2 +- .../dso-page-edit-menu.component.ts | 6 +- ...dit-item-relationships-menu.component.html | 2 +- .../edit-item-relationships-menu.component.ts | 4 ++ .../edit-item/edit-item-menu.component.html | 4 +- .../edit-item/edit-item-menu.component.ts | 8 ++- .../export-collection-menu.component.html | 2 +- .../export-collection-menu.component.ts | 12 ++-- .../export-item-menu.component.html | 2 +- .../export-item-menu.component.spec.ts | 9 ++- .../export-item/export-item-menu.component.ts | 21 ++++--- .../request-correction-menu.component.html | 2 +- .../request-correction-menu.component.ts | 6 +- src/app/shared/utils/can-edit-version.pipe.ts | 20 ++++++ 47 files changed, 203 insertions(+), 168 deletions(-) create mode 100644 src/app/shared/utils/can-edit-version.pipe.ts diff --git a/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.html b/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.html index 2e5cd07b045..ac889721a2b 100644 --- a/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.html +++ b/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.html @@ -1,4 +1,4 @@ - diff --git a/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.spec.ts b/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.spec.ts index 824d9f4c741..e17cd0bc769 100644 --- a/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.spec.ts +++ b/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.spec.ts @@ -13,7 +13,10 @@ import { TranslateLoader, TranslateModule, } from '@ngx-translate/core'; -import { BehaviorSubject } from 'rxjs'; +import { + BehaviorSubject, + of, +} from 'rxjs'; import { CrisLayoutTab } from '../../../../core/layout/models/tab.model'; import { Item } from '../../../../core/shared/item.model'; @@ -101,6 +104,7 @@ describe('CrisLayoutNavbarComponent', () => { component.tabs = loaderMultilevelTabs; component.item = mockItem; component.activeTab$ = new BehaviorSubject(loaderMultilevelTabs[0]); + component.isXsOrSm$ = of(true); component.ngOnInit(); fixture.detectChanges(); }); @@ -114,6 +118,7 @@ describe('CrisLayoutNavbarComponent', () => { beforeEach(() => { windowServiceStub.setWidth(400); + component.ngOnInit(); fixture.detectChanges(); }); diff --git a/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.ts b/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.ts index ed0c3ed28d3..6ddd34f083f 100644 --- a/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.ts +++ b/src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.ts @@ -13,6 +13,7 @@ import { Output, } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; +import { Observable } from 'rxjs'; import { CrisLayoutTab } from '../../../../core/layout/models/tab.model'; import { Item } from '../../../../core/shared/item.model'; @@ -59,8 +60,11 @@ export class CrisLayoutNavbarComponent extends CrisLayoutTabsComponent implement windowService = inject(HostWindowService); + isXsOrSm$: Observable; + ngOnInit(): void { this.init(); + this.isXsOrSm$ = this.windowService.isXsOrSm(); } emitSelected(selectedTab) { diff --git a/src/app/cris-layout/cris-layout-loader/cris-layout-vertical/cris-layout-sidebar/cris-layout-sidebar.component.html b/src/app/cris-layout/cris-layout-loader/cris-layout-vertical/cris-layout-sidebar/cris-layout-sidebar.component.html index 250bf88acf0..63fe4ba6e26 100644 --- a/src/app/cris-layout/cris-layout-loader/cris-layout-vertical/cris-layout-sidebar/cris-layout-sidebar.component.html +++ b/src/app/cris-layout/cris-layout-loader/cris-layout-vertical/cris-layout-sidebar/cris-layout-sidebar.component.html @@ -1,6 +1,6 @@ -
-