Skip to content

Commit 6d6d15a

Browse files
committed
refactor: 适配dash3.x、fac0.4.x、fuc0.3.x版本
1 parent e914d5e commit 6d6d15a

34 files changed

Lines changed: 223 additions & 164 deletions

File tree

‎dash-fastapi-frontend/callbacks/layout_c/head_c.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
true
3232
]
3333
}
34-
return window.dash_clientside.no_update;
34+
throw window.dash_clientside.PreventUpdate;
3535
}
3636
""",
3737
[
@@ -88,7 +88,7 @@ def logout_confirm(okCounts):
8888
return custom_color;
8989
}
9090
}
91-
return window.dash_clientside.no_update;
91+
throw window.dash_clientside.PreventUpdate;
9292
}
9393
""",
9494
Output('hex-color-picker', 'color', allow_duplicate=True),

‎dash-fastapi-frontend/callbacks/login_c.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
running=[
4343
[Output('login-submit', 'loading'), True, False],
4444
[Output('login-submit', 'children'), '登录中', '登录'],
45-
[Output('login-captcha-image-container', 'n_clicks'), 0, 1],
45+
[Output('login-captcha-image-container', 'nClicks'), 0, 1],
4646
],
4747
prevent_initial_call=True,
4848
)
@@ -130,7 +130,7 @@ def login_auth(
130130
Output('login-captcha-image', 'src'),
131131
Output('captcha_image-session_id-container', 'data'),
132132
],
133-
Input('login-captcha-image-container', 'n_clicks'),
133+
Input('login-captcha-image-container', 'nClicks'),
134134
State('login-success-container', 'data'),
135135
prevent_initial_call=True,
136136
)
@@ -140,7 +140,7 @@ def change_login_captcha_image(captcha_click, login_success):
140140
captcha_enabled = captcha_image_info.get('captcha_enabled')
141141
forget_enabled = captcha_image_info.get('forget_enabled')
142142
register_enabled = captcha_image_info.get('register_enabled')
143-
captcha_image = f"data:image/gif;base64,{captcha_image_info.get('img')}"
143+
captcha_image = f'data:image/gif;base64,{captcha_image_info.get("img")}'
144144
session_id = captcha_image_info.get('uuid')
145145

146146
return [
@@ -202,7 +202,7 @@ def random_login_bg(pathname):
202202
Output('login-username', 'value'),
203203
Output('login-password', 'value'),
204204
],
205-
Input('login-page', 'id'),
205+
Input('login-timeout', 'timeoutCount'),
206206
)
207207

208208

