-
Notifications
You must be signed in to change notification settings - Fork 63
[ENG-2841] Delete Revision In Progress Button #1341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5e3f4e9
cfd3b1a
f3d17d2
e8badd9
73be960
43993ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also doesn't do anything.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I had removed that for another PR as well. It is now removed here too. |
||
| } | ||
|
|
||
| declare module 'ember-data/types/registries/model' { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 { // <Args> { | ||
| @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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What list are we reloading?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic is not complete but was in place for if a list of revision ids were needed, the logic would reload the list and pull the last object of the schema id from the list after the deletion and redirect to its overview page. |
||
|
|
||
| // 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(); | ||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was from the most recent merge commit 5e3f4e9 to resolve conflicts. I believe I was asked to keep it, but should it be removed?