Skip to content

Commit e2b59bd

Browse files
committed
Merge tag '25.11.0' into develop
Manual GUID & DOI assignment during Preprint & Registration Creation
2 parents c41405e + c573887 commit e2b59bd

File tree

12 files changed

+150
-3
lines changed

12 files changed

+150
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [25.11.0] - 2025-06-11
8+
### Added
9+
- Manual GUID and DOI assignment during Preprint and Registration Creation
10+
711
## [25.10.0] - 2025-05-13
812
### Added
913
- Re-enable view and download counts for preprints

app/models/preprint.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ export default class PreprintModel extends AbstractNodeModel {
8282
@attr('string') preregLinkInfo!: PreprintPreregLinkInfoEnum;
8383
@attr('number') version!: number;
8484
@attr('boolean') isLatestVersion!: boolean;
85+
@attr('string') manualDoi!: string;
86+
@attr('string') manualGuid!: string;
8587

8688
@belongsTo('node', { inverse: 'preprints' })
8789
node!: AsyncBelongsTo<NodeModel> & NodeModel;

app/models/registration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export default class RegistrationModel extends NodeModel.extend(Validations) {
115115
@attr('boolean') hasAnalyticCode!: boolean;
116116
@attr('boolean') hasPapers!: boolean;
117117
@attr('boolean') hasSupplements!: boolean;
118+
@attr('string') manualDoi!: string;
119+
@attr('string') manualGuid!: string;
118120

119121
// Write-only attributes
120122
@attr('array') includedNodeIds?: string[];

app/preprints/-components/submit/title-and-abstract/component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import Component from '@glimmer/component';
22
import PreprintStateMachine from 'ember-osf-web/preprints/-components/submit/preprint-state-machine/component';
33
import { action } from '@ember/object';
44
import { ValidationObject } from 'ember-changeset-validations';
5-
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
5+
import { validatePresence, validateLength, validateFormat } from 'ember-changeset-validations/validators';
66
import buildChangeset from 'ember-osf-web/utils/build-changeset';
77
import { inject as service } from '@ember/service';
88
import Intl from 'ember-intl/services/intl';
9+
import { DOIRegex } from 'ember-osf-web/utils/doi';
910

1011
/**
1112
* The TitleAndAbstract Args
@@ -17,6 +18,8 @@ interface TitleAndAbstractArgs {
1718
interface TitleAndAbstractForm {
1819
title: string;
1920
description: string;
21+
manualDoi: string;
22+
manualGuid: string;
2023
}
2124

2225
/**
@@ -45,6 +48,22 @@ export default class TitleAndAbstract extends Component<TitleAndAbstractArgs>{
4548
},
4649
}),
4750
],
51+
manualDoi: validateFormat({
52+
allowBlank: true,
53+
allowNone: true,
54+
ignoreBlank: true,
55+
regex: DOIRegex,
56+
type: 'invalid_doi',
57+
}),
58+
manualGuid: validateLength({
59+
allowBlank: true,
60+
min:5,
61+
type: 'greaterThanOrEqualTo',
62+
translationArgs: {
63+
description: this.intl.t('preprints.submit.step-title.guid'),
64+
gte: '5 characters',
65+
},
66+
}),
4867
};
4968

5069
titleAndAbstractFormChangeset = buildChangeset(this.args.manager.preprint, this.titleAndAbstractFormValidation);

app/preprints/-components/submit/title-and-abstract/template.hbs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@
4848
@onKeyUp={{this.validate}}
4949
/>
5050
{{/let}}
51+
{{#if (and (feature-flag 'manual_doi_and_guid') (not @manager.isEditFlow))}}
52+
{{#let (unique-id 'manualDoi') as |manualDoiField|}}
53+
<label for={{manualDoiField}}
54+
data-test-manual-doi-label
55+
>
56+
{{t 'preprints.submit.step-title.doi'}}
57+
<span local-class='required'>*</span>
58+
</label>
59+
<form.text
60+
data-test-manual-doi-input
61+
@valuePath={{'manualDoi'}}
62+
@isRequired={{false}}
63+
{{on 'change' this.validate}}
64+
local-class='input-container'
65+
@uniqueID={{manualDoiField}}
66+
@onKeyUp={{this.validate}}
67+
/>
68+
{{/let}}
69+
{{#let (unique-id 'manualGuid') as |manualGuidField|}}
70+
<label for={{manualGuidField}}
71+
data-test-manudal-guid-label
72+
>
73+
{{t 'preprints.submit.step-title.guid'}}
74+
<span local-class='required'>*</span>
75+
</label>
76+
<form.text
77+
data-test-manual-guid-input
78+
@valuePath={{'manualGuid'}}
79+
@isRequired={{false}}
80+
{{on 'change' this.validate}}
81+
local-class='input-container'
82+
@uniqueID={{manualGuidField}}
83+
@onKeyUp={{this.validate}}
84+
/>
85+
{{/let}}
86+
{{/if}}
5187
</FormControls>
5288
</div>
5389
</div>

config/environment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ module.exports = function(environment) {
316316
},
317317
storageI18n: 'storage_i18n',
318318
gravyWaffle: 'gravy_waffle',
319+
manualDoiAndGuid: 'manual_doi_and_guid',
319320
enableInactiveSchemas: 'enable_inactive_schemas',
320321
verifyEmailModals: 'ember_verify_email_modals',
321322
ABTesting: {

lib/osf-components/addon/components/registries/finalize-registration-modal/manager/component.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import RegistrationModel from 'ember-osf-web/models/registration';
1414
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception';
1515

1616
import DraftRegistrationManager from 'registries/drafts/draft/draft-registration-manager';
17+
import buildChangeset from 'ember-osf-web/utils/build-changeset';
18+
import { ValidationObject } from 'ember-changeset-validations';
19+
import { validateFormat, validateLength } from 'ember-changeset-validations/validators';
20+
import { DOIRegex } from 'ember-osf-web/utils/doi';
1721
import template from './template';
1822

1923
export interface FinalizeRegistrationModalManager {
@@ -25,16 +29,44 @@ export interface FinalizeRegistrationModalManager {
2529
draftManager: DraftRegistrationManager;
2630
}
2731

32+
interface ManualDoiAndGuidForm {
33+
manualDoi: string;
34+
manualGuid: string;
35+
}
36+
2837
@layout(template)
2938
@tagName('')
3039
export default class FinalizeRegistrationModalManagerComponent extends Component
3140
implements FinalizeRegistrationModalManager {
3241
@service intl!: Intl;
3342
@service toast!: Toast;
3443

44+
// validationFunction() {
45+
// debugger;
46+
// }
47+
manualDoiAndGuidFormChangesetValidation: ValidationObject<ManualDoiAndGuidForm> = {
48+
manualDoi: validateFormat({
49+
allowBlank: true,
50+
allowNone: true,
51+
ignoreBlank: true,
52+
regex: DOIRegex,
53+
type: 'invalid_doi',
54+
}),
55+
// manualDoi: this.validationFunction,
56+
manualGuid: validateLength({
57+
allowBlank: true,
58+
min:5,
59+
type: 'greaterThanOrEqualTo',
60+
translationArgs: {
61+
description: this.intl.t('preprints.submit.step-title.guid'),
62+
gte: '5 characters',
63+
},
64+
}),
65+
};
3566
// Required arguments
3667
registration!: RegistrationModel;
3768
draftManager!: DraftRegistrationManager;
69+
guidAndDoiFormChangeset!: any;
3870

3971
// Optional arguments
4072
onSubmitRegistration?: (registrationId: string) => void;
@@ -67,6 +99,14 @@ export default class FinalizeRegistrationModalManagerComponent extends Component
6799

68100
didReceiveAttrs() {
69101
assert('finalize-registration-modal::manager must have a registration', Boolean(this.registration));
102+
this.guidAndDoiFormChangeset = buildChangeset(this.registration, this.manualDoiAndGuidFormChangesetValidation);
103+
}
104+
105+
@action
106+
validateManualDoiAndGuid() {
107+
// debugger;
108+
this.guidAndDoiFormChangeset.validate();
109+
this.guidAndDoiFormChangeset.execute();
70110
}
71111

72112
@action

lib/osf-components/addon/components/registries/finalize-registration-modal/manager/template.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
hasEmbargoEndDate=this.hasEmbargoEndDate
66
submittingRegistration=this.submittingRegistration
77
draftManager=this.draftManager
8+
guidAndDoiFormChangeset=this.guidAndDoiFormChangeset
9+
validateManualDoiAndGuid=this.validateManualDoiAndGuid
810
)}}

lib/osf-components/addon/components/registries/finalize-registration-modal/template.hbs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,44 @@
4343
/>
4444
{{/if}}
4545
</div>
46+
{{#if (feature-flag 'manual_doi_and_guid')}}
47+
<FormControls
48+
@changeset={{this.manager.guidAndDoiFormChangeset}}
49+
data-test-form
50+
as |form|
51+
>
52+
{{#let (unique-id 'manualDoi') as |manualDoiField|}}
53+
<label for={{manualDoiField}}
54+
data-test-manual-doi-label
55+
>
56+
{{t 'preprints.submit.step-title.doi'}}
57+
</label>
58+
<form.text
59+
data-test-manual-doi-input
60+
{{on 'change' this.manager.validateManualDoiAndGuid}}
61+
@valuePath={{'manualDoi'}}
62+
@isRequired={{false}}
63+
@uniqueID={{manualDoiField}}
64+
@onKeyUp={{this.manager.validateManualDoiAndGuid}}
65+
/>
66+
{{/let}}
67+
{{#let (unique-id 'manualGuid') as |manualGuidField|}}
68+
<label for={{manualGuidField}}
69+
data-test-manudal-guid-label
70+
>
71+
{{t 'preprints.submit.step-title.guid'}}
72+
</label>
73+
<form.text
74+
data-test-manual-guid-input
75+
{{on 'change' this.manager.validateManualDoiAndGuid}}
76+
@valuePath={{'manualGuid'}}
77+
@isRequired={{false}}
78+
@uniqueID={{manualGuidField}}
79+
@onKeyUp={{this.manager.validateManualDoiAndGuid}}
80+
/>
81+
{{/let}}
82+
</FormControls>
83+
{{/if}}
4684
</dialog.main>
4785
<dialog.footer>
4886
<Button

lib/osf-components/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"ember-intl": "*",
2525
"ember-radio-button": "*",
2626
"ember-responsive": "*",
27-
"ember-in-viewport": "*"
27+
"ember-in-viewport": "*",
28+
"ember-feature-flags": "*"
2829
}
2930
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-osf-web",
3-
"version": "25.10.0",
3+
"version": "25.11.0",
44
"private": true,
55
"description": "Ember front-end for the Open Science Framework",
66
"homepage": "https://github.com/CenterForOpenScience/ember-osf-web#readme",

translations/en-us.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,8 @@ preprints:
16221622
title-input: 'Title'
16231623
abstract-input: 'Abstract'
16241624
abstract-input-error: '20 characters'
1625+
doi: 'DOI'
1626+
guid: 'Guid'
16251627
step-file:
16261628
delete-modal-button: 'Continue'
16271629
delete-modal-button-tooltip: 'Version file'

0 commit comments

Comments
 (0)