Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-workflow
Commits
855da481
Commit
855da481
authored
1 year ago
by
amit-s19
Browse files
Options
Download
Patches
Plain Diff
Removed hard coded urls
parent
0643bae2
main
dev
feat/centro
feature/formlistapi
fix/remove-forms
revert-67-contributeByGitpod
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/wrapper/src/api/index.js
+4
-3
apps/wrapper/src/api/index.js
apps/wrapper/src/components/GenericForm/index.js
+6
-4
apps/wrapper/src/components/GenericForm/index.js
packages/form-manager/src/app.controller.ts
+6
-4
packages/form-manager/src/app.controller.ts
with
16 additions
and
11 deletions
+16
-11
apps/wrapper/src/api/index.js
+
4
−
3
View file @
855da481
const
GITPOD_URL
=
process
.
env
.
REACT_APP_GITPOD_WORKSPACE_URL
const
HASURA_URL
=
process
.
env
.
REACT_APP_HASURA_URL_URL
const
FORM_MANAGER_URL
=
process
.
env
.
REACT_APP_FORM_MANAGER_URL
const
makeHasuraCalls
=
async
(
query
)
=>
{
// const userData = getCookie("userData");
return
fetch
(
`
${
GITPOD_URL
.
slice
(
0
,
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
8080-
"
+
GITPOD_URL
.
slice
(
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
/v1/graphql`
,
{
return
fetch
(
`
${
HASURA_URL
}
/v1/graphql`
,
{
method
:
"
POST
"
,
headers
:
{
Accept
:
"
application/json
"
,
...
...
@@ -43,7 +44,7 @@ export const saveFormSubmission = (data) => {
export
const
getPrefillXML
=
async
(
form
,
onFormSuccessData
,
prefillXML
,
imageUrls
)
=>
{
try
{
let
res
=
await
fetch
(
`
${
GITPOD_URL
.
slice
(
0
,
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
3006-
"
+
GITPOD_URL
.
slice
(
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
/prefillXML?form=
${
form
}
&onFormSuccessData=
${
encodeURI
(
let
res
=
await
fetch
(
`
${
FORM_MANAGER_URL
}
/prefillXML?form=
${
form
}
&onFormSuccessData=
${
encodeURI
(
JSON
.
stringify
(
onFormSuccessData
)
)}
`
,
{
method
:
'
POST
'
,
...
...
This diff is collapsed.
Click to expand it.
apps/wrapper/src/components/GenericForm/index.js
+
6
−
4
View file @
855da481
...
...
@@ -3,7 +3,9 @@ import styles from './index.module.css';
import
beautify
from
"
xml-beautifier
"
;
import
{
getPrefillXML
,
saveFormSubmission
}
from
'
../../api
'
;
const
GITPOD_URL
=
process
.
env
.
REACT_APP_GITPOD_WORKSPACE_URL
const
EKETO_URL
=
process
.
env
.
REACT_APP_EKETO_URL
const
FORM_MANAGER_URL
=
process
.
env
.
REACT_APP_FORM_MANAGER_URL
const
HASURA_URL
=
process
.
env
.
REACT_APP_HASURA_URL
const
GenericForm
=
(
props
)
=>
{
const
{
selectedFlow
,
setSelectedFlow
}
=
props
;
...
...
@@ -77,7 +79,7 @@ const GenericForm = (props) => {
}
const
parseFormData
=
async
(
formData
)
=>
{
let
jsonRes
=
await
fetch
(
`
${
GITPOD_URL
.
slice
(
0
,
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
3006-
"
+
GITPOD_URL
.
slice
(
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
/parse`
,
{
let
jsonRes
=
await
fetch
(
`
${
FORM_MANAGER_URL
}
/parse`
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
({
xml
:
formData
,
...
...
@@ -114,13 +116,13 @@ const GenericForm = (props) => {
selectedFlow
.
offline
&&
<
p
className
=
'
animate__animated animate__fadeIn
'
style
=
{{
color
:
'
#fff
'
,
fontSize
:
'
1.5rem
'
}}
>
Disable
internet
and
try
submitting
the
form
<
/p
>
}
{
selectedFlow
.
submitToHasura
&&
<
p
className
=
'
animate__animated animate__fadeIn
'
style
=
{{
color
:
'
#fff
'
,
fontSize
:
'
1.5rem
'
}}
>
Submit
the
form
and
check
<
a
style
=
{{
color
:
'
#ffc119
'
}}
target
=
"
_blank
"
href
=
{
`
${
GITPOD_URL
.
slice
(
0
,
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
8080-
"
+
GITPOD_URL
.
slice
(
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
`
}
>
Hasura
<
/a></
p
>
selectedFlow
.
submitToHasura
&&
<
p
className
=
'
animate__animated animate__fadeIn
'
style
=
{{
color
:
'
#fff
'
,
fontSize
:
'
1.5rem
'
}}
>
Submit
the
form
and
check
<
a
style
=
{{
color
:
'
#ffc119
'
}}
target
=
"
_blank
"
href
=
{
`
${
HASURA_URL
}
`
}
>
Hasura
<
/a></
p
>
}
<
div
className
=
{
styles
.
formContainer
}
>
<
iframe
title
=
'
current-form
'
className
=
{
styles
.
odkForm
}
src
=
{
`
${
GITPOD_URL
.
slice
(
0
,
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
8065-
"
+
GITPOD_URL
.
slice
(
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
/preview?formSpec=
${
encodedFormSpec
}
&xform=
${
encodedFormURI
}
`
`
${
EKETO_URL
}
/preview?formSpec=
${
encodedFormSpec
}
&xform=
${
encodedFormURI
}
`
}
/
>
<
div
className
=
{
styles
.
jsonResponse
}
>
...
...
This diff is collapsed.
Click to expand it.
packages/form-manager/src/app.controller.ts
+
6
−
4
View file @
855da481
...
...
@@ -47,7 +47,9 @@ export class AppController {
private
configService
:
ConfigService
,
)
{
}
GITPOD_URL
=
this
.
configService
.
get
(
'
GITPOD_WORKSPACE_URL
'
);
MINIO_ENDPOINT
=
this
.
configService
.
get
(
'
MINIO_ENDPOINT
'
);
MINIO_URL
=
this
.
configService
.
get
(
'
MINIO_URL
'
);
FORM_MANAGER_URL
=
this
.
configService
.
get
(
'
FORM_MANAGER_URL
'
);
getLoginToken
=
()
=>
{
try
{
...
...
@@ -190,7 +192,7 @@ export class AppController {
);
const
instanceId
=
uuidv4
();
await
this
.
cacheManager
.
set
(
instanceId
,
prefilledForm
,
86400
*
10
);
return
`
${
this
.
GITPOD_URL
.
slice
(
0
,
this
.
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
3006-
"
+
this
.
GITPOD_URL
.
slice
(
this
.
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
/form/instance/
${
instanceId
}
`
;
return
`
${
this
.
FORM_MANAGER_URL
}
/form/instance/
${
instanceId
}
`
;
}
else
{
return
'
OK
'
;
}
...
...
@@ -269,7 +271,7 @@ export class AppController {
// console.log('sessionRes', sessionRes);
const
minioClient
:
Client
=
new
Minio
.
Client
({
endPoint
:
"
9000-
"
+
this
.
GITPOD_URL
.
slice
(
8
)
,
endPoint
:
this
.
MINIO_ENDPOINT
,
useSSL
:
true
,
accessKey
:
this
.
configService
.
get
(
'
MINIO_USERNAME
'
),
secretKey
:
this
.
configService
.
get
(
'
MINIO_PASSWORD
'
)
...
...
@@ -296,7 +298,7 @@ export class AppController {
},
);
const
fileURL
=
`
${
this
.
GITPOD_URL
.
slice
(
0
,
this
.
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
+
"
9000-
"
+
this
.
GITPOD_URL
.
slice
(
this
.
GITPOD_URL
.
indexOf
(
'
/
'
)
+
2
)
}
/
${
this
.
configService
.
get
(
'
MINIO_BUCKETNAME
'
)}
/
${
fileName
}
`
;
const
fileURL
=
`
${
this
.
MINIO_URL
}
/
${
this
.
configService
.
get
(
'
MINIO_BUCKETNAME
'
)}
/
${
fileName
}
`
;
console
.
log
(
'
Uploaded File:
'
,
fileURL
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets