Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
rk4718
wacc_26_web_client
Commits
7879c0dd
Commit
7879c0dd
authored
Mar 13, 2020
by
Raghav Khanna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code reformatting.
parent
9c03ebff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
src/Comm.js
src/Comm.js
+12
-14
No files found.
src/Comm.js
View file @
7879c0dd
import
React
from
'
react
'
import
axios
from
'
axios
'
import
{
array
}
from
"
prop-types
"
;
const
SERVER_ADDR
=
"
http://192.168.1.67:8080/
"
const
SERVER_ENDPOINT
=
""
const
SERVER_ADDR
=
"
http://192.168.1.67:8080/
"
;
const
SERVER_ENDPOINT
=
""
;
const
testGraphData
=
[{
name
:
"
WACC Program
"
,
children
:
[{
...
...
@@ -16,33 +15,32 @@ const testGraphData = [{
export
function
astMetaToGraphData
(
astMeta
)
{
let
firstNode
=
astMeta
.
nodes
[
"
0
"
]
let
graphData
=
createGraphNode
(
firstNode
.
name
,
firstNode
.
value
,
firstNode
.
children
,
astMeta
)
let
firstNode
=
astMeta
.
nodes
[
"
0
"
]
;
let
graphData
=
createGraphNode
(
firstNode
.
name
,
firstNode
.
value
,
firstNode
.
children
,
astMeta
)
;
return
graphData
}
function
createGraphNode
(
name
,
value
,
childrenIDs
,
astMeta
){
var
children
=
[];
let
children
=
[];
if
(
typeof
childrenIDs
!==
"
undefined
"
)
{
for
(
var
i
=
0
;
i
<
childrenIDs
.
length
;
i
++
)
{
var
childID
=
childrenIDs
[
i
]
var
child
=
astMeta
.
nodes
[
childID
];
for
(
let
i
=
0
;
i
<
childrenIDs
.
length
;
i
++
)
{
let
childID
=
childrenIDs
[
i
]
;
let
child
=
astMeta
.
nodes
[
childID
];
children
.
push
(
createGraphNode
(
child
.
name
,
child
.
value
,
child
.
children
,
astMeta
))
}
}
let
retObj
=
{
// console.log(JSON.stringify(retObj))
return
{
name
:
name
,
attributes
:
{
value
:
value
},
attributes
:
{
value
:
value
},
children
:
children
}
// console.log(JSON.stringify(retObj))
return
retObj
}
export
async
function
sendWaccCode
(
code
)
{
let
ADDR
=
SERVER_ADDR
+
SERVER_ENDPOINT
;
var
data
=
{
isError
:
true
};
let
data
=
{
isError
:
true
};
await
axios
.
post
(
ADDR
,
{
contents
:
code
},
{
headers
:
{
'
Content-Type
'
:
'
application/json
'
}})
.
then
(
res
=>
{
data
=
res
.
data
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment