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

Staging #386

Merged
merged 2 commits into from
Sep 11, 2023
Merged
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
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@
"description": "",
"main": "index.js",
"private": true,
"workspaces": {
"packages": [
"packages/**/*"
],
"nohoist": [
"packages/lambdas/**"
]
},
"workspaces": [
"packages/**/*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/TheTechCompany/HiveCommandClient.git"
Expand Down Expand Up @@ -59,4 +54,4 @@
"@types/react": "17.0.2"
},
"packageManager": "[email protected]"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export const FunctionEditor = () => {
id
}

children {
id
name
label
}

rank
}
Expand Down Expand Up @@ -66,8 +71,8 @@ export const FunctionEditor = () => {
})



const [ editingPage, setEditingPage ] = useState<any>(null);
const [ editingPage, setEditingPage ] = useState<any>(null);

const [ value, setValue ] = useState('');

Expand All @@ -76,6 +81,25 @@ const [ editingPage, setEditingPage ] = useState<any>(null);
const [ nodes, setNodes, onNodesChange ] = useNodesState<any[]>([]);
const [ edges, setEdges, onEdgesChange] = useEdgesState<any[]>([]);

useEffect(() => {
setNodes(editingPage?.children?.map((x, ix) => ({
id: x?.id,
label: x?.name,
position: {
x: 50,
y: ix * 50
},
data: {
label: x?.name
// label: node.label,
// width: node.width,
// height: node.height
}
})))
setEdges(editingPage?.children?.map((x, ix) => ({id: x?.id, source: x?.id, target: editingPage?.children?.[ix + 1]?.id})))

}, [editingPage])

useEffect(() => {

const g = new dagre.graphlib.Graph()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export const PagesPane = (props: any) => {
}}
/>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ flex: 1 }}><Button onClick={props.onExport}>Export</Button></Box>
<Box sx={{ flex: 1 }}>
<Box sx={{ flex: 1 }}><Button size="small" variant='contained' onClick={props.onExport}>Export</Button></Box>
<Box sx={{ flex: 1, display: 'flex', justifyContent: 'center' }}>
<Typography>Pages</Typography>
</Box>
<Box sx={{ flex: 1, display: 'flex', justifyContent: 'flex-end' }}>
Expand All @@ -89,7 +89,7 @@ export const PagesPane = (props: any) => {
</IconButton>
</Box>
</Box>
<Divider />
<Divider sx={{margin: '6px'}}/>

<List>
{pages?.slice()?.sort((a,b) => (a.rank || '').localeCompare(b.rank || ''))?.map((page) => (
Expand Down
7 changes: 6 additions & 1 deletion packages/core/command-schematic-export/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import express from 'express';
import { PDFDocument } from 'pdf-lib';
import { writeFileSync } from 'fs';
import chromium from 'chrome-aws-lambda';

const html_index = require.resolve('@hive-command/export-page');

Expand All @@ -29,7 +30,11 @@ export const export_schematic = async (schematic: {pages: any[]}) => {

if(typeof(address) != 'string'){

const browser = await puppeteer.launch({headless: false});
const browser = await puppeteer.launch({
args: chromium.args,
headless: chromium.headless,
executablePath: await chromium.executablePath
});

const page = await browser.newPage();

Expand Down
4 changes: 2 additions & 2 deletions packages/infrastructure/main/src/export-lambda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const ExportLambda = () => {

const lambda = archive.getFile({
type: "zip",
sourceDir: path.join(__dirname, "/../../../lambdas/export-schematic/"),
sourceDir: path.join(__dirname, "/../../../../lambdas/export-schematic/"),
outputPath: "lambda_function_payload.zip",
});

const fn = new Function(`hivecommand-export-schematic-fn`, {
code: new pulumi.asset.FileArchive("lambda_function_payload.zip"),
role: iamForLambda.arn,
handler: "index.test",
handler: "index.handler",
runtime: "nodejs18.x"
})

Expand Down
Loading