Skip to content
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

Tray icon #1005

Merged
merged 38 commits into from
Oct 27, 2020
Merged

Tray icon #1005

merged 38 commits into from
Oct 27, 2020

Conversation

ixrock
Copy link
Contributor

@ixrock ixrock commented Oct 1, 2020

Tray icon and menu (enabled by default)

image

Added preferences

  • auto-startup on login (api: app.setLoginItemSettings, enabled by default)

image

close #833

Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
@ixrock ixrock added the enhancement New feature or request label Oct 1, 2020
@ixrock ixrock added this to the 3.7.0 milestone Oct 1, 2020
@ixrock ixrock requested a review from a team October 1, 2020 04:34
Signed-off-by: Roman <ixrock@gmail.com>
Copy link
Collaborator

@Nokel81 Nokel81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we still have the kontena logo in master?

Looks pretty good

@nevalla
Copy link
Contributor

nevalla commented Oct 1, 2020

Why do we still have the kontena logo in master?

Looks pretty good

Kontena refuses to die 😂

Signed-off-by: Roman <ixrock@gmail.com>
@nevalla
Copy link
Contributor

nevalla commented Oct 6, 2020

Couple of usage issues / enhancement requests:

  • Icon on dark OSX theme is invisible
  • When opening cluster from "inactive" workspace does not activate the workspace (cluster menu etc)
  • IMHO connection status is irrelevant here
  • Can we have checkbox to indicate what cluster is active in tray menu?

ixrock added 3 commits October 6, 2020 15:17
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
@ixrock
Copy link
Contributor Author

ixrock commented Oct 6, 2020

This error possibly causing integration tests start failing.
@nevalla Could you please check or maybe you have any ideas?

image

ixrock added 4 commits October 7, 2020 13:21
- optimization: don't re-create tray icon on menu udpates (avoid blinking)

Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
# Conflicts:
#	src/renderer/components/cluster-manager/cluster-view.tsx
Signed-off-by: Roman <ixrock@gmail.com>
@ixrock
Copy link
Contributor Author

ixrock commented Oct 7, 2020

@nevalla @jakolehm PTAL
Now it's possible to close main window Cmd+W or by clicking (x) at traffic-light buttons.

