Sentiaus opened a new pull request, #5251:
URL: https://github.com/apache/texera/pull/5251
<!--
Thanks for sending a pull request (PR)! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
[Contributing to
Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md)
2. Ensure you have added or run the appropriate tests for your PR
3. If the PR is work in progress, mark it a draft on GitHub.
4. Please write your PR title to summarize what this PR proposes, we
are following Conventional Commits style for PR titles as well.
5. Be sure to keep the PR description updated to reflect all changes.
-->
### What changes were proposed in this PR?
Adds the frontend service layer for Google Drive integration. No UI surfaces
are changed in this PR — those are in the follow-up.
**`DriveService` (`drive.service.ts`):** New injectable service with four
responsibilities:
- `getToken()` — calls `GET /api/auth/google/drive/token` and returns the
connection status and short-lived access token
- `connect(reauth?)` — opens a popup to the `/connect` URL; emits on
`onConnected()` when the OAuth flow completes
- `onConnected()` — observable that fires when the popup posts a
`gdrive-connected` window message
- `exportToDrive(blob, fileName)` — opens the Google Picker folder selector,
then uploads the blob to the chosen folder via the Drive multipart upload API
**`GoogleDriveConnectComponent`:** OAuth callback landing page at
`/gdrive-connect`. Receives the authorization code from Google's redirect,
posts a `gdrive-connected` message to the opener window, and closes itself.
**Routing:** Adds `/gdrive-connect` to the app router pointing at
`GoogleDriveConnectComponent`.
**`index.html`:** Injects the gapi and Google Identity Services scripts
needed by the Picker API.
### Any related issues, documentation, discussions?
Closes #4240 (partial — UI wiring in follow-up PR)
### How was this PR tested?
Unit tests in `drive.service.spec.ts` and
`google-drive-connect.component.spec.ts` covering:
- `getToken()` returns status and access token
- `connect()` opens a popup and `onConnected()` emits on message receipt
- `exportToDrive()` calls the Drive multipart upload API and resolves
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 4.6
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]