simplified, removed redundant information

This commit is contained in:
Jordan Ellis 2019-01-08 11:17:57 -08:00
Родитель c13ec4e523
Коммит d8e8b7d80d
8 изменённых файлов: 20 добавлений и 31 удалений

4
docs/DEBUG.md Normal file
Просмотреть файл

@ -0,0 +1,4 @@
# Debugging Guide
## FAQ
### My Electron Process Isn't Starting...
If you're seeing the output `electron.1 Exited Successfully` when running via `npm run start`, and the electron process is failing to startup, this is because you're hitting a typescript compiler error. Running `tsc` within the root directory will compile the project and show the errors.

Просмотреть файл

@ -1,6 +1,6 @@
import {
AssetState, AssetType, IApplicationState, IAppSettings, IAsset,
IAssetMetadata, IConnection, IExportFormat, IProject, ITag, StorageType,
IAssetMetadata, IConnection, IExportFormat, IProject, ITag, StorageType, IAppContext,
} from "../models/applicationState";
import { ExportAssetState } from "../providers/export/exportProvider";
import { IAssetProvider, IAssetProviderRegistrationOptions } from "../providers/storage/assetProvider";
@ -10,6 +10,7 @@ import { IProjectSettingsPageProps } from "../react/components/pages/projectSett
import IConnectionActions from "../redux/actions/connectionActions";
import IProjectActions, * as projectActions from "../redux/actions/projectActions";
import { IProjectService } from "../services/projectService";
import { getHostProcess } from "./platform";
export default class MockFactory {
@ -304,6 +305,12 @@ export default class MockFactory {
};
}
public static appContext(): IAppContext {
return {
hostProcess: getHostProcess(),
}
}
public static projectSettingsProps(projectId?: string): IProjectSettingsPageProps {
return {
project: null,
@ -322,6 +329,7 @@ export default class MockFactory {
return {
appSettings: MockFactory.appSettings(),
appContext: MockFactory.appContext(),
connections: testConnections,
recentProjects: testProjects,
currentProject: testProjects[0],

Просмотреть файл

@ -1,31 +1,20 @@
import {
IHostProcess,
HostProcessType,
IOS,
} from "../models/applicationState";
import os from "os";
import process from "process";
import { detect } from "detect-browser";
const browser = detect();
export function getHostProcess(): IHostProcess {
return {
name: getHostProcessType(),
release: `${browser.name} ${browser.version}`,
};
}
export function getOS(): IOS {
return {
name: os.platform(),
release: os.release(),
cpuArchitecture: os.arch(),
};
}
function getHostProcessType(): HostProcessType {
if (process.versions.hasOwnProperty("electron")) {
const userAgent = window.navigator.userAgent.toLowerCase();
if (userAgent.indexOf(" electron/") > -1) {
return HostProcessType.Electron;
} else {
return HostProcessType.Browser;

Просмотреть файл

@ -35,7 +35,6 @@ export interface IAppSettings {
*/
export interface IAppContext {
hostProcess: IHostProcess;
os: IOS;
}
/**
@ -58,19 +57,6 @@ export enum HostProcessType {
Browser = "browser",
}
/**
* @name - Operating System
* @description - Describes the Operating System
* @member name - The Operation System's name
* @member release - The release string of the Operating System
* @member cpuArchitecture - The CPU's architecture
*/
export interface IOS {
name: string;
release: string;
cpuArchitecture: string;
}
/**
* @name - Project
* @description - Defines the structure of a VoTT project

Просмотреть файл

@ -185,6 +185,7 @@ function createStore(project: IProject, setCurrentProject: boolean = false): Sto
connection: null,
devToolsEnabled: false,
},
appContext: MockFactory.appContext(),
connections: [],
recentProjects: [project],
};

Просмотреть файл

@ -133,6 +133,7 @@ function createStore(project: IProject, setCurrentProject: boolean = false): Sto
connection: null,
devToolsEnabled: false,
},
appContext: MockFactory.appContext(),
connections: [],
recentProjects: [project],
};

Просмотреть файл

@ -126,6 +126,7 @@ describe("Connection Picker Component", () => {
connection: null,
devToolsEnabled: false,
},
appContext: MockFactory.appContext(),
connections: [],
recentProjects,
};

Просмотреть файл

@ -1,5 +1,5 @@
import { IApplicationState } from "../../models/applicationState";
import { getHostProcess, getOS } from "../../common/platform";
import { getHostProcess } from "../../common/platform";
const initialState: IApplicationState = {
appSettings: {
@ -8,7 +8,6 @@ const initialState: IApplicationState = {
},
appContext: {
hostProcess: getHostProcess(),
os: getOS(),
},
connections: null, // sampleConnections,
recentProjects: null, // sampeProjects,