diff --git a/app/models/registration.ts b/app/models/registration.ts index 85580f6b952..364f515842e 100644 --- a/app/models/registration.ts +++ b/app/models/registration.ts @@ -109,6 +109,7 @@ export default class RegistrationModel extends NodeModel.extend(Validations) { // Write-only attributes @attr('array') includedNodeIds?: string[]; + @attr('boolean') createDoi?: boolean; @attr('fixstring') draftRegistrationId?: string; @belongsTo('node', { inverse: 'registrations' }) @@ -150,6 +151,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/lib/osf-components/addon/components/osf-layout/registries-side-nav/component.ts b/lib/osf-components/addon/components/osf-layout/registries-side-nav/component.ts index df41797a6f9..5c2b50796ba 100644 --- a/lib/osf-components/addon/components/osf-layout/registries-side-nav/component.ts +++ b/lib/osf-components/addon/components/osf-layout/registries-side-nav/component.ts @@ -4,19 +4,44 @@ import { action } from '@ember/object'; import { and, or } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Media from 'ember-responsive'; +import Toast from 'ember-toastr/services/toast'; +import SchemaResponseModel, { RevisionReviewStates } from 'ember-osf-web/models/schema-response'; +import Intl from 'ember-intl/services/intl'; +import RouterService from '@ember/routing/router-service'; +import { tracked } from '@glimmer/tracking'; +import NodeModel from 'ember-osf-web/models/node'; +import RegistrationModel from 'ember-osf-web/models/registration'; import { layout } from 'ember-osf-web/decorators/component'; import styles from './styles'; import template from './template'; +// interface Args { +// registration: RegistrationModel; +// selectedRevisionId: string; +// } + @tagName('') @layout(template, styles) -export default class RegistriesSideNav extends Component { +export default class RegistriesSideNav extends Component { // { @service media!: Media; + @service toast!: Toast; + @service intl!: Intl; + @service router!: RouterService; + + @tracked selectedSchema!: SchemaResponseModel; + @tracked registration!: RegistrationModel; + @tracked node!: NodeModel; + + toDelete: SchemaResponseModel | null = null; + deleteEdit = false; + + reloadList?: (page?: number) => void; // bound by paginated-list // Optional params onLinkClicked?: () => void; + // latestSchemaResponseId = this.selectedSchema.id; // Private properties shouldCollapse = false; @@ -31,4 +56,24 @@ export default class RegistriesSideNav extends Component { toggle() { this.toggleProperty('shouldCollapse'); } + + @action + delete() { + this.set('deleteEdit', false); + const edit = this.toDelete; + if (!edit) { + return; + } + this.set('toDelete', null); + // edit.deleteRecord(); + edit.destroyRecord(); + this.router.transitionTo( + 'registries.overview.index', + this.selectedSchema.get('id'), + { queryParams: { state: RevisionReviewStates.RevisionInProgress } }, + // this.latestSchemaResponseId); + ); + this.registration.reload(); + + } } diff --git a/lib/osf-components/addon/components/osf-layout/registries-side-nav/template.hbs b/lib/osf-components/addon/components/osf-layout/registries-side-nav/template.hbs index 3c41565cec5..5c557710095 100644 --- a/lib/osf-components/addon/components/osf-layout/registries-side-nav/template.hbs +++ b/lib/osf-components/addon/components/osf-layout/registries-side-nav/template.hbs @@ -38,4 +38,15 @@ {{/let}} {{/if}} + + {{t 'registries.newUpdateModal.cancel_update'}} + diff --git a/translations/en-us.yml b/translations/en-us.yml index f2daf2c2057..df5c4779d18 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -591,8 +591,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:' @@ -1106,6 +1109,8 @@ registries: uploadSuccess: 'Successfully uploaded csv file.' overview: title: 'Moderated Overview' + delete_update: 'Delete update' + confirm_delete: 'Please confirm deletion of update.' new: provider_info: 'You are submitting to {provider}. Click here to learn more about other hosted registries.' required: 'required' @@ -1601,6 +1606,8 @@ registries: modalBodyNoUpdates: 'The {registryName} does not allow updates for this registration template.
Contact their registy if you have any questions.' learnMore: 'Click here to learn more' next: Next + cancel_update: 'Cancel update' + meetings: index: meetings-list: