[TLC-249] Linting

This commit is contained in:
Kim Shepherd
2022-08-31 15:21:38 +12:00
parent 5f6e20eaa4
commit 87bbe50732
3 changed files with 14 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ import { ItemStatusComponent } from './item-status/item-status.component';
import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component'; import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component';
import { ItemCollectionMapperComponent } from './item-collection-mapper/item-collection-mapper.component'; import { ItemCollectionMapperComponent } from './item-collection-mapper/item-collection-mapper.component';
import { ItemMoveComponent } from './item-move/item-move.component'; import { ItemMoveComponent } from './item-move/item-move.component';
import { ItemRegisterDoiComponent } from './item-register-doi/item-registerdoi.component' import { ItemRegisterDoiComponent } from './item-register-doi/item-registerdoi.component';
import { ItemRelationshipsComponent } from './item-relationships/item-relationships.component'; import { ItemRelationshipsComponent } from './item-relationships/item-relationships.component';
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component'; import { ItemVersionHistoryComponent } from './item-version-history/item-version-history.component';

View File

@@ -27,7 +27,7 @@ export class ItemRegisterDoiComponent extends AbstractSimpleItemActionComponent
protected messageKey = 'registerdoi'; protected messageKey = 'registerdoi';
doiToUpdateMessage = 'item.edit.' + this.messageKey + '.to-update'; doiToUpdateMessage = 'item.edit.' + this.messageKey + '.to-update';
identifiers$: Observable<Identifier[]>; identifiers$: Observable<Identifier[]>;
processing: boolean = false; processing = false;
constructor(protected route: ActivatedRoute, constructor(protected route: ActivatedRoute,
protected router: Router, protected router: Router,
@@ -38,6 +38,9 @@ export class ItemRegisterDoiComponent extends AbstractSimpleItemActionComponent
super(route, router, notificationsService, itemDataService, translateService); super(route, router, notificationsService, itemDataService, translateService);
} }
/**
* Initialise component
*/
ngOnInit(): void { ngOnInit(): void {
this.itemRD$ = this.route.data.pipe( this.itemRD$ = this.route.data.pipe(
map((data) => data.dso), map((data) => data.dso),
@@ -74,6 +77,9 @@ export class ItemRegisterDoiComponent extends AbstractSimpleItemActionComponent
this.registerDoi(); this.registerDoi();
} }
/**
* Request that a pending, minted or null DOI be queued for registration
*/
registerDoi() { registerDoi() {
this.processing = true; this.processing = true;
this.itemDataService.registerDOI(this.item.id).pipe(getFirstCompletedRemoteData()).subscribe( this.itemDataService.registerDOI(this.item.id).pipe(getFirstCompletedRemoteData()).subscribe(

View File

@@ -113,7 +113,7 @@ export class ItemStatusComponent implements OnInit {
// Observable for configuration determining whether the Register DOI feature is enabled // Observable for configuration determining whether the Register DOI feature is enabled
let registerConfigEnabled$: Observable<boolean> = this.configurationService.findByPropertyName('identifiers.item-status.register').pipe( let registerConfigEnabled$: Observable<boolean> = this.configurationService.findByPropertyName('identifiers.item-status.register').pipe(
map((enabled: RemoteData<ConfigurationProperty>) => { map((enabled: RemoteData<ConfigurationProperty>) => {
let show: boolean = false; let show = false;
if (enabled.hasSucceeded) { if (enabled.hasSucceeded) {
if (enabled.payload !== undefined && enabled.payload !== null) { if (enabled.payload !== undefined && enabled.payload !== null) {
if (enabled.payload.values !== undefined) { if (enabled.payload.values !== undefined) {
@@ -154,14 +154,14 @@ export class ItemStatusComponent implements OnInit {
let showRegister$: Observable<boolean> = combineLatest([this.identifiers$, registerConfigEnabled$]).pipe( let showRegister$: Observable<boolean> = combineLatest([this.identifiers$, registerConfigEnabled$]).pipe(
distinctUntilChanged(), distinctUntilChanged(),
map(([identifiers, enabled]) => { map(([identifiers, enabled]) => {
let no_doi: boolean = true; let no_doi = true;
let pending: boolean = false; let pending = false;
if (identifiers !== undefined && identifiers !== null) { if (identifiers !== undefined && identifiers !== null) {
identifiers.forEach((identifier: Identifier) => { identifiers.forEach((identifier: Identifier) => {
if (hasValue(identifier) && identifier.identifierType == 'doi') { if (hasValue(identifier) && identifier.identifierType === 'doi') {
// The item has some kind of DOI // The item has some kind of DOI
no_doi = false; no_doi = false;
if (identifier.identifierStatus == '10' || identifier.identifierStatus == '11' if (identifier.identifierStatus === '10' || identifier.identifierStatus === '11'
|| identifier.identifierStatus == null) { || identifier.identifierStatus == null) {
// The item's DOI is pending, minted or null. // The item's DOI is pending, minted or null.
// It isn't registered, reserved, queued for registration or reservation or update, deleted // It isn't registered, reserved, queued for registration or reservation or update, deleted
@@ -174,7 +174,7 @@ export class ItemStatusComponent implements OnInit {
// If there is no DOI, or a pending/minted/null DOI, and the config is enabled, return true // If there is no DOI, or a pending/minted/null DOI, and the config is enabled, return true
return ((pending || no_doi) && enabled); return ((pending || no_doi) && enabled);
}) })
) );
// Subscribe to changes from the showRegister check and rebuild operations list accordingly // Subscribe to changes from the showRegister check and rebuild operations list accordingly
this.subs.push(showRegister$.subscribe((show) => { this.subs.push(showRegister$.subscribe((show) => {