Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { layout } from 'ember-osf-web/decorators/component';
import styles from './styles';
import template from './template';


@tagName('')
@layout(template, styles)
export default class RegistriesSideNav extends Component {
Expand Down
30 changes: 24 additions & 6 deletions lib/registries/addon/edit-revision/controller.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import Controller from '@ember/controller';
import { assert } from '@ember/debug';
import { alias, not } from '@ember/object/computed';
import RouterService from '@ember/routing/router-service';
import { inject as service } from '@ember/service';
import BrandModel from 'ember-osf-web/models/brand';
import { waitFor } from '@ember/test-waiters';
import { task } from 'ember-concurrency';
import IntlService from 'ember-intl/services/intl';
import RegistrationModel from 'ember-osf-web/models/registration';
import RegistrationProviderModel from 'ember-osf-web/models/registration-provider';
import SchemaResponseModel from 'ember-osf-web/models/schema-response';
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception';
import Media from 'ember-responsive';

export default class EditRevisionController extends Controller {
@service media!: Media;
@service router!: RouterService;
@service intl!: IntlService;
@service toast!: Toastr;

@not('media.isDesktop') showMobileView!: boolean;

@alias('model.revision') revision?: SchemaResponseModel;
@alias('model.registration') registration?: RegistrationModel;
@alias('model.provider') provider?: RegistrationProviderModel;
@alias('model.provider.brand') brand?: BrandModel;
@alias('model.revisionManager.revision') revision?: SchemaResponseModel;
@alias('model.revisionManager.registration') registration?: RegistrationModel;

@task
@waitFor
async deleteRevision() {
assert('this.revision is required to delete a revision', this.revision);
assert('this.registration is required to redirect after deleting a revision', this.registration);
try {
await this.revision.destroyRecord();
this.router.transitionTo('registries.overview.index', this.registration.id);
} catch (e) {
const errorMessage = this.intl.t('move_to_project.could_not_create_project');
captureException(e, { errorMessage });
this.toast.error(getApiErrorMessage(e), errorMessage);
}
}
}
12 changes: 12 additions & 0 deletions lib/registries/addon/edit-revision/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@
@label='{{t 'registries.drafts.draft.review.page_label'}}'
@navMode={{leftNav.leftGutterMode}}
/>
<leftNav.link
@icon='trash-alt'
as |link|
>
<link.icon />
<DeleteButton
@delete={{perform this.deleteRevision}}
@modalTitle={{t 'registries.edit_revision.delete_modal.title'}}
@modalBody={{t 'registries.edit_revision.delete_modal.body'}}
@buttonLabel={{t 'registries.edit_revision.delete_modal.button'}}
/>
</leftNav.link>
</layout.leftNav>
<layout.main local-class='Main'>
{{outlet}}
Expand Down
13 changes: 10 additions & 3 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -579,20 +579,20 @@ node_card:
private_tooltip: 'This registration is private'
timestamp_label: 'Registered:'
statuses:
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_registration_approval: 'Pending registration approval'
pending_embargo_approval: 'Pending embargo'
pending: 'Pending moderation'
embargo: Embargoed
rejected: 'Rejected'
pending_embargo_termination: 'Pending embargo termination'
pending_withdraw_request: 'Pending withdrawal'
pending_withdraw: 'Pending withdrawal moderation'
withdrawn: Withdrawn
archiving: Archiving
withdrawn: 'Withdrawn'
archiving: 'Archiving'
tags: 'Tags:'
registration_template: 'Registration template:'
contributors: 'Contributors:'
Expand Down Expand Up @@ -1106,6 +1106,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}. <a href="https://help.osf.io/hc/en-us/categories/360001550953-Registrations">Click here</a> to learn more about other hosted registries.'
required: 'required'
Expand Down Expand Up @@ -1214,6 +1216,10 @@ registries:
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'
delete_modal:
title: 'Delete this update'
body: 'Are you sure to delete this update?'
button: 'Cancel update'


index:
Expand Down Expand Up @@ -1601,6 +1607,7 @@ registries:
modalBodyNoUpdates: 'The {registryName} does not allow updates for this registration template.<br>Contact their registy if you have any questions.'
learnMore: 'Click <a href="https://help.osf.io/hc/en-us/articles/360035806634-Edit-Registration-Metadata" target="_blank">here</a> to learn more'
next: Next
cancel_update: 'Cancel update'
meetings:
index:
meetings-list:
Expand Down