-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
lib/osf-components/addon/components/file-actions-menu/submit-to-boa-modal/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { inject as service } from '@ember/service'; | ||
import { waitFor } from '@ember/test-waiters'; | ||
import Component from '@glimmer/component'; | ||
import { task } from 'ember-concurrency'; | ||
import { taskFor } from 'ember-concurrency-ts'; | ||
import IntlService from 'ember-intl/services/intl'; | ||
import File from 'ember-osf-web/packages/files/file'; | ||
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception'; | ||
|
||
interface Args { | ||
file: File; | ||
closeModal: () => {}; | ||
onSubmitToBoa: () => {}; | ||
} | ||
|
||
export default class SubmitToBoaModal extends Component<Args> { | ||
@service toast!: Toastr; | ||
@service intl!: IntlService; | ||
|
||
@task | ||
@waitFor | ||
async confirmSubmitToBoa() { | ||
try { | ||
await taskFor(this.args.file.submitToBoa).perform(); | ||
this.args.closeModal(); | ||
this.args.onSubmitToBoa(); | ||
} catch (e) { | ||
captureException(e); | ||
this.toast.error(getApiErrorMessage(e), | ||
this.intl.t('osf-components.file-browser.submit_to_boa_fail', { fileName: this.args.file.name })); | ||
} | ||
} | ||
} |
Empty file.
22 changes: 22 additions & 0 deletions
22
lib/osf-components/addon/components/file-actions-menu/submit-to-boa-modal/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<OsfDialog @isOpen={{@isOpen}} @onClose={{@closeModal}} as |dialog|> | ||
<dialog.heading> | ||
{{t 'osf-components.file-browser.submit_to_boa'}} | ||
</dialog.heading> | ||
<dialog.main> | ||
{{t 'osf-components.file-browser.confirm_submit_to_boa' fileName=@file.name}} | ||
</dialog.main> | ||
<dialog.footer> | ||
<Button | ||
{{on 'click' (fn (mut @isOpen) false)}} | ||
> | ||
{{t 'general.cancel'}} | ||
</Button> | ||
<Button | ||
@type='destroy' | ||
disabled={{this.confirmSubmitToBoa.isRunning}} | ||
{{on 'click' (perform this.confirmSubmitToBoa)}} | ||
> | ||
{{t 'osf-components.file-browser.confirm_submit_to_boa_yes'}} | ||
</Button> | ||
</dialog.footer> | ||
</OsfDialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters