diff --git a/src/app/record/components/work-contributors/work-contributors.component.html b/src/app/record/components/work-contributors/work-contributors.component.html
index fae9214381..37f972fe64 100644
--- a/src/app/record/components/work-contributors/work-contributors.component.html
+++ b/src/app/record/components/work-contributors/work-contributors.component.html
@@ -31,11 +31,7 @@
- maxNumberOfContributors + 1
- "
- >
+ maxNumberOfContributors + 1">
- maxNumberOfContributors + 1)
- "
- >
+ maxNumberOfContributors + 1)">
maxNumberOfContributors + 1)
- "
+ *ngIf="!(contributors?.length > maxNumberOfContributors + 1)"
>
{
const mockFormGroup: UntypedFormGroup = new UntypedFormGroup({})
component['parentForm'].form = mockFormGroup
component.userRecord = getUserRecord()
-
+
fixture.detectChanges()
loader = TestbedHarnessEnvironment.loader(fixture)
})
diff --git a/src/app/record/components/work-contributors/work-contributors.component.ts b/src/app/record/components/work-contributors/work-contributors.component.ts
index c534ca65dd..c70bd32096 100644
--- a/src/app/record/components/work-contributors/work-contributors.component.ts
+++ b/src/app/record/components/work-contributors/work-contributors.component.ts
@@ -69,7 +69,7 @@ export class WorkContributorsComponent implements OnInit, OnDestroy {
maxNumberOfContributors = 49
maxNumberOfContributorsSummary = 10
privateName = 'Name is private'
-
+
contributionRoles = ContributionRoles
recordHolderContribution: Contributor
@@ -87,9 +87,7 @@ export class WorkContributorsComponent implements OnInit, OnDestroy {
private platform: PlatformInfoService,
private workService: RecordWorksService,
private affiliationService: RecordAffiliationService
- ) {
-
- }
+ ) {}
get contributorsFormArray() {
return this.parentForm.control.controls['contributors'] as UntypedFormArray
diff --git a/src/app/record/components/work-stack-group/modals/work-bibtex-modal/work-bibtex-modal.component.ts b/src/app/record/components/work-stack-group/modals/work-bibtex-modal/work-bibtex-modal.component.ts
index 0f0e3bae6e..da13f235d0 100644
--- a/src/app/record/components/work-stack-group/modals/work-bibtex-modal/work-bibtex-modal.component.ts
+++ b/src/app/record/components/work-stack-group/modals/work-bibtex-modal/work-bibtex-modal.component.ts
@@ -61,74 +61,65 @@ export class WorkBibtexModalComponent implements OnInit, OnDestroy {
let parsed = null
try {
parsed = bibtexParse.toJSON(reader.result)
- if (
- typeof parsed === 'string' &&
- parsed.substring(0, 5).toLowerCase().indexOf('error') > -1
- ) {
- that.bibtexErrorParsingText = parsed
- that.bibtexErrorParsing = true
- that.loadingWorks = false
- } else {
- if (parsed) {
- const newWorks = []
- if (parsed.length === 0) {
- that.bibtexErrorNoEntries = true
- that.loadingWorks = false
- }
- while (parsed.length > 0) {
- const cur = parsed.shift()
- const bibtexEntry = cur.entryType.toLowerCase()
- if (
- bibtexEntry !== 'preamble' &&
- bibtexEntry !== 'comment'
- ) {
- newWorks.push(
- that.populateWork(
- cur
- )
- )
- }
+ if (
+ typeof parsed === 'string' &&
+ parsed.substring(0, 5).toLowerCase().indexOf('error') > -1
+ ) {
+ that.bibtexErrorParsingText = parsed
+ that.bibtexErrorParsing = true
+ that.loadingWorks = false
+ } else {
+ if (parsed) {
+ const newWorks = []
+ if (parsed.length === 0) {
+ that.bibtexErrorNoEntries = true
+ that.loadingWorks = false
+ }
+ while (parsed.length > 0) {
+ const cur = parsed.shift()
+ const bibtexEntry = cur.entryType.toLowerCase()
+ if (bibtexEntry !== 'preamble' && bibtexEntry !== 'comment') {
+ newWorks.push(that.populateWork(cur))
}
- if (newWorks.length > 0) {
- that._recordWorksService
- .worksValidate(newWorks)
- .pipe(first())
- .subscribe((data) => {
- that.worksFromBibtex = []
- data.forEach((work) => {
- that.worksFromBibtex.push(work)
- if (work.errors.length > 0 && !that.isAnInvalidWork) {
- that.isAnInvalidWork = true
- that._snackBar.showValidationError()
- }
- })
- that.worksFromBibtex.forEach((w) => {
- const newPutCode = 'new-' + that.addedWorkCount++
- w.putCode = {
- value: newPutCode,
- }
- that.group[newPutCode] = new UntypedFormGroup({
- checked: new UntypedFormControl(false),
- })
+ }
+ if (newWorks.length > 0) {
+ that._recordWorksService
+ .worksValidate(newWorks)
+ .pipe(first())
+ .subscribe((data) => {
+ that.worksFromBibtex = []
+ data.forEach((work) => {
+ that.worksFromBibtex.push(work)
+ if (work.errors.length > 0 && !that.isAnInvalidWork) {
+ that.isAnInvalidWork = true
+ that._snackBar.showValidationError()
+ }
+ })
+ that.worksFromBibtex.forEach((w) => {
+ const newPutCode = 'new-' + that.addedWorkCount++
+ w.putCode = {
+ value: newPutCode,
+ }
+ that.group[newPutCode] = new UntypedFormGroup({
+ checked: new UntypedFormControl(false),
})
- that.importForm = new UntypedFormGroup(that.group)
- that.loadingWorks = false
})
- }
+ that.importForm = new UntypedFormGroup(that.group)
+ that.loadingWorks = false
+ })
}
}
- } catch (e) {
- that.bibtexErrorParsingText = e
- that.bibtexErrorParsing = true
- that.loadingWorks = false
}
+ } catch (e) {
+ that.bibtexErrorParsingText = e
+ that.bibtexErrorParsing = true
+ that.loadingWorks = false
}
}
+ }
}
- populateWork(
- bibJSON
- ): Work {
+ populateWork(bibJSON): Work {
const work = {} as Work
const bibtex = bibtexParse.toBibtex([bibJSON])
@@ -261,7 +252,7 @@ export class WorkBibtexModalComponent implements OnInit, OnDestroy {
value: lowerKeyTags['url'],
}
}
-
+
work.contributorsGroupedByOrcid = []
if (lowerKeyTags.hasOwnProperty('author')) {
const authors = this.removeEndingAnd(lowerKeyTags['author'])
@@ -271,7 +262,6 @@ export class WorkBibtexModalComponent implements OnInit, OnDestroy {
const editors = this.removeEndingAnd(lowerKeyTags['editor'])
this.addContributors(editors.split(' and '), 'editor', work)
}
-
}
return work
}