init process & os contextual info
This commit is contained in:
Родитель
ba82f012ab
Коммит
c7f8683a9f
|
@ -0,0 +1,74 @@
|
|||
import {
|
||||
IHostProcess,
|
||||
HostProcessType,
|
||||
IHostProcessInfo,
|
||||
IOS,
|
||||
CPUArchitectureType,
|
||||
OSType,
|
||||
IOSInfo
|
||||
} from "../models/applicationState";
|
||||
|
||||
export function getHostProcess(): IHostProcess {
|
||||
const procType = getProcessType();
|
||||
const procInfo = getProcessInfo(procType);
|
||||
|
||||
return {
|
||||
type: procType,
|
||||
info: procInfo,
|
||||
};
|
||||
}
|
||||
|
||||
export function getOS(): IOS {
|
||||
const osType = getOsType();
|
||||
const osInfo = getOSInfo(osType);
|
||||
|
||||
return {
|
||||
type: osType,
|
||||
info: osInfo,
|
||||
}
|
||||
}
|
||||
|
||||
function getProcessType(): HostProcessType {
|
||||
// TODO
|
||||
return HostProcessType.Browser;
|
||||
}
|
||||
|
||||
function getProcessInfo(type: HostProcessType): IHostProcessInfo {
|
||||
switch (type) {
|
||||
case HostProcessType.Browser:
|
||||
return {
|
||||
build: "TODO",
|
||||
cpuArchitecture: CPUArchitectureType.x64, // TODO
|
||||
};
|
||||
case HostProcessType.Electron:
|
||||
return {
|
||||
build: "TODO",
|
||||
cpuArchitecture: CPUArchitectureType.x86, // TODO
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getOsType(): OSType {
|
||||
// TODO
|
||||
return OSType.Linux;
|
||||
}
|
||||
|
||||
function getOSInfo(type: OSType): IOSInfo {
|
||||
switch (type) {
|
||||
case OSType.Linux:
|
||||
return {
|
||||
build: "TODO",
|
||||
cpuArchitecture: CPUArchitectureType.x64, // TODO
|
||||
};
|
||||
case OSType.Mac:
|
||||
return {
|
||||
build: "TODO",
|
||||
cpuArchitecture: CPUArchitectureType.x64, // TODO
|
||||
};
|
||||
case OSType.Windows:
|
||||
return {
|
||||
build: "TODO",
|
||||
cpuArchitecture: CPUArchitectureType.x64, // TODO
|
||||
};
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
export interface IApplicationState {
|
||||
appSettings: IAppSettings;
|
||||
appContext: IAppContext;
|
||||
connections: IConnection[];
|
||||
recentProjects: IProject[];
|
||||
currentProject: IProject;
|
||||
|
@ -26,6 +27,38 @@ export interface IAppSettings {
|
|||
connection: IConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name - Application Context
|
||||
* @description - Contains contextual information about where the application is running
|
||||
* @member hostProcess - Information about the process hosting the web app
|
||||
* @member os - Information about the operating system the web app is running on
|
||||
*/
|
||||
export interface IAppContext {
|
||||
hostProcess: IHostProcess;
|
||||
os: IOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name - Host Process
|
||||
* @description - Describes the host process
|
||||
* @member type - The type of host process
|
||||
* @member info - Extra info about the host process
|
||||
*/
|
||||
export interface IHostProcess {
|
||||
type: HostProcessType;
|
||||
info: IHostProcessInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name - Operating System
|
||||
* @description - Describes the Operating System
|
||||
* @member type - The type of Operating System
|
||||
*/
|
||||
export interface IOS {
|
||||
type: OSType;
|
||||
info: IOSInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name - Project
|
||||
* @description - Defines the structure of a VoTT project
|
||||
|
@ -220,3 +253,58 @@ export enum RegionType {
|
|||
Rectangle = "RECTANGLE",
|
||||
Polygon = "POLYGON",
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum ELECTRON - Electron Host Process Type
|
||||
* @enum BROWSER - Browser Host Process Type
|
||||
*/
|
||||
export enum HostProcessType {
|
||||
Electron = "electron",
|
||||
Browser = "browser",
|
||||
}
|
||||
|
||||
/**
|
||||
* @name - Host Process Info
|
||||
* @description - Detailed information about the host process
|
||||
* @member build - Build string of the host process
|
||||
* @member cpuArchitecture - CPU architecture the process was compiled for
|
||||
*/
|
||||
export interface IHostProcessInfo {
|
||||
build: string;
|
||||
cpuArchitecture: CPUArchitectureType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum WINDOWS - Windows OS Type
|
||||
* @enum MAC - Mac OS Type
|
||||
* @enum LINUX - Linux OS Type
|
||||
*/
|
||||
export enum OSType {
|
||||
Windows = "windows",
|
||||
Mac = "mac",
|
||||
Linux = "linux",
|
||||
}
|
||||
|
||||
/**
|
||||
* @name - Operating System Info
|
||||
* @description - Detailed information about the operating system
|
||||
* @member build - Build string of the operating system
|
||||
* @member cpuArchitecture - CPU architecture the operating system was compiled for
|
||||
*/
|
||||
export interface IOSInfo {
|
||||
build: string;
|
||||
cpuArchitecture: CPUArchitectureType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum X86 - 32-bit x86 machine code
|
||||
* @enum X64 - 64-bit x64 machine code
|
||||
* @enum ARM - 32-bit ARM machine code
|
||||
* @enum ARM64 - 64-bit ARM machine code
|
||||
*/
|
||||
export enum CPUArchitectureType {
|
||||
x86 = "x86",
|
||||
x64 = "x64",
|
||||
Arm = "arm",
|
||||
Arm64 = "arm64",
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
import { IApplicationState } from "../../models/applicationState";
|
||||
import { getHostProcess, getOS } from "../../common/platform";
|
||||
|
||||
const initialState: IApplicationState = {
|
||||
appSettings: {
|
||||
devToolsEnabled: false,
|
||||
connection: null,
|
||||
},
|
||||
appContext: {
|
||||
hostProcess: getHostProcess(),
|
||||
os: getOS(),
|
||||
},
|
||||
connections: null, // sampleConnections,
|
||||
recentProjects: null, // sampeProjects,
|
||||
currentProject: null,
|
||||
|
|
Загрузка…
Ссылка в новой задаче