‎dash-fastapi-frontend/callbacks/monitor_c/job_c/job_c.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import uuid
32
from dash import ctx, dcc, no_update
43
from dash.dependencies import ALL, Input, Output, State
54
from dash.exceptions import PreventUpdate
@@ -67,7 +66,6 @@ def generate_job_table(query_params: Dict):
6766
job_table_pagination=Output(
6867
'job-list-table', 'pagination', allow_duplicate=True
6968
),
70-
job_table_key=Output('job-list-table', 'key'),
7169
job_table_selectedrowkeys=Output('job-list-table', 'selectedRowKeys'),
7270
),
7371
inputs=dict(
@@ -115,7 +113,6 @@ def get_job_table_data(
115113
return dict(
116114
job_table_data=table_data,
117115
job_table_pagination=table_pagination,
118-
job_table_key=str(uuid.uuid4()),
119116
job_table_selectedrowkeys=None,
120117
)
121118

@@ -129,7 +126,7 @@ def get_job_table_data(
129126
if (reset_click) {
130127
return [null, null, null, {'type': 'reset'}]
131128
}
132-
return window.dash_clientside.no_update;
129+
throw window.dash_clientside.PreventUpdate;
133130
}
134131
""",
135132
[
@@ -153,7 +150,7 @@ def get_job_table_data(
153150
hidden_status ? '隐藏搜索' : '显示搜索'
154151
]
155152
}
156-
return window.dash_clientside.no_update;
153+
throw window.dash_clientside.PreventUpdate;
157154
}
158155
""",
159156
[

‎dash-fastapi-frontend/callbacks/monitor_c/job_c/job_log_c.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import uuid
32
from dash import ctx, dcc
43
from dash.dependencies import ALL, Input, Output, State
54
from dash.exceptions import PreventUpdate
@@ -19,7 +18,6 @@
1918
job_log_table_pagination=Output(
2019
'job_log-list-table', 'pagination', allow_duplicate=True
2120
),
22-
job_log_table_key=Output('job_log-list-table', 'key'),
2321
job_log_table_selectedrowkeys=Output(
2422
'job_log-list-table', 'selectedRowKeys'
2523
),
@@ -105,7 +103,6 @@ def get_job_log_table_data(
105103
return dict(
106104
job_log_table_data=table_data,
107105
job_log_table_pagination=table_pagination,
108-
job_log_table_key=str(uuid.uuid4()),
109106
job_log_table_selectedrowkeys=None,
110107
)
111108

@@ -119,7 +116,7 @@ def get_job_log_table_data(
119116
if (reset_click) {
120117
return [null, null, null, null, {'type': 'reset'}]
121118
}
122-
return window.dash_clientside.no_update;
119+
throw window.dash_clientside.PreventUpdate;
123120
}
124121
""",
125122
[
@@ -144,7 +141,7 @@ def get_job_log_table_data(
144141
hidden_status ? '隐藏搜索' : '显示搜索'
145142
]
146143
}
147-
return window.dash_clientside.no_update;
144+
throw window.dash_clientside.PreventUpdate;
148145
}
149146
""",
150147
[

‎dash-fastapi-frontend/callbacks/monitor_c/logininfor_c.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import uuid
32
from dash import ctx, dcc, no_update
43
from dash.dependencies import Input, Output, State, ALL
54
from dash.exceptions import PreventUpdate
@@ -46,7 +45,6 @@ def generate_logininfor_table(query_params: Dict):
4645
login_log_table_pagination=Output(
4746
'login_log-list-table', 'pagination', allow_duplicate=True
4847
),
49-
login_log_table_key=Output('login_log-list-table', 'key'),
5048
login_log_table_selectedrowkeys=Output(
5149
'login_log-list-table', 'selectedRowKeys'
5250
),
@@ -93,7 +91,7 @@ def get_login_log_table_data(
9391
begin_time=begin_time,
9492
end_time=end_time,
9593
order_by_column=sorter.get('columns')[0] if sorter else None,
96-
is_asc=f"{sorter.get('orders')[0]}ing" if sorter else None,
94+
is_asc=f'{sorter.get("orders")[0]}ing' if sorter else None,
9795
page_num=1,
9896
page_size=10,
9997
)
@@ -110,7 +108,6 @@ def get_login_log_table_data(
110108
return dict(
111109
login_log_table_data=table_data,
112110
login_log_table_pagination=table_pagination,
113-
login_log_table_key=str(uuid.uuid4()),
114111
login_log_table_selectedrowkeys=None,
115112
)
116113

@@ -124,7 +121,7 @@ def get_login_log_table_data(
124121
if (reset_click) {
125122
return [null, null, null, null, {'type': 'reset'}]
126123
}
127-
return window.dash_clientside.no_update;
124+
throw window.dash_clientside.PreventUpdate;
128125
}
129126
""",
130127
[
@@ -149,7 +146,7 @@ def get_login_log_table_data(
149146
hidden_status ? '隐藏搜索' : '显示搜索'
150147
]
151148
}
152-
return window.dash_clientside.no_update;
149+
throw window.dash_clientside.PreventUpdate;
153150
}
154151
""",
155152
[
@@ -301,7 +298,7 @@ def export_login_log_list(
301298
begin_time=begin_time,
302299
end_time=end_time,
303300
order_by_column=sorter.get('columns')[0] if sorter else None,
304-
is_asc=f"{sorter.get('orders')[0]}ing" if sorter else None,
301+
is_asc=f'{sorter.get("orders")[0]}ing' if sorter else None,
305302
)
306303
export_login_log_res = LogininforApi.export_logininfor(export_params)
307304
export_login_log = export_login_log_res.content

‎dash-fastapi-frontend/callbacks/monitor_c/online_c.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import uuid
21
from dash import ctx
32
from dash.dependencies import ALL, Input, Output, State
43
from dash.exceptions import PreventUpdate
@@ -45,7 +44,6 @@ def generate_online_table(query_params: Dict):
4544
online_table_pagination=Output(
4645
'online-list-table', 'pagination', allow_duplicate=True
4746
),
48-
online_table_key=Output('online-list-table', 'key'),
4947
online_table_selectedrowkeys=Output(
5048
'online-list-table', 'selectedRowKeys'
5149
),
@@ -89,7 +87,6 @@ def get_online_table_data(
8987
return dict(
9088
online_table_data=table_data,
9189
online_table_pagination=table_pagination,
92-
online_table_key=str(uuid.uuid4()),
9390
online_table_selectedrowkeys=None,
9491
)
9592

@@ -103,7 +100,7 @@ def get_online_table_data(
103100
if (reset_click) {
104101
return [null, null, {'type': 'reset'}]
105102
}
106-
return window.dash_clientside.no_update;
103+
throw window.dash_clientside.PreventUpdate;
107104
}
108105
""",
109106
[
@@ -126,7 +123,7 @@ def get_online_table_data(
126123
hidden_status ? '隐藏搜索' : '显示搜索'
127124
]
128125
}
129-
return window.dash_clientside.no_update;
126+
throw window.dash_clientside.PreventUpdate;
130127
}
131128
""",
132129
[

‎dash-fastapi-frontend/callbacks/monitor_c/operlog_c.py‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import uuid
32
from dash import ctx, dcc
43
from dash.dependencies import Input, Output, State, ALL
54
from dash.exceptions import PreventUpdate
@@ -42,7 +41,7 @@ def generate_operlog_table(query_params: Dict):
4241
item.get('oper_time')
4342
)
4443
item['key'] = str(item['oper_id'])
45-
item['cost_time'] = f"{item['cost_time']}毫秒"
44+
item['cost_time'] = f'{item["cost_time"]}毫秒'
4645
item['operation'] = [
4746
{'content': '详情', 'type': 'link', 'icon': 'antd-eye'}
4847
if PermissionManager.check_perms('monitor:operlog:query')
@@ -60,7 +59,6 @@ def generate_operlog_table(query_params: Dict):
6059
operation_log_table_pagination=Output(
6160
'operation_log-list-table', 'pagination', allow_duplicate=True
6261
),
63-
operation_log_table_key=Output('operation_log-list-table', 'key'),
6462
operation_log_table_selectedrowkeys=Output(
6563
'operation_log-list-table', 'selectedRowKeys'
6664
),
@@ -110,7 +108,7 @@ def get_operation_log_table_data(
110108
begin_time=begin_time,
111109
end_time=end_time,
112110
order_by_column=sorter.get('columns')[0] if sorter else None,
113-
is_asc=f"{sorter.get('orders')[0]}ing" if sorter else None,
111+
is_asc=f'{sorter.get("orders")[0]}ing' if sorter else None,
114112
page_num=1,
115113
page_size=10,
116114
)
@@ -127,7 +125,6 @@ def get_operation_log_table_data(
127125
return dict(
128126
operation_log_table_data=table_data,
129127
operation_log_table_pagination=table_pagination,
130-
operation_log_table_key=str(uuid.uuid4()),
131128
operation_log_table_selectedrowkeys=None,
132129
)
133130

@@ -141,7 +138,7 @@ def get_operation_log_table_data(
141138
if (reset_click) {
142139
return [null, null, null, null, null, {'type': 'reset'}]
143140
}
144-
return window.dash_clientside.no_update;
141+
throw window.dash_clientside.PreventUpdate;
145142
}
146143
""",
147144
[
@@ -167,7 +164,7 @@ def get_operation_log_table_data(
167164
hidden_status ? '隐藏搜索' : '显示搜索'
168165
]
169166
}
170-
return window.dash_clientside.no_update;
167+
throw window.dash_clientside.PreventUpdate;
171168
}
172169
""",
173170
[
@@ -370,7 +367,7 @@ def export_operation_log_list(
370367
begin_time=begin_time,
371368
end_time=end_time,
372369
order_by_column=sorter.get('columns')[0] if sorter else None,
373-
is_asc=f"{sorter.get('orders')[0]}ing" if sorter else None,
370+
is_asc=f'{sorter.get("orders")[0]}ing' if sorter else None,
374371
)
375372
export_operation_log_res = OperlogApi.export_operlog(export_params)
376373
export_operation_log = export_operation_log_res.content

‎dash-fastapi-frontend/callbacks/system_c/config_c.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import uuid
32
from dash import ctx, dcc, no_update
43
from dash.dependencies import ALL, Input, Output, State
54
from dash.exceptions import PreventUpdate
@@ -59,7 +58,6 @@ def generate_config_table(query_params: Dict):
5958
config_table_pagination=Output(
6059
'config-list-table', 'pagination', allow_duplicate=True
6160
),
62-
config_table_key=Output('config-list-table', 'key'),
6361
config_table_selectedrowkeys=Output(
6462
'config-list-table', 'selectedRowKeys'
6563
),
@@ -120,7 +118,6 @@ def get_config_table_data(
120118
return dict(
121119
config_table_data=table_data,
122120
config_table_pagination=table_pagination,
123-
config_table_key=str(uuid.uuid4()),
124121
config_table_selectedrowkeys=None,
125122
)
126123

@@ -134,7 +131,7 @@ def get_config_table_data(
134131
if (reset_click) {
135132
return [null, null, null, null, {'type': 'reset'}]
136133
}
137-
return window.dash_clientside.no_update;
134+
throw window.dash_clientside.PreventUpdate;
138135
}
139136
""",
140137
[
@@ -159,7 +156,7 @@ def get_config_table_data(
159156
hidden_status ? '隐藏搜索' : '显示搜索'
160157
]
161158
}
162-
return window.dash_clientside.no_update;
159+
throw window.dash_clientside.PreventUpdate;
163160
}
164161
""",
165162
[

‎dash-fastapi-frontend/callbacks/system_c/dept_c.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def get_dept_table_data(
148148
if (reset_click) {
149149
return [null, null, {'type': 'reset'}]
150150
}
151-
return window.dash_clientside.no_update;
151+
throw window.dash_clientside.PreventUpdate;
152152
}
153153
""",
154154
[
@@ -170,7 +170,7 @@ def get_dept_table_data(
170170
hidden_status ? '隐藏搜索' : '显示搜索'
171171
]
172172
}
173-
return window.dash_clientside.no_update;
173+
throw window.dash_clientside.PreventUpdate;
174174
}
175175
""",
176176
[

‎dash-fastapi-frontend/callbacks/system_c/dict_c/dict_c.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import uuid
32
from dash import ctx, dcc, no_update
43
from dash.dependencies import Input, Output, State, ALL
54
from dash.exceptions import PreventUpdate
@@ -64,7 +63,6 @@ def generate_dict_type_table(query_params: Dict):
6463
dict_type_table_pagination=Output(
6564
'dict_type-list-table', 'pagination', allow_duplicate=True
6665
),
67-
dict_type_table_key=Output('dict_type-list-table', 'key'),
6866
dict_type_table_selectedrowkeys=Output(
6967
'dict_type-list-table', 'selectedRowKeys'
7068
),
@@ -124,7 +122,6 @@ def get_dict_type_table_data(
124122
return dict(
125123
dict_type_table_data=table_data,
126124
dict_type_table_pagination=table_pagination,
127-
dict_type_table_key=str(uuid.uuid4()),
128125
dict_type_table_selectedrowkeys=None,
129126
)
130127

@@ -138,7 +135,7 @@ def get_dict_type_table_data(
138135
if (reset_click) {
139136
return [null, null, null, null, {'type': 'reset'}]
140137
}
141-
return window.dash_clientside.no_update;
138+
throw window.dash_clientside.PreventUpdate;
142139
}
143140
""",
144141
[
@@ -163,7 +160,7 @@ def get_dict_type_table_data(
163160
hidden_status ? '隐藏搜索' : '显示搜索'
164161
]
165162
}
166-
return window.dash_clientside.no_update;
163+
throw window.dash_clientside.PreventUpdate;
167164
}
168165
""",
169166
[

0 commit comments

Comments
 (0)