Add new Buefy-specific upgrade template
since that was broken..
This commit is contained in:
parent
9faaea881d
commit
f0880785a9
|
@ -8,6 +8,7 @@
|
|||
<title>${initial_msg or "Working"}...</title>
|
||||
${core_javascript()}
|
||||
${core_styles()}
|
||||
${self.extra_styles()}
|
||||
</head>
|
||||
<body style="height: 100%;">
|
||||
|
||||
|
@ -61,6 +62,8 @@
|
|||
<div style="flex-grow: 1;"></div>
|
||||
</div>
|
||||
|
||||
${self.after_progress()}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -72,23 +75,6 @@
|
|||
let WholePage = {
|
||||
template: '#whole-page-template',
|
||||
|
||||
data() {
|
||||
return {
|
||||
progressURL: '${url('progress', key=progress.key, _query={'sessiontype': progress.session.type})}',
|
||||
progressMessage: "${(initial_msg or "Working").replace('"', '\\"')} (please wait)",
|
||||
progressMax: null,
|
||||
progressMaxDisplay: null,
|
||||
progressValue: null,
|
||||
stillInProgress: true,
|
||||
|
||||
% if can_cancel:
|
||||
canCancel: true,
|
||||
cancelURL: '${url('progress.cancel', key=progress.key, _query={'sessiontype': progress.session.type})}',
|
||||
cancelingProgress: false,
|
||||
% endif
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
totalDisplay() {
|
||||
|
@ -113,10 +99,15 @@
|
|||
setTimeout(() => {
|
||||
this.updateProgress()
|
||||
}, 1000)
|
||||
|
||||
// custom logic if applicable
|
||||
this.mountedCustom()
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
mountedCustom() {},
|
||||
|
||||
updateProgress() {
|
||||
|
||||
this.$http.get(this.progressURL).then(response => {
|
||||
|
@ -146,6 +137,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
// custom logic if applicable
|
||||
this.updateProgressCustom(response)
|
||||
|
||||
if (this.stillInProgress) {
|
||||
|
||||
// fetch progress data again, in one second from now
|
||||
|
@ -157,6 +151,8 @@
|
|||
})
|
||||
},
|
||||
|
||||
updateProgressCustom(response) {},
|
||||
|
||||
% if can_cancel:
|
||||
|
||||
cancelProgress() {
|
||||
|
@ -178,13 +174,46 @@
|
|||
}
|
||||
}
|
||||
|
||||
Vue.component('whole-page', WholePage)
|
||||
let WholePageData = {
|
||||
|
||||
new Vue({
|
||||
el: '#whole-page-app'
|
||||
})
|
||||
progressURL: '${url('progress', key=progress.key, _query={'sessiontype': progress.session.type})}',
|
||||
progressMessage: "${(initial_msg or "Working").replace('"', '\\"')} (please wait)",
|
||||
progressMax: null,
|
||||
progressMaxDisplay: null,
|
||||
progressValue: null,
|
||||
stillInProgress: true,
|
||||
|
||||
% if can_cancel:
|
||||
canCancel: true,
|
||||
cancelURL: '${url('progress.cancel', key=progress.key, _query={'sessiontype': progress.session.type})}',
|
||||
cancelingProgress: false,
|
||||
% endif
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
${self.modify_whole_page_vars()}
|
||||
${self.make_whole_page_app()}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<%def name="extra_styles()"></%def>
|
||||
|
||||
<%def name="after_progress()"></%def>
|
||||
|
||||
<%def name="modify_whole_page_vars()"></%def>
|
||||
|
||||
<%def name="make_whole_page_app()">
|
||||
<script type="text/javascript">
|
||||
|
||||
WholePage.data = function() { return WholePageData }
|
||||
|
||||
Vue.component('whole-page', WholePage)
|
||||
|
||||
new Vue({
|
||||
el: '#whole-page-app'
|
||||
})
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
|
69
tailbone/templates/themes/falafel/upgrade.mako
Normal file
69
tailbone/templates/themes/falafel/upgrade.mako
Normal file
|
@ -0,0 +1,69 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/progress.mako" />
|
||||
|
||||
<%def name="extra_styles()">
|
||||
${parent.extra_styles()}
|
||||
<style type="text/css">
|
||||
|
||||
.progress-with-textout {
|
||||
border: 1px solid Black;
|
||||
line-height: 1.2;
|
||||
margin-top: 1rem;
|
||||
overflow: auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="after_progress()">
|
||||
<!-- <div ref="stdout" class="stdout"></div> -->
|
||||
|
||||
<div ref="textout"
|
||||
class="progress-with-textout is-family-monospace is-size-7">
|
||||
<span v-for="line in progressOutput"
|
||||
:key="line.key"
|
||||
v-html="line.text">
|
||||
</span>
|
||||
|
||||
## nb. we auto-scroll down to "see" this element
|
||||
<div ref="seeme"></div>
|
||||
</div>
|
||||
|
||||
</%def>
|
||||
|
||||
<%def name="modify_whole_page_vars()">
|
||||
<script type="text/javascript">
|
||||
|
||||
WholePageData.progressURL = '${url('upgrades.execute_progress', uuid=instance.uuid)}'
|
||||
WholePageData.progressOutput = []
|
||||
WholePageData.progressOutputCounter = 0
|
||||
|
||||
WholePage.methods.mountedCustom = function() {
|
||||
|
||||
// grow the textout area to fill most of screen
|
||||
let textout = this.$refs.textout
|
||||
let height = window.innerHeight - textout.offsetTop - 100
|
||||
textout.style.height = height + 'px'
|
||||
}
|
||||
|
||||
WholePage.methods.updateProgressCustom = function(response) {
|
||||
if (response.data.stdout) {
|
||||
|
||||
// add lines to textout area
|
||||
this.progressOutput.push({
|
||||
key: ++this.progressOutputCounter,
|
||||
text: response.data.stdout})
|
||||
|
||||
// scroll down to end of textout area
|
||||
this.$nextTick(() => {
|
||||
this.$refs.seeme.scrollIntoView({behavior: 'smooth'})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
|
@ -78,13 +78,15 @@
|
|||
<%def name="render_buefy_form()">
|
||||
<div class="form">
|
||||
<${form.component}
|
||||
% if expose_websockets and master.has_perm('execute'):
|
||||
% if master.has_perm('execute'):
|
||||
@declare-failure-click="declareFailureClick"
|
||||
:declare-failure-submitting="declareFailureSubmitting"
|
||||
% if expose_websockets:
|
||||
% if instance_executable:
|
||||
@execute-upgrade-click="executeUpgrade"
|
||||
% endif
|
||||
:upgrade-executing="upgradeExecuting"
|
||||
@declare-failure-click="declareFailureClick"
|
||||
:declare-failure-submitting="declareFailureSubmitting"
|
||||
% endif
|
||||
% endif
|
||||
>
|
||||
</${form.component}>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
Model Master View
|
||||
"""
|
||||
|
||||
import io
|
||||
import os
|
||||
import csv
|
||||
import datetime
|
||||
|
@ -33,7 +34,6 @@ import tempfile
|
|||
import logging
|
||||
|
||||
import json
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
import sqlalchemy_continuum as continuum
|
||||
|
@ -115,6 +115,7 @@ class MasterView(View):
|
|||
executable = False
|
||||
execute_progress_template = None
|
||||
execute_progress_initial_msg = None
|
||||
execute_can_cancel = True
|
||||
supports_prev_next = False
|
||||
supports_import_batch_from_file = False
|
||||
has_input_file_templates = False
|
||||
|
@ -1839,6 +1840,7 @@ class MasterView(View):
|
|||
return self.render_progress(progress, {
|
||||
'instance': obj,
|
||||
'initial_msg': self.execute_progress_initial_msg,
|
||||
'can_cancel': self.execute_can_cancel,
|
||||
'cancel_url': self.get_action_url('view', obj),
|
||||
'cancel_msg': "{} execution was canceled".format(model_title),
|
||||
}, template=self.execute_progress_template)
|
||||
|
@ -3785,7 +3787,7 @@ class MasterView(View):
|
|||
"""
|
||||
obj = self.get_instance()
|
||||
fields = self.get_row_csv_fields()
|
||||
data = six.StringIO()
|
||||
data = io.StringIO()
|
||||
writer = UnicodeDictWriter(data, fields)
|
||||
writer.writeheader()
|
||||
for row in self.get_effective_row_data(sort=True):
|
||||
|
|
|
@ -60,6 +60,7 @@ class UpgradeView(MasterView):
|
|||
executable = True
|
||||
execute_progress_template = '/upgrade.mako'
|
||||
execute_progress_initial_msg = "Upgrading"
|
||||
execute_can_cancel = False
|
||||
|
||||
labels = {
|
||||
'executed_by': "Executed by",
|
||||
|
|
Loading…
Reference in a new issue