mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 05:53:03 +00:00
117287: Removed remaining observable function calls from the HTML templates
This commit is contained in:
@@ -118,27 +118,25 @@
|
||||
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="getCcLicenseLink$()">
|
||||
<ng-container *ngVar="getCcLicenseLink$() | async as licenseLink">
|
||||
<div *ngIf="!licenseLink">
|
||||
<ds-themed-loading></ds-themed-loading>
|
||||
<ng-container *ngIf="ccLicenseLink$ | async as licenseLink">
|
||||
<div *ngIf="!licenseLink">
|
||||
<ds-themed-loading></ds-themed-loading>
|
||||
</div>
|
||||
<div *ngIf="licenseLink"
|
||||
class="mt-2 p-4 bg-light text-dark">
|
||||
<div>
|
||||
{{ 'submission.sections.ccLicense.link' | translate }}
|
||||
</div>
|
||||
<div *ngIf="licenseLink"
|
||||
class="mt-2 p-4 bg-light text-dark">
|
||||
<div>
|
||||
{{ 'submission.sections.ccLicense.link' | translate }}
|
||||
</div>
|
||||
<a class="license-link" href="{{ licenseLink }}" target="_blank" rel="noopener noreferrer">
|
||||
{{ licenseLink }}
|
||||
</a>
|
||||
<div class="m-2">
|
||||
<div (click)="setAccepted(!accepted)">
|
||||
<input type="checkbox"
|
||||
title="accepted"
|
||||
[checked]="accepted">
|
||||
<span> {{ 'submission.sections.ccLicense.confirmation' | translate }}</span>
|
||||
</div>
|
||||
<a class="license-link" href="{{ licenseLink }}" target="_blank" rel="noopener noreferrer">
|
||||
{{ licenseLink }}
|
||||
</a>
|
||||
<div class="m-2">
|
||||
<div (click)="setAccepted(!accepted)">
|
||||
<input type="checkbox"
|
||||
title="accepted"
|
||||
[checked]="accepted">
|
||||
<span> {{ 'submission.sections.ccLicense.confirmation' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { Component, Inject, OnChanges, SimpleChanges, OnInit } from '@angular/core';
|
||||
import { Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
import { Field, Option, SubmissionCcLicence } from '../../../core/submission/models/submission-cc-license.model';
|
||||
import {
|
||||
@@ -16,7 +16,7 @@ import { SectionDataObject } from '../models/section-data.model';
|
||||
import { SectionsService } from '../sections.service';
|
||||
import { WorkspaceitemSectionCcLicenseObject } from '../../../core/submission/models/workspaceitem-section-cc-license.model';
|
||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
import { isNotEmpty } from '../../../shared/empty.util';
|
||||
import { isNotEmpty, hasValue, hasNoValue } from '../../../shared/empty.util';
|
||||
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
||||
import { SubmissionCcLicenseUrlDataService } from '../../../core/submission/submission-cc-license-url-data.service';
|
||||
import {ConfigurationDataService} from '../../../core/data/configuration-data.service';
|
||||
@@ -30,7 +30,7 @@ import {ConfigurationDataService} from '../../../core/data/configuration-data.se
|
||||
styleUrls: ['./submission-section-cc-licenses.component.scss']
|
||||
})
|
||||
@renderSectionFor(SectionsType.CcLicense)
|
||||
export class SubmissionSectionCcLicensesComponent extends SectionModelComponent {
|
||||
export class SubmissionSectionCcLicensesComponent extends SectionModelComponent implements OnChanges, OnInit {
|
||||
|
||||
/**
|
||||
* The form id
|
||||
@@ -87,6 +87,8 @@ export class SubmissionSectionCcLicensesComponent extends SectionModelComponent
|
||||
return this.data.accepted;
|
||||
}
|
||||
|
||||
ccLicenseLink$: Observable<string>;
|
||||
|
||||
constructor(
|
||||
protected modalService: NgbModal,
|
||||
protected sectionService: SectionsService,
|
||||
@@ -105,6 +107,19 @@ export class SubmissionSectionCcLicensesComponent extends SectionModelComponent
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
if (hasNoValue(this.ccLicenseLink$)) {
|
||||
this.ccLicenseLink$ = this.getCcLicenseLink$();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (hasValue(changes.sectionData) || hasValue(changes.submissionCcLicenses)) {
|
||||
this.ccLicenseLink$ = this.getCcLicenseLink$();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The data of this section.
|
||||
*/
|
||||
@@ -128,6 +143,7 @@ export class SubmissionSectionCcLicensesComponent extends SectionModelComponent
|
||||
},
|
||||
uri: undefined,
|
||||
});
|
||||
this.ccLicenseLink$ = this.getCcLicenseLink$();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,6 +175,7 @@ export class SubmissionSectionCcLicensesComponent extends SectionModelComponent
|
||||
},
|
||||
accepted: false,
|
||||
});
|
||||
this.ccLicenseLink$ = this.getCcLicenseLink$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,18 +3,17 @@ Template for the identifiers submission section component
|
||||
@author Kim Shepherd
|
||||
-->
|
||||
<!-- Main identifier data -->
|
||||
<ng-container *ngVar="(getIdentifierData() | async) as identifierData">
|
||||
<ng-container *ngIf="identifierData && identifierData.identifiers">
|
||||
<div>
|
||||
<span>{{'submission.sections.identifiers.info' | translate}}</span>
|
||||
<ul>
|
||||
<ng-container *ngFor="let identifier of identifierData.identifiers">
|
||||
<ng-container *ngIf="identifierData.displayTypes.includes(identifier.identifierType) && identifier.value">
|
||||
<li>{{'submission.sections.identifiers.' + identifier.identifierType + '_label' | translate}}
|
||||
{{identifier.value}}</li>
|
||||
<ng-container *ngIf="(identifierData$ | async) as identifierData">
|
||||
<div *ngIf="identifierData.identifiers">
|
||||
<span>{{ 'submission.sections.identifiers.info' | translate }}</span>
|
||||
<ul>
|
||||
<ng-container *ngFor="let identifier of identifierData.identifiers">
|
||||
<ng-container *ngIf="identifierData.displayTypes.includes(identifier.identifierType) && identifier.value">
|
||||
<li>{{ 'submission.sections.identifiers.' + identifier.identifierType + '_label' | translate }}
|
||||
{{ identifier.value }}
|
||||
</li>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ul>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ul>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
@@ -1,13 +1,12 @@
|
||||
import {ChangeDetectionStrategy, Component, Inject } from '@angular/core';
|
||||
|
||||
import { Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { SectionsType } from '../sections-type';
|
||||
import { SectionModelComponent } from '../models/section.model';
|
||||
import { renderSectionFor } from '../sections-decorator';
|
||||
import { SectionDataObject } from '../models/section-data.model';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
import { AlertType } from '../../../shared/alert/aletr-type';
|
||||
import { SectionsService } from '../sections.service';
|
||||
import { WorkspaceitemSectionIdentifiersObject } from '../../../core/submission/models/workspaceitem-section-identifiers.model';
|
||||
|
||||
@@ -26,11 +25,6 @@ import { WorkspaceitemSectionIdentifiersObject } from '../../../core/submission/
|
||||
|
||||
@renderSectionFor(SectionsType.Identifiers)
|
||||
export class SubmissionSectionIdentifiersComponent extends SectionModelComponent {
|
||||
/**
|
||||
* The Alert categories.
|
||||
* @type {AlertType}
|
||||
*/
|
||||
public AlertTypeEnum = AlertType;
|
||||
|
||||
/**
|
||||
* Variable to track if the section is loading.
|
||||
@@ -42,14 +36,7 @@ export class SubmissionSectionIdentifiersComponent extends SectionModelComponent
|
||||
* Observable identifierData subject
|
||||
* @type {Observable<WorkspaceitemSectionIdentifiersObject>}
|
||||
*/
|
||||
public identifierData$: Observable<WorkspaceitemSectionIdentifiersObject> = new Observable<WorkspaceitemSectionIdentifiersObject>();
|
||||
|
||||
/**
|
||||
* Array to track all subscriptions and unsubscribe them onDestroy
|
||||
* @type {Array}
|
||||
*/
|
||||
protected subs: Subscription[] = [];
|
||||
public subbedIdentifierData: WorkspaceitemSectionIdentifiersObject;
|
||||
public identifierData$: Observable<WorkspaceitemSectionIdentifiersObject>;
|
||||
|
||||
/**
|
||||
* Initialize instance variables.
|
||||
@@ -71,10 +58,6 @@ export class SubmissionSectionIdentifiersComponent extends SectionModelComponent
|
||||
super(injectedCollectionId, injectedSectionData, injectedSubmissionId);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all instance variables and retrieve configuration.
|
||||
*/
|
||||
@@ -83,13 +66,6 @@ export class SubmissionSectionIdentifiersComponent extends SectionModelComponent
|
||||
this.identifierData$ = this.getIdentifierData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if identifier section has read-only visibility
|
||||
*/
|
||||
isReadOnly(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe from all subscriptions, if needed.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user