Skip to content

Feat: Add runtime PAT entry with user avatar. [draft B]#13

Closed
matejvasek wants to merge 1 commit into
masterfrom
011-feat-github-pat-avatar-ver-B
Closed

Feat: Add runtime PAT entry with user avatar. [draft B]#13
matejvasek wants to merge 1 commit into
masterfrom
011-feat-github-pat-avatar-ver-B

Conversation

@matejvasek
Copy link
Copy Markdown
Collaborator

@matejvasek matejvasek commented Apr 23, 2026

In this attempt I removed:

"SourceControlService interface extended with init(pat: string) and isInitialized(): boolean methods; GithubService implementation updated accordingly",

to give Claude more freedom

Changes

  • Replace compile-time GitHub PAT injection (webpack DefinePlugin) with runtime entry via a modal that validates the PAT against the GitHub API and stores it in sessionStorage
  • Add UserAvatar component to every page header showing the authenticated GitHub user (clickable on list page, display-only on create/edit)
  • Disable Create button until a PAT is provided, with tooltip and hint alert when the modal is dismissed without one
  • Add PatContext (React Context) for cross-cutting PAT state, rewrite useSourceControlService to read PAT from context instead of a baked-in global
  • Remove GITHUB_PAT from webpack DefinePlugin and globals.d.ts

The PAT was previously required at build time and baked into the bundle. Now users enter it at runtime on first visit. sessionStorage keeps it for the browser session. Each view wraps itself with a PatProvider since OCP dynamic plugins render routes independently.

New files: PatContext, useUserAvatar, PatModal, UserAvatar, PageWrapper. 12 test suites, 65 tests passing.

Replace compile-time GitHub PAT injection (webpack DefinePlugin)
with runtime entry. A modal prompts for the PAT on first visit,
validates it against the GitHub API, stores it in sessionStorage,
and displays the authenticated user in every page header.

PatContext (React Context) provides cross-cutting PAT state.
Each view wraps itself with a PatProvider since OCP dynamic
plugins render routes independently. useSourceControlService
now reads the PAT from context instead of a baked-in global.

Create button is disabled until a PAT is provided. Dismissing
the modal without a PAT shows a hint directing the user to
the Connect button in the header.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matej Vašek <matejvasek@gmail.com>
@matejvasek matejvasek changed the title Feat: Add runtime PAT entry with user avatar. [draft] Feat: Add runtime PAT entry with user avatar. [draft B] Apr 23, 2026
@matejvasek matejvasek closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant