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-Registration-Core
Commits
81e594cb
Commit
81e594cb
authored
4 years ago
by
Dileep Bapat
Browse files
Options
Download
Patches
Plain Diff
Adding entity to registry
parent
40db545a
old.march21
No related merge requests found
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
registry-portal/public/keycloak.json
+1
-1
registry-portal/public/keycloak.json
registry-portal/src/App.js
+4
-1
registry-portal/src/App.js
registry-portal/src/components/Add/Add.js
+63
-0
registry-portal/src/components/Add/Add.js
registry-portal/src/components/Add/Add.module.css
+27
-0
registry-portal/src/components/Add/Add.module.css
registry-portal/src/components/Admin/Admin.js
+10
-5
registry-portal/src/components/Admin/Admin.js
registry-portal/src/components/EntityRegistry/EntityRegistry.js
+1
-0
...ry-portal/src/components/EntityRegistry/EntityRegistry.js
registry-portal/src/components/UploadHistory/UploadHistory.js
+33
-24
...stry-portal/src/components/UploadHistory/UploadHistory.js
registry-portal/src/utils/constants.js
+2
-0
registry-portal/src/utils/constants.js
with
141 additions
and
31 deletions
+141
-31
registry-portal/public/keycloak.json
+
1
−
1
View file @
81e594cb
{
"realm"
:
"divoc"
,
"auth-server-url"
:
"/auth/"
,
"auth-server-url"
:
"
https://divoc.xiv.in
/auth/"
,
"ssl-required"
:
"external"
,
"resource"
:
"facility-admin-portal"
,
"public-client"
:
true
,
...
...
This diff is collapsed.
Click to expand it.
registry-portal/src/App.js
+
4
−
1
View file @
81e594cb
...
...
@@ -23,6 +23,7 @@ import FacilityInfo from './components/FacilityInfo/FacilityInfo';
import
{
addFacilityDetails
}
from
"
./redux/reducers/facilityReducer
"
;
import
{
useAxios
}
from
"
./utils/useAxios
"
;
import
FacilityConfigureSlot
from
"
./components/FacilityConfigureSlot
"
;
import
Add
from
"
./components/Add/Add
"
;
export
default
function
App
()
{
const
{
initialized
,
keycloak
}
=
useKeycloak
();
...
...
@@ -68,7 +69,9 @@ export default function App() {
<
Route
exact
path
=
{
config
.
urlPath
+
"
/analytics/map
"
}
component
=
{
MapView
}
/
>
<
PrivateRoute
exact
path
=
{
config
.
urlPath
+
"
/dashboard
"
}
component
=
{
Dashboard
}
/
>
<
PrivateRoute
exact
path
=
{
config
.
urlPath
+
"
/about
"
}
component
=
{
About
}
/
>
<
PrivateRoute
exact
path
=
{
config
.
urlPath
+
"
/admin
"
}
component
=
{
Admin
}
<
PrivateRoute
exact
path
=
{
config
.
urlPath
+
"
/admin/:entity?
"
}
component
=
{
Admin
}
role
=
{
CONSTANTS
.
ADMIN_ROLE
}
clientId
=
{
CONSTANTS
.
PORTAL_CLIENT
}
/
>
<
PrivateRoute
exact
path
=
{
config
.
urlPath
+
"
/registry/:entity
"
}
component
=
{
Add
}
role
=
{
CONSTANTS
.
ADMIN_ROLE
}
clientId
=
{
CONSTANTS
.
PORTAL_CLIENT
}
/
>
<
PrivateRoute
exact
path
=
{
config
.
urlPath
+
"
/analytics
"
}
component
=
{
Analytics
}
role
=
{
CONSTANTS
.
MONITORING
}
clientId
=
{
CONSTANTS
.
PORTAL_CLIENT
}
/
>
...
...
This diff is collapsed.
Click to expand it.
registry-portal/src/components/Add/Add.js
0 → 100644
+
63
−
0
View file @
81e594cb
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
{
TabPanels
}
from
"
../TabPanel/TabPanel
"
;
import
Entities
from
"
../EntityRegistry/EntityRegistry
"
;
import
{
Button
,
Col
}
from
"
react-bootstrap
"
;
import
{
API_URL
,
SampleCSV
}
from
"
../../utils/constants
"
;
import
DownloadImg
from
"
../../assets/img/download.svg
"
;
import
"
./Add.module.css
"
import
{
useAxios
}
from
"
../../utils/useAxios
"
;
import
AppBar
from
"
@material-ui/core/AppBar
"
;
import
Tabs
from
"
@material-ui/core/Tabs
"
;
import
Tab
from
"
@material-ui/core/Tab
"
;
import
Form
from
"
@rjsf/core
"
;
import
{
useHistory
}
from
"
react-router-dom
"
;
const
schema
=
{
title
:
"
Todo
"
,
type
:
"
object
"
,
required
:
[
"
title
"
],
properties
:
{
title
:
{
type
:
"
string
"
,
title
:
"
Title
"
,
default
:
"
A new task
"
},
done
:
{
type
:
"
boolean
"
,
title
:
"
Done?
"
,
default
:
false
}
}
};
const
log
=
(
type
)
=>
console
.
log
.
bind
(
console
,
type
);
export
default
function
Add
(
props
)
{
const
axiosInstance
=
useAxios
(
""
);
const
[
schema
,
setSchema
]
=
useState
({});
const
entityType
=
props
.
match
.
params
.
entity
;
const
history
=
useHistory
();
useEffect
(
x
=>
{
axiosInstance
.
current
.
get
(
API_URL
.
SCHEMA_BASE
+
entityType
+
"
.json
"
)
.
then
((
res
)
=>
{
setSchema
(
res
.
data
);
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
})
},
[]);
const
onSubmit
=
function
(
form
)
{
const
data
=
form
.
formData
[
entityType
];
axiosInstance
.
current
.
post
(
API_URL
.
REST_BASE
+
entityType
,
data
)
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
alert
(
'
Saved!
'
);
history
.
push
(
'
/portal/admin/
'
)
}
else
alert
(
"
Something went wrong while saving!
"
);
});
alert
(
'
submit
'
+
form
.
formData
[
entityType
]);
};
return
<
div
className
=
{
"
container
"
}
>
<
Form
schema
=
{
schema
}
onChange
=
{
log
(
"
changed
"
)}
onSubmit
=
{
onSubmit
}
onError
=
{
log
(
"
errors
"
)}
/
>
<
/div
>
}
This diff is collapsed.
Click to expand it.
registry-portal/src/components/Add/Add.module.css
0 → 100644
+
27
−
0
View file @
81e594cb
.btn-template
{
border-radius
:
6px
;
border
:
none
;
color
:
#FFFFFF
;
background
:
#88C6A9
;
text-align
:
center
;
padding-top
:
10px
;
}
.btn-template
h6
{
text-align
:
center
;
font-weight
:
bold
;
font-size
:
12px
;
margin
:
0
;
padding
:
5px
;
}
.btn-template
a
{
padding
:
0
;
margin
:
0
;
}
.btn-template
img
{
width
:
25px
;
height
:
25px
;
padding
:
4px
;
}
This diff is collapsed.
Click to expand it.
registry-portal/src/components/Admin/Admin.js
+
10
−
5
View file @
81e594cb
...
...
@@ -6,17 +6,22 @@ import {API_URL, SampleCSV} from "../../utils/constants";
import
DownloadImg
from
"
../../assets/img/download.svg
"
;
import
"
./Admin.module.css
"
import
{
useAxios
}
from
"
../../utils/useAxios
"
;
import
AppBar
from
"
@material-ui/core/AppBar
"
;
import
Tabs
from
"
@material-ui/core/Tabs
"
;
import
Tab
from
"
@material-ui/core/Tab
"
;
export
default
function
Admin
()
{
export
default
function
Admin
(
props
)
{
const
axiosInstance
=
useAxios
(
""
);
const
[
entities
,
setEntities
]
=
useState
([]);
const
entityType
=
props
.
match
.
params
.
entity
;
useEffect
(()
=>
{
axiosInstance
.
current
.
get
(
API_URL
.
REGISTRY_LIST
)
.
then
((
res
)
=>
{
setEntities
(
res
.
data
.
result
);
const
entities
=
res
.
data
.
result
.
filter
(
x
=>
x
[
0
]
!=
x
[
0
].
toLowerCase
())
setEntities
(
entities
);
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
...
...
@@ -36,13 +41,13 @@ export default function Admin() {
return
entities
.
map
(
ent
=>
{
return
{
title
:
ent
,
component
:
<
Entities
type
=
{
ent
}
/>
,
rightTabContent
:
renderDownloadTemplateButton
(
SampleCSV
.
FACILITY_REGISTRY
)
component
:
<
Entities
type
=
{
ent
}
/
>
// ,
rightTabContent: renderDownloadTemplateButton(SampleCSV.FACILITY_REGISTRY)
}
});
}
return
entities
.
length
>
0
&&
(
<
TabPanels
tabs
=
{
fetchTabs
()}
/
>
<
TabPanels
tabs
=
{
fetchTabs
()}
/
>
);
}
This diff is collapsed.
Click to expand it.
registry-portal/src/components/EntityRegistry/EntityRegistry.js
+
1
−
0
View file @
81e594cb
...
...
@@ -58,6 +58,7 @@ function Entities({type}) {
emptyListMessage
=
{
"
No Entity Found
"
}
tableData
=
{
data
}
tableHeader
=
{
HeaderData
}
entityType
=
{
type
}
onRefresh
=
{()
=>
fetchTableDetails
()}
/
>
}
...
...
This diff is collapsed.
Click to expand it.
registry-portal/src/components/UploadHistory/UploadHistory.js
+
33
−
24
View file @
81e594cb
...
...
@@ -12,6 +12,10 @@ import "./UploadHistory.css";
import
{
TotalRecords
}
from
"
../TotalRecords
"
;
import
Modal
from
"
react-bootstrap/Modal
"
;
import
IconButton
from
"
@material-ui/core/IconButton
"
;
import
Checkbox
from
"
@material-ui/core/Checkbox
"
;
import
{
useHistory
}
from
'
react-router-dom
'
;
import
{
identity
}
from
"
ramda
"
;
const
UploadHistory
=
({
fileUploadAPI
,
...
...
@@ -24,12 +28,13 @@ const UploadHistory = ({
tableData
,
tableHeader
,
onRefresh
,
entityType
})
=>
{
const
axiosInstance
=
useAxios
(
""
);
const
[
uploadHistory
,
setUploadHistory
]
=
useState
([]);
const
[
selectedHistory
,
setSelectedHistory
]
=
useState
(
null
);
const
[
show
,
setShow
]
=
useState
(
false
);
const
history
=
useHistory
();
const
handleClose
=
()
=>
setShow
(
false
);
const
handleShow
=
()
=>
setShow
(
true
);
useEffect
(()
=>
{
...
...
@@ -86,6 +91,9 @@ const UploadHistory = ({
}
return
0
;
}
const
handleAdd
=
function
()
{
history
.
push
(
'
/portal/registry/
'
+
entityType
)
};
return
(
<
div
>
...
...
@@ -96,18 +104,19 @@ const UploadHistory = ({
count
=
{
getTotalRegistryUploadCount
()}
/
>
)}
<
UploadComponent
fileUploadAPI
=
{
fileUploadAPI
}
onUploadComplete
=
{()
=>
{
fetchUploadHistory
();
if
(
onRefresh
)
{
onRefresh
();
}
}}
uploadHistoryCount
=
{
selectedHistory
&&
selectedHistory
.
success
}
errorCount
=
{
selectedHistory
&&
selectedHistory
.
errors
}
handleShow
=
{
handleShow
}
/
>
<
IconButton
onClick
=
{
handleAdd
}
>
Add
/
Invite
<
/IconButton
>
{
/*<UploadComponent*/
}
{
/* fileUploadAPI={fileUploadAPI}*/
}
{
/* onUploadComplete={() => {*/
}
{
/* fetchUploadHistory();*/
}
{
/* if (onRefresh) {*/
}
{
/* onRefresh();*/
}
{
/* }*/
}
{
/* }}*/
}
{
/* uploadHistoryCount={selectedHistory && selectedHistory.success}*/
}
{
/* errorCount={selectedHistory && selectedHistory.errors}*/
}
{
/* handleShow={handleShow}*/
}
{
/*/>*/
}
<
/div
>
<
div
className
=
"
upload-csv-container
"
>
<
div
className
=
"
upload-history
"
>
...
...
@@ -118,17 +127,17 @@ const UploadHistory = ({
emptyListMessage
=
{
emptyListMessage
}
/
>
<
/div
>
<
div
className
=
"
upload-history
"
>
<
UploadHistoryTable
data
=
{
uploadHistory
}
headerData
=
{
uploadCSVHeaderData
}
onCellClicked
=
{(
value
)
=>
{
setSelectedHistory
(
value
);
handleShow
();
}}
title
=
"
Uploads History
"
/>
<
/div
>
{
/*
<div className="upload-history">
*/
}
{
/*
<UploadHistoryTable
*/
}
{
/*
data={uploadHistory}
*/
}
{
/*
headerData={uploadCSVHeaderData}
*/
}
{
/*
onCellClicked={(value) => {
*/
}
{
/*
setSelectedHistory(value);
*/
}
{
/*
handleShow();
*/
}
{
/*
}}
*/
}
{
/*
title="Uploads History"
*/
}
{
/*
/>
*/
}
{
/*
</div>
*/
}
<
div
className
=
"
error-temp
"
>
{
selectedHistory
&&
(
<
UploadErrors
uploadHistory
=
{
selectedHistory
}
...
...
This diff is collapsed.
Click to expand it.
registry-portal/src/utils/constants.js
+
2
−
0
View file @
81e594cb
...
...
@@ -22,6 +22,8 @@ export const FACILITY_TYPE = Object.freeze({
export
const
API_URL
=
Object
.
freeze
({
REGISTRY_SEARCH
:
"
http://localhost:8080/search
"
,
REGISTRY_LIST
:
"
http://localhost:8080/registers
"
,
SCHEMA_BASE
:
"
http://localhost:8080/api/docs/
"
,
REST_BASE
:
"
http://localhost:8080/api/v1/
"
,
FACILITY_API
:
"
/divoc/admin/api/v1/facilities
"
,
USER_FACILITY_API
:
"
/divoc/admin/api/v1/facility
"
,
FACILITY_NOTIFY_API
:
"
/divoc/admin/api/v1/facilities/notify
"
,
...
...
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