Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect flight-data-reader submodule for data upload #64

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "client/flight-data-reader"]
path = client/flight-data-reader
url = https://github.com/PokeyOne/flight-data-reader.git
branch = trunk
8 changes: 8 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
FROM rust:1.73 as flight-data-reader

RUN cargo install wasm-pack
COPY flight-data-reader /usr/src/flight-data-reader
WORKDIR /usr/src/flight-data-reader/web_package/rocket-data
RUN wasm-pack build

FROM node:18-alpine as base

FROM base as dev
WORKDIR /app
COPY --from=flight-data-reader /usr/src/flight-data-reader/web_package/rocket-data/pkg rocket-data
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=cache,target=/root/.cache/yarn \
yarn install
Expand Down
1 change: 1 addition & 0 deletions client/flight-data-reader
Submodule flight-data-reader added at 28f1a0
3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
"react-dom": "^18.2.0",
"react-material-file-upload": "^0.0.4",
"react-syntax-highlighter": "^15.5.0",
"rocket-data": "file:./rocket-data",
"socket-io": "^1.0.0",
"typescript": "^4.8.4",
"vite-plugin-top-level-await": "^1.3.1",
"vite-plugin-wasm": "^3.2.2",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
17 changes: 9 additions & 8 deletions client/src/components/DataUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, Slide, Stack, Tooltip, Typography } from "@mui/material";
import { Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, Stack, Tooltip, Typography } from "@mui/material";
import { useActiveMission } from "../utils/ActiveMissionContext";
import React, { useState, forwardRef, useEffect } from 'react';
import { TransitionProps } from "@mui/material/transitions";
import React, { useState, useEffect } from 'react';
import FileUpload from "react-material-file-upload";
import * as DataConverter from "rocket-data"



Expand All @@ -16,8 +16,11 @@ const MissionConfig: React.FC<IDataUploadProps> = (props: IDataUploadProps) => {
const { isOpen, onClose } = props;
const [files, setFiles] = useState<File[]>([]);

const handleSave = () => {
// TODO: mateos rust library
const handleSave = async () => {
const config_file = files.find((element: File) => element.name.indexOf(".json") !== -1);
const bin_file = files.find((element: File) => element.name.indexOf(".bin") !== -1);
const csv_str = await DataConverter.convert_to_csv(config_file, bin_file);
console.log(csv_str);
props.onClose();
};

Expand All @@ -43,9 +46,7 @@ const MissionConfig: React.FC<IDataUploadProps> = (props: IDataUploadProps) => {
<Typography variant="subtitle1">Supported File Type:</Typography>
<Chip label='.cvs' color="primary" variant="outlined"/>
<Chip label='.json' color="primary" variant="outlined"/>
<Tooltip title="Raw data. not Supported yet">
<Chip label='.bin' color="error" variant="outlined" />
</Tooltip>
<Chip label='.bin' color="primary" variant="outlined"/>
</Stack>
<Tooltip title="To upload multiple files they both must be selected in your file system">
<div>
Expand Down
7 changes: 6 additions & 1 deletion client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from'vite-tsconfig-paths';
import wasm from 'vite-plugin-wasm';
import topLevelAwait from 'vite-plugin-top-level-await';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), viteTsconfigPaths()],
plugins: [react(),
viteTsconfigPaths(),
wasm(),
topLevelAwait()],
server: {
host: true,
watch: {
Expand Down
8 changes: 8 additions & 0 deletions documentation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ Now if you haven't already you can clone the repository
```bash
git clone https://github.com/UVicRocketry/Ground-Support.git
```

Then clone project submodules

```bash
cd Ground-Support
git submodule update --init --recursive
```

**Server Environment File**

In the `/services/server` directory create a `.env` file. If not called exactly `.env`, create one and copy and paste
Expand Down