Skip to content

Commit

Permalink
Feature: push os system info to view and update error check list modal
Browse files Browse the repository at this point in the history
  • Loading branch information
maparr committed Sep 27, 2023
1 parent e403e3f commit 35c2b42
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
16 changes: 16 additions & 0 deletions app/redux/ui/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ export const getWarningByType = <T extends WarningType>(type: T) => (
getWarnings(state).find((w) => w.type === type) as
| WarningObject<T>
| undefined;

export const getOsPlatform = (state: RootState) => state.ui.osPlatform;
export const isWindows = (state: RootState) => {
const osPlatform = getOsPlatform(state);
return osPlatform === 'win32';
};

export const isMacOS = (state: RootState) => {
const osPlatform = getOsPlatform(state);
return osPlatform === 'darwin';
};

export const isLinux = (state: RootState) => {
const osPlatform = getOsPlatform(state);
return osPlatform === 'linux';
};
1 change: 1 addition & 0 deletions app/types/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface UiState {
error: Error | null;
skinId: string | null;
warnings: AnyWarningObject[];
osPlatform: string;
}

export interface RootState {
Expand Down
5 changes: 2 additions & 3 deletions desktop/NodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,18 @@ class NodeManager extends AbstractManager {
if (!fatalErrorLine) {
const installedLibs = await checkRequiredLibs();

if (!installedLibs.openCL) {
if (installedLibs?.openCL === false) {
this.sendNodeError(requiredLibsCrashErrors.openCL);
return;
}

if (!installedLibs.visualCpp) {
if (installedLibs?.visualCpp === false) {
this.sendNodeError(requiredLibsCrashErrors.visualCpp);
return;
}

// If we can't find fatal error — show default crash error
this.sendNodeError(defaultCrashError());

return;
}

Expand Down
4 changes: 2 additions & 2 deletions desktop/checkRequiredLibs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const checkUbuntuOpenCLLibrary = async (): Promise<boolean> => {
};

type RequiredLibraries = {
openCL: boolean;
openCL?: boolean;
visualCpp?: boolean;
};
const checkWindowsLibs = async (): Promise<RequiredLibraries> => ({
Expand All @@ -131,7 +131,7 @@ export const checkRequiredLibs = async (): Promise<RequiredLibraries> => {
return checkLinuxLibs();
}

return {} as RequiredLibraries;
return {};
};

export const requiredLibsCrashErrors = {
Expand Down
2 changes: 1 addition & 1 deletion desktop/main/sources/smesherInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const syncSmesherInfo = (
from(
(async () => {
if (!isLocalNode) return '';
if (await managers.node.getNodeStatus(60)) {
if (await managers.node.getNodeStatus()) {
const smesherId = await managers.smesher
.getSmesherId()
.catch(() => '');
Expand Down
1 change: 1 addition & 0 deletions desktop/main/startApp.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os from 'os';
import * as $ from 'rxjs';
import { app } from 'electron';
import Bech32 from '@spacemesh/address-wasm';
Expand Down

0 comments on commit 35c2b42

Please sign in to comment.