fix: inherit from wuttaweb for appinfo/index template
although for now, still must override for some link buttons
This commit is contained in:
parent
b6a8e508bf
commit
2ffc067097
|
@ -1,8 +1,7 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/master/index.mako" />
|
<%inherit file="wuttaweb:templates/appinfo/index.mako" />
|
||||||
|
|
||||||
<%def name="page_content()">
|
<%def name="page_content()">
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
|
||||||
<once-button type="is-primary"
|
<once-button type="is-primary"
|
||||||
|
@ -28,95 +27,5 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<${b}-collapse class="panel" open>
|
${parent.page_content()}
|
||||||
|
|
||||||
<template #trigger="props">
|
|
||||||
<div class="panel-heading"
|
|
||||||
style="cursor: pointer;"
|
|
||||||
role="button">
|
|
||||||
|
|
||||||
## TODO: for some reason buefy will "reuse" the icon
|
|
||||||
## element in such a way that its display does not
|
|
||||||
## refresh. so to work around that, we use different
|
|
||||||
## structure for the two icons, so buefy is forced to
|
|
||||||
## re-draw
|
|
||||||
|
|
||||||
<b-icon v-if="props.open"
|
|
||||||
pack="fas"
|
|
||||||
icon="angle-down">
|
|
||||||
</b-icon>
|
|
||||||
|
|
||||||
<span v-if="!props.open">
|
|
||||||
<b-icon pack="fas"
|
|
||||||
icon="angle-right">
|
|
||||||
</b-icon>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span>Configuration Files</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="panel-block">
|
|
||||||
<div style="width: 100%;">
|
|
||||||
<${b}-table :data="configFiles">
|
|
||||||
|
|
||||||
<${b}-table-column field="priority"
|
|
||||||
label="Priority"
|
|
||||||
v-slot="props">
|
|
||||||
{{ props.row.priority }}
|
|
||||||
</${b}-table-column>
|
|
||||||
|
|
||||||
<${b}-table-column field="path"
|
|
||||||
label="File Path"
|
|
||||||
v-slot="props">
|
|
||||||
{{ props.row.path }}
|
|
||||||
</${b}-table-column>
|
|
||||||
|
|
||||||
</${b}-table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</${b}-collapse>
|
|
||||||
|
|
||||||
<${b}-collapse class="panel"
|
|
||||||
:open="false">
|
|
||||||
|
|
||||||
<template #trigger="props">
|
|
||||||
<div class="panel-heading"
|
|
||||||
style="cursor: pointer;"
|
|
||||||
role="button">
|
|
||||||
|
|
||||||
## TODO: for some reason buefy will "reuse" the icon
|
|
||||||
## element in such a way that its display does not
|
|
||||||
## refresh. so to work around that, we use different
|
|
||||||
## structure for the two icons, so buefy is forced to
|
|
||||||
## re-draw
|
|
||||||
|
|
||||||
<b-icon v-if="props.open"
|
|
||||||
pack="fas"
|
|
||||||
icon="angle-down">
|
|
||||||
</b-icon>
|
|
||||||
|
|
||||||
<span v-if="!props.open">
|
|
||||||
<b-icon pack="fas"
|
|
||||||
icon="angle-right">
|
|
||||||
</b-icon>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<strong>Installed Packages</strong>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="panel-block">
|
|
||||||
<div style="width: 100%;">
|
|
||||||
${grid.render_vue_tag()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</${b}-collapse>
|
|
||||||
</%def>
|
|
||||||
|
|
||||||
<%def name="modify_vue_vars()">
|
|
||||||
${parent.modify_vue_vars()}
|
|
||||||
<script>
|
|
||||||
ThisPageData.configFiles = ${json.dumps([dict(path=p, priority=i) for i, p in enumerate(request.rattail_config.prioritized_files, 1)])|n}
|
|
||||||
</script>
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
|
@ -257,6 +257,9 @@
|
||||||
loading: false,
|
loading: false,
|
||||||
ajaxDataUrl: ${json.dumps(getattr(grid, 'ajax_data_url', request.path_url))|n},
|
ajaxDataUrl: ${json.dumps(getattr(grid, 'ajax_data_url', request.path_url))|n},
|
||||||
|
|
||||||
|
## nb. this tracks whether grid.fetchFirstData() happened
|
||||||
|
fetchedFirstData: false,
|
||||||
|
|
||||||
savingDefaults: false,
|
savingDefaults: false,
|
||||||
|
|
||||||
data: ${grid.vue_component}CurrentData,
|
data: ${grid.vue_component}CurrentData,
|
||||||
|
@ -519,6 +522,17 @@
|
||||||
...this.getFilterParams()}
|
...this.getFilterParams()}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
## nb. this is meant to call for a grid which is hidden at
|
||||||
|
## first, when it is first being shown to the user. and if
|
||||||
|
## it was initialized with empty data set.
|
||||||
|
async fetchFirstData() {
|
||||||
|
if (this.fetchedFirstData) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await this.loadAsyncData()
|
||||||
|
this.fetchedFirstData = true
|
||||||
|
},
|
||||||
|
|
||||||
## TODO: i noticed buefy docs show using `async` keyword here,
|
## TODO: i noticed buefy docs show using `async` keyword here,
|
||||||
## so now i am too. knowing nothing at all of if/how this is
|
## so now i am too. knowing nothing at all of if/how this is
|
||||||
## supposed to improve anything. we shall see i guess
|
## supposed to improve anything. we shall see i guess
|
||||||
|
|
|
@ -71,10 +71,20 @@ class AppInfoView(MasterView):
|
||||||
app.get_title())
|
app.get_title())
|
||||||
|
|
||||||
def get_data(self, session=None):
|
def get_data(self, session=None):
|
||||||
|
""" """
|
||||||
|
|
||||||
|
# nb. init with empty data, only load it upon user request
|
||||||
|
if not self.request.GET.get('partial'):
|
||||||
|
return []
|
||||||
|
|
||||||
|
# TODO: pretty sure this is not cross-platform. probably some
|
||||||
|
# sort of pip methods belong on the app handler? or it should
|
||||||
|
# have a pip handler for all that?
|
||||||
pip = os.path.join(sys.prefix, 'bin', 'pip')
|
pip = os.path.join(sys.prefix, 'bin', 'pip')
|
||||||
output = subprocess.check_output([pip, 'list', '--format=json'])
|
output = subprocess.check_output([pip, 'list', '--format=json'])
|
||||||
data = json.loads(output.decode('utf_8').strip())
|
data = json.loads(output.decode('utf_8').strip())
|
||||||
|
|
||||||
|
# must avoid null values for sort to work right
|
||||||
for pkg in data:
|
for pkg in data:
|
||||||
pkg.setdefault('editable_project_location', '')
|
pkg.setdefault('editable_project_location', '')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue