From 5e3f4e9993966792b0844febddf1d9dd0742b357 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Tue, 12 Oct 2021 09:16:48 -0400 Subject: [PATCH 01/32] added translation file, resolved merge conflicts. --- app/models/registration.ts | 3 +++ translations/en-us.yml | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/registration.ts b/app/models/registration.ts index 9397f6acbb2..d27fb8e8f3d 100644 --- a/app/models/registration.ts +++ b/app/models/registration.ts @@ -90,9 +90,11 @@ export default class RegistrationModel extends NodeModel.extend(Validations) { @attr('fixstring') iaUrl?: string; @attr('array') providerSpecificMetadata!: ProviderMetadata[]; @attr('fixstring') revisionState?: RevisionReviewStates; + @attr('object') latestSchemaResponse?: SchemaResponseModel; // Write-only attributes @attr('array') includedNodeIds?: string[]; + @attr('boolean') createDoi?: boolean; @attr('fixstring') draftRegistrationId?: string; @belongsTo('node', { inverse: 'registrations' }) @@ -134,6 +136,7 @@ export default class RegistrationModel extends NodeModel.extend(Validations) { // Write-only relationships @belongsTo('draft-registration', { inverse: null }) draftRegistration!: DraftRegistrationModel; + static reviewsState: string; } declare module 'ember-data/types/registries/model' { diff --git a/translations/en-us.yml b/translations/en-us.yml index a8de7cbc253..0b4ba92b8bb 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -587,8 +587,11 @@ node_card: pending_embargo_termination: 'Pending embargo termination' pending_withdraw_request: 'Pending withdrawal' pending_withdraw: 'Pending withdrawal moderation' - withdrawn: Withdrawn - archiving: Archiving + withdrawn: 'Withdrawn' + archiving: 'Archiving' + revision_in_progress: 'A revision is currently in progress' + revision_pending_admin_approval: 'Revision is currently pending admin approval' + revision_pending_edit_moderation: 'Revision is currently pending moderator approval' tags: 'Tags:' registration_template: 'Registration template:' contributors: 'Contributors:' From 74b720c0737aeed4de8f91f38ca5da04eed59b54 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 1 Sep 2021 15:16:39 -0400 Subject: [PATCH 02/32] added Update button to registries/my-registrations endpoint, updated translation file for button. --- .../addon/components/node-card/template.hbs | 13 +++++++++++++ translations/en-us.yml | 1 + 2 files changed, 14 insertions(+) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 38fedb8a3c6..4df277b58f8 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -87,6 +87,13 @@ > {{t 'general.delete'}} + + {{t 'general.delete'}} + @@ -166,6 +173,12 @@ + {{else}} diff --git a/translations/en-us.yml b/translations/en-us.yml index 0b4ba92b8bb..dd546a2bb05 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -600,6 +600,7 @@ node_card: registry: 'Registry:' options: Options view: 'View' + update: 'Update' forks: fork: Fork title: Forks From 9b8e6032e52a8c968fc8cc6c3b19cad9f5934be9 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 1 Sep 2021 20:16:02 -0400 Subject: [PATCH 03/32] added CSS to local-class for buttons, removed inline CSS. --- .../addon/components/node-card/styles.scss | 4 ++ .../addon/components/node-card/template.hbs | 37 ++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/styles.scss b/lib/osf-components/addon/components/node-card/styles.scss index c353bff123b..355061a1c82 100644 --- a/lib/osf-components/addon/components/node-card/styles.scss +++ b/lib/osf-components/addon/components/node-card/styles.scss @@ -1,3 +1,7 @@ +.MyRegistrationsButtons { + display: inline-block; +} + .NodeCard { margin: 10px 0; } diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 4df277b58f8..b16bbd4408c 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -164,22 +164,31 @@ {{/if}} - - - + + - {{t 'node_card.update'}} - - + + + {{else}} From f697b75020a870d2ac56731109528db529c53b1d Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 24 Sep 2021 14:35:07 -0400 Subject: [PATCH 04/32] added asserts methods for update button for my registrations, updated translation file for multiple buttons, added schema response to registration for rendering hbs. --- .../addon/components/node-card/template.hbs | 9 +++------ tests/integration/components/node-card/component-test.ts | 7 ++++++- translations/en-us.yml | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index b16bbd4408c..ebcb277f5c8 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -177,15 +177,12 @@ - diff --git a/tests/integration/components/node-card/component-test.ts b/tests/integration/components/node-card/component-test.ts index 9ff07ebdf62..a614ee64cb9 100644 --- a/tests/integration/components/node-card/component-test.ts +++ b/tests/integration/components/node-card/component-test.ts @@ -1,7 +1,8 @@ import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupIntl, TestContext } from 'ember-intl/test-support'; +import { setupIntl, t, TestContext } from 'ember-intl/test-support'; +import { RevisionReviewStates } from 'ember-osf-web/models/revision'; import { setupRenderingTest } from 'ember-qunit'; import moment from 'moment'; import { module, test } from 'qunit'; @@ -23,6 +24,7 @@ module('Integration | Component | node-card', hooks => { const registration = server.create('registration', { tags: ['a', 'b', 'c'], description: 'Through the night', + revisionState: RevisionReviewStates.Approved, }); server.create('contributor', { node: registration, index: 0, bibliographic: true }); server.create('contributor', { node: registration, index: 1, bibliographic: true }); @@ -104,5 +106,8 @@ module('Integration | Component | node-card', hooks => { assert.dom(`[data-test-tags-widget-tag='${tag}']`).hasText(tag, 'Tag is correct'); } assert.dom(`[data-test-view-button='${registration.id}']`).exists('View button exists'); + + assert.dom('[data-test-update-button]').exists('Update button exists.'); + assert.dom('[data-test-update-button]').hasText(t('node_card.update_button').toString()); }); }); diff --git a/translations/en-us.yml b/translations/en-us.yml index dd546a2bb05..7b77a222f19 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -599,8 +599,8 @@ node_card: last_updated: 'Last updated:' registry: 'Registry:' options: Options - view: 'View' - update: 'Update' + view_button: 'View' + update_button: 'Update' forks: fork: Fork title: Forks From 40342499f6a48bd7f852043290082af89d9b4fc8 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 1 Sep 2021 15:16:39 -0400 Subject: [PATCH 05/32] added Update button to registries/my-registrations endpoint, updated translation file for button. --- translations/en-us.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/translations/en-us.yml b/translations/en-us.yml index 7b77a222f19..a11d3191edb 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -599,8 +599,13 @@ node_card: last_updated: 'Last updated:' registry: 'Registry:' options: Options +<<<<<<< HEAD view_button: 'View' update_button: 'Update' +======= + view: 'View' + update: 'Update' +>>>>>>> 3a97f2815 (added Update button to registries/my-registrations endpoint, updated translation file for button.) forks: fork: Fork title: Forks From 21d67d1e09b62681620fe8087c3c42b04d09e41a Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 1 Sep 2021 20:16:02 -0400 Subject: [PATCH 06/32] added CSS to local-class for buttons, removed inline CSS. --- .../addon/components/node-card/template.hbs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index ebcb277f5c8..b16bbd4408c 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -177,12 +177,15 @@ - From d5ba846797e46127a94070dfde435febf7cc0dbb Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Mon, 27 Sep 2021 22:24:56 -0400 Subject: [PATCH 07/32] added router service to node card, updated route to registries.edit-revision.index, changed type of button to create, added transitionTo function with createNewSchemaResponse on card view. --- .../addon/components/node-card/component.ts | 34 ++++++++++++++++--- .../addon/components/node-card/template.hbs | 12 +++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index f40759174ba..2ebfa8c9ee9 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -1,8 +1,9 @@ import { tagName } from '@ember-decorators/component'; -import Component from '@ember/component'; +import Component from '@glimmer/component'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import config from 'ember-get-config'; +import Store from '@ember-data/store'; import { layout } from 'ember-osf-web/decorators/component'; import Node, { NodeType } from 'ember-osf-web/models/node'; @@ -10,16 +11,27 @@ import Registration from 'ember-osf-web/models/registration'; import Analytics from 'ember-osf-web/services/analytics'; import pathJoin from 'ember-osf-web/utils/path-join'; -import styles from './styles'; +import { task } from 'ember-concurrency'; +import { waitFor } from '@ember/test-waiters'; +import RouterService from '@ember/routing/router-service'; +import RegistrationModel from 'ember-osf-web/models/registration'; +import SchemaResponseModel from 'ember-osf-web/models/schema-response'; + import template from './template'; +import styles from './styles'; + +interface Args { + registration: RegistrationModel; +} const { OSF: { url: baseURL } } = config; @layout(template, styles) @tagName('') -export default class NodeCard extends Component { +export default class NodeCard extends Component { @service analytics!: Analytics; - + @service router!: RouterService; + @service store!: Store; // Optional parameters node?: Node | Registration; delete?: (node: Node) => void; @@ -29,8 +41,22 @@ export default class NodeCard extends Component { // Private properties searchUrl = pathJoin(baseURL, 'search'); + constructor(owner: unknown, args: Args) { + super(owner, args); + } + @computed('readOnly', 'node', 'node.{nodeType,userHasWritePermission}') get showDropdown() { return !this.readOnly && this.node && this.node.nodeType === NodeType.Fork && this.node.userHasWritePermission; } + + @task + @waitFor + async createNewSchemaResponse() { + const newRevision: SchemaResponseModel = this.store.createRecord('schema-response', { + registration: this.args.registration, + }); + await newRevision.save(); + this.router.transitionTo('registries.edit-revision', newRevision.id); + } } diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index b16bbd4408c..e6c54f6fb62 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -177,6 +177,7 @@ {{t 'node_card.update'}} +======= + data-test-update-button='{{@node.id}}' + @route='registries.edit-revision.index' + @models={{array @node.id}} + > + From c50f2ce10b7ab18e987f95a74b52d99c46414de4 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 29 Sep 2021 09:30:49 -0400 Subject: [PATCH 08/32] updated schema response variables in mirage file. --- mirage/scenarios/registrations.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mirage/scenarios/registrations.ts b/mirage/scenarios/registrations.ts index 7a4f6ba3dfe..04f1e92911f 100644 --- a/mirage/scenarios/registrations.ts +++ b/mirage/scenarios/registrations.ts @@ -57,6 +57,8 @@ export function registrationScenario( const currentUserWrite = server.create('registration', { id: 'writr', registrationSchema: server.schema.registrationSchemas.find('prereg_challenge'), + reviewsState: RegistrationReviewStates.Accepted, + revisionState: RevisionReviewStates.Approved, currentUserPermissions: [Permission.Read, Permission.Write], providerSpecificMetadata: [ { field_name: 'Metadata field 1', field_value: '' }, @@ -64,6 +66,17 @@ export function registrationScenario( ], }); + server.create('schema-response', { + id: 'copyEdit', + revisionJustification: 'Copy Edit', + revisionResponses: { + q1: 'Good Morning', + q2: ['List of greetings'], + }, + initiatedBy: currentUser, + registration: currentUserWrite, + }); + server.create('contributor', { users: currentUser, node: currentUserWrite }); const registrationResponses = { From 8c84a9dd33ead7c1691f0b26f3ca33fc1505ed05 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 29 Sep 2021 17:12:42 -0400 Subject: [PATCH 09/32] linting: removed comment. --- .../addon/components/node-card/component.ts | 58 ++++++++++++++----- .../addon/components/node-card/template.hbs | 2 +- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index 2ebfa8c9ee9..ed4742a2ce6 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -1,5 +1,5 @@ import { tagName } from '@ember-decorators/component'; -import Component from '@glimmer/component'; +import Component from '@ember/component'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import config from 'ember-get-config'; @@ -10,28 +10,28 @@ import Node, { NodeType } from 'ember-osf-web/models/node'; import Registration from 'ember-osf-web/models/registration'; import Analytics from 'ember-osf-web/services/analytics'; import pathJoin from 'ember-osf-web/utils/path-join'; +import Toast from 'ember-toastr/services/toast'; import { task } from 'ember-concurrency'; import { waitFor } from '@ember/test-waiters'; import RouterService from '@ember/routing/router-service'; -import RegistrationModel from 'ember-osf-web/models/registration'; import SchemaResponseModel from 'ember-osf-web/models/schema-response'; - +import Intl from 'ember-intl/services/intl'; +import RegistrationModel from 'ember-osf-web/models/registration'; +import { taskFor } from 'ember-concurrency-ts'; +import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception'; import template from './template'; import styles from './styles'; - -interface Args { - registration: RegistrationModel; -} - const { OSF: { url: baseURL } } = config; @layout(template, styles) @tagName('') -export default class NodeCard extends Component { +export default class NodeCard extends Component { @service analytics!: Analytics; @service router!: RouterService; @service store!: Store; + @service toast!: Toast; + @service intl!: Intl; // Optional parameters node?: Node | Registration; delete?: (node: Node) => void; @@ -41,20 +41,50 @@ export default class NodeCard extends Component { // Private properties searchUrl = pathJoin(baseURL, 'search'); - constructor(owner: unknown, args: Args) { - super(owner, args); - } - @computed('readOnly', 'node', 'node.{nodeType,userHasWritePermission}') get showDropdown() { return !this.readOnly && this.node && this.node.nodeType === NodeType.Fork && this.node.userHasWritePermission; } + @task + @waitFor + async getLatestRevision(registration: RegistrationModel) { + const schemaResponseDates: Date[] = []; + if (!registration){ + const notReistrationError = this.intl.t('registries.update_dropdown.not_a_registration_error'); + return this.toast.error(notReistrationError); + } + try { + const revisionList : SchemaResponseModel[] = await registration.queryHasMany('schemaResponses'); + revisionList.forEach(revision => { + const date: Date = revision.dateModified; + schemaResponseDates.push(date); + }); + const latestDate = schemaResponseDates.sort((a: any, b: any) => + new Date(b).valueOf() - new Date(a).valueOf())[0]; + + const latestSchemaResponse = revisionList.filter(revision => revision.dateModified === latestDate); + registration.set('latestSchemaResponse', latestSchemaResponse); + + } catch (e) { + const errorMessage = this.intl.t('node.schema_response_error'); + captureException(e, {errorMessage}); + this.toast.error(getApiErrorMessage(e), errorMessage); + } + } + + didReceiveAttrs() { + if (this.node?.isRegistration) { + taskFor(this.getLatestRevision).perform(this.node as Registration); + } + } + + // TODO add to button for Update when clicked, add route @task @waitFor async createNewSchemaResponse() { const newRevision: SchemaResponseModel = this.store.createRecord('schema-response', { - registration: this.args.registration, + registration: this.node, }); await newRevision.save(); this.router.transitionTo('registries.edit-revision', newRevision.id); diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index e6c54f6fb62..7350297720b 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -194,7 +194,7 @@ > + {{#unless (not-eq this.node.reviewsState 'accepted')}} + {{#if this.latestSchemaResponse}} + + + + {{/if}} + {{/unless}} {{else}} From a34df1801fb70c5f5f3799e3a0f4c5abe82e157e Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 8 Oct 2021 09:15:13 -0400 Subject: [PATCH 12/32] no-verifying using unless until computed is ready. --- lib/osf-components/addon/components/node-card/component.ts | 1 - lib/osf-components/addon/components/node-card/styles.scss | 7 +++++++ lib/osf-components/addon/components/node-card/template.hbs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index 89370f72f99..19339e354e0 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -91,4 +91,3 @@ export default class NodeCard extends Component { this.router.transitionTo('registries.edit-revision', newRevision.id); } } - diff --git a/lib/osf-components/addon/components/node-card/styles.scss b/lib/osf-components/addon/components/node-card/styles.scss index 355061a1c82..be352a16a87 100644 --- a/lib/osf-components/addon/components/node-card/styles.scss +++ b/lib/osf-components/addon/components/node-card/styles.scss @@ -1,5 +1,12 @@ +.UpdateButton { + background-color: #fff; + border: 1px solid #d9d9d9; + color: var(--primary-color) +} + .MyRegistrationsButtons { display: inline-block; + } .NodeCard { diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index d4bc5fe2ca6..26d465e2995 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -197,7 +197,9 @@ @models={{array this.latestSchemaResponse.id}} > From ae57d9a2f0a5e45ad9ee5def15a41f43f85259f4 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 8 Oct 2021 16:41:30 -0400 Subject: [PATCH 13/32] added logic for whether dropdown should show if registration review state is accepted or embargo. --- .../addon/components/node-card/component.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index 19339e354e0..a1aef7cf678 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -90,4 +90,20 @@ export default class NodeCard extends Component { await newRevision.save(); this.router.transitionTo('registries.edit-revision', newRevision.id); } + + @computed('node.isRegistration') + get shouldShowUpdateButton(): boolean { + let showUpdateButton = false; + if (this.node && this.node.isRegistration) { + const registration = this.node as Registration; + if (registration.reviewsState === 'accepted' || registration.reviewsState === 'embargo') { + showUpdateButton = true; + } else { + showUpdateButton = false; + } + } + return showUpdateButton; + } } + + From 87f805850c8fbd12fee9bb340e7f1bfd853b71f8 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Mon, 11 Oct 2021 14:59:19 -0400 Subject: [PATCH 14/32] using unless. --- .../addon/components/node-card/component.ts | 2 - .../addon/components/node-card/template.hbs | 38 ++++++++++--------- .../make-decision-dropdown/component.ts | 6 +-- mirage/scenarios/registrations.ts | 8 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index a1aef7cf678..f1038a1f1c9 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -105,5 +105,3 @@ export default class NodeCard extends Component { return showUpdateButton; } } - - diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 26d465e2995..e7895815c38 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -188,24 +188,26 @@ {{t 'node_card.update_button'}} - {{#unless (not-eq this.node.reviewsState 'accepted')}} - {{#if this.latestSchemaResponse}} - - - - {{/if}} - {{/unless}} + {{#if this.shouldShowUpdateButton}} + {{#unless (not-eq this.node.reviewsState 'accepted')}} + {{#if this.latestSchemaResponse}} + + + + {{/if}} + {{/unless}} + {{/if}} {{else}} diff --git a/lib/registries/addon/components/make-decision-dropdown/component.ts b/lib/registries/addon/components/make-decision-dropdown/component.ts index fac71c55db8..4a523a08b21 100644 --- a/lib/registries/addon/components/make-decision-dropdown/component.ts +++ b/lib/registries/addon/components/make-decision-dropdown/component.ts @@ -106,10 +106,10 @@ export default class MakeDecisionDropdown extends Component { get moderatorActions() { const { reviewsState } = this.args.registration; - const { revisionState } = this.args.registration; - let actions: ReviewsStateToDecisionMap[] = reviewsState ? reviewsStateToDecisionMap[reviewsState] : []; + let actions: ReviewsStateToDecisionMap[] = reviewsState ? + reviewsStateToDecisionMap[RegistrationReviewStates.Accepted] : []; if (this.revisionIsPending) { - actions = reviewsStateToDecisionMap[revisionState]; + actions = reviewsStateToDecisionMap[RegistrationReviewStates.Pending]; } return actions; } diff --git a/mirage/scenarios/registrations.ts b/mirage/scenarios/registrations.ts index 04f1e92911f..bd9898c80af 100644 --- a/mirage/scenarios/registrations.ts +++ b/mirage/scenarios/registrations.ts @@ -57,8 +57,8 @@ export function registrationScenario( const currentUserWrite = server.create('registration', { id: 'writr', registrationSchema: server.schema.registrationSchemas.find('prereg_challenge'), - reviewsState: RegistrationReviewStates.Accepted, - revisionState: RevisionReviewStates.Approved, + reviewsState: RegistrationReviewStates.Withdrawn, + revisionState: RevisionReviewStates.RevisionInProgress, currentUserPermissions: [Permission.Read, Permission.Write], providerSpecificMetadata: [ { field_name: 'Metadata field 1', field_value: '' }, @@ -172,9 +172,9 @@ export function registrationScenario( title: 'Revision Model: Contributor View (non-Admin/Mod)', registrationSchema: server.schema.registrationSchemas.find('testSchema'), provider: egap, - reviewsState: RegistrationReviewStates.Accepted, + reviewsState: RegistrationReviewStates.Withdrawn, registeredBy: currentUser, - revisionState: RevisionReviewStates.Approved, + revisionState: RevisionReviewStates.RevisionInProgress, currentUserPermissions: [Permission.Write], providerSpecificMetadata: [ { field_name: 'IP Address', field_value: '127.0.0.1' }, From 90a9593701c2920c09ae2d3318e10d4395e8e7df Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 13 Oct 2021 16:26:52 -0400 Subject: [PATCH 15/32] linting, using unless. --- lib/osf-components/addon/components/node-card/template.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index e7895815c38..23af609dda5 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -172,7 +172,7 @@ @models={{array @node.id}} > Date: Tue, 19 Oct 2021 10:03:53 -0400 Subject: [PATCH 16/32] updated local class selectors for scss update button changes. --- .../addon/components/node-card/component.ts | 4 ++-- .../addon/components/node-card/styles.scss | 24 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index f1038a1f1c9..3f07607b1c3 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -55,8 +55,8 @@ export default class NodeCard extends Component { @waitFor async getLatestRevision(registration: RegistrationModel) { if (!registration) { - const notReistrationError = this.intl.t('registries.update_dropdown.not_a_registration_error'); - return this.toast.error(notReistrationError); + const notARegistrationError = this.intl.t('registries.update_dropdown.not_a_registration_error'); + return this.toast.error(notARegistrationError); } if (registration.reviewsState !== 'accepted') { diff --git a/lib/osf-components/addon/components/node-card/styles.scss b/lib/osf-components/addon/components/node-card/styles.scss index be352a16a87..f44c223b95e 100644 --- a/lib/osf-components/addon/components/node-card/styles.scss +++ b/lib/osf-components/addon/components/node-card/styles.scss @@ -1,14 +1,3 @@ -.UpdateButton { - background-color: #fff; - border: 1px solid #d9d9d9; - color: var(--primary-color) -} - -.MyRegistrationsButtons { - display: inline-block; - -} - .NodeCard { margin: 10px 0; } @@ -98,3 +87,16 @@ overflow: hidden; white-space: nowrap; } + +.UpdateButton { + background-color: #fff; + border: 1px solid #d9d9d9; + color: var(--primary-color); +} + +.MyRegistrationsButtons { + display: inline-block; + background-color: #fff; + border: 1px solid #d9d9d9; + color: var(--primary-color); +} From eb4ec84cad869bb50c5b2fef9a5ecad1e176566d Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 22 Oct 2021 13:01:00 -0400 Subject: [PATCH 17/32] removed unnecessary logic, user-agent CSS for node card. --- .../addon/components/node-card/template.hbs | 18 ++---------------- mirage/scenarios/registrations.ts | 4 ++-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 23af609dda5..b7d5f1bafcc 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -175,19 +175,6 @@ {{t 'node_card.view_button'}} - - - {{#if this.shouldShowUpdateButton}} {{#unless (not-eq this.node.reviewsState 'accepted')}} {{#if this.latestSchemaResponse}} @@ -197,10 +184,9 @@ @route='registries.edit-revision.index' @models={{array this.latestSchemaResponse.id}} > + @@ -215,4 +201,4 @@ {{/if}} - + \ No newline at end of file diff --git a/mirage/scenarios/registrations.ts b/mirage/scenarios/registrations.ts index bd9898c80af..3c0bfb33165 100644 --- a/mirage/scenarios/registrations.ts +++ b/mirage/scenarios/registrations.ts @@ -57,8 +57,8 @@ export function registrationScenario( const currentUserWrite = server.create('registration', { id: 'writr', registrationSchema: server.schema.registrationSchemas.find('prereg_challenge'), - reviewsState: RegistrationReviewStates.Withdrawn, - revisionState: RevisionReviewStates.RevisionInProgress, + reviewsState: RegistrationReviewStates.Accepted, + revisionState: RevisionReviewStates.Approved, currentUserPermissions: [Permission.Read, Permission.Write], providerSpecificMetadata: [ { field_name: 'Metadata field 1', field_value: '' }, From 801c4bcc521002374b1f545702f2b078ddbaaf26 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 22 Oct 2021 13:38:03 -0400 Subject: [PATCH 18/32] updated translation file for no previous available revised responses. --- .../components/registries/revised-responses-list/template.hbs | 2 +- translations/en-us.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs b/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs index f683bf96bcb..390582cc790 100644 --- a/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs +++ b/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs @@ -4,6 +4,6 @@

{{~else}}

- {{~t 'registries.revisedResponsesList.noResponses'~}} + {{~t 'registries.edit_revision.revised_responses_list.no_responses'~}}

{{/each}} \ No newline at end of file diff --git a/translations/en-us.yml b/translations/en-us.yml index 3ebe2bd9c58..0128cc79135 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -1133,6 +1133,8 @@ registries: action_submit_failed: 'Your decision was not recorded' non_admin_warning: 'Only admins can submit an update.' invalid_warning: 'Please address invalid or missing entries to complete update.' + revised_responses_list: + no_responses: 'No previous responses available.' continue_edit_modal: heading: 'Are you sure this needs more edits?' warning: 'This will cancel any approvals from other admin contributors and return the registration back to its draft form for additional changes.' From df38a172bc647599d2944d88b390646a2783ff0f Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 22 Oct 2021 14:36:08 -0400 Subject: [PATCH 19/32] linting. --- .../addon/components/node-card/styles.scss | 2 +- .../addon/components/node-card/template.hbs | 60 ++++++++++--------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/styles.scss b/lib/osf-components/addon/components/node-card/styles.scss index f44c223b95e..1bd13677ac2 100644 --- a/lib/osf-components/addon/components/node-card/styles.scss +++ b/lib/osf-components/addon/components/node-card/styles.scss @@ -1,5 +1,5 @@ .NodeCard { - margin: 10px 0; + margin: 10px; } .NodeCard__heading { diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index b7d5f1bafcc..8e9dc42ddba 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -164,36 +164,40 @@ {{/if}} -
- - - - {{#if this.shouldShowUpdateButton}} - {{#unless (not-eq this.node.reviewsState 'accepted')}} - {{#if this.latestSchemaResponse}} - +
+
+
+ + + + {{#if this.shouldShowUpdateButton}} + {{#unless (not-eq this.node.reviewsState 'accepted')}} + {{#if this.latestSchemaResponse}} + - - + + + {{/if}} + {{/unless}} {{/if}} - {{/unless}} - {{/if}} +
+
{{else}} From 7c989babbc3cbee9767e6d37560e114ff2582a7d Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 22 Oct 2021 14:59:26 -0400 Subject: [PATCH 20/32] linting. --- .../addon/components/node-card/styles.scss | 9 ++++----- .../addon/components/node-card/template.hbs | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/styles.scss b/lib/osf-components/addon/components/node-card/styles.scss index 1bd13677ac2..0b514d96124 100644 --- a/lib/osf-components/addon/components/node-card/styles.scss +++ b/lib/osf-components/addon/components/node-card/styles.scss @@ -88,15 +88,14 @@ white-space: nowrap; } -.UpdateButton { +.RegistrationCard_view { background-color: #fff; - border: 1px solid #d9d9d9; color: var(--primary-color); + vertical-align: bottom; } -.MyRegistrationsButtons { - display: inline-block; +.RegistrationCard_update { background-color: #fff; - border: 1px solid #d9d9d9; color: var(--primary-color); + vertical-align: bottom; } diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 8e9dc42ddba..244698967bd 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -168,8 +168,9 @@
@@ -181,14 +182,14 @@ {{#unless (not-eq this.node.reviewsState 'accepted')}} {{#if this.latestSchemaResponse}} From 144238b1187434ddccfb1b3c8c4eb40b92d4bc75 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Fri, 22 Oct 2021 19:25:31 -0400 Subject: [PATCH 21/32] linting. --- .../addon/components/node-card/template.hbs | 19 ++++++++++++++++++- translations/en-us.yml | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 244698967bd..35262fbd1ab 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -34,14 +34,30 @@ {{#if @node.archiving}} {{t 'node_card.registration.statuses.archiving'}} | {{/if}} + + {{#if @node.revisionState.id}} + {{t 'node_card.registration.statuses.revision_in_progress'}} | + {{else if (eq @node.revisionState 'unapproved')}} + {{t 'node_card.registration.statuses.revision_pending_admin_approval'}} | + {{else if (eq @node.revisionState 'in_progress')}} + {{t 'node_card.registration.statuses.revision_pending_moderation'}} | + {{else if (eq @node.revisionState 'pending_moderation')}} + {{t 'node_card.registration.statuses.revision_pending_admin_approval'}} | + {{else if (eq @node.revisionState 'approved')}} + {{t 'node_card.registration.statuses.revision_pending_moderation'}} | + {{/if}} + {{node-card/node-icon category=@node.category}} + + {{@node.title}} + - {{@node.title}} + {{else}} @@ -101,6 +117,7 @@ {{/if}} {{/if}} +
{{#if @node}}
diff --git a/translations/en-us.yml b/translations/en-us.yml index 0128cc79135..a8dd7672117 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -588,6 +588,7 @@ node_card: pending_withdraw: 'Pending withdrawal moderation' withdrawn: Withdrawn archiving: Archiving + revision_pending_moderation: 'Revision is pending moderation.' tags: 'Tags:' registration_template: 'Registration template:' contributors: 'Contributors:' From 260a97e46d396433d1e30082f76413812669ebfe Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Mon, 25 Oct 2021 16:57:59 -0400 Subject: [PATCH 22/32] updated translation file: readded bulk upload translations. --- .../revised-responses-list/template.hbs | 2 +- translations/en-us.yml | 97 ++++++++++++++++--- 2 files changed, 84 insertions(+), 15 deletions(-) diff --git a/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs b/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs index 390582cc790..f683bf96bcb 100644 --- a/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs +++ b/lib/osf-components/addon/components/registries/revised-responses-list/template.hbs @@ -4,6 +4,6 @@

{{~else}}

- {{~t 'registries.edit_revision.revised_responses_list.no_responses'~}} + {{~t 'registries.revisedResponsesList.noResponses'~}}

{{/each}} \ No newline at end of file diff --git a/translations/en-us.yml b/translations/en-us.yml index a8dd7672117..933bba5f7f1 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -525,6 +525,7 @@ validationErrors: onlyProjectOrComponentFiles: 'The {numOfFiles, plural, =1 {file} other {files}} "{missingFilesList}" cannot be found on this {projectOrComponent}.' new_folder_name: 'Folder name must not be blank.' year_format: 'Please specify a valid year.' + no_updated_responses: 'No changes have been made in this update.' validated_input_form: discard_changes: 'Discard changes' node_navbar: @@ -588,17 +589,17 @@ node_card: pending_withdraw: 'Pending withdrawal moderation' withdrawn: Withdrawn archiving: Archiving - revision_pending_moderation: 'Revision is pending moderation.' tags: 'Tags:' registration_template: 'Registration template:' contributors: 'Contributors:' description: 'Description:' last_updated: 'Last updated:' registry: 'Registry:' - options: 'Options' + options: Options view_button: 'View' update_button: 'Update' schema_response_error: 'Updates irretreivable.' + forks: fork: Fork title: Forks @@ -618,7 +619,7 @@ node: registrations: new_registration_modal: title: Register - info: 'Registration creates a frozen version of the project. Your original project remains editable and will have the registration linked. Things to know about registration:
  • Registrations cannot be edited or deleted.
  • Withdrawing a registration removes its contents, but leaves behind basic metadata: title, contributors, date registered, date withdrawn, and justification (if provided).
  • Registrations can be public or embargoed for up to four years. Embargoed registrations will be made public automatically when the embargo expires.
Continue your registration by selecting a registration form:' + info: 'Registration creates a frozen version of the project. Your original project remains editable and will have the registration linked. Things to know about registration:
  • Registrations cannot be edited or deleted.
  • Withdrawing a registration removes its contents, but leaves behind basic metadata: title, contributors, date registered, date withdrawn, and justification (if provided).
  • Registrations can be public or embargoed for up to four years. Embargoed registrations will be made public automatically when the embargo expires.
  • Registrations are archived on Internet Archive and a link to the archived copy will be added to the registration metadata.
Continue your registration by selecting a registration form:' create: 'Create draft' prereg_modal: title: 'Preregistration Challenge' @@ -918,9 +919,9 @@ collections: project_contributors_title: 'Project contributors' project_contributors_description: 'Updates made to this section will update the project.' collection_metadata_title: 'Collection metadata' - cancel: 'Cancel' + cancel: Cancel add_button: 'Add to collection' - update_button: 'Update' + update_button: Update add_save_success: '{title} has been added to the collection.' update_save_success: '{title} has been updated in the collection.' add_save_error: 'Error adding {title} to the collection.' @@ -1027,10 +1028,73 @@ registries: removedModeratorError: 'Error removing {permission}' updatedModeratorPermissionSuccess: 'Successfully updated {userName} to {permission}' updatedModeratorPermissionError: 'Error updating permission to {permission}' - notifications: - title: 'Notifications' + settings: + title: 'Settings' heading: 'Configure reviews notification preferences' paragraph: 'To configure other notification preferences visit your user settings.' + bulkUpload: 'Bulk upload' + bulkUploadHelpText: 'Drag and drop the csv file that has the registration information to upload.' + dropCsvHere: 'Drop csv file here to upload' + uploadError: 'Upload error' + copyToClipboard: 'Copy to clipboard' + cell: 'Cell' + copyToClipboardSuccess: 'Successfully copied to clipboard.' + generalErrorMessage: 'Your file was not uploaded due to the errors listed below. Please correct the errors and try again. If you have any questions, please contact the help desk at support@osf.io.' + invalidSchemaId: + title: 'Invalid schema ID' + detail: 'The schema ID in this cell does not match with a registration template in our system. It’s likely this ID was manually edited after it was downloaded or the registration template is outdated. Contact the help desk at support@osf.io for the current ID or a new csv file.' + invalidColumnId: + title: 'Invalid column ID' + detail: 'This Column ID does not match with the ones used by this registration template. It’s likely it was manually edited after it was downloaded or the registration template is outdated. Contact the help desk at support@osf.io for the current ID or a new csv file.
Invalid IDs: {invalidIds}.
Missing IDs: {missingIds}.' + invalidProjectId: + title: 'Invalid project ID' + detail: 'This Project GUID does not exist. Check that each project’s GUID is accurate. Registrations that do not have a project should have a blank cell.' + invalidInstitutionName: + title: 'Invalid institution name' + detail: 'This affiliated institution name does not match our system. Check that the institution’s name is spelled correctly. Click here to view a list of currently active affiliated institutions.' + invalidLicenseName: + title: 'Invalid license name' + detail: 'This license does not match our system. It’s likely that the license is either spelled incorrectly, is not an option in our system, or formatted incorrectly. Click here to view a list of available licenses. See section “CSV Templates” in our Moderator’s Guide for more information on formatting specific licenses.' + invalidSubjectName: + title: 'Invalid subject name' + detail: 'This subject does not match our system. It’s likely it is spelled incorrectly. OSF uses the bepress taxonomy. Only the word or phase after the last colon needs to be entered.' + invalidCategoryName: + title: 'Invalid category name' + detail: 'This category does not exist. Check that the category is spelled currently. See section “Field Formatting” in the Moderator Guide for a list of categories. Categories can be edited after the registration is submitted.' + invalidResponse: + title: 'Invalid response' + detail: 'This response is not acceptable by the system. It’s likely that this is due to misspelling or having multiple answers for a single response question. See section “Field Formatting” in the Moderator Guide for more information.' + invalidContributors: + title: 'Invalid format for contributors' + detail: 'This contributors list does not match the system’s formatting requirements. Review the required formatting in the Moderator’s Manual. Contact the help desk at support@osf.io if this is not the issue.' + missingTitle: + title: 'Missing title' + detail: 'This title is missing. Check that each registration has a title.' + missingDescription: + title: 'Missing description' + detail: 'This description is missing. Enter a high level summary of the registration. This summary can be edited after the registration is submitted.' + missingAdminContributor: + title: 'Missing admin contributor' + detail: 'This registration doesn’t include an admin contributor. A registration requires at least one admin contributor to be submitted. See section “Field Formatting” in the Moderator Guide for more information on formatting contributors.' + missingBibliographicContributor: + title: 'Missing bibliographic contributor' + detail: 'This registration doesn’t have any bibliographic contributors. Registration must have at least one bibliographic contributors. See section “Field Formatting” in the Moderator Guide for information on formatting contributors.' + missingLicenseName: + title: 'Missing license name' + detail: 'This license is missing. Check that each registration has a license.' + missingSubjectName: + title: 'Missing subject name' + detail: 'This subject is missing. Check that each registration has a subject.' + sizeExceedsLimit: + title: 'File size exceeds limit' + detail: 'The csv file exceeds the 1MB limit. Break the file into multiple files and reupload them. Contact the Help Desk at support@osf.io if you have any questions.' + bulkUploadJobExists: + title: 'Bulk upload job already exists' + detail: 'This csv file was already uploaded into the system and cannot be re-uploaded.' + invalidFileType: + title: 'Invalid file type' + detail: 'Only csv files can be uploaded in the system. Convert the file into the csv format and reupload the document. Contact the Help Desk at support@osf.io if you have any questions.' + uploadSuccess: 'Successfully uploaded csv file.' overview: title: 'Moderated Overview' new: @@ -1124,6 +1188,8 @@ registries: justification_description: 'Justification will be provided to admins and moderators upon review. Once approved, it will be displayed at the top of the registration.' page_title: 'Update registration' review: + justification_page_label: 'Justification' + no_justification: 'No justification provided.' submit_changes: 'Submit changes' accept_changes: 'Accept changes' continue_editing: 'Continue editing' @@ -1134,13 +1200,13 @@ registries: action_submit_failed: 'Your decision was not recorded' non_admin_warning: 'Only admins can submit an update.' invalid_warning: 'Please address invalid or missing entries to complete update.' - revised_responses_list: - no_responses: 'No previous responses available.' continue_edit_modal: heading: 'Are you sure this needs more edits?' warning: 'This will cancel any approvals from other admin contributors and return the registration back to its draft form for additional changes.' reason: 'What additional changes need to be made and why?' submit: 'Submit' + + index: lead: 'The open registries network' see_example: 'See an example' @@ -1440,16 +1506,18 @@ registries: finalizeRegistrationModal: title: 'Almost done...' notice: - noModerationFromProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files (1) in the projects or components being registered, (2) uploaded or selected as prompt responses, including those connected through add-ons during archiving will result in archiving failure and loss of your registration timestamp. Please do not modify your files until after you have received email confirmation of archiving completion. If this registration has been archiving for more than 72 hours, please email support@osf.io for assistance.
  • The content and version history of Wiki and OSF Storage will be copied to the registration.
  • This project may contain links to other projects. These links will be copied into your registration, but the projects that they link to will not be registered. If you wish to register the linked projects, they must be registered separately. Learn more about links.
' - withModerationFromProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files (1) in the projects or components being registered, (2) uploaded or selected as prompt responses, including those connected through add-ons during archiving will result in archiving failure and loss of your registration timestamp. Please do not modify your files until after you have received email confirmation of archiving completion. If this registration has been archiving for more than 72 hours, please email support@osf.io for assistance.
  • The content and version history of Wiki and OSF Storage will be copied to the registration.
  • This project may contain links to other projects. These links will be copied into your registration, but the projects that they link to will not be registered. If you wish to register the linked projects, they must be registered separately. Learn more about links.
  • A moderator must review and approve your registration before it will be made public or embargoed.
' - noModerationNoProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files uploaded or selected as prompt responses will result in archiving failure and loss of your registration timestamp. If this registration has been archiving for more than 72 hours, email support@osf.io for assistance.
' - withModerationNoProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files uploaded or selected as prompt responses will result in archiving failure and loss of your registration timestamp. If this registration has been archiving for more than 72 hours, email support@osf.io for assistance.
  • A moderator must review and approve your registration before it will be made public or embargoed.
' + noModerationFromProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files (1) in the projects or components being registered, (2) uploaded or selected as prompt responses, including those connected through add-ons during archiving will result in archiving failure and loss of your registration timestamp. Please do not modify your files until after you have received email confirmation of archiving completion. If this registration has been archiving for more than 72 hours, please email support@osf.io for assistance.
  • The content and version history of Wiki and OSF Storage will be copied to the registration.
  • This project may contain links to other projects. These links will be copied into your registration, but the projects that they link to will not be registered. If you wish to register the linked projects, they must be registered separately. Learn more about links.
  • Registrations are archived on Internet Archive and a link to the archived copy will be added to the registration metadata.
' + withModerationFromProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files (1) in the projects or components being registered, (2) uploaded or selected as prompt responses, including those connected through add-ons during archiving will result in archiving failure and loss of your registration timestamp. Please do not modify your files until after you have received email confirmation of archiving completion. If this registration has been archiving for more than 72 hours, please email support@osf.io for assistance.
  • The content and version history of Wiki and OSF Storage will be copied to the registration.
  • This project may contain links to other projects. These links will be copied into your registration, but the projects that they link to will not be registered. If you wish to register the linked projects, they must be registered separately. Learn more about links.
  • A moderator must review and approve your registration before it will be made public or embargoed.
  • Registrations are archived on Internet Archive and a link to the archived copy will be added to the registration metadata.
' + noModerationNoProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files uploaded or selected as prompt responses will result in archiving failure and loss of your registration timestamp. If this registration has been archiving for more than 72 hours, email support@osf.io for assistance.
  • Registrations are archived on Internet Archive and a link to the archived copy will be added to the registration metadata.
' + withModerationNoProject: 'Remember:
  • Registrations cannot be modified or deleted once submitted.
  • Changes to any files uploaded or selected as prompt responses will result in archiving failure and loss of your registration timestamp. If this registration has been archiving for more than 72 hours, email support@osf.io for assistance.
  • A moderator must review and approve your registration before it will be made public or embargoed.
  • Registrations are archived on Internet Archive and a link to the archived copy will be added to the registration metadata.
' immediateOption: 'Make registration public immediately' embargoOption: 'Enter registration into embargo' - createDoi: 'Create DOI' + submit: Submit back: Back datePlaceholder: 'Choose embargo end date' + revisedResponsesList: + noResponses: 'No responses updated' sharingIcons: label: 'Share this registration via {mediaType}' makeDecisionDropdown: @@ -1740,6 +1808,7 @@ osf-components: collapseSideNav: 'Collapse registration form navigation' registries-top-nav: showRegistrationNavigation: 'Show registration form navigation' + justification: 'Return to justification' metadata: 'Return to metadata' previousPage: 'Previous page' nextPage: 'Next page' From 431fa29da07792a5a04d00e23296dc5ed20b191c Mon Sep 17 00:00:00 2001 From: chth0n1x <82047646+chth0n1x@users.noreply.github.com> Date: Wed, 3 Nov 2021 11:08:47 -0400 Subject: [PATCH 23/32] Reverting file to original revisionState --- .../addon/components/make-decision-dropdown/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/registries/addon/components/make-decision-dropdown/component.ts b/lib/registries/addon/components/make-decision-dropdown/component.ts index 0893ab62899..7153cd471db 100644 --- a/lib/registries/addon/components/make-decision-dropdown/component.ts +++ b/lib/registries/addon/components/make-decision-dropdown/component.ts @@ -112,7 +112,7 @@ export default class MakeDecisionDropdown extends Component { this.args.registration.reviewsState as Exclude; let actions = reviewsState ? reviewsStateToDecisionMap[reviewsState] : []; if (this.revisionIsPending) { - actions = reviewsStateToDecisionMap[RegistrationReviewStates.Pending]; + actions = reviewsStateToDecisionMap[revisionState]; } return actions; } From ce4e77ac8d3873a03b35ed22741a029f3f29e3ce Mon Sep 17 00:00:00 2001 From: chth0n1x <82047646+chth0n1x@users.noreply.github.com> Date: Wed, 3 Nov 2021 11:10:20 -0400 Subject: [PATCH 24/32] Reverting revisionState variable --- .../addon/components/make-decision-dropdown/component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/registries/addon/components/make-decision-dropdown/component.ts b/lib/registries/addon/components/make-decision-dropdown/component.ts index 7153cd471db..607a94a1ce0 100644 --- a/lib/registries/addon/components/make-decision-dropdown/component.ts +++ b/lib/registries/addon/components/make-decision-dropdown/component.ts @@ -110,6 +110,7 @@ export default class MakeDecisionDropdown extends Component { get moderatorActions() { const reviewsState = this.args.registration.reviewsState as Exclude; + const revisionState = this.args.registration.revisionState as ActionableRevisionStates; let actions = reviewsState ? reviewsStateToDecisionMap[reviewsState] : []; if (this.revisionIsPending) { actions = reviewsStateToDecisionMap[revisionState]; From 51ae9677a0bf99f34f8b9f501eccb736691af6a3 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 3 Nov 2021 11:14:00 -0400 Subject: [PATCH 25/32] fixed translation strings for revision state, fixed mirage scenarios for testing. --- .../addon/components/node-card/template.hbs | 9 ++++----- mirage/scenarios/registrations.ts | 9 +++++---- translations/en-us.yml | 6 +++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 35262fbd1ab..7ee662de7f2 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -36,15 +36,14 @@ {{/if}} {{#if @node.revisionState.id}} - {{t 'node_card.registration.statuses.revision_in_progress'}} | {{else if (eq @node.revisionState 'unapproved')}} - {{t 'node_card.registration.statuses.revision_pending_admin_approval'}} | + {{t 'node_card.registration.statuses.revision_unapproved'}} | {{else if (eq @node.revisionState 'in_progress')}} - {{t 'node_card.registration.statuses.revision_pending_moderation'}} | + {{t 'node_card.registration.statuses.revision_in_progress'}} | {{else if (eq @node.revisionState 'pending_moderation')}} - {{t 'node_card.registration.statuses.revision_pending_admin_approval'}} | - {{else if (eq @node.revisionState 'approved')}} {{t 'node_card.registration.statuses.revision_pending_moderation'}} | + {{else if (eq @node.revisionState 'approved')}} + {{t 'node_card.registration.statuses.revision_approved'}} | {{/if}} {{node-card/node-icon category=@node.category}} diff --git a/mirage/scenarios/registrations.ts b/mirage/scenarios/registrations.ts index 90f5514bdba..175e39e8ed2 100644 --- a/mirage/scenarios/registrations.ts +++ b/mirage/scenarios/registrations.ts @@ -67,10 +67,11 @@ export function registrationScenario( }); server.create('schema-response', { - id: 'copyEdit', + id: 'copyEditWritr1', revisionJustification: 'Copy Edit', + reviewsState: RevisionReviewStates.Approved, revisionResponses: { - q1: 'Good Morning', + q1: 'Hello', q2: ['List of greetings'], }, initiatedBy: currentUser, @@ -157,7 +158,7 @@ export function registrationScenario( }, 'withContributors', 'withReviewActions'); server.create('schema-response', { - id: 'copyEdit', + id: 'copyEditSilicon', revisionJustification: 'Copy Edit', revisionResponses: { q1: 'Good Morning', @@ -187,7 +188,7 @@ export function registrationScenario( }, 'withContributors', 'withReviewActions'); server.create('schema-response', { - id: 'copyEdit', + id: 'copyEditTungsten', revisionJustification: 'Copy Edit', revisionResponses: { q1: 'Good Morning', diff --git a/translations/en-us.yml b/translations/en-us.yml index 933bba5f7f1..f754bba1c5c 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -579,7 +579,11 @@ node_card: private_tooltip: 'This registration is private' timestamp_label: 'Registered:' statuses: - pending_registration_approval: 'Pending registration' + pending_registration_approval: 'Pending registration approval' + revision_pending_moderation: 'Pending moderation' + revision_in_progress: 'Revision in progress' + revision_unapproved: 'Revision unapproved' + revision_approved: 'Latest Update' pending_embargo_approval: 'Pending embargo' pending: 'Pending moderation' embargo: Embargoed From dc2797d8db859b25ed1f1e418e81298c66434c5c Mon Sep 17 00:00:00 2001 From: chth0n1x <82047646+chth0n1x@users.noreply.github.com> Date: Wed, 3 Nov 2021 12:54:44 -0400 Subject: [PATCH 26/32] Update lib/osf-components/addon/components/node-card/template.hbs Updating logic for if user should be able to create an update with on click mouse event. Co-authored-by: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> --- .../addon/components/node-card/template.hbs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 7ee662de7f2..70e7b1b69f6 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -195,8 +195,13 @@ {{#if this.shouldShowUpdateButton}} - {{#unless (not-eq this.node.reviewsState 'accepted')}} - {{#if this.latestSchemaResponse}} +
From 6d0ad809ff1e0ec2c53fe9520336d700c8c1d8ec Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 3 Nov 2021 14:53:47 -0400 Subject: [PATCH 28/32] readding deleted import from make-decision-dropdown. --- .../addon/components/make-decision-dropdown/component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/registries/addon/components/make-decision-dropdown/component.ts b/lib/registries/addon/components/make-decision-dropdown/component.ts index 607a94a1ce0..7b216f9d6ed 100644 --- a/lib/registries/addon/components/make-decision-dropdown/component.ts +++ b/lib/registries/addon/components/make-decision-dropdown/component.ts @@ -15,6 +15,7 @@ import RegistrationModel, RegistrationReviewStates, reviewsStateToDecisionMap, NonActionableRegistrationStates, + ActionableRevisionStates, } from 'ember-osf-web/models/registration'; import { ReviewActionTrigger } from 'ember-osf-web/models/review-action'; import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception'; From 7e1b1a8a56594dfad9b5f08c92869547e9023e29 Mon Sep 17 00:00:00 2001 From: Ashley Robinson Date: Wed, 10 Nov 2021 12:37:46 -0500 Subject: [PATCH 29/32] linting with unless. --- .../addon/components/node-card/component.ts | 2 +- .../addon/components/node-card/template.hbs | 26 +++++++------------ mirage/scenarios/registrations.ts | 4 +-- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index 9632f9e1f43..3f8dd6e20fa 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -44,7 +44,7 @@ export default class NodeCard extends Component { // Private properties searchUrl = pathJoin(baseURL, 'search'); @tracked - latestSchemaResponse?: SchemaResponseModel; + latestSchemaResponse!: SchemaResponseModel; @computed('readOnly', 'node', 'node.{nodeType,userHasWritePermission}') get showDropdown() { diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index 58e131868d8..348f03f0c7b 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -34,7 +34,7 @@ {{#if @node.archiving}} {{t 'node_card.registration.statuses.archiving'}} | {{/if}} - + {{#if @node.revisionState.id}} {{else if (eq @node.revisionState 'unapproved')}} {{t 'node_card.registration.statuses.revision_unapproved'}} | @@ -47,16 +47,13 @@ {{/if}} {{node-card/node-icon category=@node.category}} - - {{@node.title}} - - + {{@node.title}} {{else}} @@ -100,7 +97,6 @@ {{/if}} {{/if}} -
{{#if @node}}
@@ -168,26 +164,22 @@
- {{#if this.shouldShowUpdateButton}} -
-
-
-
+
+ + + + {{#if this.latestSchemaResponse}} + {{#if this.shouldShowViewChangesButton}} - {{#if this.shouldShowUpdateButton}} - {{#unless (not-eq this.node.reviewsState 'accepted')}} - {{#if this.latestSchemaResponse}} - - - - - {{/if}} - {{/unless}} - {{/if}} -
-
+ {{/if}} + {{/if}} + {{#if this.shouldShowUpdateButton}} + + {{/if}}
{{else}} @@ -203,4 +202,11 @@ {{/if}}
-
\ No newline at end of file +
+{{#if @node.isRegistration}} + +{{/if}} \ No newline at end of file diff --git a/translations/en-us.yml b/translations/en-us.yml index e150a35eece..7cd1c6bd89d 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -602,6 +602,7 @@ node_card: options: Options view_button: 'View' update_button: 'Update' + view_changes_button: 'View changes' schema_response_error: 'Updates irretreivable.' forks: @@ -1594,7 +1595,7 @@ registries: modalBodyFirst: 'Updates to registration responses can be updated by clicking “Next”.
Edits to metadata including Description, Category, License, Publication DOI, and Tags are done on the registration by clicking the ' modalBodySecond: ' icon.' modalBodyNoUpdates: 'The {registryName} does not allow updates for this registration template.
Contact their registy if you have any questions.' - learnMore: 'Read NEEDS LINK to learn more' + learnMore: 'Click here to learn more' next: Next meetings: index: From 3befd8a055feb68c7e6d32e35b1d43a8a20c1f47 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Thu, 11 Nov 2021 11:36:35 -0500 Subject: [PATCH 31/32] remove extra --- .../addon/components/node-card/component.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/component.ts b/lib/osf-components/addon/components/node-card/component.ts index 916bd7e3245..c6fdd116a95 100644 --- a/lib/osf-components/addon/components/node-card/component.ts +++ b/lib/osf-components/addon/components/node-card/component.ts @@ -78,16 +78,6 @@ export default class NodeCard extends Component { } } - // @task - // @waitFor - // async createNewSchemaResponse() { - // const newRevision: SchemaResponseModel = this.store.createRecord('schema-response', { - // registration: this.node, - // }); - // await newRevision.save(); - // this.router.transitionTo('registries.edit-revision', newRevision.id); - // } - get shouldShowViewChangesButton() { if (this.node instanceof RegistrationModel) { return this.node.revisionState === RevisionReviewStates.RevisionInProgress || From f4f10c7045ebc40d77d9cbf7e68f605e1d27f510 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Thu, 11 Nov 2021 11:56:30 -0500 Subject: [PATCH 32/32] fix tests --- lib/osf-components/addon/components/node-card/template.hbs | 3 ++- .../addon/components/registries/page-renderer/component.ts | 4 ++-- tests/integration/components/node-card/component-test.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/osf-components/addon/components/node-card/template.hbs b/lib/osf-components/addon/components/node-card/template.hbs index fc2261ca3d3..2f05c80fb61 100644 --- a/lib/osf-components/addon/components/node-card/template.hbs +++ b/lib/osf-components/addon/components/node-card/template.hbs @@ -176,7 +176,7 @@ {{#if this.shouldShowViewChangesButton}} @@ -190,6 +190,7 @@ {{/if}} {{#if this.shouldShowUpdateButton}}