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

feat: system tray custom menu & podman modal #597

Merged
merged 32 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8188c53
added podman modal
corn-potage May 7, 2024
a80d60d
fixed developer menu, added mac os version check for podman 5
corn-potage May 9, 2024
7f1352c
fixed preferences modal width
corn-potage May 10, 2024
edaceca
fixed banner configs, added updateAvailable
corn-potage May 10, 2024
faacb18
added openPodmanModal
corn-potage May 10, 2024
1d3207c
added window focus/creation when selecting podman status
corn-potage May 10, 2024
abf6473
added node package open through tray
corn-potage May 10, 2024
1c57b57
added alert dialog
corn-potage May 13, 2024
1b0e4f5
custom menu working
corn-potage May 22, 2024
40834a0
merge conflict resolved
corn-potage May 23, 2024
bccd7ee
added theme support, and first try at ipc commands
corn-potage May 24, 2024
f35fcc5
separate out native and custom menu, add node status checking func
corn-potage May 24, 2024
7d6daaf
improved node package status for running
corn-potage May 28, 2024
0772091
added svg icons
corn-potage May 31, 2024
d78ec77
added styling for stopped nodes
corn-potage May 31, 2024
731ab4d
stronger logic for status and icons
corn-potage May 31, 2024
4451ec1
style changes. prepare to try react component
corn-potage May 31, 2024
0e9e616
refined podman status
corn-potage May 31, 2024
99daca9
improved logic on banners
corn-potage May 31, 2024
a20544e
disable click prevention in case user quits modal
corn-potage May 31, 2024
d1cad61
added additional errors for nodes
corn-potage May 31, 2024
33f68e3
added additional positioning for other OS
corn-potage Jun 3, 2024
0b6e945
fixed lint errors
corn-potage Jun 3, 2024
35cfaa4
Merge branch 'main' into feat/podmanModal
jgresham Jun 3, 2024
067f451
reverted to fix
corn-potage Jun 4, 2024
4525a7c
fix: put tray files in assets as main loads them
jgresham Jun 4, 2024
0737be3
replaced icons, added conditional on separator
corn-potage Jun 6, 2024
ba324a9
stop all nodes and podman machine on tray quit
jgresham Jun 6, 2024
54c9096
enabled custom tray only for mac
corn-potage Jul 29, 2024
7a356b5
use modelRoutes.podman in sidebar
jgresham Jul 30, 2024
2cce995
lint in tray imports
jgresham Jul 30, 2024
504ed76
Merge branch 'main' into feat/podmanModal
jgresham Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/icons/tray/status/error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tray/status/stopped.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tray/status/synced.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tray/status/syncing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions assets/locales/en/systemRequirements.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"macOSTitle": "MacOS version is at least {{minVersion}} to run Podman 5.0",
"macOSDescription": "MacOS version: {{version}}",
"processorCoresTitle": "Processor has {{minCores}} cores or more",
"processorCoresDescription": "Processor cores: {{cores}}",
"memorySizeTitle": "At least {{minSize}}GB of system memory (RAM)",
Expand Down
7 changes: 6 additions & 1 deletion assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,10 @@
"CalculatingDataSize": "(calculating data size...)",
"KeepNodeData": "Keep node related chain data {{data}}",
"NoResults": "No results",
"TrySearching": "Try searching for another keyword or clear all filters"
"TrySearching": "Try searching for another keyword or clear all filters",
"RunningOutdatedPodman": "You are running an outdated version of Podman",
"CurrentPodman": "Your current Podman installation ({{currentPodmanVersion}}) is incompatible with NiceNode and requires version {{requiredPodmanVersion}} or higher for it to run.",
"PodmanIsRequiredComponent": "Podman is a required component for NiceNode to run the many client options. Podman facilitates the running of containers within a virtualised Linux environment and will operate in the background.",
"DownloadAndUpdate": "Download and update",
"PodmanUpdate": "Podman update"
}
15 changes: 14 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ const getAssetPath = (...paths: string[]): string => {
return path.join(RESOURCES_PATH, ...paths);
};

const getTrayPath = (...paths: string[]): string => {
return path.join(
__dirname,
'..',
'..',
'src',
Copy link
Member

Choose a reason for hiding this comment

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

I think this path will not work in packaged builds

'renderer',
'Presentational',
'Tray',
...paths,
);
};

export const createWindow = async () => {
// let name: string;
// if (windowName === 'log') {
Expand Down Expand Up @@ -275,7 +288,7 @@ const initialize = () => {
monitor.initialize();
cronJobs.initialize();
i18nMain.initialize();
tray.initialize(getAssetPath);
tray.initialize(getAssetPath, getTrayPath);
console.log('app locale: ', app.getLocale());
console.log('app LocaleCountryCode: ', app.getLocaleCountryCode());
};
Expand Down
2 changes: 2 additions & 0 deletions src/main/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const CHANNELS = {
nodeLogs: 'nodeLogs',
podman: 'podman',
podmanInstall: 'podmanInstall',
openPodmanModal: 'openPodmanModal',
openNodePackageScreen: 'openNodePackageScreen',
theme: 'theme',
notifications: 'notifications',
reportEvent: 'reportEvent',
Expand Down
6 changes: 5 additions & 1 deletion src/main/nn-auto-updater/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ export class nnAutoUpdater
if (isLinux()) {
console.log('nnAutoUpdater setFeedURL in linux!');
} else {
this.nativeUpdater.setFeedURL(options);
try {
this.nativeUpdater.setFeedURL(options);
} catch (e) {
console.error('Error in setFeedURL: ', e);
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/nodePackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const startNodePackage = async (nodeId: NodeId) => {
node.lastStartedTimestampMs = Date.now();
node.stoppedBy = undefined;
nodePackageStore.updateNodePackage(node);
let allServicesStarted = true;

const isEthereumPackage = node.spec.specId === 'ethereum';

Expand All @@ -153,6 +154,7 @@ export const startNodePackage = async (nodeId: NodeId) => {
} catch (e) {
logger.error(`Unable to start node service: ${JSON.stringify(service)}`);
nodePackageStatus = NodeStatus.errorStarting;
allServicesStarted = false;
// try to start all services, or stop other services?
// todo: set as partially started?
// throw e;
Expand Down Expand Up @@ -182,7 +184,8 @@ export const startNodePackage = async (nodeId: NodeId) => {
}

// If all node services start without error, the package is considered running
if (nodePackageStatus === NodeStatus.running) {
if (allServicesStarted) {
nodePackageStatus = NodeStatus.running;
setLastRunningTime(nodeId, 'node');
}

Expand Down
6 changes: 5 additions & 1 deletion src/main/podman/podman.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
type ConfigValuesMap,
buildCliConfig,
} from '../../common/nodeConfig';
import { send } from '../messenger';
import { CHANNELS, send } from '../messenger.js';
import { restartNodes } from '../nodePackageManager';
import { isLinux } from '../platform';
import { killChildProcess } from '../processExit';
Expand Down Expand Up @@ -772,6 +772,10 @@ export const isPodmanStarting = async () => {
return bIsPodmanStarting;
};

export const openPodmanModal = async () => {
send(CHANNELS.openPodmanModal);
};

// todoo
// setTimeout(() => {
// isPodmanRunning();
Expand Down
4 changes: 4 additions & 0 deletions src/main/state/nodePackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,7 @@ export const getUserNodePackagesWithNodes = async () => {
});
return userNodePackages;
};

export const openNodePackageScreen = async (nodeId: NodeId) => {
send(CHANNELS.openNodePackageScreen, nodeId);
};
Loading