• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CenterForOpenScience / ember-osf-web / 16687036594

01 Aug 2025 11:18PM UTC coverage: 67.218% (+0.009%) from 67.209%
16687036594

push

github

web-flow
Feature/pbs 25 12 (#2607)

* Added fix to break a race-condition error

* Refactor to use the abstracted method

* [eng-8159] Allow collections without metadata to be submitted

* Added a new banner for all OSF preprints

* Updates for the PR

* Added an enabled true/false to prevent a race condition

* Removed the unnecessary @enabled pass through variable

* Forgot to save the template

* Updates to fix the viewOnlyToken in cases there is a / or %2fF at the end (#2603)

[ENG-8174] Extra Characters (%2F) in View-Only Files Tab URL Prevent Page from Loading

* [eng-8492] Update to detach the metrics call to preprint metric failures from preventing the preprint detail page from loading (#2604)

* Update to detach the metrics call to preprint metric failures from preventing the preprint detail page from loading

* This is much better

* Removed unneeded file

* apiMetrics -> apiMeta (#2605)

* fix again (#2606)

---------

Co-authored-by: Brian Pilati <brianpilati@cos.io>
Co-authored-by: Lord Business <113387478+bp-cos@users.noreply.github.com>

3279 of 5350 branches covered (61.29%)

Branch coverage included in aggregate %.

19 of 26 new or added lines in 7 files covered. (73.08%)

3 existing lines in 2 files now uncovered.

8552 of 12251 relevant lines covered (69.81%)

184.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/preprints/-components/submit/supplements/component.ts
1
import Component from '@glimmer/component';
2
import PreprintStateMachine from 'ember-osf-web/preprints/-components/submit/preprint-state-machine/component';
3
import { action } from '@ember/object';
4
import { tracked } from '@glimmer/tracking';
5
import { task } from 'ember-concurrency';
6
import { waitFor } from '@ember/test-waiters';
7
import { taskFor } from 'ember-concurrency-ts';
8
import NodeModel from 'ember-osf-web/models/node';
9
import Toast from 'ember-toastr/services/toast';
10
import { inject as service } from '@ember/service';
11
import Intl from 'ember-intl/services/intl';
12

13
/**
14
 * The Supplements Args
15
 */
16
interface SupplementsArgs {
17
    manager: PreprintStateMachine;
18
}
19

20
/**
21
 * The Supplements Component
22
 */
23
export default class Supplements extends Component<SupplementsArgs>{
24
    @service toast!: Toast;
25
    @service intl!: Intl;
26
    @tracked displayExistingNodeWidget = false;
×
27
    @tracked isSupplementAttached = false;
×
28
    @tracked isModalOpen = false;
×
29

30
    constructor(owner: unknown, args: SupplementsArgs) {
31
        super(owner, args);
×
32

33
        if(this.args.manager.preprint.get('node')?.get('id')) {
×
34
            this.isSupplementAttached = true;
×
35
        }
36

37
        this.args.manager.validateSupplements(true);
×
38
    }
39

40
    public get isDisplayCancelButton(): boolean {
41
        return this.displayExistingNodeWidget;
×
42
    }
43

44
    @action
45
    public onCancelProjectAction(): void {
46
        this.displayExistingNodeWidget = false;
×
47
        this.isModalOpen = false;
×
48
    }
49

50
    @action
51
    public onConnectOsfProject(): void {
52
        this.displayExistingNodeWidget = true;
×
53
    }
54

55
    @action
56
    public onCreateOsfProject(): void {
57
        this.displayExistingNodeWidget = false;
×
58
        this.isModalOpen = true;
×
59
    }
60

61
    @task
62
    @waitFor
63
    private async saveSelectedProject(): Promise<void> {
64
        await this.args.manager.preprint.save();
×
65
        this.validate();
×
66
    }
67

68
    @task
69
    @waitFor
70
    public async removeSelectedProject(): Promise<void> {
71
        try {
×
NEW
72
            this.validate(false);
×
UNCOV
73
            await this.args.manager.preprint.removeM2MRelationship('node'); // Remove relationship
×
74
            // Remove relationship on the node side, this only clears the cache locally
75
            this.args.manager.preprint.node.get('preprints')
×
76
                .removeObject(this.args.manager.preprint);
77
            this.isSupplementAttached = false;
×
78
            this.validate();
×
79
        } catch (error) {
80
            this.toast.error(this.intl.t('preprints.submit.step-supplements.failed-removal'));
×
81
        }
82
    }
83

84
    @action
85
    public projectSelected(node: NodeModel): void {
86
        this.args.manager.preprint.set('node', node);
×
87
        taskFor(this.saveSelectedProject).perform();
×
88
        this.isSupplementAttached = true;
×
89
        this.onCancelProjectAction();
×
90
    }
91

92
    @action
93
    public validate(isValid = true): void {
×
NEW
94
        this.args.manager.validateSupplements(isValid);
×
95
    }
96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc