Add version management dashboard
This commit is contained in:
48
dashboard/main.py
Normal file
48
dashboard/main.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import pandas as pd
|
||||
import streamlit as st
|
||||
from streamlit_js_eval import streamlit_js_eval
|
||||
from settings import *
|
||||
from sidebar import show_sidebar
|
||||
|
||||
def highlight_disabled_col(value):
|
||||
return 'background-color: #F0F2F6'
|
||||
|
||||
def init_page():
|
||||
st.set_page_config(
|
||||
page_title='DataSaker Version Management',
|
||||
layout='wide'
|
||||
)
|
||||
st.header('DataSaker Version Management')
|
||||
st.subheader(get_datasaker())
|
||||
|
||||
if __name__=='__main__':
|
||||
|
||||
init_page()
|
||||
|
||||
col1, col2 = st.columns([7, 3])
|
||||
with col1:
|
||||
st.subheader('Service')
|
||||
|
||||
if st.button('Data Reload'):
|
||||
git_pull()
|
||||
streamlit_js_eval(js_expressions='parent.window.location.reload()')
|
||||
|
||||
df = pd.DataFrame.from_dict(get_service())
|
||||
regex = '^release-[0-9]+.[0-9]+.[0-9]+$'
|
||||
edited_df = st.data_editor(
|
||||
df.style.applymap(highlight_disabled_col),
|
||||
key='data_editor',
|
||||
column_config={
|
||||
'type': st.column_config.TextColumn('Type', disabled=True),
|
||||
'name': st.column_config.TextColumn('Name', disabled=True, width='medium'),
|
||||
'latest_candidate_version': st.column_config.TextColumn('Candidate Latest Version', disabled=True),
|
||||
'candidate_version': st.column_config.TextColumn('Candidate Version', validate=regex),
|
||||
'release_version': st.column_config.TextColumn('Release Version', validate=regex),
|
||||
'product_version': st.column_config.TextColumn('Product Version', validate=regex)
|
||||
}
|
||||
)
|
||||
with col2:
|
||||
st.text('Edited Rows')
|
||||
st.write(st.session_state['data_editor']['edited_rows'])
|
||||
|
||||
show_sidebar(df, edited_df)
|
||||
Reference in New Issue
Block a user