Skip to content

Commit

Permalink
Merge pull request #5 from tago-io/feature/os-rock-pi
Browse files Browse the repository at this point in the history
Feature: Added Rock Pi logo on 'operating system' card in home page
  • Loading branch information
matheuslbenachio authored Jul 6, 2022
2 parents e278ef2 + fee3891 commit 19a94a0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"rcompare",
"rerender",
"respawn",
"rockchip",
"rpio",
"svgr",
"swaptotal",
Expand Down
10 changes: 8 additions & 2 deletions packages/tcore-api/src/Services/Hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ export async function getOSInfo() {
const osInfo = await si.osInfo();
const osPlatform = os.platform();

let version = osInfo.release;
let version = `Version ${osInfo.release}`;
let code = "";
let hardware = "";
let name = osInfo.distro || osInfo.codename;
const arch = osInfo.arch;
const hostname = os.hostname();
const osVersion = os.version();

// debian
// redhat
Expand All @@ -75,9 +76,14 @@ export async function getOSInfo() {
break;
}

if (String(osVersion).includes("rockchip")) {
name = "Rock Pi";
version = `${osInfo.distro || osInfo.codename} ${osInfo.release}`;
hardware = "rock-pi";
}
if (system.raspberry) {
hardware = "raspberry-pi";
version = system.raspberry?.type;
version = `Version ${system.raspberry.type}`;
name = "Raspberry Pi";
}

Expand Down
1 change: 1 addition & 0 deletions packages/tcore-console/assets/icons/rock-pi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function OperatingSystem(props: IOperatingSystemProps) {
const getHardwareIcon = () => {
if (os.hardware === "raspberry-pi") {
return EIcon["raspberry-pi"];
} else if (os.hardware === "rock-pi") {
return EIcon["rock-pi"];
}
};

Expand Down Expand Up @@ -71,7 +73,7 @@ function OperatingSystem(props: IOperatingSystemProps) {
<div className="data">
<h3>{os.name || "-"}</h3>
<span className="description">
Version {os.version}
{os.version}
{os.arch ? " • " : ""}
{os.arch}
</span>
Expand Down
2 changes: 2 additions & 0 deletions packages/tcore-console/src/Components/Icon/Icon.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ enum EIcon {
"question-circle" = "question-circle",
"raspberry-pi" = "raspberry-pi",
"redo" = "redo",
"rock-pi" = "rock-pi",
"save" = "save",
"scroll" = "scroll",
"search" = "search",
Expand Down Expand Up @@ -179,6 +180,7 @@ const icons = {
"question-circle": require("../../../assets/icons/question-circle.svg"),
"raspberry-pi": require("../../../assets/icons/raspberry-pi.svg"),
"redo": require("../../../assets/icons/redo.svg"),
"rock-pi": require("../../../assets/icons/rock-pi.svg"),
"save": require("../../../assets/icons/save.svg"),
"scroll": require("../../../assets/icons/scroll.svg"),
"search": require("../../../assets/icons/search.svg"),
Expand Down

0 comments on commit 19a94a0

Please sign in to comment.