ixrock added 2 commits October 7, 2020 23:31
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
@@ -73,7 +75,9 @@ export class BaseStore<T = any> extends Singleton {

enableSync() {
this.syncDisposers.push(
reaction(() => this.toJSON(), model => this.onModelChange(model)),
reaction(() => this.toJSON(), model => this.onModelChange(model), {
delay: this.params.syncDelayMs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a delay now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added to avoid possible infinite cycle of saving store.json in some cases when update comes from renderer
(don't remember exact case, usually hard to reproduce)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into something like that too. The fix that I used was making sure any updates happen within the store class and are marked as @action that way multiple deep updates don't cause an infinite loop. But if you have tried that this might help

ixrock added 2 commits October 8, 2020 10:13
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
@nevalla
Copy link
Contributor

nevalla commented Oct 12, 2020

Investigated integration tests failures. They are now failing because we introduced new window for Tray and tests are expecting certain amount of windows. To fix those please modify integration/app.tests.ts to have following lines (26):

while (await app.client.getWindowCount() > 2);
await app.client.windowByIndex(1)

However, after fixing that, tests revealed a real problem. When adding new cluster, the cluster activation happens before the cluster is added in cluster store on main process.

# Conflicts:
#	src/renderer/components/+add-cluster/add-cluster.tsx
#	src/renderer/components/+cluster-settings/cluster-settings.tsx
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
# Conflicts:
#	locales/en/messages.po
#	locales/fi/messages.po
#	locales/ru/messages.po
Signed-off-by: Roman <ixrock@gmail.com>
@ixrock
Copy link
Contributor Author

ixrock commented Oct 15, 2020

@nevalla integration on linux failed again for some reasons.. and why I actually can't re-run it? (but clicking to "Re-run" says only it's has been requested).

package.json Outdated
@@ -200,6 +208,7 @@
"openid-client": "^3.15.2",
"path-to-regexp": "^6.1.0",
"proper-lockfile": "^4.1.1",
"react": "^16.13.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why react moved here?

Copy link
Contributor Author

@ixrock ixrock Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such error arised initially by @nevalla AFAIK not sure if this still fixing something..
Commit: ec50c41

Copy link
Contributor Author

@ixrock ixrock Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. tried to move out react to devDependencies and got this from Lens build version:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And seems like it's requested by react-router in runtime in main process (need to refactor navigation.ts to get rid of this dependency)

Copy link
Contributor Author

@ixrock ixrock Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakolehm did refactoring and now react and react-router not required to be runtime dependencies. PTAL.

Signed-off-by: Roman <ixrock@gmail.com>
…` and `react-router` not required as package.json dependecies in runtime (main)

Signed-off-by: Roman <ixrock@gmail.com>
Comment on lines +66 to +67
const browserWindow = await windowManager.ensureMainWindow();
showAbout(browserWindow);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "About Lens" dialog have to depend on the browserWindow's existence? This means, if not already open, the user must wait for the splash window and browser window to come up before seeing "About Lens". Maybe the splash window can be skipped? Though maybe there is still a delay for the browser window?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and I don't know if it's technically possible to show the dialog without it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have Lens minimized and pick "About Lens" from the Lens system menu the dialog comes up without bringing up the main window:
image
Though I guess this probably still requires the main window to exist

src/main/tray.ts Outdated
label: "Check for updates",
async click() {
const result = await AppUpdater.checkForUpdates();
const browserWindow = await windowManager.ensureMainWindow();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this line be inside the if (!result) { ... }? I'm not sure what happens when result is true (Does there still need to be a browserWindow?)

// load & show app
this.showMain();
initMenu(this);
async ensureMainWindow(): Promise<BrowserWindow> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could take showSplash param and pass on to initMainWindow()?

@@ -57,4 +57,8 @@
box-shadow: 0 0 0 1px $borderFaintColor;
}
}

.Checkbox {
align-self: start; // limit clickable area to checkbox + text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding comments! I get lost easily in css files :)

@@ -303,12 +309,15 @@
"postinstall-postinstall": "^2.1.0",
"progress-bar-webpack-plugin": "^2.1.0",
"raw-loader": "^4.0.1",
"react": "^16.13.1",
"react": "^16.14.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this PR require React upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we revert? Not that many changes in that release: https://github.com/facebook/react/blob/master/CHANGELOG.md#16140-october-14-2020

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it's even matter? :) It is not a major release update.

@jakolehm
Copy link
Contributor

@ixrock integration tests are failing (I have triggered restart but it didn't help).

@nevalla
Copy link
Contributor

nevalla commented Oct 22, 2020

@ixrock integration tests are failing (I have triggered restart but it didn't help).

Some of the menu links have now ?namespace= that integration tests do not take into an account. Created PR to ignore that query param: #1109.

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
@nevalla
Copy link
Contributor

nevalla commented Oct 23, 2020

Noticed that we are now using dark icon as default, which does not look that good on Ubuntu and Windows:
image
image

I suggest we should use the white icon as default (could be done in future PR too).

@ixrock
Copy link
Contributor Author

ixrock commented Oct 23, 2020

Current implementation sets icon color depending on electron's API nativeTheme.shouldUseDarkColors.
If this is not supported in Linux we could force specific color to Linux-only.
UPD: or maybe themes in Linux/Win should use inverted colors for that option..
Read more: https://www.electronjs.org/docs/api/native-theme

@nevalla nevalla modified the milestones: 3.7.0, 4.0.0 Oct 26, 2020
@jakolehm
Copy link
Contributor

@ixrock this needs conflict resolve.

# Conflicts:
#	package.json
#	src/common/user-store.ts
#	src/common/workspace-store.ts
#	src/main/index.ts
#	src/main/window-manager.ts
#	src/renderer/components/+cluster-settings/cluster-settings.tsx
#	src/renderer/components/+preferences/preferences.tsx
#	src/renderer/components/cluster-manager/cluster-manager.tsx
#	src/renderer/components/cluster-manager/clusters-menu.tsx
#	src/renderer/components/layout/sidebar.tsx
#	yarn.lock
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
Copy link
Contributor

@nevalla nevalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ixrock ixrock dismissed jakolehm’s stale review October 27, 2020 13:25

done already

@ixrock ixrock merged commit 334815f into master Oct 27, 2020
@ixrock ixrock deleted the feature/tray branch October 27, 2020 13:25
@jakolehm jakolehm mentioned this pull request Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tray icon
5 participants