diff --git a/app/models/addon-operation-invocation.ts b/app/models/addon-operation-invocation.ts index da157eb6ff..19eaef0173 100644 --- a/app/models/addon-operation-invocation.ts +++ b/app/models/addon-operation-invocation.ts @@ -32,6 +32,8 @@ export enum InvocationStatus { export enum ItemType { Folder = 'FOLDER', File = 'FILE', + Collection = 'COLLECTION', + Document = 'DOCUMENT', } export type OperationResult = ListItemsResult | Item; diff --git a/app/models/authorized-citation-account.ts b/app/models/authorized-citation-account.ts index 697879b152..2a464d57b2 100644 --- a/app/models/authorized-citation-account.ts +++ b/app/models/authorized-citation-account.ts @@ -23,8 +23,6 @@ export default class AuthorizedCitationAccountModel extends AuthorizedAccountMod ConnectedCitationOperationNames.ListRootCollections; // rename 'itemId' key to 'collectionId' delete Object.assign(operationKwargs, { ['collectionId']: operationKwargs['itemId'] })['itemId']; - // gravyvalet doesn't like 'itemType' as a parameter - delete operationKwargs.itemType; const newInvocation = this.store.createRecord('addon-operation-invocation', { operationName, operationKwargs, diff --git a/app/models/configured-citation-addon.ts b/app/models/configured-citation-addon.ts index 0a33d424ac..25764947aa 100644 --- a/app/models/configured-citation-addon.ts +++ b/app/models/configured-citation-addon.ts @@ -30,8 +30,6 @@ export default class ConfiguredCitationAddonModel extends ConfiguredAddonModel { ConnectedCitationOperationNames.ListRootCollections; // rename 'itemId' key to 'collectionId' delete Object.assign(operationKwargs, { ['collectionId']: operationKwargs['itemId'] })['itemId']; - // gravyvalet doesn't like 'itemType' as a parameter - delete operationKwargs.itemType; const newInvocation = this.store.createRecord('addon-operation-invocation', { operationName, operationKwargs, diff --git a/lib/osf-components/addon/components/addons-service/configured-addon-edit/component.ts b/lib/osf-components/addon/components/addons-service/configured-addon-edit/component.ts index a05043e0ee..fd6d7d15b9 100644 --- a/lib/osf-components/addon/components/addons-service/configured-addon-edit/component.ts +++ b/lib/osf-components/addon/components/addons-service/configured-addon-edit/component.ts @@ -5,9 +5,13 @@ import { TaskInstance } from 'ember-concurrency'; import { Item, ItemType } from 'ember-osf-web/models/addon-operation-invocation'; import AuthorizedAccountModel from 'ember-osf-web/models/authorized-account'; +import AuthorizedCitationAccountModel from 'ember-osf-web/models/authorized-citation-account'; import AuthorizedComputingAccountModel from 'ember-osf-web/models/authorized-computing-account'; +import AuthorizedStorageAccountModel from 'ember-osf-web/models/authorized-storage-account'; import ConfiguredAddonModel from 'ember-osf-web/models/configured-addon'; +import ConfiguredCitationAddonModel from 'ember-osf-web/models/configured-citation-addon'; import ConfiguredComputingAddonModel from 'ember-osf-web/models/configured-computing-addon'; +import ConfiguredStorageAddonModel from 'ember-osf-web/models/configured-storage-addon'; interface Args { @@ -21,9 +25,27 @@ export default class ConfiguredAddonEdit extends Component { @tracked selectedFolder = this.args.configuredAddon?.rootFolder; @tracked currentItems: Item[] = []; - defaultKwargs = { - itemType: ItemType.Folder, - }; + defaultKwargs: any = {}; + + constructor(owner: unknown, args: Args) { + super(owner, args); + if (this.args.configuredAddon) { + if (this.args.configuredAddon instanceof ConfiguredStorageAddonModel) { + this.defaultKwargs['itemType'] = ItemType.Folder; + } + if (this.args.configuredAddon instanceof ConfiguredCitationAddonModel) { + this.defaultKwargs['filterItems'] = ItemType.Collection; + } + } + if (this.args.authorizedAccount) { + if (this.args.authorizedAccount instanceof AuthorizedStorageAccountModel) { + this.defaultKwargs['itemType'] = ItemType.Folder; + } + if (this.args.authorizedAccount instanceof AuthorizedCitationAccountModel) { + this.defaultKwargs['filterItems'] = ItemType.Collection; + } + } + } get hasRootFolder() { return !( diff --git a/lib/osf-components/addon/components/addons-service/configured-addon-edit/template.hbs b/lib/osf-components/addon/components/addons-service/configured-addon-edit/template.hbs index 15313e433a..9ac7898a54 100644 --- a/lib/osf-components/addon/components/addons-service/configured-addon-edit/template.hbs +++ b/lib/osf-components/addon/components/addons-service/configured-addon-edit/template.hbs @@ -80,13 +80,21 @@ {{on 'click' (fn fileManager.goToFolder folder)}} > - + {{#if (or (eq folder.itemType 'FOLDER') (eq folder.itemType 'COLLECTION'))}} + + {{else}} + + {{/if}} {{folder.itemName}} {{else}} - + {{#if (or (eq folder.itemType 'FOLDER') (eq folder.itemType 'COLLECTION'))}} + + {{else}} + + {{/if}} {{folder.itemName}} {{/if}}