Skip to content
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

[ENG-6848] Fix folder icon #2462

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/addon-operation-invocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export enum InvocationStatus {
export enum ItemType {
Folder = 'FOLDER',
File = 'FILE',
Collection = 'COLLECTION',
Document = 'DOCUMENT',
}

export type OperationResult = ListItemsResult | Item;
Expand Down
2 changes: 0 additions & 2 deletions app/models/authorized-citation-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions app/models/configured-citation-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -21,9 +25,27 @@ export default class ConfiguredAddonEdit extends Component<Args> {
@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 !(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,21 @@
{{on 'click' (fn fileManager.goToFolder folder)}}
>
<span local-class='item-name'>
<FaIcon @icon='folder' />
{{#if (or (eq folder.itemType 'FOLDER') (eq folder.itemType 'COLLECTION'))}}
<FaIcon @icon='folder' />
{{else}}
<FaIcon @icon='file' />
{{/if}}
{{folder.itemName}}
</span>
</Button>
{{else}}
<span local-class='item-name'>
<FaIcon @icon='folder' />
{{#if (or (eq folder.itemType 'FOLDER') (eq folder.itemType 'COLLECTION'))}}
<FaIcon @icon='folder' />
{{else}}
<FaIcon @icon='file' />
{{/if}}
{{folder.itemName}}
</span>
{{/if}}
Expand Down
Loading