-
Notifications
You must be signed in to change notification settings - Fork 59
[ENG-7876] Feature/file picker select root #2556
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
Merged
adlius
merged 14 commits into
CenterForOpenScience:feature/pbs-25-10
from
bp-cos:feature/file-picker-select-root
May 29, 2025
Merged
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
693f0cf
Added the files
bp-cos 61953bf
Removed tokens
bp-cos 31c050b
Updates to display the selected root folder
bp-cos 524cb91
Added GFP to the files page
bp-cos a112740
Updates to add the root folder
bp-cos ad68862
Added the manager to reload the wb once a new file or folder is selected
bp-cos 4ae8f50
Enabled the disabled button featuree again
bp-cos b06f2bc
Fixed a test
bp-cos eb5790d
Updates to the flow for a token from the BE
bp-cos 568219d
Added the final touches and removed pruned instructions
bp-cos 6f9dafe
Updates for the PR
bp-cos 99dd98d
Updates to move all the google file picker code into the component
bp-cos ca2e0b7
Cleaned up comments and models
bp-cos 75f9928
Update for PR request
bp-cos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -62,3 +62,8 @@ | |
.item-name { | ||
white-space: normal; | ||
} | ||
|
||
.picker-style { | ||
white-space: pre-wrap; | ||
|
||
} |
This file contains hidden or 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 hidden or 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
49 changes: 48 additions & 1 deletion
49
lib/osf-components/addon/components/file-browser/add-new/component.ts
This file contains hidden or 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 |
---|---|---|
@@ -1,14 +1,61 @@ | ||
// import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
import { waitFor } from '@ember/test-waiters'; | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
import { task } from 'ember-concurrency'; | ||
import { taskFor } from 'ember-concurrency-ts'; | ||
import ConfiguredStorageAddonModel from 'ember-osf-web/models/configured-storage-addon'; | ||
import GoogleFilePickerWidget from 'osf-components/components/google-file-picker-widget/component'; | ||
import StorageManager from 'osf-components/components/storage-provider-manager/storage-manager/component'; | ||
|
||
interface Args { | ||
manager: StorageManager; | ||
configuredStorageAddon: ConfiguredStorageAddonModel; | ||
} | ||
|
||
export default class FileBrowser extends Component<Args> { | ||
@tracked createFolderModalOpen = false; | ||
@tracked googlePickerComponent: GoogleFilePickerWidget | null = null; | ||
@tracked dropzoneClickableElementId = ''; | ||
@tracked isWBGoogleDrive = false; | ||
@tracked googleFilePickerRootFolder!: string; | ||
@tracked accountId!: string; | ||
|
||
constructor(owner: unknown, args: Args) { | ||
super(owner, args); | ||
|
||
taskFor(this.loadExternalStorageService).perform(); | ||
} | ||
|
||
/** | ||
* This is called only to authorize because the current implementation will throw an | ||
* error because the "root folder" is not yet set. | ||
*/ | ||
@task | ||
@waitFor | ||
async loadExternalStorageService() { | ||
this.googleFilePickerRootFolder = this.args.configuredStorageAddon?.rootFolder; | ||
const baseAccount = await this.args.configuredStorageAddon?.baseAccount; | ||
this.accountId = baseAccount?.id; | ||
const external = await this.args.configuredStorageAddon?.externalStorageService; | ||
this.isWBGoogleDrive = external?.wbKey === 'googledrive'; | ||
} | ||
|
||
get isGoogleDrive(): boolean { | ||
return this.isWBGoogleDrive; | ||
} | ||
|
||
@action | ||
registerChild(child: GoogleFilePickerWidget) { | ||
this.googlePickerComponent = child; // Store the child's instance | ||
} | ||
|
||
@action | ||
openGoogleFilePicker(dropdown: any) { | ||
dropdown.close(); | ||
if (this.googlePickerComponent) { | ||
this.googlePickerComponent.openPicker(); | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add this to the base model. We should put it back on the
AuthorizedStorageAccount
model.