-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add workspace app icons to tray window #86
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
base: main
Are you sure you want to change the base?
Conversation
- Adds AgentAppViewModel to handle each button - Adds collapsible control components to handle the collapsing section - Adds Uuid type to work around issues with the built-in Guid type - Adds ModelMerge utility for merging lists with minimal updates to work around constant flashing in the UI
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.
I didn't finish looking at all the files, but it looks like you're still doing some stuff, so I'll get another look later anyway. It's the end of my day so sending the comments I have so you'll have them to look at in the morning.
|
||
public required Uuid Id { get; init; } | ||
|
||
[ObservableProperty] public required partial string Name { get; set; } |
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.
needs [NotifyPropertyChangedFor(nameof(Details))]
too
var uriString = AppUri; | ||
var cred = _credentialManager.GetCachedCredentials(); | ||
if (cred.State is CredentialState.Valid && cred.ApiToken is not null) | ||
uriString = uriString.Replace(SessionTokenUriVar, cred.ApiToken); |
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.
I know they just changed this in coder/coder
to do it for all URIs, but I think we should restrict to non-HTTP URLs like vscode:
or cursor:
. I can't think of any reason an http(s) URL would ever need our session token (if it's for a web-app, then they can just log in normally), and it seems like it would be very easy to abuse and exfiltrate session tokens to some random webserver.
if (FetchingApps) return; | ||
FetchingApps = true; | ||
|
||
var client = _coderApiClientFactory.Create(_credentialManager); |
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.
If we don't have valid credentials here (e.g. due to sign out race), then we hit an exception and leave FetchingApps
true.
private void FetchApps() | ||
{ | ||
if (FetchingApps) return; | ||
FetchingApps = true; |
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.
If we're not going to protect this via a mutex, we need to ensure that we are on the main UI thread, else there is a TOCTOU race.
|
||
// Sort by status green, red, gray, then by hostname. | ||
agents.Sort((a, b) => | ||
ModelUpdate.ApplyLists(Agents, agents, (a, b) => |
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.
I don't think this application will propagate the PropertyChanged
event, which means that existing agents won't collapse new agents when they are expanded.
Having agent view models collapse other agent view models feels fragile. Could we have some state on this view model that controls which agent is expanded, rather than a bunch of IsExpanded bools on each agent view model that we need to toggle? Or, could we lift the routine that expands an agent up to this model, so that it can expand exactly one of them?
|
||
public partial class CoderApiClient | ||
{ | ||
public Task<WorkspaceAgent> GetWorkspaceAgent(string id, CancellationToken ct = default) |
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.
This would be safer if we accepted a UUID, rather than a string, which could totally change the endpoint we hit.
AgentAppViewModel
to handle each buttonUuid
type to work around issues with the built-inGuid
typeModelMerge
utility for merging lists with minimal updates to work around constant flashing in the UITODO:
ModelMerge
AgentAppViewModel
since I don't think they do anything$SESSION_TOKEN
replacementKnown issues:
/icon/cursor.svg
seems to be an SVG with an embedded PNG, which I guess can't be rendered properly by WinUIbuttons.mp4
Closes #50