finished update system
This commit is contained in:
parent
33381343ca
commit
d510921fb5
@ -23,7 +23,6 @@ def settings():
|
||||
t_apps = TemplateApps.query.all()
|
||||
for t_app in t_apps:
|
||||
template_apps.append(f"{t_app.name}&&{t_app.icon}")
|
||||
update_need = check_needed()
|
||||
return render_template(
|
||||
"settings_system/settings.html",
|
||||
config_form=config_form,
|
||||
@ -31,7 +30,6 @@ def settings():
|
||||
user_form=user_form,
|
||||
template_apps=",".join(template_apps),
|
||||
version=version,
|
||||
update_need=update_need,
|
||||
)
|
||||
|
||||
|
||||
@ -70,3 +68,8 @@ def get_app_template():
|
||||
def update():
|
||||
update_dashmachine()
|
||||
return "ok"
|
||||
|
||||
|
||||
@settings_system.route("/settings/check_update", methods=["GET"])
|
||||
def check_update():
|
||||
return str(check_needed())
|
||||
|
@ -72,6 +72,23 @@ $( document ).ready(function() {
|
||||
type: 'GET',
|
||||
success: function(data){
|
||||
M.toast({html: 'DashMachine Updated'});
|
||||
$("#update-btn").removeClass('hide');
|
||||
$("#check-update-btn").addClass('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#check-update-btn").on('click', function(e) {
|
||||
$.ajax({
|
||||
url: $(this).attr('data-url'),
|
||||
type: 'GET',
|
||||
success: function(data){
|
||||
if (data === "True"){
|
||||
$("#update-btn").removeClass('hide');
|
||||
$("#check-update-btn").addClass('hide');
|
||||
} else {
|
||||
M.toast({html: 'Up to date!'});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -291,15 +291,22 @@
|
||||
<h5>DashMachine</h5>
|
||||
<p class="mb-2">version: {{ version }}</p>
|
||||
|
||||
{% if update_needed %}
|
||||
{{ button(
|
||||
float="left",
|
||||
id="update-btn",
|
||||
icon="system_update_alt",
|
||||
class="hide",
|
||||
data={"url": url_for('settings_system.update')},
|
||||
text="update available"
|
||||
) }}
|
||||
{% endif %}
|
||||
|
||||
{{ button(
|
||||
float="left",
|
||||
id="check-update-btn",
|
||||
icon="security",
|
||||
data={"url": url_for('settings_system.check_update')},
|
||||
text="check for update"
|
||||
) }}
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user