Skip to content

Store profile color in workspace#51417

Merged
gzdunek merged 9 commits intomasterfrom
gzdunek/store-profile-color
Jan 30, 2025
Merged

Store profile color in workspace#51417
gzdunek merged 9 commits intomasterfrom
gzdunek/store-profile-color

Conversation

@gzdunek
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek commented Jan 23, 2025

This is the part 1/2 of the redesigned profile switcher. It adds an API to storing a profile color in workspaces. The color is generated when we add a new workspace or when we restore persisted state and don't find a color in the workspace.
I prepared a list of 7 colors, I don't think people have more clusters than that.

Adding a new property to the workspace state wasn't too nice - I got about 30 TS errors about a missing property in or stories/tests. To fix this for good, I replaced all the places where we construct a workspace manually with a new addRootClusterWithDoc helper. Kudos to Rafał for adding it, it helped me a lot!

@gzdunek gzdunek added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v17 labels Jan 23, 2025
@gzdunek gzdunek requested review from avatus and ravicious January 23, 2025 16:41
@github-actions github-actions Bot requested a review from flyinghermit January 23, 2025 16:42
@gzdunek gzdunek removed the request for review from flyinghermit January 23, 2025 16:42
Comment thread web/packages/teleterm/src/ui/services/workspacesService/profileColor.ts Outdated
Comment thread web/packages/teleterm/src/ui/services/workspacesService/profileColor.ts Outdated
Comment thread web/packages/teleterm/src/ui/services/workspacesService/profileColor.ts Outdated
Comment thread web/packages/teleterm/src/ui/services/workspacesService/workspacesService.test.ts Outdated
Comment thread web/packages/teleterm/src/ui/services/workspacesService/workspacesService.ts Outdated
Comment thread web/packages/teleterm/src/ui/services/statePersistence/statePersistenceService.ts Outdated
@gzdunek gzdunek requested a review from ravicious January 27, 2025 11:16
@gzdunek gzdunek added this pull request to the merge queue Jan 30, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 30, 2025
@gzdunek gzdunek added this pull request to the merge queue Jan 30, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 30, 2025
@gzdunek gzdunek added this pull request to the merge queue Jan 30, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 30, 2025
@gzdunek gzdunek added this pull request to the merge queue Jan 30, 2025
Merged via the queue into master with commit 3b1c689 Jan 30, 2025
@gzdunek gzdunek deleted the gzdunek/store-profile-color branch January 30, 2025 15:39
@public-teleport-github-review-bot
Copy link
Copy Markdown

@gzdunek See the table below for backport results.

Branch Result
branch/v17 Create PR

gzdunek added a commit that referenced this pull request Jan 30, 2025
* Adjust workspace tests to accept persisted workspace type

* Store profile color in workspace

* Replace manual workspace creation in stories/tests with `addRootClusterWithDoc`

* Fix checking if all colors are taken

* Add DELETE IN comment

* `ProfileColor` -> `WorkspaceColor`

* Lint

* Prettier

* Add TODO about creating workspaces in `setActiveWorkspace`

(cherry picked from commit 3b1c689)
github-merge-queue Bot pushed a commit that referenced this pull request Jan 30, 2025
* Store profile color in workspace (#51417)

* Adjust workspace tests to accept persisted workspace type

* Store profile color in workspace

* Replace manual workspace creation in stories/tests with `addRootClusterWithDoc`

* Fix checking if all colors are taken

* Add DELETE IN comment

* `ProfileColor` -> `WorkspaceColor`

* Lint

* Prettier

* Add TODO about creating workspaces in `setActiveWorkspace`

(cherry picked from commit 3b1c689)

* Redesign profile switcher  (#51419)

* Add mapping of profile color to theme color

* Prepare UserIcon to display colors, make it slightly larger

* Rewrite single identity item to show icon and user/cluster in separate lines

* Render single cluster items in a list

* Add color picker

* Render active cluster separately, above inactive clusters

* Put the new identity components together

* Refactor `Identity` story, render the container component instead of "presentational" one

* Refresh startup page

* Minor style fixes

* Add comment about `dataVisualisationColors`

* Bring back the original styling of `StaticListItem`

* Make the pencil icon hoverable and clickable

* Increase min-width from 200 px to 300 px, simplify active cluster layout

* Show logout button when any part of `ListItem` is hovered

* Remove text from logout button, improve titles

* Pass correct index number to `AddClusterItem`

* Update comment for `focusGrabber`

* Use `useStoreSelector` correctly

* Improve accessibility of color picker

* Replace Pam icon with plus symbol

* Remove unnecessary optional chaining

* Align profile status error with user icon

* Add story for cluster connect panel

* Make user icon letter follow active theme

This was suggested by Kenny, and I think it looks good.

* Change gap from 11 px to 10 px

* Rename profile color -> workspace color

(cherry picked from commit 937e4a9)
carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
* Adjust workspace tests to accept persisted workspace type

* Store profile color in workspace

* Replace manual workspace creation in stories/tests with `addRootClusterWithDoc`

* Fix checking if all colors are taken

* Add DELETE IN comment

* `ProfileColor` -> `WorkspaceColor`

* Lint

* Prettier

* Add TODO about creating workspaces in `setActiveWorkspace`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/sm ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants