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

CenterForOpenScience / ember-osf-web / 16118219201

07 Jul 2025 01:24PM UTC coverage: 67.207% (-0.2%) from 67.382%
16118219201

Pull #2595

github

web-flow
Merge 0da7bb715 into 186fd8065
Pull Request #2595: [ENG-6835] [ENG-8060] [ENG-8289] VRL Project PR - FE

3275 of 5343 branches covered (61.3%)

Branch coverage included in aggregate %.

40 of 112 new or added lines in 16 files covered. (35.71%)

3 existing lines in 1 file now uncovered.

8536 of 12231 relevant lines covered (69.79%)

184.39 hits per line

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

0.0
/app/models/configured-citation-addon.ts
1
import { AsyncBelongsTo, belongsTo } from '@ember-data/model';
2

3
import ResourceReferenceModel from 'ember-osf-web/models/resource-reference';
4
import { task } from 'ember-concurrency';
5
import { waitFor } from '@ember/test-waiters';
6
import {
7
    ConnectedCitationOperationNames, Item, OperationKwargs,
8
} from 'ember-osf-web/models/addon-operation-invocation';
9
import { taskFor } from 'ember-concurrency-ts';
10
import AuthorizedCitationAccountModel from './authorized-citation-account';
11
import ExternalCitationServiceModel from './external-citation-service';
12
import ConfiguredAddonModel from './configured-addon';
13

14
export default class ConfiguredCitationAddonModel extends ConfiguredAddonModel {
15
    @belongsTo('external-citation-service', { inverse: null })
16
    externalCitationService!: AsyncBelongsTo<ExternalCitationServiceModel> & ExternalCitationServiceModel;
17

18
    @belongsTo('authorized-citation-account')
19
    baseAccount!: AsyncBelongsTo<AuthorizedCitationAccountModel> & AuthorizedCitationAccountModel;
20

21
    @belongsTo('resource-reference', { inverse: 'configuredCitationAddons' })
22
    authorizedResource!: AsyncBelongsTo<ResourceReferenceModel> & ResourceReferenceModel;
23

24
    get externalServiceId() {
25
        return (this as ConfiguredCitationAddonModel).belongsTo('externalCitationService').id();
×
26
    }
27

28
    @task
29
    @waitFor
30
    async getFolderItems(this: ConfiguredAddonModel, kwargs?: OperationKwargs) {
31
        const operationKwargs = kwargs || {};
×
32
        const operationName = operationKwargs.itemId ? ConnectedCitationOperationNames.ListCollectionItems :
×
33
            ConnectedCitationOperationNames.ListRootCollections;
34
        // rename 'itemId' key to 'collectionId'
35
        delete Object.assign(operationKwargs, { ['collectionId']: operationKwargs['itemId'] })['itemId'];
×
36
        const newInvocation = this.store.createRecord('addon-operation-invocation', {
×
37
            operationName,
38
            operationKwargs,
39
            thruAddon: this,
40
        });
41
        return await newInvocation.save();
×
42
    }
43

44
    @task
45
    @waitFor
46
    async getItemInfo(this: ConfiguredAddonModel, itemId: string) {
47
        const newInvocation = this.store.createRecord('addon-operation-invocation', {
×
48
            operationName: ConnectedCitationOperationNames.GetItemInfo,
49
            operationKwargs: { itemId },
50
            thruAddon: this,
51
        });
52
        return await newInvocation.save();
×
53
    }
54

55
    @task
56
    @waitFor
57
    async getSelectedItemName(this: ConfiguredCitationAddonModel) {
NEW
58
        const response = await taskFor(this.getItemInfo).perform(this.rootFolder);
×
NEW
59
        this.rootFolderName = (response.operationResult as Item).itemName;
×
60
    }
61
}
62

63
declare module 'ember-data/types/registries/model' {
64
    export default interface ModelRegistry {
65
        'configured-citation-addon': ConfiguredCitationAddonModel;
66
    } // eslint-disable-line semi
67
}
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