first commit
This commit is contained in:
0
streamlit_dashboard/streamlit_pages/__init__.py
Normal file
0
streamlit_dashboard/streamlit_pages/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
38
streamlit_dashboard/streamlit_pages/admin_streamlit_page.py
Normal file
38
streamlit_dashboard/streamlit_pages/admin_streamlit_page.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import streamlit as st
|
||||
from streamlit_authenticator import Authenticate
|
||||
|
||||
# Imports from this module
|
||||
from streamlit_constants import ADMIN_ROLE_NAME
|
||||
from streamlit_constants import USDA_API_KEY, CENSUS_YEAR
|
||||
from page_classes.naics_report_page_class import NaicsReportPage
|
||||
from page_classes.report_comparer_page_class import ComparerPage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.admin_panel_page_class import AdminPanelPage
|
||||
|
||||
authenticator:Authenticate = st.session_state.get('authenticator')
|
||||
|
||||
st.set_page_config(layout='wide')
|
||||
|
||||
PAGE_CLASS_STATE_KEY = 'admin_page_session_state'
|
||||
|
||||
if st.session_state.get('authentication_status'):
|
||||
user_roles = st.session_state.get('roles', [])
|
||||
if user_roles and ADMIN_ROLE_NAME in user_roles:
|
||||
authenticator.logout()
|
||||
st.write(f'Welcome *{st.session_state.get("name")}*')
|
||||
|
||||
if PAGE_CLASS_STATE_KEY in st.session_state:
|
||||
admin_page = st.session_state[PAGE_CLASS_STATE_KEY]
|
||||
else:
|
||||
admin_page = AdminPanelPage()
|
||||
st.session_state[PAGE_CLASS_STATE_KEY] = admin_page
|
||||
|
||||
admin_page.render(st.container())
|
||||
else:
|
||||
authenticator.logout()
|
||||
st.write(f"You do not have the '{ADMIN_ROLE_NAME}' role required to access this page.")
|
||||
st.write(f"See https://github.com/mkhorasani/Streamlit-Authenticator?tab=readme-ov-file#3-creating-a-config-file for how to modify the authentication config file to add this role to an account.")
|
||||
elif st.session_state.get('authentication_status') is False:
|
||||
st.error('Username/password is incorrect')
|
||||
elif st.session_state.get('authentication_status') is None:
|
||||
st.warning('Please enter your username and password')
|
||||
11
streamlit_dashboard/streamlit_pages/center_streamlit_page.py
Normal file
11
streamlit_dashboard/streamlit_pages/center_streamlit_page.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import streamlit as st
|
||||
from streamlit_authenticator import Authenticate
|
||||
from page_classes.funding_milestones_page_class import NetworkFundingMilestonesReportPage
|
||||
from page_classes.center_milestones_page_class import CenterMilestonesReportPage
|
||||
# Imports from this module
|
||||
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=CenterMilestonesReportPage, report_config=REPORT_CONFIGS[CenterMilestonesReportPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,11 @@
|
||||
import streamlit as st
|
||||
from streamlit_authenticator import Authenticate
|
||||
|
||||
# Imports from this module
|
||||
from streamlit_constants import USDA_API_KEY, CENSUS_YEAR
|
||||
from page_classes.report_comparer_page_class import ComparerPage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=ComparerPage, report_config=REPORT_CONFIGS[ComparerPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,11 @@
|
||||
import streamlit as st
|
||||
from streamlit_authenticator import Authenticate
|
||||
from page_classes.funding_milestones_page_class import NetworkFundingMilestonesReportPage
|
||||
|
||||
# Imports from this module
|
||||
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=NetworkFundingMilestonesReportPage, report_config=REPORT_CONFIGS[NetworkFundingMilestonesReportPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,6 @@
|
||||
from page_classes.home_page_class import HomePage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=HomePage, report_config=REPORT_CONFIGS[HomePage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,6 @@
|
||||
from page_classes.naics_report_page_class import NaicsReportPage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=NaicsReportPage, report_config=REPORT_CONFIGS[NaicsReportPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,6 @@
|
||||
from page_classes.nbs_milestones_page_class import NetworkNbsMilestonesReportPage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=NetworkNbsMilestonesReportPage, report_config=REPORT_CONFIGS[NetworkNbsMilestonesReportPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,6 @@
|
||||
from page_classes.training_attendee_ranges_page_class import TrainingAttendeeRanges
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=TrainingAttendeeRanges, report_config=REPORT_CONFIGS[TrainingAttendeeRanges])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,6 @@
|
||||
from page_classes.training_attendee_counts_class import TrainingEventAttendeeCounts
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=TrainingEventAttendeeCounts, report_config=REPORT_CONFIGS[TrainingEventAttendeeCounts])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,7 @@
|
||||
from page_classes.training_count_statistics_page_class import TrainingsCountStatisticsPage
|
||||
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=TrainingsCountStatisticsPage, report_config=REPORT_CONFIGS[TrainingsCountStatisticsPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,6 @@
|
||||
from page_classes.training_event_count_attendee_comparison_page_class import TrainingEventCountAttendeeComparison
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=TrainingEventCountAttendeeComparison, report_config=REPORT_CONFIGS[TrainingEventCountAttendeeComparison])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,7 @@
|
||||
# Imports from this module
|
||||
from page_classes.training_event_count_page_class import TrainingsEventCountsPage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=TrainingsEventCountsPage, report_config=REPORT_CONFIGS[TrainingsEventCountsPage])
|
||||
auth_wrapper.run()
|
||||
@@ -0,0 +1,7 @@
|
||||
# Imports from this module
|
||||
from page_classes.training_primary_topics_page_class import TrainingsPrimaryTopicsPage
|
||||
from page_classes.page_class_constants import REPORT_CONFIGS
|
||||
from page_classes.authentication_page_wrapper import AuthenticationPageWrapper
|
||||
|
||||
auth_wrapper = AuthenticationPageWrapper(inner_report_page=TrainingsPrimaryTopicsPage, report_config=REPORT_CONFIGS[TrainingsPrimaryTopicsPage])
|
||||
auth_wrapper.run()
|
||||
Reference in New Issue
Block a user