Skip to content

Commit

Permalink
feat(Triggers): Adds Remote Access Code triggers. Closes #3241
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderson1993 committed Jul 29, 2022
1 parent 40a15dd commit a6c1def
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
needs: build
strategy:
matrix:
os: [macos-10.15, ubuntu-18.04, windows-2019]
os: [macos-latest, ubuntu-18.04, windows-2019]

steps:
- name: Check out Git repository
Expand Down
1 change: 1 addition & 0 deletions server/triggers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export * from "./engines";
export * from "./internalComm";
export * from "./jumpDrive";
export * from "./lighting";
export * from "./remoteAccess";
25 changes: 25 additions & 0 deletions server/triggers/remoteAccess.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import App from "../app";

export function remoteAccessSendCode({simulatorId, code}) {
console.log(simulatorId, code);
return {simulatorId, code};
}

export function remoteAccessUpdateCode({
simulatorId,
codeId,
state,
}: {
simulatorId: string;
codeId: string;
state: "Denied" | "Accepted";
}) {
const simulator = App.simulators.find(s => s.id === simulatorId);
const code = simulator.ship.remoteAccessCodes.find(c => c.id === codeId);
console.log(simulatorId, state, code.code);
return {
simulatorId,
state: state === "Accepted" ? "true" : "false",
code: code.code,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ export * from "./engines";
export * from "./internalComm";
export * from "./jumpDrive";
export * from "./lighting";
export * from "./remoteAccess";
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from "react";

export const remoteAccessSendCode = {
name: "remoteAccessSendCode",
objectKey: "remoteAccessSendCode",
category: "Triggers",
component: () => (
<div>
Event: Remote Access Code Sent
<div>
<small>"Code" is the code that was sent.</small>
</div>
</div>
),
outputs: [
{
id: "triggerOut",
color: "orange",
title: "Triggers the action",
type: "Trigger",
},
{
id: "code",
color: "yellow",
title: "Code",
type: "String",
},
],
inputs: [],
config: [],
};
export const remoteAccessUpdateCode = {
name: "remoteAccessUpdateCode",
objectKey: "remoteAccessUpdateCode",
category: "Triggers",
component: () => (
<div>
Event: Remote Access Code Accepted/Denied
<div>
<small>"Code" is the code that was sent.</small>
</div>
<div>
<small>
Possible "State" options:{" "}
<div>
<code>true</code>: Code was accepted
</div>
<div>
<code>false</code>: Code was rejected
</div>
</small>
</div>
</div>
),
outputs: [
{
id: "triggerOut",
color: "orange",
title: "Triggers the action",
type: "Trigger",
},
{
id: "code",
color: "yellow",
title: "Code",
type: "String",
},
{
id: "state",
color: "green",
title: "State",
type: "String",
},
],
inputs: [],
config: [],
};

0 comments on commit a6c1def

Please sign in to comment.